clutter/actor: Use pick context in clutter_actor_should_pick_paint()

Pass the ClutterPickContext to clutter_actor_should_pick_paint() and
check the pick mode from it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
This commit is contained in:
Georges Basile Stavracas Neto 2020-10-16 10:02:56 -03:00
parent a4961ad4a7
commit 05b6b6a88d
3 changed files with 8 additions and 5 deletions

View File

@ -2311,7 +2311,7 @@ static void
clutter_actor_real_pick (ClutterActor *self, clutter_actor_real_pick (ClutterActor *self,
ClutterPickContext *pick_context) ClutterPickContext *pick_context)
{ {
if (clutter_actor_should_pick_paint (self)) if (clutter_actor_should_pick_paint (self, pick_context))
{ {
ClutterActorBox box = { ClutterActorBox box = {
.x1 = 0, .x1 = 0,
@ -2344,6 +2344,7 @@ clutter_actor_real_pick (ClutterActor *self,
/** /**
* clutter_actor_should_pick_paint: * clutter_actor_should_pick_paint:
* @self: A #ClutterActor * @self: A #ClutterActor
* @pick_context: a #ClutterPickContext
* *
* Should be called inside the implementation of the * Should be called inside the implementation of the
* #ClutterActor::pick virtual function in order to check whether * #ClutterActor::pick virtual function in order to check whether
@ -2355,13 +2356,14 @@ clutter_actor_real_pick (ClutterActor *self,
* %FALSE otherwise * %FALSE otherwise
*/ */
gboolean gboolean
clutter_actor_should_pick_paint (ClutterActor *self) clutter_actor_should_pick_paint (ClutterActor *self,
ClutterPickContext *pick_context)
{ {
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE); g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
if (CLUTTER_ACTOR_IS_MAPPED (self) && if (CLUTTER_ACTOR_IS_MAPPED (self) &&
clutter_actor_has_allocation (self) && clutter_actor_has_allocation (self) &&
(_clutter_context_get_pick_mode () == CLUTTER_PICK_ALL || (clutter_pick_context_get_mode (pick_context) == CLUTTER_PICK_ALL ||
CLUTTER_ACTOR_IS_REACTIVE (self))) CLUTTER_ACTOR_IS_REACTIVE (self)))
return TRUE; return TRUE;

View File

@ -591,7 +591,8 @@ void clutter_actor_set_offscreen_redirect
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterOffscreenRedirect clutter_actor_get_offscreen_redirect (ClutterActor *self); ClutterOffscreenRedirect clutter_actor_get_offscreen_redirect (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_actor_should_pick_paint (ClutterActor *self); gboolean clutter_actor_should_pick_paint (ClutterActor *self,
ClutterPickContext *pick_context);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_actor_is_in_clone_paint (ClutterActor *self); gboolean clutter_actor_is_in_clone_paint (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT

View File

@ -184,7 +184,7 @@ meta_surface_actor_pick (ClutterActor *actor,
ClutterActorIter iter; ClutterActorIter iter;
ClutterActor *child; ClutterActor *child;
if (!clutter_actor_should_pick_paint (actor)) if (!clutter_actor_should_pick_paint (actor, pick_context))
return; return;
/* If there is no region then use the regular pick */ /* If there is no region then use the regular pick */