summaryrefslogtreecommitdiff
path: root/src/compositor-rdp.c
diff options
context:
space:
mode:
authorHardening <rdp.effort@gmail.com>2013-06-03 22:55:47 +0200
committerKristian Høgsberg <krh@bitplanet.net>2013-06-04 00:10:19 -0400
commitb60e46f6ba95b0fd8915e460080a9c9c0f68e49d (patch)
tree818d3d4757231a6b4d62ed725685a7222d85e0f3 /src/compositor-rdp.c
parent3b64d6236c4100bf0cb9db0070bdc6175b919296 (diff)
downloadweston-b60e46f6ba95b0fd8915e460080a9c9c0f68e49d.tar.gz
Handle mouse wheel
The RDP compositor was ignoring mouse wheel events, this patch adds support for it.
Diffstat (limited to 'src/compositor-rdp.c')
-rw-r--r--src/compositor-rdp.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index e855ba61..b81d7895 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -42,6 +42,7 @@
#include "pixman-renderer.h"
#define MAX_FREERDP_FDS 32
+#define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int(10)
struct rdp_compositor_config {
int width;
@@ -758,7 +759,7 @@ xf_peer_activate(freerdp_peer *client)
static void
xf_mouseEvent(rdpInput *input, UINT16 flags, UINT16 x, UINT16 y) {
- wl_fixed_t wl_x, wl_y;
+ wl_fixed_t wl_x, wl_y, axis;
RdpPeerContext *peerContext = (RdpPeerContext *)input->context;
struct rdp_output *output;
uint32_t button = 0;
@@ -785,6 +786,22 @@ xf_mouseEvent(rdpInput *input, UINT16 flags, UINT16 x, UINT16 y) {
(flags & PTR_FLAGS_DOWN) ? WL_POINTER_BUTTON_STATE_PRESSED : WL_POINTER_BUTTON_STATE_RELEASED
);
}
+
+ if (flags & PTR_FLAGS_WHEEL) {
+ /* DEFAULT_AXIS_STEP_DISTANCE is stolen from compositor-x11.c
+ * The RDP specs says the lower bits of flags contains the "the number of rotation
+ * units the mouse wheel was rotated".
+ *
+ * http://blogs.msdn.com/b/oldnewthing/archive/2013/01/23/10387366.aspx explains the 120 value
+ */
+ axis = (DEFAULT_AXIS_STEP_DISTANCE * (flags & 0xff)) / 120;
+ if (flags & PTR_FLAGS_WHEEL_NEGATIVE)
+ axis = -axis;
+
+ notify_axis(&peerContext->item.seat, weston_compositor_get_time(),
+ WL_POINTER_AXIS_VERTICAL_SCROLL,
+ axis);
+ }
}
static void