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
This commit is contained in:
Florian Müllner 2015-03-20 00:06:34 +01:00
parent f2c1a416bf
commit 169b00aa64

View File

@ -116,6 +116,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 static void
shell_gtk_embed_set_window (ShellGtkEmbed *embed, shell_gtk_embed_set_window (ShellGtkEmbed *embed,
ShellEmbeddedWindow *window) ShellEmbeddedWindow *window)
@ -140,6 +155,10 @@ shell_gtk_embed_set_window (ShellGtkEmbed *embed,
g_signal_handlers_disconnect_by_func (embed->priv->window, g_signal_handlers_disconnect_by_func (embed->priv->window,
(gpointer)shell_gtk_embed_on_window_destroy, (gpointer)shell_gtk_embed_on_window_destroy,
embed); embed);
g_signal_handlers_disconnect_by_func (embed->priv->window,
(gpointer)shell_gtk_embed_on_window_mapped,
embed);
} }
embed->priv->window = window; embed->priv->window = window;
@ -153,13 +172,8 @@ shell_gtk_embed_set_window (ShellGtkEmbed *embed,
g_signal_connect (embed->priv->window, "destroy", g_signal_connect (embed->priv->window, "destroy",
G_CALLBACK (shell_gtk_embed_on_window_destroy), embed); G_CALLBACK (shell_gtk_embed_on_window_destroy), embed);
/* Listen for new windows so we can detect when Mutter has g_signal_connect (embed->priv->window, "map",
created a MutterWindow for this window */ G_CALLBACK (shell_gtk_embed_on_window_mapped), embed);
embed->priv->window_created_handler =
g_signal_connect (display,
"window-created",
G_CALLBACK (shell_gtk_embed_window_created_cb),
embed);
} }
clutter_actor_queue_relayout (CLUTTER_ACTOR (embed)); clutter_actor_queue_relayout (CLUTTER_ACTOR (embed));