[clutter] x11: Provide a StageWindow::unrealize implementation



commit 94c30a4f675380d7b57580ae3deb34ecca4ea376
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Apr 14 15:43:19 2011 +0100

    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.

 clutter/x11/clutter-stage-x11.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c
index 5421742..36e6916 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]