From a4961ad4a7c21da853f9d9b186c99637029ff9b1 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 16 Oct 2020 09:59:54 -0300 Subject: [PATCH] clutter/pick-context: Make pick context aware of the pick mode Pass the pick mode during construction, and add a getter for it. It'll be used by the next patches to make clutter_actor_should_pick_paint() not depend on a global context. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509 --- clutter/clutter/clutter-pick-context-private.h | 3 ++- clutter/clutter/clutter-pick-context.c | 14 +++++++++++++- clutter/clutter/clutter-pick-context.h | 3 +++ clutter/clutter/clutter-stage.c | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/clutter/clutter/clutter-pick-context-private.h b/clutter/clutter/clutter-pick-context-private.h index 4e6db156b..7e4422edd 100644 --- a/clutter/clutter/clutter-pick-context-private.h +++ b/clutter/clutter/clutter-pick-context-private.h @@ -20,6 +20,7 @@ #include "clutter-pick-context.h" -ClutterPickContext * clutter_pick_context_new_for_view (ClutterStageView *view); +ClutterPickContext * clutter_pick_context_new_for_view (ClutterStageView *view, + ClutterPickMode mode); #endif /* CLUTTER_PICK_CONTEXT_PRIVATE_H */ diff --git a/clutter/clutter/clutter-pick-context.c b/clutter/clutter/clutter-pick-context.c index 5ecb907b0..6209e58ce 100644 --- a/clutter/clutter/clutter-pick-context.c +++ b/clutter/clutter/clutter-pick-context.c @@ -23,6 +23,7 @@ struct _ClutterPickContext { grefcount ref_count; + ClutterPickMode mode; CoglFramebuffer *framebuffer; }; @@ -31,12 +32,14 @@ G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context, clutter_pick_context_unref) ClutterPickContext * -clutter_pick_context_new_for_view (ClutterStageView *view) +clutter_pick_context_new_for_view (ClutterStageView *view, + ClutterPickMode mode) { ClutterPickContext *pick_context; pick_context = g_new0 (ClutterPickContext, 1); g_ref_count_init (&pick_context->ref_count); + pick_context->mode = mode; pick_context->framebuffer = g_object_ref (clutter_stage_view_get_framebuffer (view)); @@ -81,3 +84,12 @@ clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context) { return pick_context->framebuffer; } + +/** + * clutter_pick_context_get_mode: (skip) + */ +ClutterPickMode +clutter_pick_context_get_mode (ClutterPickContext *pick_context) +{ + return pick_context->mode; +} diff --git a/clutter/clutter/clutter-pick-context.h b/clutter/clutter/clutter-pick-context.h index a1f8dec41..d420d0a57 100644 --- a/clutter/clutter/clutter-pick-context.h +++ b/clutter/clutter/clutter-pick-context.h @@ -46,4 +46,7 @@ void clutter_pick_context_destroy (ClutterPickContext *pick_context); CLUTTER_EXPORT CoglFramebuffer * clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context); +CLUTTER_EXPORT +ClutterPickMode clutter_pick_context_get_mode (ClutterPickContext *pick_context); + #endif /* CLUTTER_PICK_CONTEXT_H */ diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index 9d1211076..7df016dfa 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -1405,7 +1405,7 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage, _clutter_stage_clear_pick_stack (stage); - pick_context = clutter_pick_context_new_for_view (view); + pick_context = clutter_pick_context_new_for_view (view, mode); context->pick_mode = mode; priv->cached_pick_mode = CLUTTER_PICK_NONE;