[mutter] compositor-x11: Move synchronization to before-update
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] compositor-x11: Move synchronization to before-update
- Date: Thu, 2 Jul 2020 20:53:50 +0000 (UTC)
commit 551101c65cda0e8a3c3a609baef263d39a32a651
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri May 29 23:47:29 2020 +0200
compositor-x11: Move synchronization to before-update
The synchronization must happen no matter the painting, as it in itself
might result in reported damage, making the stage actually painted. Thus
move it out of the "pre-paint" handler, to something explicitly not tied
to the painting itself - ClutterStage::before-update.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
src/compositor/meta-compositor-x11.c | 42 ++++++++++++++++++++++++++++++------
1 file changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/src/compositor/meta-compositor-x11.c b/src/compositor/meta-compositor-x11.c
index 0ab4aa0320..2cec7df1cb 100644
--- a/src/compositor/meta-compositor-x11.c
+++ b/src/compositor/meta-compositor-x11.c
@@ -39,6 +39,8 @@ struct _MetaCompositorX11
Window output;
+ gulong before_update_handler_id;
+
gboolean frame_has_updated_xsurfaces;
gboolean have_x11_sync_object;
@@ -291,15 +293,10 @@ out:
}
static void
-meta_compositor_x11_pre_paint (MetaCompositor *compositor)
+on_before_update (ClutterStage *stage,
+ MetaCompositor *compositor)
{
MetaCompositorX11 *compositor_x11 = META_COMPOSITOR_X11 (compositor);
- MetaCompositorClass *parent_class;
-
- maybe_unredirect_top_window (compositor_x11);
-
- parent_class = META_COMPOSITOR_CLASS (meta_compositor_x11_parent_class);
- parent_class->pre_paint (compositor);
if (compositor_x11->frame_has_updated_xsurfaces)
{
@@ -332,6 +329,18 @@ meta_compositor_x11_pre_paint (MetaCompositor *compositor)
}
}
+static void
+meta_compositor_x11_pre_paint (MetaCompositor *compositor)
+{
+ MetaCompositorX11 *compositor_x11 = META_COMPOSITOR_X11 (compositor);
+ MetaCompositorClass *parent_class;
+
+ maybe_unredirect_top_window (compositor_x11);
+
+ parent_class = META_COMPOSITOR_CLASS (meta_compositor_x11_parent_class);
+ parent_class->pre_paint (compositor);
+}
+
static void
meta_compositor_x11_post_paint (MetaCompositor *compositor)
{
@@ -380,10 +389,26 @@ meta_compositor_x11_new (MetaDisplay *display,
NULL);
}
+static void
+meta_compositor_x11_constructed (GObject *object)
+{
+ MetaCompositorX11 *compositor_x11 = META_COMPOSITOR_X11 (object);
+ MetaCompositor *compositor = META_COMPOSITOR (compositor_x11);
+ ClutterStage *stage = meta_compositor_get_stage (compositor);
+
+ compositor_x11->before_update_handler_id =
+ g_signal_connect (stage, "before-update",
+ G_CALLBACK (on_before_update), compositor);
+
+ G_OBJECT_CLASS (meta_compositor_x11_parent_class)->constructed (object);
+}
+
static void
meta_compositor_x11_dispose (GObject *object)
{
MetaCompositorX11 *compositor_x11 = META_COMPOSITOR_X11 (object);
+ MetaCompositor *compositor = META_COMPOSITOR (compositor_x11);
+ ClutterStage *stage = meta_compositor_get_stage (compositor);
if (compositor_x11->have_x11_sync_object)
{
@@ -391,6 +416,8 @@ meta_compositor_x11_dispose (GObject *object)
compositor_x11->have_x11_sync_object = FALSE;
}
+ g_clear_signal_handler (&compositor_x11->before_update_handler_id, stage);
+
G_OBJECT_CLASS (meta_compositor_x11_parent_class)->dispose (object);
}
@@ -405,6 +432,7 @@ meta_compositor_x11_class_init (MetaCompositorX11Class *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MetaCompositorClass *compositor_class = META_COMPOSITOR_CLASS (klass);
+ object_class->constructed = meta_compositor_x11_constructed;
object_class->dispose = meta_compositor_x11_dispose;
compositor_class->manage = meta_compositor_x11_manage;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]