backend: Set up and use ownership chains
This means objects have an owner, where the chain eventually always leads to a MetaContext. This also means that all objects can find their way to other object instances via the chain, instead of scattered global singletons. This is a squashed commit originally containing the following: cursor-tracker: Don't get backend from singleton idle-manager: Don't get backend from singleton input-device: Pass pointer to backend during construction The backend is needed during construction to get the wacom database. input-mapper: Pass backend when constructing monitor: Don't get backend from singleton monitor-manager: Get backend directly from monitor manager remote: Get backend from manager class For the remote desktop and screen cast implementations, replace getting the backend from singletons with getting it via the manager classes. launcher: Pass backend during construction device-pool: Pass backend during construction Instead of passing the (maybe null) launcher, pass the backend, and get the launcher from there. That way we always have a way to some known context from the device pool. drm-buffer/gbm: Get backend via device pool cursor-renderer: Get backend directly from renderer input-device: Get backend getter input-settings: Add backend construct property and getter input-settings/x11: Don't get backend from singleton renderer: Get backend from renderer itself seat-impl: Add backend getter seat/native: Get backend from instance struct stage-impl: Get backend from stage impl itself x11/xkb-a11y: Don't get backend from singleton backend/x11/nested: Don't get Wayland compositor from singleton crtc: Add backend property Adding a link to the GPU isn't enough; the virtual CRTCs of virtual monitors doesn't have one. cursor-tracker: Don't get display from singleton remote: Don't get display from singleton seat: Don't get display from singleton backend/x11: Don't get display from singleton Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
This commit is contained in:
@ -39,6 +39,17 @@
|
||||
#include "core/display-private.h"
|
||||
#include "meta/util.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_BACKEND,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec *props[N_PROPS] = { 0 };
|
||||
|
||||
static GQuark quark_tool_settings = 0;
|
||||
|
||||
typedef struct _MetaInputSettingsPrivate MetaInputSettingsPrivate;
|
||||
@ -66,6 +77,8 @@ struct _DeviceMappingInfo
|
||||
|
||||
struct _MetaInputSettingsPrivate
|
||||
{
|
||||
MetaBackend *backend;
|
||||
|
||||
ClutterSeat *seat;
|
||||
gulong monitors_changed_id;
|
||||
|
||||
@ -1711,6 +1724,26 @@ meta_input_settings_constructed (GObject *object)
|
||||
load_keyboard_a11y_settings (input_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaInputSettings *settings = META_INPUT_SETTINGS (object);
|
||||
MetaInputSettingsPrivate *priv =
|
||||
meta_input_settings_get_instance_private (settings);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
priv->backend = g_value_get_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_class_init (MetaInputSettingsClass *klass)
|
||||
{
|
||||
@ -1718,6 +1751,17 @@ meta_input_settings_class_init (MetaInputSettingsClass *klass)
|
||||
|
||||
object_class->dispose = meta_input_settings_dispose;
|
||||
object_class->constructed = meta_input_settings_constructed;
|
||||
object_class->set_property = meta_input_settings_set_property;
|
||||
|
||||
props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
"backend",
|
||||
"MetaBackend",
|
||||
META_TYPE_BACKEND,
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_properties (object_class, N_PROPS, props);
|
||||
|
||||
quark_tool_settings =
|
||||
g_quark_from_static_string ("meta-input-settings-tool-settings");
|
||||
@ -1864,3 +1908,12 @@ meta_input_settings_get_kbd_a11y_settings (MetaInputSettings *input_settings,
|
||||
|
||||
*a11y_settings = priv->kbd_a11y_settings;
|
||||
}
|
||||
|
||||
MetaBackend *
|
||||
meta_input_settings_get_backend (MetaInputSettings *settings)
|
||||
{
|
||||
MetaInputSettingsPrivate *priv =
|
||||
meta_input_settings_get_instance_private (settings);
|
||||
|
||||
return priv->backend;
|
||||
}
|
||||
|
Reference in New Issue
Block a user