[clutter] gdk: stage: disable some operations for foreign windows



commit a9b38fefdc097427cc33ca2b8d527415ee4f157b
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Mon Sep 7 12:21:18 2015 +0100

    gdk: stage: disable some operations for foreign windows
    
    Some operations like :
         * resize
         * show/hide
         * set_title
         * set_user_resizable
    
    should be handled by the embedding framework, so disable them for
    foreign windows.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754671

 clutter/gdk/clutter-stage-gdk.c |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/clutter/gdk/clutter-stage-gdk.c b/clutter/gdk/clutter-stage-gdk.c
index 8a301ae..05c6fe3 100644
--- a/clutter/gdk/clutter-stage-gdk.c
+++ b/clutter/gdk/clutter-stage-gdk.c
@@ -141,6 +141,12 @@ clutter_stage_gdk_resize (ClutterStageWindow *stage_window,
 {
   ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
 
+  /* No need to resize foreign windows, it should be handled by the
+   * embedding framework.
+   */
+  if (stage_gdk->foreign_window)
+    return;
+
   if (width == 0 || height == 0)
     {
       /* Should not happen, if this turns up we need to debug it and
@@ -350,7 +356,7 @@ clutter_stage_gdk_set_fullscreen (ClutterStageWindow *stage_window,
   if (stage == NULL || CLUTTER_ACTOR_IN_DESTRUCTION (stage))
     return;
 
-  if (stage_gdk->window == NULL)
+  if (stage_gdk->window == NULL || stage_gdk->foreign_window)
     return;
 
   CLUTTER_NOTE (BACKEND, "%ssetting fullscreen", is_fullscreen ? "" : "un");
@@ -393,7 +399,7 @@ clutter_stage_gdk_set_title (ClutterStageWindow *stage_window,
 {
   ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
 
-  if (stage_gdk->window == NULL)
+  if (stage_gdk->window == NULL || stage_gdk->foreign_window)
     return;
 
   gdk_window_set_title (stage_gdk->window, title);
@@ -406,7 +412,7 @@ clutter_stage_gdk_set_user_resizable (ClutterStageWindow *stage_window,
   ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
   GdkWMFunction function;
 
-  if (stage_gdk->window == NULL)
+  if (stage_gdk->window == NULL || stage_gdk->foreign_window)
     return;
 
   function = GDK_FUNC_MOVE | GDK_FUNC_MINIMIZE | GDK_FUNC_CLOSE;
@@ -424,7 +430,7 @@ clutter_stage_gdk_set_accept_focus (ClutterStageWindow *stage_window,
 {
   ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
 
-  if (stage_gdk->window == NULL)
+  if (stage_gdk->window == NULL || stage_gdk->foreign_window)
     return;
 
   gdk_window_set_accept_focus (stage_gdk->window, accept_focus);
@@ -440,10 +446,14 @@ clutter_stage_gdk_show (ClutterStageWindow *stage_window,
 
   clutter_actor_map (CLUTTER_ACTOR (CLUTTER_STAGE_COGL (stage_gdk)->wrapper));
 
-  if (do_raise)
-    gdk_window_show (stage_gdk->window);
-  else
-    gdk_window_show_unraised (stage_gdk->window);
+  /* Foreign window should be shown by the embedding framework. */
+  if (!stage_gdk->foreign_window)
+    {
+      if (do_raise)
+        gdk_window_show (stage_gdk->window);
+      else
+        gdk_window_show_unraised (stage_gdk->window);
+    }
 }
 
 static void
@@ -454,7 +464,10 @@ clutter_stage_gdk_hide (ClutterStageWindow *stage_window)
   g_return_if_fail (stage_gdk->window != NULL);
 
   clutter_actor_unmap (CLUTTER_ACTOR (CLUTTER_STAGE_COGL (stage_gdk)->wrapper));
-  gdk_window_hide (stage_gdk->window);
+
+  /* Foreign window should be hidden by the embedding framework. */
+  if (!stage_gdk->foreign_window)
+    gdk_window_hide (stage_gdk->window);
 }
 
 static gboolean


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