summaryrefslogtreecommitdiff
path: root/gdk/gdkwindow.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1999-02-21 19:25:53 +0000
committerOwen Taylor <otaylor@src.gnome.org>1999-02-21 19:25:53 +0000
commit295e763b4da13726b7beb8e9c905a5af30b0e251 (patch)
tree5fe997b4b1782ab486fc747befca6a2d6caa69c7 /gdk/gdkwindow.c
parente8cfe9062fff69574f41ad9a82688f140dcf2eda (diff)
downloadgdk-pixbuf-295e763b4da13726b7beb8e9c905a5af30b0e251.tar.gz
removed debugging statements about embedded XID's. They could have been
Sun Feb 21 14:21:46 1999 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.c: removed debugging statements about embedded XID's. They could have been moved to the new PLUGSOCKET debug key, but they weren't really useful anyways. * gdk/gdk.h: Added gdk_error_trap_push/pop to provide a clean interface to the gdk_error_code functionality of trapping X errors. * gtk/gtkplug.c gtk/gtksocket.c: Add error traps around accesses to foreign windows.
Diffstat (limited to 'gdk/gdkwindow.c')
-rw-r--r--gdk/gdkwindow.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 076d76378..c2b894453 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -503,19 +503,23 @@ gdk_window_foreign_new (guint32 anid)
Window root, parent;
Window *children = NULL;
guint nchildren;
-
- if (!XGetWindowAttributes (gdk_display, anid, &attrs)) {
- g_warning ("XGetWindowAttributes failed on window ID %d\n", anid);
+ gboolean result;
+
+ gdk_error_trap_push ();
+ result = XGetWindowAttributes (gdk_display, anid, &attrs);
+ if (gdk_error_trap_pop () || !result)
+ return NULL;
+
+ /* FIXME: This is pretty expensive. Maybe the caller should supply
+ * the parent */
+ gdk_error_trap_push ();
+ result = XQueryTree (gdk_display, anid, &root, &parent, &children, &nchildren);
+ if (gdk_error_trap_pop () || !result)
return NULL;
- }
private = g_new (GdkWindowPrivate, 1);
window = (GdkWindow*) private;
- /* FIXME: This is pretty expensive. Maybe the caller should supply
- * the parent */
- XQueryTree (gdk_display, anid, &root, &parent, &children, &nchildren);
-
if (children)
XFree (children);
private->parent = gdk_xid_table_lookup (parent);
@@ -634,7 +638,8 @@ gdk_window_internal_destroy (GdkWindow *window,
* it a delete event, as if we were a WM
*/
XClientMessageEvent xevent;
-
+
+ gdk_error_trap_push ();
gdk_window_hide (window);
gdk_window_reparent (window, NULL, 0, 0);
@@ -644,9 +649,11 @@ gdk_window_internal_destroy (GdkWindow *window,
xevent.format = 32;
xevent.data.l[0] = gdk_wm_delete_window;
xevent.data.l[1] = CurrentTime;
-
+
XSendEvent (private->xdisplay, private->xwindow,
False, 0, (XEvent *)&xevent);
+ gdk_flush ();
+ gdk_error_trap_pop ();
}
}
else if (xdestroy)