diff --git a/src/tests/meta-test-utils.c b/src/tests/meta-test-utils.c index 3cbff77ae..b448eb83c 100644 --- a/src/tests/meta-test-utils.c +++ b/src/tests/meta-test-utils.c @@ -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 *