[clutter/clutter-1.16] wayland: Only create and act on shell_surface for non-foreign surfaces



commit 7153863309f71d7f0fc9abae6c3e7c294af41dd8
Author: Rob Bradford <rob linux intel com>
Date:   Mon Jul 15 18:36:26 2013 +0100

    wayland: Only create and act on shell_surface for non-foreign surfaces
    
    We should not create a shell surface and set the role for that shell
    surface if the surface was a foreign one provided through
    clutter_wayland_set_wl_surface
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699578

 clutter/wayland/clutter-stage-wayland.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/clutter/wayland/clutter-stage-wayland.c b/clutter/wayland/clutter-stage-wayland.c
index 099f407..9b9b8d8 100644
--- a/clutter/wayland/clutter-stage-wayland.c
+++ b/clutter/wayland/clutter-stage-wayland.c
@@ -113,15 +113,17 @@ clutter_stage_wayland_realize (ClutterStageWindow *stage_window)
 
   wl_surface = cogl_wayland_onscreen_get_surface (stage_cogl->onscreen);
   wl_surface_set_user_data (wl_surface, stage_wayland);
-
-  wl_shell_surface =
-    cogl_wayland_onscreen_get_shell_surface (stage_cogl->onscreen);
-  wl_shell_surface_add_listener (wl_shell_surface,
-                                 &shell_surface_listener,
-                                 stage_wayland);
-
   stage_wayland->wayland_surface = wl_surface;
-  stage_wayland->wayland_shell_surface = wl_shell_surface;
+
+  if (!stage_wayland->foreign_wl_surface)
+    {
+      wl_shell_surface =
+        cogl_wayland_onscreen_get_shell_surface (stage_cogl->onscreen);
+      wl_shell_surface_add_listener (wl_shell_surface,
+                                     &shell_surface_listener,
+                                     stage_wayland);
+      stage_wayland->wayland_shell_surface = wl_shell_surface;
+    }
 
   if (stage_wayland->fullscreen)
     clutter_stage_wayland_set_fullscreen (stage_window, TRUE);
@@ -138,8 +140,8 @@ clutter_stage_wayland_show (ClutterStageWindow *stage_window,
 
   clutter_stage_window_parent_iface->show (stage_window, do_raise);
 
-  /* TODO: must not call this on foreign surfaces when we add that support */
-  wl_shell_surface_set_toplevel (stage_wayland->wayland_shell_surface);
+  if (stage_wayland->wayland_shell_surface)
+    wl_shell_surface_set_toplevel (stage_wayland->wayland_shell_surface);
 
   /* We need to queue a redraw after the stage is shown because all of
    * the other queue redraws up to this point will have been ignored
@@ -161,7 +163,7 @@ clutter_stage_wayland_set_fullscreen (ClutterStageWindow *stage_window,
 
   stage_wayland->fullscreen = fullscreen;
 
-  if (!stage_wayland->wayland_shell_surface) /* Not realized yet */
+  if (!stage_wayland->wayland_shell_surface)
     return;
 
   if (fullscreen)


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