summaryrefslogtreecommitdiff
path: root/gdk/gdkwindow.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2004-03-13 18:27:56 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-03-13 18:27:56 +0000
commitef5915da35267558c5840157b45baa0d45c782a7 (patch)
tree3ac1509f734c0cc6d962a39e83cdaac9cd30cb62 /gdk/gdkwindow.c
parentfadaa651457f9f0adc282f65caa42e70cb386609 (diff)
downloadgtk+-ef5915da35267558c5840157b45baa0d45c782a7.tar.gz
Make this a total no-op when the new or old parent is destroyed. (#134230,
Sat Mar 13 12:17:16 2004 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Make this a total no-op when the new or old parent is destroyed. (#134230, patch from Soeren Sandmann) * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): For foreign windows in our heirarchy, call _gdk_windowing_window_destroy_foreign (window) and skip all the normal destruction logic. * gdk/x11/gdkwindow-x11.c gdk/win32/gdkwindow-win32.c: Move code to request destruction of a foreign window code into a separate _gdk_windowing_window_destroy_foreign(). * gdk/x11/gdkwindow-x11.c (gdk_window_impl_x11_finalize): Call GDK_WINDOW_DISPLAY() on the wrapper not on the impl. (Also from Soeren's patch)
Diffstat (limited to 'gdk/gdkwindow.c')
-rw-r--r--gdk/gdkwindow.c54
1 files changed, 40 insertions, 14 deletions
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 4df74dd6df..7987e650a3 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -278,6 +278,23 @@ gdk_window_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static void
+window_remove_filters (GdkWindow *window)
+{
+ GdkWindowObject *obj = (GdkWindowObject*) window;
+
+ if (obj->filters)
+ {
+ GList *tmp_list;
+
+ for (tmp_list = obj->filters; tmp_list; tmp_list = tmp_list->next)
+ g_free (tmp_list->data);
+
+ g_list_free (obj->filters);
+ obj->filters = NULL;
+ }
+}
+
/**
* _gdk_window_destroy_hierarchy:
* @window: a #GdkWindow
@@ -309,6 +326,9 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
private = (GdkWindowObject*) window;
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
switch (GDK_WINDOW_TYPE (window))
{
case GDK_WINDOW_TOPLEVEL:
@@ -316,7 +336,25 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
case GDK_WINDOW_FOREIGN:
- if (!GDK_WINDOW_DESTROYED (window))
+ if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_FOREIGN && !foreign_destroy)
+ {
+ /* Logically, it probably makes more sense to send
+ * a "destroy yourself" message to the foreign window
+ * whether or not it's in our heirarchy; but for historical
+ * reasons, we only send "destroy yourself" messages to
+ * foreign windows in our heirarchy.
+ */
+ if (private->parent)
+ _gdk_windowing_window_destroy_foreign (window);
+
+ /* Also for historical reasons, we remove any filters
+ * on a foreign window when it or a parent is destroyed;
+ * this likely causes problems if two separate portions
+ * of code are maintaining filter lists on a foreign window.
+ */
+ window_remove_filters (window);
+ }
+ else
{
private->state |= GDK_WINDOW_STATE_WITHDRAWN;
@@ -363,19 +401,7 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
private->parent = NULL;
private->destroyed = TRUE;
- if (private->filters)
- {
- tmp = private->filters;
-
- while (tmp)
- {
- g_free (tmp->data);
- tmp = tmp->next;
- }
-
- g_list_free (private->filters);
- private->filters = NULL;
- }
+ window_remove_filters (window);
gdk_drawable_set_colormap (GDK_DRAWABLE (window), NULL);
}