diff options
author | Kristian Rietveld <kris@imendio.com> | 2007-09-12 17:13:24 +0000 |
---|---|---|
committer | Kristian Rietveld <kristian@src.gnome.org> | 2007-09-12 17:13:24 +0000 |
commit | eab3ef31455b8ce2c410d2c45240a77bdd9f5bd2 (patch) | |
tree | 431737c48edd2e43f9537158de2b736d4fb2d43f /gdk | |
parent | cfd5eaaa8c4a126cf6d76ed254680ad0a52d8fc0 (diff) | |
download | gtk+-eab3ef31455b8ce2c410d2c45240a77bdd9f5bd2.tar.gz |
Fixes #426246.
2007-09-12 Kristian Rietveld <kris@imendio.com>
Fixes #426246.
* gdk/gdk.symbols:
* gdk/gdkwindow.[ch]
(gdk_window_freeze_toplevel_updates_libgtk_only),
(gdk_window_thaw_toplevel_updates_libgtk_only): new functions
to freeze a toplevel window and all its descendants. To be made
public in 2.14,
(gdk_window_schedule_update): return if toplevel is frozen,
(gdk_window_process_all_updates): defer processing updates if toplevel
is frozen.
* gtk/gtkwindow.c (gtk_window_configure_event): directly size
allocate for override redirect windows, freeze toplevel and
descendants otherwise and wait until resizing is done.
svn path=/trunk/; revision=18802
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdk.symbols | 2 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 73 | ||||
-rw-r--r-- | gdk/gdkwindow.h | 5 |
3 files changed, 77 insertions, 3 deletions
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index ef801d3e34..d7962109fe 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -649,6 +649,7 @@ gdk_window_constrain_size gdk_window_destroy gdk_window_end_paint gdk_window_foreign_new +gdk_window_freeze_toplevel_updates_libgtk_only gdk_window_freeze_updates gdk_window_get_children gdk_window_get_internal_paint_info @@ -673,6 +674,7 @@ gdk_window_process_updates gdk_window_remove_filter gdk_window_set_debug_updates gdk_window_set_user_data +gdk_window_thaw_toplevel_updates_libgtk_only gdk_window_thaw_updates gdk_window_set_composited #endif diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 2028693cb0..fe4e7f674a 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -2290,10 +2290,22 @@ gdk_window_update_idle (gpointer data) return FALSE; } +static gboolean +gdk_window_is_toplevel_frozen (GdkWindow *window) +{ + GdkWindowObject *toplevel; + + toplevel = (GdkWindowObject *)gdk_window_get_toplevel (window); + + return toplevel->update_and_descendants_freeze_count > 0; +} + static void gdk_window_schedule_update (GdkWindow *window) { - if (window && GDK_WINDOW_OBJECT (window)->update_freeze_count) + if (window && + (GDK_WINDOW_OBJECT (window)->update_freeze_count || + gdk_window_is_toplevel_frozen (window))) return; if (!update_idle) @@ -2423,7 +2435,8 @@ gdk_window_process_all_updates (void) { GdkWindowObject *private = (GdkWindowObject *)tmp_list->data; - if (private->update_freeze_count) + if (private->update_freeze_count || + gdk_window_is_toplevel_frozen (tmp_list->data)) update_windows = g_slist_prepend (update_windows, private); else gdk_window_process_updates_internal (tmp_list->data); @@ -2471,7 +2484,9 @@ gdk_window_process_updates (GdkWindow *window, return; } - if (private->update_area && !private->update_freeze_count) + if (private->update_area && + !private->update_freeze_count && + !gdk_window_is_toplevel_frozen (window)) { gdk_window_process_updates_internal (window); update_windows = g_slist_remove (update_windows, window); @@ -2816,6 +2831,58 @@ gdk_window_thaw_updates (GdkWindow *window) } /** + * gdk_window_freeze_toplevel_updates_libgtk_only: + * @window: a #GdkWindow + * + * Temporarily freezes a window and all its descendants such that it won't + * receive expose events. The window will begin receiving expose events + * again when gdk_window_thaw_toplevel_updates_libgtk_only() is called. If + * gdk_window_freeze_toplevel_updates_libgtk_only() + * has been called more than once, + * gdk_window_thaw_toplevel_updates_libgtk_only() must be called + * an equal number of times to begin processing exposes. + * + * This function is not part of the GDK public API and is only + * for use by GTK+. + **/ +void +gdk_window_freeze_toplevel_updates_libgtk_only (GdkWindow *window) +{ + GdkWindowObject *private = (GdkWindowObject *)window; + + g_return_if_fail (window != NULL); + g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (private->window_type != GDK_WINDOW_CHILD); + + private->update_and_descendants_freeze_count++; +} + +/** + * gdk_window_thaw_toplevel_updates_libgtk_only: + * @window: a #GdkWindow + * + * Thaws a window frozen with + * gdk_window_freeze_toplevel_updates_libgtk_only(). + * + * This function is not part of the GDK public API and is only + * for use by GTK+. + **/ +void +gdk_window_thaw_toplevel_updates_libgtk_only (GdkWindow *window) +{ + GdkWindowObject *private = (GdkWindowObject *)window; + + g_return_if_fail (window != NULL); + g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (private->window_type != GDK_WINDOW_CHILD); + g_return_if_fail (private->update_and_descendants_freeze_count > 0); + + private->update_and_descendants_freeze_count--; + + gdk_window_schedule_update (window); +} + +/** * gdk_window_set_debug_updates: * @setting: %TRUE to turn on update debugging * diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h index d50d3e6c9a..3e169c4398 100644 --- a/gdk/gdkwindow.h +++ b/gdk/gdkwindow.h @@ -298,6 +298,8 @@ struct _GdkWindowObject guint shaped : 1; GdkEventMask event_mask; + + guint update_and_descendants_freeze_count; }; struct _GdkWindowObjectClass @@ -605,6 +607,9 @@ GdkRegion *gdk_window_get_update_area (GdkWindow *window); void gdk_window_freeze_updates (GdkWindow *window); void gdk_window_thaw_updates (GdkWindow *window); +void gdk_window_freeze_toplevel_updates_libgtk_only (GdkWindow *window); +void gdk_window_thaw_toplevel_updates_libgtk_only (GdkWindow *window); + void gdk_window_process_all_updates (void); void gdk_window_process_updates (GdkWindow *window, gboolean update_children); |