Changeset f97c1a6 for window.c


Ignore:
Timestamp:
May 23, 2011, 9:09:44 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
33b6431b
Parents:
4c7c21f (diff), 1d21d9f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge branch 'g_main_loop'

The logic in owl_select_prune_bad_fds still needs to be reimplemented.

Conflicts:
	configure.ac
	owl.c
	select.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • window.c

    rb31f1c9 rf97c1a6  
    524524  owl_window_set_position(w, nlines, ncols, w->begin_y, w->begin_x);
    525525}
     526
     527/** Redrawing main loop hooks **/
     528
     529static bool _owl_window_should_redraw(void) {
     530  return g.resizepending || owl_window_get_screen()->dirty_subtree;
     531}
     532
     533static gboolean _owl_window_redraw_prepare(GSource *source, int *timeout) {
     534  *timeout = -1;
     535  return _owl_window_should_redraw();
     536}
     537
     538static gboolean _owl_window_redraw_check(GSource *source) {
     539  return _owl_window_should_redraw();
     540}
     541
     542static gboolean _owl_window_redraw_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) {
     543  owl_colorpair_mgr *cpmgr;
     544
     545  /* if a resize has been scheduled, deal with it */
     546  owl_global_check_resize(&g);
     547  /* update the terminal if we need to */
     548  owl_window_redraw_scheduled();
     549  /* On colorpair shortage, reset and redraw /everything/. NOTE: if we
     550   * still overflow, this be useless work. With 8-colors, we get 64
     551   * pairs. With 256-colors, we get 32768 pairs with ext-colors
     552   * support and 256 otherwise. */
     553  cpmgr = owl_global_get_colorpair_mgr(&g);
     554  if (cpmgr->overflow) {
     555    owl_function_debugmsg("colorpairs: used all %d pairs; reset pairs and redraw.",
     556                          owl_util_get_colorpairs());
     557    owl_fmtext_reset_colorpairs(cpmgr);
     558    owl_function_full_redisplay();
     559    owl_window_redraw_scheduled();
     560  }
     561  return TRUE;
     562}
     563
     564static GSourceFuncs redraw_funcs = {
     565  _owl_window_redraw_prepare,
     566  _owl_window_redraw_check,
     567  _owl_window_redraw_dispatch,
     568  NULL
     569};
     570
     571GSource *owl_window_redraw_source_new(void) {
     572  GSource *source;
     573  source = g_source_new(&redraw_funcs, sizeof(GSource));
     574  /* TODO: priority?? */
     575  return source;
     576}
Note: See TracChangeset for help on using the changeset viewer.