mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
backends: Turn MetaInputSettings into a singleton
We will need to fetch information from it at certain places. The MetaBackend still takes care of freeing it though.
This commit is contained in:
parent
f81e0f8922
commit
f51972c2aa
@ -316,7 +316,7 @@ meta_backend_real_post_init (MetaBackend *backend)
|
|||||||
g_slist_free (devices);
|
g_slist_free (devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->input_settings = meta_input_settings_create ();
|
priv->input_settings = meta_input_settings_get ();
|
||||||
|
|
||||||
center_pointer (backend);
|
center_pointer (backend);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ struct _MetaInputSettingsClass
|
|||||||
|
|
||||||
GType meta_input_settings_get_type (void) G_GNUC_CONST;
|
GType meta_input_settings_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
MetaInputSettings * meta_input_settings_create (void);
|
MetaInputSettings * meta_input_settings_get (void);
|
||||||
|
|
||||||
GDesktopTabletMapping meta_input_settings_get_tablet_mapping (MetaInputSettings *settings,
|
GDesktopTabletMapping meta_input_settings_get_tablet_mapping (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device);
|
ClutterInputDevice *device);
|
||||||
|
@ -1043,7 +1043,7 @@ meta_input_settings_init (MetaInputSettings *settings)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaInputSettings *
|
static MetaInputSettings *
|
||||||
meta_input_settings_create (void)
|
meta_input_settings_create (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_NATIVE_BACKEND
|
#ifdef HAVE_NATIVE_BACKEND
|
||||||
@ -1060,6 +1060,20 @@ meta_input_settings_create (void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaInputSettings *
|
||||||
|
meta_input_settings_get (void)
|
||||||
|
{
|
||||||
|
static MetaInputSettings *input_settings = NULL;
|
||||||
|
|
||||||
|
if (g_once_init_enter (&input_settings))
|
||||||
|
{
|
||||||
|
MetaInputSettings *settings = meta_input_settings_create ();
|
||||||
|
g_once_init_leave (&input_settings, settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
return input_settings;
|
||||||
|
}
|
||||||
|
|
||||||
GDesktopTabletMapping
|
GDesktopTabletMapping
|
||||||
meta_input_settings_get_tablet_mapping (MetaInputSettings *settings,
|
meta_input_settings_get_tablet_mapping (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device)
|
ClutterInputDevice *device)
|
||||||
|
Loading…
Reference in New Issue
Block a user