When we replace the stage Window using a foreign one we also need to
destroy the Window we created, if needed, to avoid leaking resources
all around.
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1750
ClutterStageX11 *stage_x11;
ClutterGeometry geom;
Window xwindow;
+ guint destroy_old_xwindow : 1;
} ForeignWindowData;
static void
CLUTTER_NOTE (BACKEND, "Setting foreign window (0x%x)", (int) fwd->xwindow);
+ if (fwd->destroy_old_xwindow)
+ XDestroyWindow (fwd->stage_x11->xdpy, fwd->stage_x11->xwin);
+
fwd->stage_x11->xwin = fwd->xwindow;
fwd->stage_x11->is_foreign_xwin = TRUE;
fwd.stage_x11 = stage_x11;
fwd.xwindow = xwindow;
+ /* destroy the old Window, if we own it */
+ fwd.destroy_old_xwindow = stage_x11->is_foreign_xwin ? FALSE : TRUE;
fwd.geom.x = x;
fwd.geom.y = y;
fwd.geom.width = width;