diff options
-rw-r--r-- | docs/reference/gdk/gdk3-sections.txt | 1 | ||||
-rw-r--r-- | gdk/gdk.symbols | 1 | ||||
-rw-r--r-- | gdk/gdkdisplaymanager.c | 29 | ||||
-rw-r--r-- | gdk/gdkdisplaymanager.h | 2 |
4 files changed, 27 insertions, 6 deletions
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt index e409bbc0eb..34069e47b3 100644 --- a/docs/reference/gdk/gdk3-sections.txt +++ b/docs/reference/gdk/gdk3-sections.txt @@ -171,6 +171,7 @@ GdkDisplayClass <TITLE>GdkDisplayManager</TITLE> GdkDisplayManager gdk_display_manager_get +gdk_display_manager_peek gdk_display_manager_get_default_display gdk_display_manager_set_default_display gdk_display_manager_list_displays diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index 6e30e9a203..9eb67ccc29 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -101,6 +101,7 @@ gdk_display_is_closed gdk_display_keyboard_ungrab gdk_display_list_devices gdk_display_manager_get +gdk_display_manager_peek gdk_display_manager_get_default_display gdk_display_manager_get_type gdk_display_manager_list_displays diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c index b15aeb0afb..2d2e684256 100644 --- a/gdk/gdkdisplaymanager.c +++ b/gdk/gdkdisplaymanager.c @@ -289,6 +289,29 @@ static GdkDisplayManager *manager = NULL; GdkDisplayManager* gdk_display_manager_get (void) { + gdk_display_manager_peek (); + + if (manager == NULL) + g_error ("No GDK backend found (%s)", allowed_backends); + + return manager; +} + +/** + * gdk_display_manager_peek: + * + * Gets the singleton #GdkDisplayManager object. If GDK could + * not be initialized, %NULL is returned. + * + * Returns: (transfer none): The global #GdkDisplayManager singleton, + * or %NULL if GDK could not be initialized. gdk_parse_args(), + * gdk_init(), or gdk_init_check() must have been called first + * + * Since: 3.10 + */ +GdkDisplayManager * +gdk_display_manager_peek (void) +{ if (manager == NULL) { const gchar *backend_list; @@ -369,13 +392,7 @@ gdk_display_manager_get (void) } #endif } - g_strfreev (backends); - - if (manager == NULL) - g_error ("No GDK backend found (%s)", allowed_backends); - - GDK_NOTE (MISC, if (manager) g_message ("Using %s", G_OBJECT_TYPE_NAME (manager))); } return manager; diff --git a/gdk/gdkdisplaymanager.h b/gdk/gdkdisplaymanager.h index 419b3f5739..4392af04f4 100644 --- a/gdk/gdkdisplaymanager.h +++ b/gdk/gdkdisplaymanager.h @@ -43,6 +43,8 @@ G_BEGIN_DECLS GType gdk_display_manager_get_type (void) G_GNUC_CONST; GdkDisplayManager *gdk_display_manager_get (void); +GDK_AVAILABLE_IN_3_10 +GdkDisplayManager *gdk_display_manager_peek (void); GdkDisplay * gdk_display_manager_get_default_display (GdkDisplayManager *manager); void gdk_display_manager_set_default_display (GdkDisplayManager *manager, GdkDisplay *display); |