xserver: Branch 'master' - 2 commits

Peter Hutterer whot at kemper.freedesktop.org
Mon Jun 12 01:47:05 UTC 2017


 hw/xwayland/xwayland-input.c |   28 ++++++++++++++++++++++++++--
 hw/xwayland/xwayland.h       |    2 ++
 2 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 7c7a540f1e1d6b5466e1c9aa28476a2d7273d5ed
Author: Jason Gerecke <killertofu at gmail.com>
Date:   Fri Jun 9 16:02:07 2017 -0700

    xwayland: Implement tablet_tool_wheel for scrolling
    
    The 'tablet_tool_wheel' function for tablet scrolling was added back in
    8a1defcc634 but left unimplemented. This commit fills in the necessary
    details, using the "clicks" count as the number of discrete scroll up/down
    events to send.
    
    Signed-off-by: Jason Gerecke <jason.gerecke at wacom.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 0e5f84f54..c5bb38184 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1560,6 +1560,13 @@ static void
 tablet_tool_wheel(void *data, struct zwp_tablet_tool_v2 *tool,
                   wl_fixed_t degrees, int32_t clicks)
 {
+    struct xwl_tablet_tool *xwl_tablet_tool = data;
+    struct xwl_seat *xwl_seat = xwl_tablet_tool->seat;
+
+    if (!xwl_seat->focus_window)
+        return;
+
+    xwl_tablet_tool->wheel_clicks = clicks;
 }
 
 static void
@@ -1671,6 +1678,23 @@ tablet_tool_frame(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t time)
     }
 
     xwl_tablet_tool->buttons_prev = xwl_tablet_tool->buttons_now;
+
+    while (xwl_tablet_tool->wheel_clicks) {
+            if (xwl_tablet_tool->wheel_clicks < 0) {
+                button = 4;
+                xwl_tablet_tool->wheel_clicks++;
+            }
+            else {
+                button = 5;
+                xwl_tablet_tool->wheel_clicks--;
+            }
+
+            QueuePointerEvents(xwl_tablet_tool->xdevice,
+                               ButtonPress, button, 0, &mask);
+            QueuePointerEvents(xwl_tablet_tool->xdevice,
+                               ButtonRelease, button, 0, &mask);
+
+    }
 }
 
 static const struct zwp_tablet_tool_v2_listener tablet_tool_listener = {
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index a05e0862c..066877099 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -214,6 +214,8 @@ struct xwl_tablet_tool {
     uint32_t buttons_now,
              buttons_prev;
 
+    int32_t wheel_clicks;
+
     struct xwl_cursor cursor;
 };
 
commit fbc9814975fe82be25becf1a55d4f8d34298a956
Author: Jason Gerecke <killertofu at gmail.com>
Date:   Fri Jun 9 16:02:06 2017 -0700

    xwayland: Correct off-by-one error in tablet button numbering
    
    The 'tablet_tool_frame' function treats the button masks as though they
    are zero-indexed, but 'tablet_tool_button_state' treats them as one-
    indexed. The result is that an e.g. middle click event recieved from
    Wayland will be sent from the X server as a right-click instead.
    
    Fixes: 773b04748d0 ("xwayland: handle button events after motion events")
    Signed-off-by: Jason Gerecke <jason.gerecke at wacom.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 02fdf6eef..0e5f84f54 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1620,9 +1620,9 @@ tablet_tool_button_state(void *data, struct zwp_tablet_tool_v2 *tool,
     BUG_RETURN(xbtn >= 8 * sizeof(*mask));
 
     if (state)
-        SetBit(mask, xbtn);
+        SetBit(mask, xbtn - 1);
     else
-        ClearBit(mask, xbtn);
+        ClearBit(mask, xbtn - 1);
 
     xwl_seat->xwl_screen->serial = serial;
 }


More information about the xorg-commit mailing list