[mutter/wip/surface-two: 4/4] compositor: Add a new MetaSurfaceActorEmpty
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/surface-two: 4/4] compositor: Add a new MetaSurfaceActorEmpty
- Date: Mon, 24 Feb 2014 19:47:19 +0000 (UTC)
commit fe1a58b4591b994b5b7c537fa992b06c91d10c24
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Feb 24 14:38:01 2014 -0500
compositor: Add a new MetaSurfaceActorEmpty
This will be used in the interim before MetaSurfaceActorWayland
we set_window_id is called. This is somewhat expensive and hacky,
but all other attempts to prevent either MetaWindowActor or
MetaWindow from created prematurely, e.g. before we have a
set_window_id have failed.
src/Makefile.am | 2 +
src/compositor/compositor.c | 12 ++++
src/compositor/meta-surface-actor-empty.c | 96 ++++++++++++++++++++++++++++
src/compositor/meta-surface-actor-empty.h | 60 +++++++++++++++++
src/compositor/meta-window-actor-private.h | 1 +
src/compositor/meta-window-actor.c | 7 ++-
src/meta/compositor.h | 2 +
src/wayland/meta-xwayland.c | 2 +
8 files changed, 180 insertions(+), 2 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index ba029b7..92b5bde 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -80,6 +80,8 @@ libmutter_wayland_la_SOURCES = \
compositor/meta-shaped-texture-private.h \
compositor/meta-surface-actor.c \
compositor/meta-surface-actor.h \
+ compositor/meta-surface-actor-empty.c \
+ compositor/meta-surface-actor-empty.h \
compositor/meta-surface-actor-x11.c \
compositor/meta-surface-actor-x11.h \
compositor/meta-surface-actor-wayland.c \
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index dcf1136..0fd6d67 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -940,6 +940,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_update_surface (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-surface-actor-empty.c b/src/compositor/meta-surface-actor-empty.c
new file mode 100644
index 0000000..d01669e
--- /dev/null
+++ b/src/compositor/meta-surface-actor-empty.c
@@ -0,0 +1,96 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2013 Red Hat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by:
+ * Jasper St. Pierre <jstpierre mecheye net>
+ */
+
+#include "config.h"
+
+#include "meta-surface-actor-empty.h"
+
+G_DEFINE_TYPE (MetaSurfaceActorEmpty, meta_surface_actor_empty, META_TYPE_SURFACE_ACTOR)
+
+static void
+meta_surface_actor_empty_process_damage (MetaSurfaceActor *actor,
+ int x, int y, int width, int height)
+{
+}
+
+static void
+meta_surface_actor_empty_pre_paint (MetaSurfaceActor *actor)
+{
+}
+
+static gboolean
+meta_surface_actor_empty_is_argb32 (MetaSurfaceActor *actor)
+{
+ return FALSE;
+}
+
+static gboolean
+meta_surface_actor_empty_is_visible (MetaSurfaceActor *actor)
+{
+ return FALSE;
+}
+
+static gboolean
+meta_surface_actor_empty_should_unredirect (MetaSurfaceActor *actor)
+{
+ return FALSE;
+}
+
+static void
+meta_surface_actor_empty_set_unredirected (MetaSurfaceActor *actor,
+ gboolean unredirected)
+{
+}
+
+static gboolean
+meta_surface_actor_empty_is_unredirected (MetaSurfaceActor *actor)
+{
+ return FALSE;
+}
+
+static void
+meta_surface_actor_empty_class_init (MetaSurfaceActorEmptyClass *klass)
+{
+ MetaSurfaceActorClass *surface_actor_class = META_SURFACE_ACTOR_CLASS (klass);
+
+ surface_actor_class->process_damage = meta_surface_actor_empty_process_damage;
+ surface_actor_class->pre_paint = meta_surface_actor_empty_pre_paint;
+ surface_actor_class->is_argb32 = meta_surface_actor_empty_is_argb32;
+ surface_actor_class->is_visible = meta_surface_actor_empty_is_visible;
+
+ surface_actor_class->should_unredirect = meta_surface_actor_empty_should_unredirect;
+ surface_actor_class->set_unredirected = meta_surface_actor_empty_set_unredirected;
+ surface_actor_class->is_unredirected = meta_surface_actor_empty_is_unredirected;
+}
+
+static void
+meta_surface_actor_empty_init (MetaSurfaceActorEmpty *self)
+{
+}
+
+MetaSurfaceActor *
+meta_surface_actor_empty_new (void)
+{
+ return g_object_new (META_TYPE_SURFACE_ACTOR_EMPTY, NULL);
+}
diff --git a/src/compositor/meta-surface-actor-empty.h b/src/compositor/meta-surface-actor-empty.h
new file mode 100644
index 0000000..bd9e821
--- /dev/null
+++ b/src/compositor/meta-surface-actor-empty.h
@@ -0,0 +1,60 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2013 Red Hat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by:
+ * Jasper St. Pierre <jstpierre mecheye net>
+ */
+
+#ifndef __META_SURFACE_ACTOR_EMPTY_H__
+#define __META_SURFACE_ACTOR_EMPTY_H__
+
+#include <glib-object.h>
+
+#include "meta-surface-actor.h"
+
+G_BEGIN_DECLS
+
+#define META_TYPE_SURFACE_ACTOR_EMPTY (meta_surface_actor_empty_get_type ())
+#define META_SURFACE_ACTOR_EMPTY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
META_TYPE_SURFACE_ACTOR_EMPTY, MetaSurfaceActorEmpty))
+#define META_SURFACE_ACTOR_EMPTY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
META_TYPE_SURFACE_ACTOR_EMPTY, MetaSurfaceActorEmptyClass))
+#define META_IS_SURFACE_ACTOR_EMPTY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
META_TYPE_SURFACE_ACTOR_EMPTY))
+#define META_IS_SURFACE_ACTOR_EMPTY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
META_TYPE_SURFACE_ACTOR_EMPTY))
+#define META_SURFACE_ACTOR_EMPTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
META_TYPE_SURFACE_ACTOR_EMPTY, MetaSurfaceActorEmptyClass))
+
+typedef struct _MetaSurfaceActorEmpty MetaSurfaceActorEmpty;
+typedef struct _MetaSurfaceActorEmptyClass MetaSurfaceActorEmptyClass;
+
+struct _MetaSurfaceActorEmpty
+{
+ MetaSurfaceActor parent;
+};
+
+struct _MetaSurfaceActorEmptyClass
+{
+ MetaSurfaceActorClass parent_class;
+};
+
+GType meta_surface_actor_empty_get_type (void);
+
+MetaSurfaceActor * meta_surface_actor_empty_new (void);
+
+G_END_DECLS
+
+#endif /* __META_SURFACE_ACTOR_EMPTY_H__ */
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index 9c6a847..021ddc6 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -63,5 +63,6 @@ void meta_window_actor_effect_completed (MetaWindowActor *actor,
gulong event);
MetaSurfaceActor *meta_window_actor_get_surface (MetaWindowActor *self);
+void meta_window_actor_update_surface (MetaWindowActor *self);
#endif /* META_WINDOW_ACTOR_PRIVATE_H */
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index d2c16b1..ddbdd25 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -34,6 +34,7 @@
#include "meta-surface-actor.h"
#include "meta-surface-actor-x11.h"
+#include "meta-surface-actor-empty.h"
struct _MetaWindowActorPrivate
{
@@ -333,7 +334,7 @@ set_surface (MetaWindowActor *self,
}
}
-static void
+void
meta_window_actor_update_surface (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
@@ -342,8 +343,10 @@ meta_window_actor_update_surface (MetaWindowActor *self)
if (window->surface)
surface_actor = window->surface->surface_actor;
- else
+ else if (!meta_is_wayland_compositor ())
surface_actor = meta_surface_actor_x11_new (window);
+ else
+ surface_actor = meta_surface_actor_empty_new ();
set_surface (self, surface_actor);
}
diff --git a/src/meta/compositor.h b/src/meta/compositor.h
index d1be47e..76ad10b 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 76ca5cb..f65ac56 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -51,6 +51,8 @@ xserver_set_window_id (struct wl_client *client,
surface->window = window;
window->surface = surface;
+
+ meta_compositor_window_surface_changed (display->compositor, window);
}
static const struct xserver_interface xserver_implementation = {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]