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 <otte@redhat.com>
This commit is contained in:
Cosimo Cecchi 2012-10-08 18:44:09 -04:00
parent 7cf19c8e4a
commit e09cf6978e
2 changed files with 7 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
}