Changeset c088c53


Ignore:
Timestamp:
May 24, 2010, 8:22:52 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
release-1.6
Children:
70087b9
Parents:
adbf00a
git-author:
Anders Kaseorg <andersk@mit.edu> (05/05/10 23:16:09)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/24/10 20:22:52)
Message:
Make terminal refreshes a pre-select action.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r1cfcab7 rc088c53  
    466466}
    467467
     468static int owl_refresh_pre_select_action(owl_ps_action *a, void *data)
     469{
     470  /* if a resize has been scheduled, deal with it */
     471  owl_global_resize(&g, 0, 0);
     472
     473  /* update the terminal if we need to */
     474  if (owl_global_is_needrefresh(&g)) {
     475    /* these are here in case a resize changes the windows */
     476    WINDOW *sepwin = owl_global_get_curs_sepwin(&g);
     477    WINDOW *typwin = owl_global_get_curs_typwin(&g);
     478
     479    /* push all changed windows to screen */
     480    update_panels();
     481    /* leave the cursor in the appropriate window */
     482    if (!owl_popwin_is_active(owl_global_get_popwin(&g))
     483        && owl_global_get_typwin(&g)) {
     484      owl_function_set_cursor(typwin);
     485    } else {
     486      owl_function_set_cursor(sepwin);
     487    }
     488    doupdate();
     489    owl_global_set_noneedrefresh(&g);
     490  }
     491  return 0;
     492}
     493
    468494
    469495int main(int argc, char **argv, char **env)
    470496{
    471   WINDOW *sepwin, *typwin;
    472497  int argcsave;
    473498  const char *const *argvsave;
     
    610635  owl_select_add_timer(0, 1, owl_perlconfig_mainloop, NULL, NULL);
    611636
     637  owl_select_add_pre_select_action(owl_refresh_pre_select_action, NULL, NULL);
    612638  owl_select_add_pre_select_action(owl_process_messages, NULL, NULL);
    613639
     
    615641  /* main loop */
    616642  while (1) {
    617 
    618     /* if a resize has been scheduled, deal with it */
    619     owl_global_resize(&g, 0, 0);
    620 
    621     /* these are here in case a resize changes the windows */
    622     sepwin=owl_global_get_curs_sepwin(&g);
    623     typwin=owl_global_get_curs_typwin(&g);
    624 
    625     /* update the terminal if we need to */
    626     if (owl_global_is_needrefresh(&g)) {
    627       /* push all changed windows to screen */
    628       update_panels();
    629       /* leave the cursor in the appropriate window */
    630       if (!owl_popwin_is_active(owl_global_get_popwin(&g))
    631           && owl_global_get_typwin(&g)) {
    632         owl_function_set_cursor(typwin);
    633       } else {
    634         owl_function_set_cursor(sepwin);
    635       }
    636       doupdate();
    637       owl_global_set_noneedrefresh(&g);
    638     }
    639 
    640643    /* select on FDs we know about. */
    641644    owl_select();
Note: See TracChangeset for help on using the changeset viewer.