[gnome-remote-desktop] session-rdp: Use correct wheel steps for scrolling events
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] session-rdp: Use correct wheel steps for scrolling events
- Date: Tue, 12 Jan 2021 13:48:46 +0000 (UTC)
commit 3b894865bd215bef08ef30a8d41616db174de189
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Sun Dec 13 12:40:20 2020 +0100
session-rdp: Use correct wheel steps for scrolling events
Scrolling events in RDP are not just discrete scrolling events.
Instead, a wheel value (default: 120) is submitted.
For high resolution mouse wheels this value is lower (e.g. 60 for
double resolution mouse wheels).
Currently, gnome-remote-desktop assumes that all mouse wheels are the
same, i.e. produce the same wheel value.
This is however not always the case and if a user with a high
resolution mouse wheel uses g-r-d, it will be slippery.
Fix this issue by using the previously implemented NotifyPointerAxis()
function to submit custom scroll distances.
Additionally, use the value 12 as scroll step, since the current
(default) scroll step 10 only allows using double resolution mouse
wheels, but not triple or quadra resolution mouse wheels.
See also: https://devblogs.microsoft.com/oldnewthing/20130123-00/?p=5473
src/grd-session-rdp.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index 7c0e099..fc073e3 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -34,6 +34,8 @@
#include "grd-settings.h"
#include "grd-stream.h"
+#define SCROLL_STEP 12
+
typedef enum _RdpPeerFlag
{
RDP_PEER_ACTIVATED = 1 << 0,
@@ -1032,7 +1034,7 @@ rdp_input_mouse_event (rdpInput *rdp_input,
GrdSession *session = GRD_SESSION (session_rdp);
GrdButtonState button_state;
int32_t button = 0;
- int axis_step;
+ double axis_step;
if (!(rdp_peer_context->flags & RDP_PEER_ACTIVATED) ||
is_view_only (session_rdp))
@@ -1061,15 +1063,23 @@ rdp_input_mouse_event (rdpInput *rdp_input,
if (button)
grd_session_notify_pointer_button (session, button, button_state);
- axis_step = flags & PTR_FLAGS_WHEEL_NEGATIVE ? -1 : 1;
+ if (!(flags & PTR_FLAGS_WHEEL) && !(flags & PTR_FLAGS_HWHEEL))
+ return TRUE;
+
+ axis_step = -(flags & 0xFF) / 120.0;
+ if (flags & PTR_FLAGS_WHEEL_NEGATIVE)
+ axis_step = -axis_step;
+
if (flags & PTR_FLAGS_WHEEL)
- grd_session_notify_pointer_axis_discrete (session,
- GRD_POINTER_AXIS_VERTICAL,
- -axis_step);
+ {
+ grd_session_notify_pointer_axis (session, 0, axis_step * SCROLL_STEP,
+ GRD_POINTER_AXIS_FLAGS_SOURCE_WHEEL);
+ }
if (flags & PTR_FLAGS_HWHEEL)
- grd_session_notify_pointer_axis_discrete (session,
- GRD_POINTER_AXIS_HORIZONTAL,
- axis_step);
+ {
+ grd_session_notify_pointer_axis (session, -axis_step * SCROLL_STEP, 0,
+ GRD_POINTER_AXIS_FLAGS_SOURCE_WHEEL);
+ }
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]