[mutter] cursor-renderer: Use 'after-paint' stage signal instead paint callback
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cursor-renderer: Use 'after-paint' stage signal instead paint callback
- Date: Thu, 2 Jul 2020 20:54:10 +0000 (UTC)
commit 9daec2303399cc017626757d127497023078a315
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri May 29 23:10:41 2020 +0200
cursor-renderer: Use 'after-paint' stage signal instead paint callback
The clutter "thread" repaint callback are not tied to painting, but
indirectly to updating. What the cursor renderer cares about is when we
actually painted, as this is related to the OpenGL fallback paths.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
src/backends/meta-cursor-renderer.c | 38 ++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/src/backends/meta-cursor-renderer.c b/src/backends/meta-cursor-renderer.c
index 485e96a8df..73f651c70f 100644
--- a/src/backends/meta-cursor-renderer.c
+++ b/src/backends/meta-cursor-renderer.c
@@ -59,7 +59,7 @@ struct _MetaCursorRendererPrivate
MetaCursorSprite *displayed_cursor;
MetaOverlay *stage_overlay;
gboolean handled_by_backend;
- guint post_paint_func_id;
+ gulong after_paint_handler_id;
GList *hw_cursor_inhibitors;
};
@@ -153,17 +153,15 @@ queue_redraw (MetaCursorRenderer *renderer,
texture, &rect);
}
-static gboolean
-meta_cursor_renderer_post_paint (gpointer data)
+static void
+meta_cursor_renderer_after_paint (ClutterStage *stage,
+ MetaCursorRenderer *renderer)
{
- MetaCursorRenderer *renderer = META_CURSOR_RENDERER (data);
MetaCursorRendererPrivate *priv =
meta_cursor_renderer_get_instance_private (renderer);
if (priv->displayed_cursor && !priv->handled_by_backend)
meta_cursor_renderer_emit_painted (renderer, priv->displayed_cursor);
-
- return TRUE;
}
static gboolean
@@ -228,11 +226,28 @@ meta_cursor_renderer_finalize (GObject *object)
if (priv->stage_overlay)
meta_stage_remove_cursor_overlay (META_STAGE (stage), priv->stage_overlay);
- clutter_threads_remove_repaint_func (priv->post_paint_func_id);
+ g_clear_signal_handler (&priv->after_paint_handler_id, stage);
G_OBJECT_CLASS (meta_cursor_renderer_parent_class)->finalize (object);
}
+static void
+meta_cursor_renderer_constructed (GObject *object)
+{
+ MetaCursorRenderer *renderer = META_CURSOR_RENDERER (object);
+ MetaCursorRendererPrivate *priv =
+ meta_cursor_renderer_get_instance_private (renderer);
+ ClutterActor *stage;
+
+ stage = meta_backend_get_stage (priv->backend);
+ priv->after_paint_handler_id =
+ g_signal_connect (stage, "after-paint",
+ G_CALLBACK (meta_cursor_renderer_after_paint),
+ renderer);
+
+ G_OBJECT_CLASS (meta_cursor_renderer_parent_class)->constructed (object);
+}
+
static void
meta_cursor_renderer_class_init (MetaCursorRendererClass *klass)
{
@@ -241,6 +256,7 @@ meta_cursor_renderer_class_init (MetaCursorRendererClass *klass)
object_class->get_property = meta_cursor_renderer_get_property;
object_class->set_property = meta_cursor_renderer_set_property;
object_class->finalize = meta_cursor_renderer_finalize;
+ object_class->constructed = meta_cursor_renderer_constructed;
klass->update_cursor = meta_cursor_renderer_real_update_cursor;
obj_props[PROP_BACKEND] =
@@ -265,14 +281,6 @@ meta_cursor_renderer_class_init (MetaCursorRendererClass *klass)
static void
meta_cursor_renderer_init (MetaCursorRenderer *renderer)
{
- MetaCursorRendererPrivate *priv =
- meta_cursor_renderer_get_instance_private (renderer);
-
- priv->post_paint_func_id =
- clutter_threads_add_repaint_func_full (CLUTTER_REPAINT_FLAGS_POST_PAINT,
- meta_cursor_renderer_post_paint,
- renderer,
- NULL);
}
graphene_rect_t
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]