remote-desktop: Support multiple axis steps at once

Just call the corresponding clutter API once for each step.
This commit is contained in:
Jonas Ådahl 2018-01-29 14:28:07 +08:00
parent 9ed236bd67
commit 1ead513b66

View File

@ -26,6 +26,7 @@
#include <linux/input.h> #include <linux/input.h>
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>
#include <stdlib.h>
#include "backends/meta-dbus-session-watcher.h" #include "backends/meta-dbus-session-watcher.h"
#include "backends/meta-screen-cast-session.h" #include "backends/meta-screen-cast-session.h"
@ -367,6 +368,7 @@ handle_notify_pointer_axis_discrete (MetaDBusRemoteDesktopSession *skeleton,
{ {
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton); MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
ClutterScrollDirection direction; ClutterScrollDirection direction;
int step_count;
if (!check_permission (session, invocation)) if (!check_permission (session, invocation))
{ {
@ -392,15 +394,14 @@ handle_notify_pointer_axis_discrete (MetaDBusRemoteDesktopSession *skeleton,
return TRUE; return TRUE;
} }
if (steps != -1 && steps != 1)
g_warning ("Multiple steps at at once not yet implemented, treating as one.");
/* /*
* We don't have the actual scroll source, but only know they should be * We don't have the actual scroll source, but only know they should be
* considered as discrete steps. The device that produces such scroll events * considered as discrete steps. The device that produces such scroll events
* is the scroll wheel, so pretend that is the scroll source. * is the scroll wheel, so pretend that is the scroll source.
*/ */
direction = discrete_steps_to_scroll_direction (axis, steps); direction = discrete_steps_to_scroll_direction (axis, steps);
for (step_count = 0; step_count < abs (steps); step_count++)
clutter_virtual_input_device_notify_discrete_scroll (session->virtual_pointer, clutter_virtual_input_device_notify_discrete_scroll (session->virtual_pointer,
CLUTTER_CURRENT_TIME, CLUTTER_CURRENT_TIME,
direction, direction,