Changeset eba02ec for window.c


Ignore:
Timestamp:
Sep 27, 2011, 4:23:30 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.9
Children:
c737503, c162fd6
Parents:
bbd0cf1
git-author:
David Benjamin <davidben@mit.edu> (09/27/11 16:08:44)
git-committer:
David Benjamin <davidben@mit.edu> (09/27/11 16:23:30)
Message:
Fix dirtying windows inside a redraw handler

This is a seriously sketchy thing to do, but at least maintain
dirty and dirty_subtree bits correctly.

Tested by triggering an editwin dirty from the sepbar code.

Reviewed-by: Nelson Elhage <nelhage@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • window.c

    rf271129 reba02ec  
    441441}
    442442
     443static bool _owl_window_is_subtree_dirty(owl_window *w)
     444{
     445  owl_window *child;
     446
     447  if (w->dirty)
     448    return true;
     449  for (child = w->child;
     450       child != NULL;
     451       child = child->next) {
     452    if (child->dirty_subtree)
     453      return true;
     454  }
     455  return false;
     456}
     457
    443458static void _owl_window_redraw_subtree(owl_window *w)
    444459{
    445460  FuncOneArg ptr = (FuncOneArg)_owl_window_redraw_subtree;
     461
    446462  if (!w->dirty_subtree)
    447463    return;
     464
    448465  _owl_window_redraw(w);
    449466  owl_window_children_foreach(w, first_arg_only, &ptr);
    450   w->dirty_subtree = 0;
     467
     468  /* Clear the dirty_subtree bit, unless a child doesn't have it
     469   * cleared because we dirtied a window in redraw. Dirtying a
     470   * non-descendant window during a redraw handler is
     471   * discouraged. Redraw will not break, but it is undefined whether
     472   * the dirty is delayed to the next event loop iteration. */
     473  if (_owl_window_is_subtree_dirty(w)) {
     474    owl_function_debugmsg("subtree still dirty after one iteration!");
     475  } else {
     476    w->dirty_subtree = 0;
     477  }
    451478}
    452479
Note: See TracChangeset for help on using the changeset viewer.