[mutter] remote-desktop: Fix absolute pointer motion coordinates
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] remote-desktop: Fix absolute pointer motion coordinates
- Date: Fri, 23 Feb 2018 12:52:09 +0000 (UTC)
commit 061f69f2a23c7d265ca0e54d7e06f25a48b4ac2f
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon Jan 29 14:42:48 2018 +0800
remote-desktop: Fix absolute pointer motion coordinates
If the coordinates was for a stream not at the stage position (0, 0),
they'd be incorrect. Fix this by correctly translating the coordinates
according to the stream position.
src/backends/meta-remote-desktop-session.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c
index 6895b5c5a..9270c0e5d 100644
--- a/src/backends/meta-remote-desktop-session.c
+++ b/src/backends/meta-remote-desktop-session.c
@@ -520,6 +520,8 @@ handle_notify_pointer_motion_absolute (MetaDBusRemoteDesktopSession *skeleton,
double y)
{
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
+ MetaScreenCastStream *stream;
+ double abs_x, abs_y;
if (!check_permission (session, invocation))
{
@@ -529,9 +531,29 @@ handle_notify_pointer_motion_absolute (MetaDBusRemoteDesktopSession *skeleton,
return TRUE;
}
+ if (!session->screen_cast_session)
+ {
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+ G_DBUS_ERROR_FAILED,
+ "No screen cast active");
+ return TRUE;
+ }
+
+ stream = meta_screen_cast_session_get_stream (session->screen_cast_session,
+ stream_path);
+ if (!stream)
+ {
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+ G_DBUS_ERROR_FAILED,
+ "Unknown stream");
+ return TRUE;
+ }
+
+ meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y);
+
clutter_virtual_input_device_notify_absolute_motion (session->virtual_pointer,
CLUTTER_CURRENT_TIME,
- x, y);
+ abs_x, abs_y);
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_absolute (skeleton,
invocation);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]