mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
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
This commit is contained in:
parent
7698fc4aaf
commit
bd4062a196
@ -151,6 +151,10 @@ clutter_virtual_input_device_notify_touch_down (ClutterVirtualInputDevice *virtu
|
|||||||
ClutterVirtualInputDeviceClass *klass =
|
ClutterVirtualInputDeviceClass *klass =
|
||||||
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
|
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_VIRTUAL_INPUT_DEVICE (virtual_device));
|
||||||
|
g_return_if_fail (slot >= 0 &&
|
||||||
|
slot < CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS);
|
||||||
|
|
||||||
klass->notify_touch_down (virtual_device, time_us,
|
klass->notify_touch_down (virtual_device, time_us,
|
||||||
slot, x, y);
|
slot, x, y);
|
||||||
}
|
}
|
||||||
@ -165,6 +169,10 @@ clutter_virtual_input_device_notify_touch_motion (ClutterVirtualInputDevice *vir
|
|||||||
ClutterVirtualInputDeviceClass *klass =
|
ClutterVirtualInputDeviceClass *klass =
|
||||||
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
|
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_VIRTUAL_INPUT_DEVICE (virtual_device));
|
||||||
|
g_return_if_fail (slot >= 0 &&
|
||||||
|
slot < CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS);
|
||||||
|
|
||||||
klass->notify_touch_motion (virtual_device, time_us,
|
klass->notify_touch_motion (virtual_device, time_us,
|
||||||
slot, x, y);
|
slot, x, y);
|
||||||
}
|
}
|
||||||
@ -177,6 +185,10 @@ clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *virtual
|
|||||||
ClutterVirtualInputDeviceClass *klass =
|
ClutterVirtualInputDeviceClass *klass =
|
||||||
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
|
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_VIRTUAL_INPUT_DEVICE (virtual_device));
|
||||||
|
g_return_if_fail (slot >= 0 &&
|
||||||
|
slot < CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS);
|
||||||
|
|
||||||
klass->notify_touch_up (virtual_device, time_us,
|
klass->notify_touch_up (virtual_device, time_us,
|
||||||
slot);
|
slot);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE (clutter_virtual_input_device_get_type ())
|
#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE (clutter_virtual_input_device_get_type ())
|
||||||
|
|
||||||
|
#define CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS 32u
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
G_DECLARE_DERIVABLE_TYPE (ClutterVirtualInputDevice,
|
G_DECLARE_DERIVABLE_TYPE (ClutterVirtualInputDevice,
|
||||||
clutter_virtual_input_device,
|
clutter_virtual_input_device,
|
||||||
|
@ -629,6 +629,14 @@ handle_notify_touch_down (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
||||||
return TRUE;
|
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)
|
if (!session->screen_cast_session)
|
||||||
{
|
{
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
@ -676,6 +684,14 @@ handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
return TRUE;
|
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)
|
if (!session->screen_cast_session)
|
||||||
{
|
{
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
@ -709,14 +725,22 @@ handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
handle_notify_touch_up (MetaDBusRemoteDesktopSession *skeleton,
|
handle_notify_touch_up (MetaDBusRemoteDesktopSession *skeleton,
|
||||||
GDBusMethodInvocation *invocation,
|
GDBusMethodInvocation *invocation,
|
||||||
unsigned int slot)
|
unsigned int slot)
|
||||||
{
|
{
|
||||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
||||||
return TRUE;
|
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_virtual_input_device_notify_touch_up (session->virtual_touchscreen,
|
||||||
CLUTTER_CURRENT_TIME,
|
CLUTTER_CURRENT_TIME,
|
||||||
slot);
|
slot);
|
||||||
|
Loading…
Reference in New Issue
Block a user