Commit 327b10bf authored by Jonas Dreßler's avatar Jonas Dreßler
Browse files

clutter: Add a GRABS debug flag

Now that we have two kinds of grabs, the intricacies of event delivery
got slightly more complicated, to make debugging things easier, add a
new GRABS debug flag that gives an overview of which grabs are currently
in effect.
parent a786ada5
Pipeline #391103 waiting for manual action with stages
......@@ -115,6 +115,7 @@ static const GDebugKey clutter_debug_keys[] = {
{ "oob-transforms", CLUTTER_DEBUG_OOB_TRANSFORMS },
{ "frame-timings", CLUTTER_DEBUG_FRAME_TIMINGS },
{ "detailed-trace", CLUTTER_DEBUG_DETAILED_TRACE },
{ "grabs", CLUTTER_DEBUG_GRABS },
};
#endif /* CLUTTER_ENABLE_DEBUG */
......
......@@ -55,6 +55,7 @@ typedef enum
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16,
CLUTTER_DEBUG_FRAME_TIMINGS = 1 << 17,
CLUTTER_DEBUG_DETAILED_TRACE = 1 << 18,
CLUTTER_DEBUG_GRABS = 1 << 19,
} ClutterDebugFlag;
typedef enum
......
......@@ -3922,6 +3922,20 @@ clutter_stage_grab (ClutterStage *stage,
priv->topmost_grab->prev = 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_stage_notify_grab (stage, grab, grab->next);
......@@ -3969,6 +3983,19 @@ clutter_stage_unlink_grab (ClutterStage *stage,
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->prev = NULL;
}
......@@ -4106,6 +4133,10 @@ setup_sequence_grab (PointerDeviceEntry *entry)
return FALSE;
}
CLUTTER_NOTE (GRABS,
"[device=%p sequence=%p] Aquiring sequence grab",
entry->device, entry->sequence);
g_assert (entry->sequence_grabbed == 0);
g_assert (entry->event_actions->len == 0);
......@@ -4126,6 +4157,10 @@ release_sequence_grab (PointerDeviceEntry *entry)
return FALSE;
}
CLUTTER_NOTE (GRABS,
"[device=%p sequence=%p] Releasing sequence grab",
entry->device, entry->sequence);
g_assert (entry->sequence_grabbed == 1);
entry->sequence_grabbed = 0;
......@@ -4151,6 +4186,10 @@ clutter_stage_maybe_lost_sequence_grab (ClutterStage *self,
if (!entry->sequence_grabbed)
return;
CLUTTER_NOTE (GRABS,
"[device=%p sequence=%p] Lost sequence grab",
device, sequence);
for (i = 0; i < entry->event_actions->len; i++)
{
ClutterAction *action = g_ptr_array_index (entry->event_actions, i);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment