[mutter/wip/surface-content: 29/30] xwayland: Update the surface actor for the window on set_window_id
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/surface-content: 29/30] xwayland: Update the surface actor for the window on set_window_id
- Date: Thu, 16 Jan 2014 19:10:33 +0000 (UTC)
commit 3a8ed2ff7633119424ae3401393253414920af33
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Dec 9 13:47:55 2013 -0500
xwayland: Update the surface actor for the window on set_window_id
We need to do this for XWayland windows, since we only get the event
telling us they're an XWayland window after the compositor knows about
the window.
src/compositor/compositor.c | 12 ++++++
src/compositor/meta-window-actor-private.h | 1 +
src/compositor/meta-window-actor.c | 60 ++++++++++++++++++++-------
src/meta/compositor.h | 2 +
src/wayland/meta-xwayland.c | 3 +
5 files changed, 62 insertions(+), 16 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 4f96830..19a8657 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -992,6 +992,18 @@ meta_compositor_window_opacity_changed (MetaCompositor *compositor,
meta_window_actor_update_opacity (window_actor);
}
+void
+meta_compositor_window_surface_changed (MetaCompositor *compositor,
+ MetaWindow *window)
+{
+ MetaWindowActor *window_actor;
+ window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ if (!window_actor)
+ return;
+
+ meta_window_actor_sync_surface_actor (window_actor);
+}
+
/* Clutter makes the assumption that there is only one X window
* per stage, which is a valid assumption to make for a generic
* application toolkit. As such, it will ignore any events sent
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index 9c6a847..70c3f4b 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -50,6 +50,7 @@ gboolean meta_window_actor_effect_in_progress (MetaWindowActor *self);
void meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
gboolean did_placement);
void meta_window_actor_sync_visibility (MetaWindowActor *self);
+void meta_window_actor_sync_surface_actor (MetaWindowActor *self);
void meta_window_actor_update_shape (MetaWindowActor *self);
void meta_window_actor_update_opacity (MetaWindowActor *self);
void meta_window_actor_mapped (MetaWindowActor *self);
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index fe09ace..ed4d90e 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -306,29 +306,60 @@ meta_window_actor_thaw (MetaWindowActor *self)
}
static void
-meta_window_actor_constructed (GObject *object)
+set_surface_actor (MetaWindowActor *self,
+ MetaSurfaceActor *surface)
{
- MetaWindowActor *self = META_WINDOW_ACTOR (object);
- MetaWindowActorPrivate *priv = self->priv;
- MetaWindow *window = priv->window;
+ MetaWindowActorPrivate *priv = self->priv;
- priv->screen = window->screen;
+ if (priv->surface)
+ {
+ g_object_unref (priv->surface);
+ clutter_actor_remove_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
+ }
- if (!priv->surface)
+ priv->surface = surface;
+
+ if (priv->surface)
{
- if (window->surface)
- priv->surface = window->surface->surface_actor;
- else
- priv->surface = meta_surface_actor_x11_new (window);
g_object_ref_sink (priv->surface);
-
clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
g_signal_connect_object (priv->surface, "allocation-changed",
G_CALLBACK (surface_allocation_changed_notify), self, 0);
- meta_window_actor_update_shape (self);
}
+ meta_window_actor_update_shape (self);
+}
+
+void
+meta_window_actor_sync_surface_actor (MetaWindowActor *self)
+{
+ MetaWindowActorPrivate *priv = self->priv;
+ MetaWindow *window = priv->window;
+
+ MetaSurfaceActor *surface = NULL;
+
+ if (window)
+ {
+ if (window->surface)
+ surface = window->surface->surface_actor;
+ else
+ surface = meta_surface_actor_x11_new (window);
+ }
+
+ set_surface_actor (self, surface);
+}
+
+static void
+meta_window_actor_constructed (GObject *object)
+{
+ MetaWindowActor *self = META_WINDOW_ACTOR (object);
+ MetaWindowActorPrivate *priv = self->priv;
+ MetaWindow *window = priv->window;
+
+ priv->screen = window->screen;
+
+ meta_window_actor_sync_surface_actor (self);
meta_window_actor_update_opacity (self);
/* Start off with an empty shape region to maintain the invariant
@@ -370,10 +401,7 @@ meta_window_actor_dispose (GObject *object)
g_clear_object (&priv->window);
- /*
- * Release the extra reference we took on the actor.
- */
- g_clear_object (&priv->surface);
+ meta_window_actor_sync_surface_actor (self);
G_OBJECT_CLASS (meta_window_actor_parent_class)->dispose (object);
}
diff --git a/src/meta/compositor.h b/src/meta/compositor.h
index 45c8b09..b86225b 100644
--- a/src/meta/compositor.h
+++ b/src/meta/compositor.h
@@ -66,6 +66,8 @@ void meta_compositor_window_shape_changed (MetaCompositor *compositor,
MetaWindow *window);
void meta_compositor_window_opacity_changed (MetaCompositor *compositor,
MetaWindow *window);
+void meta_compositor_window_surface_changed (MetaCompositor *compositor,
+ MetaWindow *window);
gboolean meta_compositor_process_event (MetaCompositor *compositor,
XEvent *event,
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 02c5b7b..7872b05 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -48,6 +48,9 @@ xserver_set_window_id (struct wl_client *client,
{
surface->window = window;
window->surface = surface;
+
+ if (display->compositor)
+ meta_compositor_window_surface_changed (display->compositor, window);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]