mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
tests/clutter/event-delivery: Flush input thread inside wait_stage_updated()
Flushing the input thread might implicitly iterate the mainloop, and thus update the stage while still inside the clutter_test_flush_input() call. This means the stage update has already happened when we call wait_stage_updated(), and that's why we call clutter_stage_schedule_update() there currently. This clutter_stage_schedule_update() call is not necessary though, instead we can flush the input thread from inside wait_stage_updated() after setting was_updated to FALSE. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2792>
This commit is contained in:
parent
909eaa117d
commit
57ce4e04e5
@ -21,11 +21,12 @@ on_event_return_stop (ClutterActor *actor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wait_stage_updated (ClutterStage *stage,
|
wait_stage_updated (gboolean *was_updated)
|
||||||
gboolean *was_updated)
|
|
||||||
{
|
{
|
||||||
*was_updated = FALSE;
|
*was_updated = FALSE;
|
||||||
clutter_stage_schedule_update (stage);
|
|
||||||
|
clutter_test_flush_input ();
|
||||||
|
|
||||||
while (!*was_updated)
|
while (!*was_updated)
|
||||||
g_main_context_iteration (NULL, TRUE);
|
g_main_context_iteration (NULL, TRUE);
|
||||||
}
|
}
|
||||||
@ -55,13 +56,11 @@ event_delivery_consecutive_touch_begin_end (void)
|
|||||||
clutter_virtual_input_device_notify_touch_up (virtual_pointer, now_us, 0);
|
clutter_virtual_input_device_notify_touch_up (virtual_pointer, now_us, 0);
|
||||||
clutter_virtual_input_device_notify_touch_down (virtual_pointer, now_us, 0, 5, 5);
|
clutter_virtual_input_device_notify_touch_down (virtual_pointer, now_us, 0, 5, 5);
|
||||||
g_assert_true (!was_updated);
|
g_assert_true (!was_updated);
|
||||||
clutter_test_flush_input ();
|
wait_stage_updated (&was_updated);
|
||||||
wait_stage_updated (CLUTTER_STAGE (stage), &was_updated);
|
|
||||||
g_assert_cmpint (n_captured_touch_events, ==, 3);
|
g_assert_cmpint (n_captured_touch_events, ==, 3);
|
||||||
|
|
||||||
clutter_virtual_input_device_notify_touch_up (virtual_pointer, now_us, 0);
|
clutter_virtual_input_device_notify_touch_up (virtual_pointer, now_us, 0);
|
||||||
clutter_test_flush_input ();
|
wait_stage_updated (&was_updated);
|
||||||
wait_stage_updated (CLUTTER_STAGE (stage), &was_updated);
|
|
||||||
g_assert_cmpint (n_captured_touch_events, ==, 4);
|
g_assert_cmpint (n_captured_touch_events, ==, 4);
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (stage, on_event_return_stop, &n_captured_touch_events);
|
g_signal_handlers_disconnect_by_func (stage, on_event_return_stop, &n_captured_touch_events);
|
||||||
|
Loading…
Reference in New Issue
Block a user