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
This commit is contained in:
parent
8a709b5766
commit
a4961ad4a7
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "clutter-pick-context.h"
|
#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 */
|
#endif /* CLUTTER_PICK_CONTEXT_PRIVATE_H */
|
||||||
|
@ -23,6 +23,7 @@ struct _ClutterPickContext
|
|||||||
{
|
{
|
||||||
grefcount ref_count;
|
grefcount ref_count;
|
||||||
|
|
||||||
|
ClutterPickMode mode;
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -31,12 +32,14 @@ G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context,
|
|||||||
clutter_pick_context_unref)
|
clutter_pick_context_unref)
|
||||||
|
|
||||||
ClutterPickContext *
|
ClutterPickContext *
|
||||||
clutter_pick_context_new_for_view (ClutterStageView *view)
|
clutter_pick_context_new_for_view (ClutterStageView *view,
|
||||||
|
ClutterPickMode mode)
|
||||||
{
|
{
|
||||||
ClutterPickContext *pick_context;
|
ClutterPickContext *pick_context;
|
||||||
|
|
||||||
pick_context = g_new0 (ClutterPickContext, 1);
|
pick_context = g_new0 (ClutterPickContext, 1);
|
||||||
g_ref_count_init (&pick_context->ref_count);
|
g_ref_count_init (&pick_context->ref_count);
|
||||||
|
pick_context->mode = mode;
|
||||||
pick_context->framebuffer =
|
pick_context->framebuffer =
|
||||||
g_object_ref (clutter_stage_view_get_framebuffer (view));
|
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;
|
return pick_context->framebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_pick_context_get_mode: (skip)
|
||||||
|
*/
|
||||||
|
ClutterPickMode
|
||||||
|
clutter_pick_context_get_mode (ClutterPickContext *pick_context)
|
||||||
|
{
|
||||||
|
return pick_context->mode;
|
||||||
|
}
|
||||||
|
@ -46,4 +46,7 @@ void clutter_pick_context_destroy (ClutterPickContext *pick_context);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
CoglFramebuffer * clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context);
|
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 */
|
#endif /* CLUTTER_PICK_CONTEXT_H */
|
||||||
|
@ -1405,7 +1405,7 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
|||||||
|
|
||||||
_clutter_stage_clear_pick_stack (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;
|
context->pick_mode = mode;
|
||||||
priv->cached_pick_mode = CLUTTER_PICK_NONE;
|
priv->cached_pick_mode = CLUTTER_PICK_NONE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user