From 94c30a4f675380d7b57580ae3deb34ecca4ea376 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 14 Apr 2011 15:43:19 +0100 Subject: [PATCH] x11: Provide a StageWindow::unrealize implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- clutter/x11/clutter-stage-x11.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c index 542174279..36e69166f 100644 --- a/clutter/x11/clutter-stage-x11.c +++ b/clutter/x11/clutter-stage-x11.c @@ -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