tests/utils: Add helper to flush the input thread

Add a helper function that ensures any queued virtual input events have
been flushed from the input thread. This works by posting a task to the
input thread, which will itself queue another callback back to the main
thread. Once the main thread callback is invoked, the flush call is
unblocked and the function returns. Upon this, any previously emitted
virtual input event should have already passed through the input thread
back into the main thread, however not necessarily fully processed.

For making sure it has been processed, one also have to make sure the
stage has been updated, e.g. via `meta_wait_for_paint()`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2727>
This commit is contained in:
Jonas Ådahl
2022-04-01 08:34:46 +02:00
committed by Marge Bot
parent bd72b671fc
commit 489bc65381
4 changed files with 53 additions and 0 deletions

View File

@ -133,6 +133,7 @@ MetaSeatImpl * meta_seat_impl_new (MetaSeatNative *seat_native,
void meta_seat_impl_destroy (MetaSeatImpl *seat_impl);
META_EXPORT_TEST
void meta_seat_impl_run_input_task (MetaSeatImpl *seat_impl,
GTask *task,
GSourceFunc dispatch_func);

View File

@ -34,6 +34,7 @@
#include "backends/native/meta-pointer-constraint-native.h"
#include "backends/native/meta-xkb-utils.h"
#include "clutter/clutter.h"
#include "core/util-private.h"
typedef struct _MetaSeatNative MetaSeatNative;
@ -66,6 +67,7 @@ struct _MetaSeatNative
};
#define META_TYPE_SEAT_NATIVE meta_seat_native_get_type ()
META_EXPORT_TEST
G_DECLARE_FINAL_TYPE (MetaSeatNative, meta_seat_native,
META, SEAT_NATIVE, ClutterSeat)