[PATCH xserver v5] xwayland-input: Track wayland protocol changes.

Kristian Høgsberg hoegsberg at gmail.com
Mon May 14 06:41:23 PDT 2012


On Sun, May 13, 2012 at 10:43:46AM -0600, Scott Moreau wrote:
> Use wl_fixed_t types in the motion and enter handlers
> so xwayland clients get the correct x/y values. Without
> this, all pointer input is broken. Thanks to Martin Minarik
> for bisecting to track down the initial problem.
> ---
> 
> Fixed up the rest of the functions as well.
> 
>  hw/xfree86/xwayland/xwayland-input.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c
> index 7cc7a1f..873bd3d 100644
> --- a/hw/xfree86/xwayland/xwayland-input.c
> +++ b/hw/xfree86/xwayland/xwayland-input.c
> @@ -268,11 +268,13 @@ device_added(struct xwl_input_device *xwl_input_device, const char *driver)
>  
>  static void
>  input_device_handle_motion(void *data, struct wl_input_device *input_device,
> -			   uint32_t time, int32_t sx, int32_t sy)
> +			   uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
>  {
>      struct xwl_input_device *xwl_input_device = data;
>      struct xwl_screen *xwl_screen = xwl_input_device->xwl_screen;
>      int32_t dx, dy, lx, ly;
> +    float sx = wl_fixed_to_double(sx_w);
> +    float sy = wl_fixed_to_double(sy_w);

Just use wl_fixed_to_int here, the xserver doesn't understand float
coordinates.

Kristian

>      if (!xwl_input_device->focus_window)
>  	return ;
> @@ -345,7 +347,7 @@ static void
>  input_device_handle_pointer_enter(void *data,
>  				  struct wl_input_device *input_device,
>  				  uint32_t serial, struct wl_surface *surface,
> -				  int32_t sx, int32_t sy)
> +				  wl_fixed_t sx_w, wl_fixed_t sy_w)
>  
>  {
>      struct xwl_input_device *xwl_input_device = data;
> @@ -428,7 +430,7 @@ input_device_handle_touch_down(void *data,
>                                 struct wl_input_device *wl_input_device,
>                                 uint32_t serial, uint32_t time,
>  			       struct wl_surface *surface,
> -                               int32_t id, int32_t x, int32_t y)
> +                               int32_t id, wl_fixed_t x, wl_fixed_t y)
>  {
>  }
>  
> @@ -442,8 +444,8 @@ input_device_handle_touch_up(void *data,
>  static void
>  input_device_handle_touch_motion(void *data,
>                                   struct wl_input_device *wl_input_device,
> -                                 uint32_t time,
> -                                 int32_t id, int32_t x, int32_t y)
> +                                 uint32_t time, int32_t id,
> +                                 wl_fixed_t x, wl_fixed_t y)
>  {
>  }
>  
> -- 
> 1.7.7.6
> 
> _______________________________________________
> 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