Changeset 26255f0


Ignore:
Timestamp:
Oct 19, 2009, 10:21:10 PM (15 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, release-1.10, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
ba88ae7
Parents:
0697f09
git-author:
Alejandro R. Sedeño <asedeno@mit.edu> (10/13/09 03:19:34)
git-committer:
Alejandro R. Sedeño <asedeno@mit.edu> (10/19/09 22:21:10)
Message:
Add a message processing pre-select action.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r0697f09 r26255f0  
    297297}
    298298
     299/*
     300 * Process any new messages we have waiting in the message queue.
     301 * Returns 1 if any messages were added to the message list, and 0 otherwise.
     302 */
     303int owl_process_messages(owl_ps_action *d, void *p)
     304{
     305  int newmsgs=0;
     306  owl_message *m;
     307
     308  /* Grab incoming messages. */
     309  while (owl_global_messagequeue_pending(&g)) {
     310    m = owl_global_messagequeue_popmsg(&g);
     311    if (owl_process_message(m))
     312      newmsgs = 1;
     313  }
     314
     315  if (newmsgs) {
     316    /* follow the last message if we're supposed to */
     317    if (owl_global_should_followlast(&g))
     318      owl_function_lastmsg_noredisplay();
     319
     320    /* do the newmsgproc thing */
     321    owl_function_do_newmsgproc();
     322
     323    /* redisplay if necessary */
     324    /* this should be optimized to not run if the new messages won't be displayed */
     325    owl_mainwin_redisplay(owl_global_get_mainwin(&g));
     326    sepbar(NULL);
     327    if (owl_popwin_is_active(owl_global_get_popwin(&g))) {
     328      owl_popwin_refresh(owl_global_get_popwin(&g));
     329      /* TODO: this is a broken kludge */
     330      if (owl_global_get_viewwin(&g)) {
     331        owl_viewwin_redisplay(owl_global_get_viewwin(&g), 0);
     332      }
     333    }
     334    owl_global_set_needrefresh(&g);
     335  }
     336  return newmsgs;
     337}
     338
    299339void owl_process_input(owl_dispatch *d)
    300340{
     
    469509  owl_editwin *tw;
    470510  owl_popwin *pw;
    471   int argcsave, followlast;
    472   int newmsgs;
     511  int argcsave;
    473512  const char *const *argvsave;
    474513  char *perlout, *perlerr;
    475514  const owl_style *s;
    476515  const char *dir;
    477   owl_message *m;
    478516  owl_options opts;
    479517
     
    624662  owl_select_add_timer(0, 1, owl_perlconfig_mainloop, NULL, NULL);
    625663
     664  owl_select_add_pre_select_action(owl_process_messages, NULL, NULL);
     665
    626666  owl_function_debugmsg("startup: entering main loop");
    627667  /* main loop */
     
    636676    sepwin=owl_global_get_curs_sepwin(&g);
    637677    typwin=owl_global_get_curs_typwin(&g);
    638 
    639     followlast=owl_global_should_followlast(&g);
    640 
    641     /* Grab incoming messages. */
    642     newmsgs=0;
    643     while(owl_global_messagequeue_pending(&g)) {
    644 
    645       m = owl_global_messagequeue_popmsg(&g);
    646 
    647       if(owl_process_message(m))
    648         newmsgs = 1;
    649     }
    650 
    651     /* follow the last message if we're supposed to */
    652     if (newmsgs && followlast) {
    653       owl_function_lastmsg_noredisplay();
    654     }
    655 
    656     /* do the newmsgproc thing */
    657     if (newmsgs) {
    658       owl_function_do_newmsgproc();
    659     }
    660    
    661     /* redisplay if necessary */
    662     /* this should be optimized to not run if the new messages won't be displayed */
    663     if (newmsgs) {
    664       owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    665       sepbar(NULL);
    666       if (owl_popwin_is_active(owl_global_get_popwin(&g))) {
    667         owl_popwin_refresh(owl_global_get_popwin(&g));
    668         /* TODO: this is a broken kludge */
    669         if (owl_global_get_viewwin(&g)) {
    670           owl_viewwin_redisplay(owl_global_get_viewwin(&g), 0);
    671         }
    672       }
    673       owl_global_set_needrefresh(&g);
    674     }
    675678
    676679    /* if a popwin just came up, refresh it */
Note: See TracChangeset for help on using the changeset viewer.