Changeset 7b2686d for owl.c


Ignore:
Timestamp:
Mar 25, 2011, 3:46:46 AM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Children:
5eb392f
Parents:
b279013
git-author:
David Benjamin <davidben@mit.edu> (02/25/11 21:52:40)
git-committer:
David Benjamin <davidben@mit.edu> (03/25/11 03:46:46)
Message:
Make the owl_window redraw hook a GSource

(Should this be a g_idle_add instead?)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    rc809f5e r7b2686d  
    442442#endif /* OWL_STDERR_REDIR */
    443443
    444 static int owl_refresh_pre_select_action(owl_ps_action *a, void *data)
    445 {
    446   owl_colorpair_mgr *cpmgr;
    447 
    448   /* if a resize has been scheduled, deal with it */
    449   owl_global_check_resize(&g);
    450   /* update the terminal if we need to */
    451   owl_window_redraw_scheduled();
    452   /* On colorpair shortage, reset and redraw /everything/. NOTE: if
    453    * the current screen uses too many colorpairs, this draws
    454    * everything twice. But this is unlikely; COLOR_PAIRS is 64 with
    455    * 8+1 colors, and 256^2 with 256+1 colors. (+1 for default.) */
    456   cpmgr = owl_global_get_colorpair_mgr(&g);
    457   if (cpmgr->overflow) {
    458     owl_function_debugmsg("colorpairs: color shortage; reset pairs and redraw. COLOR_PAIRS = %d", COLOR_PAIRS);
    459     owl_fmtext_reset_colorpairs(cpmgr);
    460     owl_function_full_redisplay();
    461     owl_window_redraw_scheduled();
    462   }
    463   return 0;
    464 }
    465 
    466 
    467444int main(int argc, char **argv, char **env)
    468445{
     
    473450  const char *dir;
    474451  owl_options opts;
     452  GSource *source;
    475453
    476454  if (!GLIB_CHECK_VERSION (2, 12, 0))
     
    591569  owl_global_push_context(&g, OWL_CTX_INTERACTIVE|OWL_CTX_RECV, NULL, "recv", NULL);
    592570
    593   owl_select_add_pre_select_action(owl_refresh_pre_select_action, NULL, NULL);
     571  source = owl_window_redraw_source_new();
     572  g_source_attach(source, NULL);
     573  g_source_unref(source);
     574
    594575  owl_select_add_pre_select_action(owl_process_messages, NULL, NULL);
    595576  owl_select_add_pre_select_action(owl_errsignal_pre_select_action, NULL, NULL);
Note: See TracChangeset for help on using the changeset viewer.