mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 17:50:10 +00:00
gdk: Spread the errors
Call gdk_ensure_initialized() directly in gdk_display_open_default(), gdk_display_open(), gdk_x11_display_open() and gdk_display_get_default(), so we get the right function name in the error message. These functions are likely candidates that people might call without ensuring that GDK is initialized.
This commit is contained in:
parent
c239788a34
commit
1f20d0c9ed
@ -366,6 +366,8 @@ gdk_display_open_default (void)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
|
||||
gdk_ensure_initialized ();
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
|
||||
if (!display)
|
||||
|
@ -1198,8 +1198,9 @@ gdk_display_get_app_launch_context (GdkDisplay *display)
|
||||
GdkDisplay *
|
||||
gdk_display_open (const char *display_name)
|
||||
{
|
||||
return gdk_display_manager_open_display (gdk_display_manager_get (),
|
||||
display_name);
|
||||
gdk_ensure_initialized ();
|
||||
|
||||
return gdk_display_manager_open_display (gdk_display_manager_get (), display_name);
|
||||
}
|
||||
|
||||
gulong
|
||||
|
@ -332,6 +332,8 @@ gdk_display_manager_get_default_display (GdkDisplayManager *manager)
|
||||
GdkDisplay *
|
||||
gdk_display_get_default (void)
|
||||
{
|
||||
gdk_ensure_initialized ();
|
||||
|
||||
return gdk_display_manager_get_default_display (gdk_display_manager_get ());
|
||||
}
|
||||
|
||||
|
@ -1432,6 +1432,8 @@ gdk_x11_display_open (const char *display_name)
|
||||
gboolean rgba;
|
||||
gboolean composited;
|
||||
|
||||
gdk_ensure_initialized ();
|
||||
|
||||
XInitThreads ();
|
||||
|
||||
xdisplay = XOpenDisplay (display_name);
|
||||
|
Loading…
Reference in New Issue
Block a user