[mutter] wayland: Make subsurfaces reactive



commit 4ab71ec9427b2ee791a782b964296b5f1b5732ed
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Apr 16 15:41:50 2014 -0400

    wayland: Make subsurfaces reactive

 src/wayland/meta-wayland-surface.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index a414e53..44bdc8c 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -529,14 +529,34 @@ const struct wl_surface_interface meta_wayland_wl_surface_interface = {
   wl_surface_set_buffer_scale
 };
 
+static gboolean
+surface_should_be_reactive (MetaWaylandSurface *surface)
+{
+  /* If we have a toplevel window, we should be reactive */
+  if (surface->window)
+    return TRUE;
+
+  /* If we're a subsurface, we should be reactive */
+  if (surface->subsurface.resource)
+    return TRUE;
+
+  return FALSE;
+}
+
+static void
+sync_reactive (MetaWaylandSurface *surface)
+{
+  clutter_actor_set_reactive (CLUTTER_ACTOR (surface->surface_actor),
+                              surface_should_be_reactive (surface));
+}
+
 void
 meta_wayland_surface_set_window (MetaWaylandSurface *surface,
                                  MetaWindow         *window)
 {
-  gboolean has_window = (window != NULL);
-
-  clutter_actor_set_reactive (CLUTTER_ACTOR (surface->surface_actor), has_window);
   surface->window = window;
+
+  sync_reactive (surface);
 }
 
 static void
@@ -1633,6 +1653,8 @@ wl_subcompositor_get_subsurface (struct wl_client *client,
 
   clutter_actor_add_child (CLUTTER_ACTOR (parent->surface_actor),
                            CLUTTER_ACTOR (surface->surface_actor));
+
+  sync_reactive (surface);
 }
 
 static const struct wl_subcompositor_interface meta_wayland_subcompositor_interface = {


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