[mutter/gbsneto/graphene-ray: 44/54] clutter/pick-context: Make pick context aware of the pick mode




commit 8dce1802862d8cc82322a56dab0f268c0bc1ac0f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Oct 16 09:59:54 2020 -0300

    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 4e6db156b2..7e4422eddf 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 5ecb907b09..6209e58cee 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 a1f8dec41b..d420d0a57a 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 9d1211076d..7df016dfa2 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]