Fix some issues with initial setup of GdkX11DisplayManager

We need to defer setting the default display until the
GdkDisplay is fully initialized. Also, short-circuit some
encoding conversions when creating windows, to avoid an
implicit dependency on the display being in the list of
displays yet.
This commit is contained in:
Matthias Clasen 2010-12-27 01:02:52 -05:00
parent 59ea137fa0
commit 48b47971b5
2 changed files with 9 additions and 5 deletions

View File

@ -49,7 +49,14 @@ static GdkDisplay *
gdk_x11_display_manager_open_display (GdkDisplayManager *manager, gdk_x11_display_manager_open_display (GdkDisplayManager *manager,
const gchar *name) const gchar *name)
{ {
return _gdk_x11_display_open (name); GdkX11DisplayManager *manager_x11 = GDK_X11_DISPLAY_MANAGER (manager);
GdkDisplay *display;
display = _gdk_x11_display_open (name);
if (manager_x11->default_display == NULL)
gdk_display_manager_set_default_display (manager, display);
return display;
} }
static GSList * static GSList *
@ -111,9 +118,6 @@ _gdk_x11_display_manager_add_display (GdkDisplayManager *manager,
{ {
GdkX11DisplayManager *manager_x11 = GDK_X11_DISPLAY_MANAGER (manager); GdkX11DisplayManager *manager_x11 = GDK_X11_DISPLAY_MANAGER (manager);
if (manager_x11->displays == NULL)
gdk_display_manager_set_default_display (manager, display);
manager_x11->displays = g_slist_prepend (manager_x11->displays, display); manager_x11->displays = g_slist_prepend (manager_x11->displays, display);
} }

View File

@ -2244,7 +2244,7 @@ set_text_property (GdkDisplay *display,
if (utf8_is_latin1 (utf8_str)) if (utf8_is_latin1 (utf8_str))
{ {
prop_type = XA_STRING; prop_type = XA_STRING;
prop_text = gdk_utf8_to_string_target (utf8_str); prop_text = _gdk_x11_display_utf8_to_string_target (display, utf8_str);
prop_length = prop_text ? strlen (prop_text) : 0; prop_length = prop_text ? strlen (prop_text) : 0;
prop_format = 8; prop_format = 8;
is_compound_text = FALSE; is_compound_text = FALSE;