x11: Provide a StageWindow::unrealize implementation

The Cogl rework removed the Window creation from realize and its
relative destruction from unrealize; the two vfuncs also managed
the mapping between Window and Stage implementation that we use
when dealing with event handling. Sadly, the missing unrealization
left entries in the mapping dangling.

Since ClutterStageX11 already provides a ::realize implementation
that sub-classes are supposed to chain up to, and the Window ↔ Stage
mapping is private to clutter-stage-x11.c, it seems only fair that
the ClutterStageX11 should also provide an ::unrealize implementation
matching the ::realize.

This implementation just removes the StageX11 pointer from the X11
Window ↔ ClutterStageX11 mapping we set up in ::realize, since the
X11 Window is managed by Cogl, now.
This commit is contained in:
Emmanuele Bassi 2011-04-14 15:43:19 +01:00
parent b80d5c8142
commit 94c30a4f67

View File

@ -371,6 +371,22 @@ set_cursor_visible (ClutterStageX11 *stage_x11)
}
}
static void
clutter_stage_x11_unrealize (ClutterStageWindow *stage_window)
{
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
if (clutter_stages_by_xid != NULL)
{
CLUTTER_NOTE (BACKEND, "Removing X11 stage 0x%x [%p]",
(unsigned int) stage_x11->xwin,
stage_x11);
g_hash_table_remove (clutter_stages_by_xid,
GINT_TO_POINTER (stage_x11->xwin));
}
}
static gboolean
clutter_stage_x11_realize (ClutterStageWindow *stage_window)
{
@ -763,6 +779,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
iface->resize = clutter_stage_x11_resize;
iface->get_geometry = clutter_stage_x11_get_geometry;
iface->realize = clutter_stage_x11_realize;
iface->unrealize = clutter_stage_x11_unrealize;
}
static inline void