Implemented horizontal mouse wheel for wayland.
authorArmin Novak <armin.novak@thincast.com>
Tue, 18 Dec 2018 12:30:13 +0000 (13:30 +0100)
committerArmin Novak <armin.novak@thincast.com>
Tue, 18 Dec 2018 12:49:13 +0000 (13:49 +0100)
client/Wayland/wlf_input.c

index cc94745..8bb8c3a 100644 (file)
@@ -97,7 +97,7 @@ BOOL wlf_handle_pointer_buttons(freerdp* instance, UwacPointerButtonEvent* ev)
 BOOL wlf_handle_pointer_axis(freerdp* instance, UwacPointerAxisEvent* ev)
 {
        rdpInput* input;
-       UINT16 flags;
+       UINT16 flags = 0;
        int direction;
 
        if (!instance || !ev || !instance->input)
@@ -106,16 +106,26 @@ BOOL wlf_handle_pointer_axis(freerdp* instance, UwacPointerAxisEvent* ev)
        input = instance->input;
        flags = PTR_FLAGS_WHEEL;
 
-       if (ev->axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
+       switch (ev->axis)
        {
-               direction = wl_fixed_to_int(ev->value);
+               case WL_POINTER_AXIS_VERTICAL_SCROLL:
+                       flags |= PTR_FLAGS_WHEEL;
+                       break;
+
+               case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
+                       flags |= PTR_FLAGS_HWHEEL;
+                       break;
 
-               if (direction < 0)
-                       flags |= 0x0078;
-               else
-                       flags |= PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
+               default:
+                       return FALSE;
        }
 
+       direction = wl_fixed_to_int(ev->value);
+       flags |= 0x0078; /* TODO: Calculate the distance with the provided value size */
+
+       if (direction > 0)
+               flags |= PTR_FLAGS_WHEEL_NEGATIVE;
+
        return freerdp_input_send_mouse_event(input, flags, ev->x, ev->y);
 }
 
@@ -145,5 +155,5 @@ BOOL wlf_keyboard_enter(freerdp* instance, UwacKeyboardEnterLeaveEvent* ev)
 
        input = instance->input;
        return freerdp_input_send_focus_in_event(input, 0) &&
-                  freerdp_input_send_mouse_event(input, PTR_FLAGS_MOVE, 0, 0);
+              freerdp_input_send_mouse_event(input, PTR_FLAGS_MOVE, 0, 0);
 }