summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2018-01-29 14:40:28 +0800
committerJonas Ådahl <jadahl@gmail.com>2018-02-23 19:33:31 +0800
commitc459ad79322c1ff7407b1bff36677324d1315fdb (patch)
treeb9d6591034c9e142dc528c5f560d7c3d148b2b1b
parent5ee825c0816ca5391702ac6271bd1d30a900ddb1 (diff)
downloadmutter-c459ad79322c1ff7407b1bff36677324d1315fdb.tar.gz
remote-desktop: Add smooth scroll event support
-rw-r--r--src/backends/meta-remote-desktop-session.c42
-rw-r--r--src/org.gnome.Mutter.RemoteDesktop.xml13
2 files changed, 55 insertions, 0 deletions
diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c
index eaf6e718b..17786ea57 100644
--- a/src/backends/meta-remote-desktop-session.c
+++ b/src/backends/meta-remote-desktop-session.c
@@ -39,6 +39,11 @@
#define META_REMOTE_DESKTOP_SESSION_DBUS_PATH "/org/gnome/Mutter/RemoteDesktop/Session"
+enum _MetaRemoteDesktopNotifyAxisFlags
+{
+ META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_FINISH = 1 << 0,
+} MetaRemoteDesktopNotifyAxisFlags;
+
struct _MetaRemoteDesktopSession
{
MetaDBusRemoteDesktopSessionSkeleton parent;
@@ -376,6 +381,42 @@ handle_notify_pointer_button (MetaDBusRemoteDesktopSession *skeleton,
return TRUE;
}
+static gboolean
+handle_notify_pointer_axis (MetaDBusRemoteDesktopSession *skeleton,
+ GDBusMethodInvocation *invocation,
+ double dx,
+ double dy,
+ uint32_t flags)
+{
+ MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
+ ClutterScrollFinishFlags finish_flags = CLUTTER_SCROLL_FINISHED_NONE;
+
+ if (!check_permission (session, invocation))
+ {
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+ G_DBUS_ERROR_ACCESS_DENIED,
+ "Permission denied");
+ return TRUE;
+ }
+
+ if (flags & META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_FINISH)
+ {
+ finish_flags |= (CLUTTER_SCROLL_FINISHED_HORIZONTAL |
+ CLUTTER_SCROLL_FINISHED_VERTICAL);
+ }
+
+ clutter_virtual_input_device_notify_scroll_continuous (session->virtual_pointer,
+ CLUTTER_CURRENT_TIME,
+ dx, dy,
+ CLUTTER_SCROLL_SOURCE_FINGER,
+ finish_flags);
+
+ meta_dbus_remote_desktop_session_complete_notify_pointer_axis (skeleton,
+ invocation);
+
+ return TRUE;
+}
+
static ClutterScrollDirection
discrete_steps_to_scroll_direction (unsigned int axis,
int steps)
@@ -480,6 +521,7 @@ meta_remote_desktop_session_init_iface (MetaDBusRemoteDesktopSessionIface *iface
iface->handle_notify_keyboard_keycode = handle_notify_keyboard_keycode;
iface->handle_notify_keyboard_keysym = handle_notify_keyboard_keysym;
iface->handle_notify_pointer_button = handle_notify_pointer_button;
+ iface->handle_notify_pointer_axis = handle_notify_pointer_axis;
iface->handle_notify_pointer_axis_discrete = handle_notify_pointer_axis_discrete;
iface->handle_notify_pointer_motion_absolute = handle_notify_pointer_motion_absolute;
}
diff --git a/src/org.gnome.Mutter.RemoteDesktop.xml b/src/org.gnome.Mutter.RemoteDesktop.xml
index 4af5fe317..47f06a414 100644
--- a/src/org.gnome.Mutter.RemoteDesktop.xml
+++ b/src/org.gnome.Mutter.RemoteDesktop.xml
@@ -88,6 +88,19 @@
</method>
<!--
+ NotifyPointerAxis:
+
+ A smooth pointer axis event notification
+
+ Possible @flags:
+ 1: finish - scroll motion was finished (e.g. fingers lifted)
+ -->
+ <method name="NotifyPointerAxis">
+ <arg name="dx" type="d" direction="in" />
+ <arg name="dy" type="d" direction="in" />
+ <arg name="flags" type="u" direction="in" />
+ </method>
+ <!--
NotifyPointerAxisDiscrete:
A discrete pointer axis event notification