[gnome-shell] gtk-embed: Handle unmap/map of the embedded window



commit 169b00aa64bb644e57cd9c6f66d6cb47eef5e5c2
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Mar 20 00:06:34 2015 +0100

    gtk-embed: Handle unmap/map of the embedded window
    
    The current code assumes that an embedded window will correspond to
    a single MetaWindow over the entire lifetime of the icon, which is
    incorrect - the embedded window is unmanaged on Unmap and a new
    MetaWindow will be created the next time the embedded window is
    mapped. As we currently ignore the new MetaWindow completely, it
    will be shown normally in the scene instead of the embedded clone
    as intended.
    Fix this by setting up clone and window actor each time the embedded
    window is mapped rather than once in shell_gtk_embed_set_window().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745824

 src/shell-gtk-embed.c |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/src/shell-gtk-embed.c b/src/shell-gtk-embed.c
index a1e552d..f18097c 100644
--- a/src/shell-gtk-embed.c
+++ b/src/shell-gtk-embed.c
@@ -117,6 +117,21 @@ shell_gtk_embed_window_created_cb (MetaDisplay   *display,
 }
 
 static void
+shell_gtk_embed_on_window_mapped (GtkWidget     *object,
+                                  ShellGtkEmbed *embed)
+{
+  MetaDisplay *display = shell_global_get_display (shell_global_get ());
+
+  /* Listen for new windows so we can detect when Mutter has
+     created a MutterWindow for this window */
+  embed->priv->window_created_handler =
+    g_signal_connect (display,
+                      "window-created",
+                      G_CALLBACK (shell_gtk_embed_window_created_cb),
+                      embed);
+}
+
+static void
 shell_gtk_embed_set_window (ShellGtkEmbed       *embed,
                             ShellEmbeddedWindow *window)
 {
@@ -140,6 +155,10 @@ shell_gtk_embed_set_window (ShellGtkEmbed       *embed,
       g_signal_handlers_disconnect_by_func (embed->priv->window,
                                             (gpointer)shell_gtk_embed_on_window_destroy,
                                             embed);
+
+      g_signal_handlers_disconnect_by_func (embed->priv->window,
+                                            (gpointer)shell_gtk_embed_on_window_mapped,
+                                            embed);
     }
 
   embed->priv->window = window;
@@ -153,13 +172,8 @@ shell_gtk_embed_set_window (ShellGtkEmbed       *embed,
       g_signal_connect (embed->priv->window, "destroy",
                         G_CALLBACK (shell_gtk_embed_on_window_destroy), embed);
 
-      /* Listen for new windows so we can detect when Mutter has
-         created a MutterWindow for this window */
-      embed->priv->window_created_handler =
-        g_signal_connect (display,
-                          "window-created",
-                          G_CALLBACK (shell_gtk_embed_window_created_cb),
-                          embed);
+      g_signal_connect (embed->priv->window, "map",
+                        G_CALLBACK (shell_gtk_embed_on_window_mapped), embed);
     }
 
   clutter_actor_queue_relayout (CLUTTER_ACTOR (embed));


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