Commit 5e3acecc authored by Elliot Lee's avatar Elliot Lee

Make gdk_window_foreign_new fail gracefully

parent 8f733319
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment