mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 05:12:15 +00:00
tests/utils: Raise error if monitors changed while waiting for paint
If it does, the views we are waiting for won't get painted. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
This commit is contained in:
parent
46da153548
commit
5dc0824ea9
@ -789,23 +789,37 @@ on_view_presented (ClutterStage *stage,
|
||||
*presented_views = g_list_remove (*presented_views, view);
|
||||
}
|
||||
|
||||
static void
|
||||
raise_error (const char *message)
|
||||
{
|
||||
g_error ("%s", message);
|
||||
}
|
||||
|
||||
void
|
||||
meta_wait_for_paint (MetaContext *context)
|
||||
{
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterActor *stage = meta_backend_get_stage (backend);
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend);
|
||||
GList *views;
|
||||
gulong handler_id;
|
||||
gulong presented_handler_id;
|
||||
gulong monitors_changed_handler_id;
|
||||
|
||||
monitors_changed_handler_id =
|
||||
g_signal_connect_swapped (monitor_manager, "monitors-changed",
|
||||
G_CALLBACK (raise_error),
|
||||
(char *) "Monitors changed while waiting for paint");
|
||||
|
||||
clutter_actor_queue_redraw (stage);
|
||||
|
||||
views = g_list_copy (meta_renderer_get_views (renderer));
|
||||
handler_id = g_signal_connect (stage, "presented",
|
||||
G_CALLBACK (on_view_presented), &views);
|
||||
presented_handler_id = g_signal_connect (stage, "presented",
|
||||
G_CALLBACK (on_view_presented), &views);
|
||||
while (views)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
g_signal_handler_disconnect (stage, handler_id);
|
||||
g_signal_handler_disconnect (stage, presented_handler_id);
|
||||
g_signal_handler_disconnect (monitor_manager, monitors_changed_handler_id);
|
||||
}
|
||||
|
||||
MetaVirtualMonitor *
|
||||
|
Loading…
Reference in New Issue
Block a user