diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2018-01-29 14:42:48 +0800 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2018-02-23 19:33:31 +0800 |
commit | 061f69f2a23c7d265ca0e54d7e06f25a48b4ac2f (patch) | |
tree | a05b8f2800f9d87b0003a6524bfafa54a7c2ec2e | |
parent | 4d5e1f690dcf42997f09c1638ea96ae7a603baef (diff) | |
download | mutter-061f69f2a23c7d265ca0e54d7e06f25a48b4ac2f.tar.gz |
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.
-rw-r--r-- | src/backends/meta-remote-desktop-session.c | 24 |
1 files changed, 23 insertions, 1 deletions
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); |