Don't use ClutterX11TexturePixmap directly to embed docked windows
Previously when a client requests that a window should be docked the shell would reparent the socket window onto the stage's window and then use ClutterX11TexturePixmap to get a texture to represent the window. This will not work if Clutter is no longer using the X11 winsys for example if it becomes its own display server. Instead this patch leaves the socket window as a child of the root window and lets mutter create a MetaWindow out of it. If Mutter is acting as a display server then this mechanism will still work via the headless x server. The ShellGtkEmbed instance now registers for notification of the ‘window-created’ signal of the display so that it can find the MetaWindow that gets created to represent the socket window. When this window is found it is prevented from being displayed on the screen by setting the actor's opacity to 0. An input shape is then set on the window to prevent it receiving any input. Instead of being a subclass of ClutterX11TexturePixmap, ShellGtkEmbed is now a subclass of ClutterClone. When the MetaWindow is found for the socket window the clone's source is set to the invisible actor for the window so it can be displayed in the panel as before. The ShellEmbeddedWindow no longer needs to know what the stage is because it no longer reparents the socket window. Therefore the ShellTrayManager doesn't need to know the stage either so shell_tray_manager_manage_stage has been replaced with just shell_tray_manager_manage_screen. https://bugzilla.gnome.org/show_bug.cgi?id=693438
This commit is contained in:
@@ -8,9 +8,7 @@
|
||||
#include "shell-embedded-window-private.h"
|
||||
|
||||
/* This type is a subclass of GtkWindow that ties the window to a
|
||||
* ShellGtkEmbed; the window is reparented into the stage
|
||||
* window for the actor and the resizing logic is bound to the clutter
|
||||
* logic.
|
||||
* ShellGtkEmbed; the resizing logic is bound to the clutter logic.
|
||||
*
|
||||
* The typical usage we might expect is
|
||||
*
|
||||
@@ -28,16 +26,13 @@
|
||||
G_DEFINE_TYPE (ShellEmbeddedWindow, shell_embedded_window, GTK_TYPE_WINDOW);
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
||||
PROP_STAGE
|
||||
PROP_0
|
||||
};
|
||||
|
||||
struct _ShellEmbeddedWindowPrivate {
|
||||
ShellGtkEmbed *actor;
|
||||
|
||||
GdkRectangle position;
|
||||
Window stage_xwindow;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -80,27 +75,6 @@ shell_embedded_window_hide (GtkWidget *widget)
|
||||
GTK_WIDGET_CLASS (shell_embedded_window_parent_class)->hide (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
shell_embedded_window_realize (GtkWidget *widget)
|
||||
{
|
||||
ShellEmbeddedWindow *window = SHELL_EMBEDDED_WINDOW (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (shell_embedded_window_parent_class)->realize (widget);
|
||||
|
||||
|
||||
/* Using XReparentWindow() is simpler than using gdk_window_reparent(),
|
||||
* since it avoids maybe having to create a new foreign GDK window for
|
||||
* the stage. However, GDK will be left thinking that the parent of
|
||||
* window->window is the root window - it's not immediately clear
|
||||
* to me whether that is more or less likely to cause problems than
|
||||
* modifying the GDK hierarchy.
|
||||
*/
|
||||
XReparentWindow (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget)),
|
||||
gdk_x11_window_get_xid (gtk_widget_get_window (widget)),
|
||||
window->priv->stage_xwindow,
|
||||
window->priv->position.x, window->priv->position.y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
shell_embedded_window_configure_event (GtkWidget *widget,
|
||||
GdkEventConfigure *event)
|
||||
@@ -127,27 +101,6 @@ shell_embedded_window_check_resize (GtkContainer *container)
|
||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (window->priv->actor));
|
||||
}
|
||||
|
||||
static void
|
||||
shell_embedded_window_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ShellEmbeddedWindow *window = SHELL_EMBEDDED_WINDOW (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_STAGE:
|
||||
window->priv->stage_xwindow =
|
||||
clutter_x11_get_stage_window (g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static GObject *
|
||||
shell_embedded_window_constructor (GType gtype,
|
||||
guint n_properties,
|
||||
@@ -182,23 +135,13 @@ shell_embedded_window_class_init (ShellEmbeddedWindowClass *klass)
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ShellEmbeddedWindowPrivate));
|
||||
|
||||
object_class->set_property = shell_embedded_window_set_property;
|
||||
object_class->constructor = shell_embedded_window_constructor;
|
||||
|
||||
widget_class->show = shell_embedded_window_show;
|
||||
widget_class->hide = shell_embedded_window_hide;
|
||||
widget_class->realize = shell_embedded_window_realize;
|
||||
widget_class->configure_event = shell_embedded_window_configure_event;
|
||||
|
||||
container_class->check_resize = shell_embedded_window_check_resize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_STAGE,
|
||||
g_param_spec_object ("stage",
|
||||
"Stage",
|
||||
"ClutterStage to embed on",
|
||||
CLUTTER_TYPE_STAGE,
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -282,9 +225,8 @@ _shell_embedded_window_unmap (ShellEmbeddedWindow *window)
|
||||
* Public API
|
||||
*/
|
||||
GtkWidget *
|
||||
shell_embedded_window_new (ClutterStage *stage)
|
||||
shell_embedded_window_new (void)
|
||||
{
|
||||
return g_object_new (SHELL_TYPE_EMBEDDED_WINDOW,
|
||||
"stage", stage,
|
||||
NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user