Changeset f70a7a3 for window.c


Ignore:
Timestamp:
Jun 3, 2010, 2:37:58 AM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
571fab7
Parents:
cc36f27
git-author:
David Benjamin <davidben@mit.edu> (06/03/10 02:32:28)
git-committer:
David Benjamin <davidben@mit.edu> (06/03/10 02:37:58)
Message:
Add a default cursor and fallback finally on the screen

Also get rid of useless prototype.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • window.c

    rcc36f27 rf70a7a3  
    4343
    4444static owl_window *cursor_owner;
     45static owl_window *default_cursor;
    4546
    4647G_DEFINE_TYPE (OwlWindow, owl_window, G_TYPE_OBJECT)
     
    334335    g_object_remove_weak_pointer(G_OBJECT(cursor_owner), (gpointer*) &cursor_owner);
    335336  cursor_owner = w;
    336   g_object_add_weak_pointer(G_OBJECT(w), (gpointer*) &cursor_owner);
     337  if (w)
     338    g_object_add_weak_pointer(G_OBJECT(w), (gpointer*) &cursor_owner);
    337339  owl_global_set_needrefresh(&g);
     340}
     341
     342void owl_window_set_default_cursor(owl_window *w)
     343{
     344  if (default_cursor)
     345    g_object_remove_weak_pointer(G_OBJECT(default_cursor), (gpointer*) &default_cursor);
     346  default_cursor = w;
     347  if (w)
     348    g_object_add_weak_pointer(G_OBJECT(w), (gpointer*) &default_cursor);
     349  owl_global_set_needrefresh(&g);
     350}
     351
     352static owl_window *_get_cursor(void)
     353{
     354  if (cursor_owner && owl_window_is_realized(cursor_owner))
     355    return cursor_owner;
     356  if (default_cursor && owl_window_is_realized(default_cursor))
     357    return default_cursor;
     358  return owl_window_get_screen();
    338359}
    339360
     
    389410void owl_window_redraw_scheduled(void)
    390411{
     412  owl_window *cursor;
     413
    391414  _owl_window_redraw_subtree(owl_window_get_screen());
    392415  update_panels();
    393   if (cursor_owner && cursor_owner->win) {
     416  cursor = _get_cursor();
     417  if (cursor && cursor->win) {
    394418    /* untouch it to avoid drawing; window should be clean now, but we must
    395419     * clean up in case there was junk left over on a subwin (cleaning up after
    396420     * subwin drawing isn't sufficient because a wsyncup messes up subwin
    397421     * ancestors */
    398     untouchwin(cursor_owner->win);
    399     wnoutrefresh(cursor_owner->win);
     422    untouchwin(cursor->win);
     423    wnoutrefresh(cursor->win);
    400424  }
    401425}
Note: See TracChangeset for help on using the changeset viewer.