Add beginning of input capture API

This API aims to provide a way for users to capture input devices under
certain conditions, for example when a pointer crosses a specified
barrier.

So far only part of the API is implemented, specifially the session
management as well as zone advertisement, where a zone refers to a
region in the compositor which edges will eventually be made available
for barrier placement.

So far the remote access handle is created while the session is enable,
despite the input capturing isn't actually active yet. This will change
in the future once it can actually become active.

v2: Remove absolute/relative pointer, keep only pointer (ofourdan)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
This commit is contained in:
Jonas Ådahl
2022-03-30 17:27:51 +02:00
committed by Carlos Garnacho
parent 2305efa990
commit a8b013b006
11 changed files with 1396 additions and 0 deletions

View File

@ -59,6 +59,7 @@
#include "backends/meta-dbus-session-watcher.h"
#include "backends/meta-idle-manager.h"
#include "backends/meta-idle-monitor-private.h"
#include "backends/meta-input-capture.h"
#include "backends/meta-input-mapper-private.h"
#include "backends/meta-input-settings-private.h"
#include "backends/meta-logical-monitor.h"
@ -139,6 +140,7 @@ struct _MetaBackendPrivate
MetaScreenCast *screen_cast;
MetaRemoteDesktop *remote_desktop;
#endif
MetaInputCapture *input_capture;
#ifdef HAVE_LIBWACOM
WacomDeviceDatabase *wacom_db;
@ -207,6 +209,7 @@ meta_backend_dispose (GObject *object)
g_clear_object (&priv->remote_desktop);
g_clear_object (&priv->screen_cast);
#endif
g_clear_object (&priv->input_capture);
g_clear_object (&priv->dbus_session_watcher);
g_clear_object (&priv->remote_access_controller);
@ -580,6 +583,11 @@ meta_backend_real_post_init (MetaBackend *backend)
META_DBUS_SESSION_MANAGER (priv->remote_desktop));
#endif /* HAVE_REMOTE_DESKTOP */
priv->input_capture = meta_input_capture_new (backend);
meta_remote_access_controller_add (
priv->remote_access_controller,
META_DBUS_SESSION_MANAGER (priv->input_capture));
if (!meta_monitor_manager_is_headless (priv->monitor_manager))
init_pointer_position (backend);