summaryrefslogtreecommitdiff
path: root/src/backends/native/meta-launcher.c
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2022-05-27 19:35:01 +0200
committerMarge Bot <marge-bot@gnome.org>2022-12-17 13:52:51 +0000
commitc390f70edca40de4d6e898a61a1c0427dbbd248f (patch)
treed9ca423c1675094aedee949405964da901ae5970 /src/backends/native/meta-launcher.c
parentc45ab10c0e9b5414fb0bbeec1560f7e6f04ee429 (diff)
downloadmutter-c390f70edca40de4d6e898a61a1c0427dbbd248f.tar.gz
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>
Diffstat (limited to 'src/backends/native/meta-launcher.c')
-rw-r--r--src/backends/native/meta-launcher.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
index e968baeed..da202ed31 100644
--- a/src/backends/native/meta-launcher.c
+++ b/src/backends/native/meta-launcher.c
@@ -46,6 +46,8 @@
struct _MetaLauncher
{
+ MetaBackend *backend;
+
MetaDbusLogin1Session *session_proxy;
MetaDbusLogin1Seat *seat_proxy;
char *seat_id;
@@ -309,7 +311,7 @@ get_seat_proxy (gchar *seat_id,
static void
sync_active (MetaLauncher *self)
{
- MetaBackend *backend = meta_get_backend ();
+ MetaBackend *backend = self->backend;
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
MetaDbusLogin1Session *session_proxy = self->session_proxy;
gboolean active;
@@ -371,9 +373,10 @@ meta_launcher_get_session_proxy (MetaLauncher *launcher)
}
MetaLauncher *
-meta_launcher_new (const char *fallback_session_id,
- const char *fallback_seat_id,
- GError **error)
+meta_launcher_new (MetaBackend *backend,
+ const char *fallback_session_id,
+ const char *fallback_seat_id,
+ GError **error)
{
MetaLauncher *self = NULL;
g_autoptr (MetaDbusLogin1Session) session_proxy = NULL;
@@ -420,6 +423,7 @@ meta_launcher_new (const char *fallback_session_id,
goto fail;
self = g_new0 (MetaLauncher, 1);
+ self->backend = backend;
self->session_proxy = g_object_ref (session_proxy);
self->seat_proxy = g_object_ref (seat_proxy);
self->seat_id = g_steal_pointer (&seat_id);
@@ -455,3 +459,9 @@ meta_launcher_activate_vt (MetaLauncher *launcher,
return meta_dbus_login1_seat_call_switch_to_sync (launcher->seat_proxy, vt,
NULL, error);
}
+
+MetaBackend *
+meta_launcher_get_backend (MetaLauncher *launcher)
+{
+ return launcher->backend;
+}