Changeset 4da7659


Ignore:
Timestamp:
Jun 21, 2011, 11:19:09 PM (6 years ago)
Author:
David Benjamin <davidben@mit.edu>
Children:
bdc53e0
Parents:
f21bc36
git-author:
David Benjamin <davidben@mit.edu> (05/24/11 01:32:37)
git-committer:
David Benjamin <davidben@mit.edu> (06/21/11 23:19:09)
Message:
Replace the stdin reader with a GIOChannel watch

We ignore the channel itself as ncurses expects to do its own thing.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    rdb4f7c3 r4da7659  
    302302}
    303303
    304 void owl_process_input(const owl_io_dispatch *d, void *data)
     304gboolean owl_process_input(GIOChannel *source, GIOCondition condition, void *data)
    305305{
     306  owl_global *g = data;
    306307  owl_input j;
    307308
    308309  while (1) {
    309     j.ch = wgetch(g.input_pad);
    310     if (j.ch == ERR) return;
     310    j.ch = wgetch(g->input_pad);
     311    if (j.ch == ERR) return TRUE;
    311312
    312313    j.uch = '\0';
     
    330331     
    331332      for (i = 1; i < bytes; i++) {
    332         int tmp = wgetch(g.input_pad);
     333        int tmp = wgetch(g->input_pad);
    333334        /* If what we got was not a byte, or not a continuation byte */
    334335        if (tmp > 0xff || !(tmp & 0x80 && ~tmp & 0x40)) {
     
    357358    owl_process_input_char(j);
    358359  }
     360  return TRUE;
    359361}
    360362
     
    485487  owl_options opts;
    486488  GSource *source;
     489  GIOChannel *channel;
    487490
    488491  argc_copy = argc;
     
    510513
    511514  /* register STDIN dispatch; throw away return, we won't need it */
    512   owl_select_add_io_dispatch(STDIN_FILENO, OWL_IO_READ, &owl_process_input, NULL, NULL);
     515  channel = g_io_channel_unix_new(STDIN_FILENO);
     516  g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR, &owl_process_input, &g);
     517  g_io_channel_unref(channel);
    513518  owl_zephyr_initialize();
    514519
Note: See TracChangeset for help on using the changeset viewer.