mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
clutter: Add a GRABS debug flag
Now that we have two kinds of grabs, the intricacies of event delivery got slightly more complicated. So this seems like a good point to introduce a new GRABS debug flag that gives an overview of which grabs are currently in effect. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
This commit is contained in:
parent
9d1c212a04
commit
2dd851d9f4
@ -116,6 +116,7 @@ static const GDebugKey clutter_debug_keys[] = {
|
|||||||
{ "oob-transforms", CLUTTER_DEBUG_OOB_TRANSFORMS },
|
{ "oob-transforms", CLUTTER_DEBUG_OOB_TRANSFORMS },
|
||||||
{ "frame-timings", CLUTTER_DEBUG_FRAME_TIMINGS },
|
{ "frame-timings", CLUTTER_DEBUG_FRAME_TIMINGS },
|
||||||
{ "detailed-trace", CLUTTER_DEBUG_DETAILED_TRACE },
|
{ "detailed-trace", CLUTTER_DEBUG_DETAILED_TRACE },
|
||||||
|
{ "grabs", CLUTTER_DEBUG_GRABS },
|
||||||
};
|
};
|
||||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ typedef enum
|
|||||||
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16,
|
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16,
|
||||||
CLUTTER_DEBUG_FRAME_TIMINGS = 1 << 17,
|
CLUTTER_DEBUG_FRAME_TIMINGS = 1 << 17,
|
||||||
CLUTTER_DEBUG_DETAILED_TRACE = 1 << 18,
|
CLUTTER_DEBUG_DETAILED_TRACE = 1 << 18,
|
||||||
|
CLUTTER_DEBUG_GRABS = 1 << 19,
|
||||||
} ClutterDebugFlag;
|
} ClutterDebugFlag;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -4085,6 +4085,20 @@ clutter_stage_grab (ClutterStage *stage,
|
|||||||
priv->topmost_grab->prev = grab;
|
priv->topmost_grab->prev = grab;
|
||||||
|
|
||||||
priv->topmost_grab = grab;
|
priv->topmost_grab = grab;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_GRABS))
|
||||||
|
{
|
||||||
|
unsigned int n_grabs = 0;
|
||||||
|
ClutterGrab *g;
|
||||||
|
|
||||||
|
for (g = priv->topmost_grab; g != NULL; g = g->next)
|
||||||
|
n_grabs++;
|
||||||
|
|
||||||
|
CLUTTER_NOTE (GRABS,
|
||||||
|
"[grab=%p] Attached seat grab (n_grabs: %u) on actor: %s",
|
||||||
|
grab, n_grabs, _clutter_actor_get_debug_name (actor));
|
||||||
|
}
|
||||||
|
|
||||||
clutter_actor_attach_grab (actor, grab);
|
clutter_actor_attach_grab (actor, grab);
|
||||||
clutter_stage_notify_grab (stage, grab, grab->next);
|
clutter_stage_notify_grab (stage, grab, grab->next);
|
||||||
|
|
||||||
@ -4132,6 +4146,19 @@ clutter_stage_unlink_grab (ClutterStage *stage,
|
|||||||
priv->grab_state = CLUTTER_GRAB_STATE_NONE;
|
priv->grab_state = CLUTTER_GRAB_STATE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_GRABS))
|
||||||
|
{
|
||||||
|
unsigned int n_grabs = 0;
|
||||||
|
ClutterGrab *g;
|
||||||
|
|
||||||
|
for (g = priv->topmost_grab; g != NULL; g = g->next)
|
||||||
|
n_grabs++;
|
||||||
|
|
||||||
|
CLUTTER_NOTE (GRABS,
|
||||||
|
"[grab=%p] Detached seat grab (n_grabs: %u)",
|
||||||
|
grab, n_grabs);
|
||||||
|
}
|
||||||
|
|
||||||
grab->next = NULL;
|
grab->next = NULL;
|
||||||
grab->prev = NULL;
|
grab->prev = NULL;
|
||||||
}
|
}
|
||||||
@ -4311,6 +4338,10 @@ setup_implicit_grab (PointerDeviceEntry *entry)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CLUTTER_NOTE (GRABS,
|
||||||
|
"[device=%p sequence=%p] Aquiring implicit grab",
|
||||||
|
entry->device, entry->sequence);
|
||||||
|
|
||||||
g_assert (entry->press_count == 0);
|
g_assert (entry->press_count == 0);
|
||||||
g_assert (entry->event_emission_chain->len == 0);
|
g_assert (entry->event_emission_chain->len == 0);
|
||||||
|
|
||||||
@ -4331,6 +4362,10 @@ release_implicit_grab (PointerDeviceEntry *entry)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CLUTTER_NOTE (GRABS,
|
||||||
|
"[device=%p sequence=%p] Releasing implicit grab",
|
||||||
|
entry->device, entry->sequence);
|
||||||
|
|
||||||
g_assert (entry->press_count == 1);
|
g_assert (entry->press_count == 1);
|
||||||
|
|
||||||
entry->press_count = 0;
|
entry->press_count = 0;
|
||||||
@ -4356,6 +4391,10 @@ clutter_stage_maybe_lost_implicit_grab (ClutterStage *self,
|
|||||||
if (!entry->press_count)
|
if (!entry->press_count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CLUTTER_NOTE (GRABS,
|
||||||
|
"[device=%p sequence=%p] Lost implicit grab",
|
||||||
|
device, sequence);
|
||||||
|
|
||||||
for (i = 0; i < entry->event_emission_chain->len; i++)
|
for (i = 0; i < entry->event_emission_chain->len; i++)
|
||||||
{
|
{
|
||||||
EventReceiver *receiver =
|
EventReceiver *receiver =
|
||||||
@ -4504,6 +4543,12 @@ cancel_implicit_grab_on_actor (PointerDeviceEntry *entry,
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
ClutterActor *parent = clutter_actor_get_parent (actor);
|
ClutterActor *parent = clutter_actor_get_parent (actor);
|
||||||
|
|
||||||
|
CLUTTER_NOTE (GRABS,
|
||||||
|
"[device=%p sequence=%p] Cancelling implicit grab on actor (%s) "
|
||||||
|
"due to unmap",
|
||||||
|
entry->device, entry->sequence,
|
||||||
|
_clutter_actor_get_debug_name (actor));
|
||||||
|
|
||||||
for (i = 0; i < entry->event_emission_chain->len; i++)
|
for (i = 0; i < entry->event_emission_chain->len; i++)
|
||||||
{
|
{
|
||||||
EventReceiver *receiver =
|
EventReceiver *receiver =
|
||||||
|
Loading…
Reference in New Issue
Block a user