[PATCH xserver v2] xwayland: Update axis notifications to follow protocol

Kristian Høgsberg hoegsberg at gmail.com
Mon Feb 25 10:28:38 PST 2013


On Mon, Feb 25, 2013 at 11:14:37AM -0700, Scott Moreau wrote:
> This fixes scrolling in xwayland. It also adds support for horizontal scrolling.
> ---
>  hw/xfree86/xwayland/xwayland-input.c |   26 ++++++++++++++++++++------
>  1 file changed, 20 insertions(+), 6 deletions(-)

Nice, that works here, committed.

Kristian

> diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c
> index 39a487d..8f52c3e 100644
> --- a/hw/xfree86/xwayland/xwayland-input.c
> +++ b/hw/xfree86/xwayland/xwayland-input.c
> @@ -381,12 +381,26 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer,
>      int val = wl_fixed_to_int(value);
>  
>      /* FIXME: Need to do proper smooth scrolling here! */
> -    if (val == 1)
> -        index = 4;
> -    else if (val == -1)
> -        index = 5;
> -    else
> -        return;
> +    switch (axis) {
> +    case WL_POINTER_AXIS_VERTICAL_SCROLL:
> +	if (val <= -1)
> +            index = 4;
> +	else if (val >= 1)
> +            index = 5;
> +	else
> +            return;
> +	break;
> +    case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
> +	if (val <= -1)
> +            index = 6;
> +	else if (val >= 1)
> +            index = 7;
> +	else
> +            return;
> +	break;
> +    default:
> +	return;
> +    }
>  
>      xf86PostButtonEvent(xwl_seat->pointer, TRUE, index, 1, 0, 0);
>      xf86PostButtonEvent(xwl_seat->pointer, TRUE, index, 0, 0, 0);
> -- 
> 1.7.10.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list