xserver: Branch 'xwayland-1.12' - 2 commits

Kristian Høgsberg krh at kemper.freedesktop.org
Wed May 22 09:25:55 PDT 2013


 hw/xfree86/xwayland/xwayland-input.c   |   11 +++++++++--
 hw/xfree86/xwayland/xwayland-private.h |    1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 057bf63260d573787e9f14f39ac32e29b0aff830
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Wed May 22 12:25:13 2013 -0400

    xwayland: Clear scrolling fractional values after 2 seconds
    
    Left over fractional values from previous scrolling could cause a tiny
    new scroll axis amount to trigger a scroll button event.  We handle this
    by tracking the time of the previous scroll event, and if the incoming
    event is more than 2s later, we clear the fractional values.

diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c
index d986deb..c550d77 100644
--- a/hw/xfree86/xwayland/xwayland-input.c
+++ b/hw/xfree86/xwayland/xwayland-input.c
@@ -377,6 +377,12 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer,
     int i, val;
     const int divisor = 10;
 
+    if (time - xwl_seat->scroll_time > 2000) {
+	xwl_seat->vertical_scroll = 0;
+	xwl_seat->horizontal_scroll = 0;
+    }
+    xwl_seat->scroll_time = time;
+
     /* FIXME: Need to do proper smooth scrolling here! */
     switch (axis) {
     case WL_POINTER_AXIS_VERTICAL_SCROLL:
diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h
index d595bc5..e427316 100644
--- a/hw/xfree86/xwayland/xwayland-private.h
+++ b/hw/xfree86/xwayland/xwayland-private.h
@@ -102,6 +102,7 @@ struct xwl_seat {
 
     wl_fixed_t			 horizontal_scroll;
     wl_fixed_t			 vertical_scroll;
+    uint32_t			 scroll_time;
 
     size_t			 keymap_size;
     char			*keymap;
commit dbe11cc878f875a7d353fd20f7483b4ee28f0965
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Wed May 22 12:18:31 2013 -0400

    xwayland: Scale axis events as we map them to scroll button events
    
    The axis scroll events corresponds to pixel motion, while a X scroll
    button event corresponds to scrolling a number of pixels.  The exact amount
    of pixes is determined by the X client receiving the event, so there's no
    way to determine a "right" scale factor.  Dividing the incoming axis value
    by 10 seems to give a decent result.

diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c
index 4a15853..d986deb 100644
--- a/hw/xfree86/xwayland/xwayland-input.c
+++ b/hw/xfree86/xwayland/xwayland-input.c
@@ -375,11 +375,12 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer,
     struct xwl_seat *xwl_seat = data;
     int index, count;
     int i, val;
+    const int divisor = 10;
 
     /* FIXME: Need to do proper smooth scrolling here! */
     switch (axis) {
     case WL_POINTER_AXIS_VERTICAL_SCROLL:
-	xwl_seat->vertical_scroll += value;
+	xwl_seat->vertical_scroll += value / divisor;
 	val = wl_fixed_to_int(xwl_seat->vertical_scroll);
 	xwl_seat->vertical_scroll -= wl_fixed_from_int(val);
 
@@ -391,7 +392,7 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer,
             return;
 	break;
     case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
-	xwl_seat->horizontal_scroll += value;
+	xwl_seat->horizontal_scroll += value / divisor;
 	val = wl_fixed_to_int(xwl_seat->horizontal_scroll);
 	xwl_seat->horizontal_scroll -= wl_fixed_from_int(val);
 


More information about the xorg-commit mailing list