From e09cf6978e762d3a3c6d5b4fcf0a2124a99bc8f7 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 8 Oct 2012 18:44:09 -0400 Subject: [PATCH] gdk: only emit display-opened after the default display has been set This avoids a case where the display has been opened, but calling gdk_display_get_default() in the callback doesn't work. Reviewed-by: Benjamin Otte --- gdk/x11/gdkdisplay-x11.c | 1 - gdk/x11/gdkdisplaymanager-x11.c | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 0f8b35fc32..607d906d32 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -1459,7 +1459,6 @@ _gdk_x11_display_open (const gchar *display_name) _gdk_x11_screen_setup (display_x11->screens[i]); g_signal_emit_by_name (display, "opened"); - g_signal_emit_by_name (gdk_display_manager_get (), "display-opened", display); return display; } diff --git a/gdk/x11/gdkdisplaymanager-x11.c b/gdk/x11/gdkdisplaymanager-x11.c index 46254a23aa..544036f1fe 100644 --- a/gdk/x11/gdkdisplaymanager-x11.c +++ b/gdk/x11/gdkdisplaymanager-x11.c @@ -51,8 +51,13 @@ gdk_x11_display_manager_open_display (GdkDisplayManager *manager, GdkDisplay *display; display = _gdk_x11_display_open (name); - if (manager_x11->default_display == NULL && display != NULL) - gdk_display_manager_set_default_display (manager, display); + if (display != NULL) + { + if (manager_x11->default_display == NULL) + gdk_display_manager_set_default_display (manager, display); + + g_signal_emit_by_name (manager, "display-opened", display); + } return display; }