mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 05:20:17 +00:00
gdkkeys: Avoid instantiating a display manager if none exists
For introspection scanning which ends up calling class_init() which in turn calls into the keybindings code, we can just use the fallback keyval conversion code. https://bugzilla.gnome.org/show_bug.cgi?id=696457
This commit is contained in:
parent
564b4e667a
commit
d6b4e84957
@ -267,6 +267,8 @@ gdk_set_allowed_backends (const gchar *backends)
|
||||
allowed_backends = g_strdup (backends);
|
||||
}
|
||||
|
||||
static GdkDisplayManager *manager = NULL;
|
||||
|
||||
/**
|
||||
* gdk_display_manager_get:
|
||||
*
|
||||
@ -287,8 +289,6 @@ gdk_set_allowed_backends (const gchar *backends)
|
||||
GdkDisplayManager*
|
||||
gdk_display_manager_get (void)
|
||||
{
|
||||
static GdkDisplayManager *manager = NULL;
|
||||
|
||||
if (manager == NULL)
|
||||
{
|
||||
const gchar *backend_list;
|
||||
@ -381,6 +381,15 @@ gdk_display_manager_get (void)
|
||||
return manager;
|
||||
}
|
||||
|
||||
/* Used for cases where we don't actually want to instantiate a
|
||||
* display manager if none exists. Internal only.
|
||||
*/
|
||||
GdkDisplayManager *
|
||||
_gdk_display_manager_get_nocreate (void)
|
||||
{
|
||||
return manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_manager_get_default_display:
|
||||
* @manager: a #GdkDisplayManager
|
||||
|
@ -64,6 +64,9 @@ struct _GdkDisplayManagerClass
|
||||
GdkDisplay *display);
|
||||
};
|
||||
|
||||
GdkDisplayManager *
|
||||
_gdk_display_manager_get_nocreate (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -203,9 +203,12 @@ gdk_keyval_convert_case (guint symbol,
|
||||
guint *lower,
|
||||
guint *upper)
|
||||
{
|
||||
GdkDisplayManager *manager = gdk_display_manager_get ();
|
||||
GdkDisplayManager *manager = _gdk_display_manager_get_nocreate ();
|
||||
|
||||
GDK_DISPLAY_MANAGER_GET_CLASS (manager)->keyval_convert_case (manager, symbol, lower, upper);
|
||||
if (manager)
|
||||
GDK_DISPLAY_MANAGER_GET_CLASS (manager)->keyval_convert_case (manager, symbol, lower, upper);
|
||||
else
|
||||
_gdk_display_manager_real_keyval_convert_case (NULL, symbol, lower, upper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user