Make gdk_window_foreign_new fail gracefully

This commit is contained in:
Elliot Lee 1998-07-16 19:41:12 +00:00
parent 8f733319d1
commit 5e3acecc12
2 changed files with 14 additions and 6 deletions

View File

@ -465,17 +465,21 @@ gdk_window_foreign_new (guint32 anid)
GdkWindowPrivate *parent_private;
XWindowAttributes attrs;
Window root, parent;
Window *children;
Window *children = NULL;
guint nchildren;
if(!XGetWindowAttributes (gdk_display, anid, &attrs)) {
g_warning("XGetWindowAttributes failed on window ID %d\n", anid);
return NULL;
}
private = g_new (GdkWindowPrivate, 1);
window = (GdkWindow*) private;
XGetWindowAttributes (gdk_display, anid, &attrs);
/* 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);

View File

@ -465,17 +465,21 @@ gdk_window_foreign_new (guint32 anid)
GdkWindowPrivate *parent_private;
XWindowAttributes attrs;
Window root, parent;
Window *children;
Window *children = NULL;
guint nchildren;
if(!XGetWindowAttributes (gdk_display, anid, &attrs)) {
g_warning("XGetWindowAttributes failed on window ID %d\n", anid);
return NULL;
}
private = g_new (GdkWindowPrivate, 1);
window = (GdkWindow*) private;
XGetWindowAttributes (gdk_display, anid, &attrs);
/* 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);