mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
native/seat-impl: Add helper for queuing main thread idle callbacks
Make the emit main thread signal use it. Will be used for calling code on the main thread from the input thread. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1739>
This commit is contained in:
@ -306,6 +306,22 @@ update_button_count (MetaSeatImpl *seat_impl,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_seat_impl_queue_main_thread_idle (MetaSeatImpl *seat_impl,
|
||||
GSourceFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_notify)
|
||||
{
|
||||
GSource *source;
|
||||
|
||||
source = g_idle_source_new ();
|
||||
g_source_set_priority (source, G_PRIORITY_HIGH);
|
||||
g_source_set_callback (source, func, user_data, destroy_notify);
|
||||
|
||||
g_source_attach (source, seat_impl->main_context);
|
||||
g_source_unref (source);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MetaSeatImpl *seat_impl;
|
||||
@ -337,7 +353,6 @@ emit_signal (MetaSeatImpl *seat_impl,
|
||||
int n_args)
|
||||
{
|
||||
MetaSeatSignalData *emit_signal_data;
|
||||
GSource *source;
|
||||
GArray *array;
|
||||
GValue self = G_VALUE_INIT;
|
||||
|
||||
@ -354,15 +369,10 @@ emit_signal (MetaSeatImpl *seat_impl,
|
||||
emit_signal_data->signal_id = signal_id;
|
||||
emit_signal_data->args = array;
|
||||
|
||||
source = g_idle_source_new ();
|
||||
g_source_set_priority (source, G_PRIORITY_HIGH);
|
||||
g_source_set_callback (source,
|
||||
(GSourceFunc) emit_signal_in_main,
|
||||
emit_signal_data,
|
||||
(GDestroyNotify) signal_data_free);
|
||||
|
||||
g_source_attach (source, seat_impl->main_context);
|
||||
g_source_unref (source);
|
||||
meta_seat_impl_queue_main_thread_idle (seat_impl,
|
||||
(GSourceFunc) emit_signal_in_main,
|
||||
emit_signal_data,
|
||||
(GDestroyNotify) signal_data_free);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -264,4 +264,9 @@ void meta_seat_impl_notify_bell_in_impl (MetaSeatImpl *seat_impl);
|
||||
|
||||
MetaInputSettings * meta_seat_impl_get_input_settings (MetaSeatImpl *seat_impl);
|
||||
|
||||
void meta_seat_impl_queue_main_thread_idle (MetaSeatImpl *seat_impl,
|
||||
GSourceFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_notify);
|
||||
|
||||
#endif /* META_SEAT_IMPL_H */
|
||||
|
Reference in New Issue
Block a user