Changeset 4cc0ee0b for owl.c


Ignore:
Timestamp:
Feb 19, 2008, 6:10:18 PM (17 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
1951db8, 61abb18
Parents:
18108b1e
Message:
owl.c:
* Input processing - deal with all remaining input before moving on.
* Change how we get stdin's fileno -- actually grab it from the stdin handle.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r9c7a701 r4cc0ee0b  
    6161#endif
    6262
    63 #define STDIN 0
    64 
    6563static const char fileIdent[] = "$Id$";
    6664
     
    212210  {
    213211    owl_dispatch *d = owl_malloc(sizeof(owl_dispatch));
    214     d->fd = STDIN;
     212    d->fd = fileno(stdin);
    215213    d->cfunc = &owl_process_input;
    216214    d->pfunc = NULL;
     
    528526        owl_function_set_cursor(sepwin);
    529527      }
     528      owl_function_debugmsg("owl.c -- doupdate()");
    530529      doupdate();
    531530      owl_global_set_noneedrefresh(&g);
     
    675674  owl_editwin *tw;
    676675
    677   j = wgetch(owl_global_get_curs_typwin(&g));
    678   if (j == ERR) return;
    679 
    680   owl_global_set_lastinputtime(&g, time(NULL));
    681   pw=owl_global_get_popwin(&g);
    682   tw=owl_global_get_typwin(&g);
    683 
    684   /* find and activate the current keymap.
    685    * TODO: this should really get fixed by activating
    686    * keymaps as we switch between windows...
    687    */
    688   if (pw && owl_popwin_is_active(pw) && owl_global_get_viewwin(&g)) {
    689     owl_context_set_popless(owl_global_get_context(&g),
    690                             owl_global_get_viewwin(&g));
    691     owl_function_activate_keymap("popless");
    692   } else if (owl_global_is_typwin_active(&g)
    693              && owl_editwin_get_style(tw) == OWL_EDITWIN_STYLE_ONELINE) {
    694     /*
    695       owl_context_set_editline(owl_global_get_context(&g), tw);
    696       owl_function_activate_keymap("editline");
    697     */
    698   } else if (owl_global_is_typwin_active(&g)
    699              && owl_editwin_get_style(tw) == OWL_EDITWIN_STYLE_MULTILINE) {
    700     owl_context_set_editmulti(owl_global_get_context(&g), tw);
    701     owl_function_activate_keymap("editmulti");
    702   } else {
    703     owl_context_set_recv(owl_global_get_context(&g));
    704     owl_function_activate_keymap("recv");
    705   }
    706   /* now actually handle the keypress */
    707   ret = owl_keyhandler_process(owl_global_get_keyhandler(&g), j);
    708   if (ret != 0 && ret != 1) {
    709     owl_function_makemsg("Unable to handle keypress");
     676  while (1) {
     677    j = wgetch(owl_global_get_curs_typwin(&g));
     678    if (j == ERR) return;
     679
     680    owl_global_set_lastinputtime(&g, time(NULL));
     681    pw=owl_global_get_popwin(&g);
     682    tw=owl_global_get_typwin(&g);
     683   
     684    /* find and activate the current keymap.
     685     * TODO: this should really get fixed by activating
     686     * keymaps as we switch between windows...
     687     */
     688    if (pw && owl_popwin_is_active(pw) && owl_global_get_viewwin(&g)) {
     689      owl_context_set_popless(owl_global_get_context(&g),
     690                              owl_global_get_viewwin(&g));
     691      owl_function_activate_keymap("popless");
     692    } else if (owl_global_is_typwin_active(&g)
     693               && owl_editwin_get_style(tw) == OWL_EDITWIN_STYLE_ONELINE) {
     694      /*
     695        owl_context_set_editline(owl_global_get_context(&g), tw);
     696        owl_function_activate_keymap("editline");
     697      */
     698    } else if (owl_global_is_typwin_active(&g)
     699               && owl_editwin_get_style(tw) == OWL_EDITWIN_STYLE_MULTILINE) {
     700      owl_context_set_editmulti(owl_global_get_context(&g), tw);
     701      owl_function_activate_keymap("editmulti");
     702    } else {
     703      owl_context_set_recv(owl_global_get_context(&g));
     704      owl_function_activate_keymap("recv");
     705    }
     706    /* now actually handle the keypress */
     707    ret = owl_keyhandler_process(owl_global_get_keyhandler(&g), j);
     708    if (ret != 0 && ret != 1) {
     709      owl_function_makemsg("Unable to handle keypress");
     710    }
    710711  }
    711712}
Note: See TracChangeset for help on using the changeset viewer.