Changeset 1b5b975


Ignore:
Timestamp:
May 6, 2010, 12:59:21 AM (10 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
c3031f3
Parents:
9d7a720
git-author:
Anders Kaseorg <andersk@mit.edu> (05/05/10 23:16:09)
git-committer:
Anders Kaseorg <andersk@mit.edu> (05/06/10 00:59:21)
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

    rf7cf6c2 r1b5b975  
    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  /* also handle relayouts */
     473  owl_global_relayout(&g);
     474
     475  /* update the terminal if we need to */
     476  if (owl_global_is_needrefresh(&g)) {
     477    /* these are here in case a relayout changes the windows */
     478    WINDOW *sepwin = owl_global_get_curs_sepwin(&g);
     479    WINDOW *typwin = owl_global_get_curs_typwin(&g);
     480
     481    /* push all changed windows to screen */
     482    update_panels();
     483    /* leave the cursor in the appropriate window */
     484    if (!owl_popwin_is_active(owl_global_get_popwin(&g))
     485        && owl_global_get_typwin(&g)) {
     486      owl_function_set_cursor(typwin);
     487    } else {
     488      owl_function_set_cursor(sepwin);
     489    }
     490    doupdate();
     491    owl_global_set_noneedrefresh(&g);
     492  }
     493  return 0;
     494}
     495
    468496
    469497int main(int argc, char **argv, char **env)
    470498{
    471   WINDOW *sepwin, *typwin;
    472499  int argcsave;
    473500  const char *const *argvsave;
     
    610637  owl_select_add_timer(0, 1, owl_perlconfig_mainloop, NULL, NULL);
    611638
     639  owl_select_add_pre_select_action(owl_refresh_pre_select_action, NULL, NULL);
    612640  owl_select_add_pre_select_action(owl_process_messages, NULL, NULL);
    613641
     
    615643  /* main loop */
    616644  while (1) {
    617 
    618     /* if a resize has been scheduled, deal with it */
    619     owl_global_resize(&g, 0, 0);
    620     /* also handle relayouts */
    621     owl_global_relayout(&g);
    622 
    623     /* these are here in case a relayout changes the windows */
    624     sepwin=owl_global_get_curs_sepwin(&g);
    625     typwin=owl_global_get_curs_typwin(&g);
    626 
    627     /* update the terminal if we need to */
    628     if (owl_global_is_needrefresh(&g)) {
    629       /* push all changed windows to screen */
    630       update_panels();
    631       /* leave the cursor in the appropriate window */
    632       if (!owl_popwin_is_active(owl_global_get_popwin(&g))
    633           && owl_global_get_typwin(&g)) {
    634         owl_function_set_cursor(typwin);
    635       } else {
    636         owl_function_set_cursor(sepwin);
    637       }
    638       doupdate();
    639       owl_global_set_noneedrefresh(&g);
    640     }
    641 
    642645    /* select on FDs we know about. */
    643646    owl_select();
Note: See TracChangeset for help on using the changeset viewer.