summaryrefslogtreecommitdiff
path: root/src/backends/meta-remote-desktop-session.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2020-10-22 11:18:34 +0200
committerJonas Ã…dahl <jadahl@gmail.com>2020-10-23 18:48:18 +0000
commitbd4062a196b15849b80fb76a9e5217f2b992ffb5 (patch)
tree68147d2abe453bb2120748a8945dd3d84b85de1d /src/backends/meta-remote-desktop-session.c
parent7698fc4aafeef3cc62842e3f5f5787d98d20c117 (diff)
downloadmutter-bd4062a196b15849b80fb76a9e5217f2b992ffb5.tar.gz
clutter: Limit number of touch slots available to a virtual touch device
It's not worth letting these devices have an "unlimited" range of touch slots. Limiting it to 32 is more than enough to map it with real touch devices nowadays. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
Diffstat (limited to 'src/backends/meta-remote-desktop-session.c')
-rw-r--r--src/backends/meta-remote-desktop-session.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c
index 28191a1e0..27bd58b72 100644
--- a/src/backends/meta-remote-desktop-session.c
+++ b/src/backends/meta-remote-desktop-session.c
@@ -629,6 +629,14 @@ handle_notify_touch_down (MetaDBusRemoteDesktopSession *skeleton,
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
return TRUE;
+ if (slot > CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS)
+ {
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+ G_DBUS_ERROR_FAILED,
+ "Touch slot out of range");
+ return TRUE;
+ }
+
if (!session->screen_cast_session)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
@@ -676,6 +684,14 @@ handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton,
return TRUE;
+ if (slot > CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS)
+ {
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+ G_DBUS_ERROR_FAILED,
+ "Touch slot out of range");
+ return TRUE;
+ }
+
if (!session->screen_cast_session)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
@@ -709,14 +725,22 @@ handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton,
static gboolean
handle_notify_touch_up (MetaDBusRemoteDesktopSession *skeleton,
- GDBusMethodInvocation *invocation,
- unsigned int slot)
+ GDBusMethodInvocation *invocation,
+ unsigned int slot)
{
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
return TRUE;
+ if (slot > CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS)
+ {
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+ G_DBUS_ERROR_FAILED,
+ "Touch slot out of range");
+ return TRUE;
+ }
+
clutter_virtual_input_device_notify_touch_up (session->virtual_touchscreen,
CLUTTER_CURRENT_TIME,
slot);