[PATCH 5/6] xwayland: follow wayland change to serial numbers

Kristian Hoegsberg hoegsberg at gmail.com
Mon Apr 16 08:48:48 PDT 2012


On Mon, Apr 16, 2012 at 05:31:50PM +0300, Tiago Vignatti wrote:
> Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>

The input device attach request expects the enter event serial number
for the window that currently has pointer focus.  I made the change
here and comitted.

Kristian

> ---
>  hw/xfree86/xwayland/xwayland-cursor.c  |    2 +-
>  hw/xfree86/xwayland/xwayland-input.c   |   42 ++++++++++++++++++-------------
>  hw/xfree86/xwayland/xwayland-private.h |    3 +-
>  3 files changed, 27 insertions(+), 20 deletions(-)
> 
> diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c
> index eae11ab..04b5297 100644
> --- a/hw/xfree86/xwayland/xwayland-cursor.c
> +++ b/hw/xfree86/xwayland/xwayland-cursor.c
> @@ -169,7 +169,7 @@ xwl_set_cursor(DeviceIntPtr device,
>      buffer = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key);
>  
>      wl_input_device_attach(xwl_input_device->input_device,
> -			   xwl_input_device->time, buffer,
> +			   xwl_screen->serial, buffer,
>  			   cursor->bits->xhot, cursor->bits->yhot);
>  }
>  
> diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c
> index ea63607..7599709 100644
> --- a/hw/xfree86/xwayland/xwayland-input.c
> +++ b/hw/xfree86/xwayland/xwayland-input.c
> @@ -268,15 +268,12 @@ 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 x, int32_t y, int32_t sx, int32_t sy)
> +			   uint32_t time, int32_t sx, int32_t sy)
>  {
>      struct xwl_input_device *xwl_input_device = data;
>      struct xwl_screen *xwl_screen = xwl_input_device->xwl_screen;
>      int32_t dx, dy, lx, ly;
>  
> -    xwl_input_device->time = time;
> -
>      if (!xwl_input_device->focus_window)
>  	return ;
>  
> @@ -292,12 +289,13 @@ input_device_handle_motion(void *data, struct wl_input_device *input_device,
>  
>  static void
>  input_device_handle_button(void *data, struct wl_input_device *input_device,
> -			   uint32_t time, uint32_t button, uint32_t state)
> +			   uint32_t serial, uint32_t time, uint32_t button,
> +			   uint32_t state)
>  {
>      struct xwl_input_device *xwl_input_device = data;
>      int index;
>  
> -    xwl_input_device->time = time;
> +    xwl_input_device->xwl_screen->serial = serial;
>  
>      switch (button) {
>      case BTN_MIDDLE:
> @@ -317,12 +315,13 @@ input_device_handle_button(void *data, struct wl_input_device *input_device,
>  
>  static void
>  input_device_handle_key(void *data, struct wl_input_device *input_device,
> -			uint32_t time, uint32_t key, uint32_t state)
> +			uint32_t serial, uint32_t time, uint32_t key,
> +			uint32_t state)
>  {
>      struct xwl_input_device *xwl_input_device = data;
>      uint32_t modifier;
>  
> -    xwl_input_device->time = time;
> +    xwl_input_device->xwl_screen->serial = serial;
>  
>      switch (key) {
>      case KEY_LEFTMETA:
> @@ -345,14 +344,14 @@ input_device_handle_key(void *data, struct wl_input_device *input_device,
>  static void
>  input_device_handle_pointer_enter(void *data,
>  				  struct wl_input_device *input_device,
> -				  uint32_t time,
> -				  struct wl_surface *surface,
> -				  int32_t x, int32_t y, int32_t sx, int32_t sy)
> +				  uint32_t serial, struct wl_surface *surface,
> +				  int32_t sx, int32_t sy)
>  
>  {
>      struct xwl_input_device *xwl_input_device = data;
>  
> -    xwl_input_device->time = time;
> +    xwl_input_device->xwl_screen->serial = serial;
> +    xwl_input_device->pointer_enter_serial = serial;
>  
>      if (surface)
>  	xwl_input_device->focus_window = wl_surface_get_user_data(surface);
> @@ -370,14 +369,14 @@ input_device_handle_pointer_enter(void *data,
>  static void
>  input_device_handle_keyboard_enter(void *data,
>  				   struct wl_input_device *input_device,
> -				   uint32_t time,
> +				   uint32_t serial,
>  				   struct wl_surface *surface,
>  				   struct wl_array *keys)
>  {
>      struct xwl_input_device *xwl_input_device = data;
>      uint32_t *k, *end;
>  
> -    xwl_input_device->time = time;
> +    xwl_input_device->xwl_screen->serial = serial;
>  
>      xwl_input_device->modifiers = 0;
>      end = (uint32_t *) ((char *) keys->data + keys->size);
> @@ -400,22 +399,29 @@ input_device_handle_axis(void *data, struct wl_input_device *input_device,
>  static void
>  input_device_handle_pointer_leave(void *data,
>                                    struct wl_input_device *input_device,
> -                                  uint32_t time, struct wl_surface *surface)
> +                                  uint32_t serial, struct wl_surface *surface)
>  {
> +    struct xwl_input_device *xwl_input_device = data;
> +
> +    xwl_input_device->xwl_screen->serial = serial;
>  }
>  
>  static void
>  input_device_handle_keyboard_leave(void *data,
>                                     struct wl_input_device *input_device,
> -                                   uint32_t time,
> +                                   uint32_t serial,
>                                     struct wl_surface *surface)
>  {
> +    struct xwl_input_device *xwl_input_device = data;
> +
> +    xwl_input_device->xwl_screen->serial = serial;
>  }
>  
>  static void
>  input_device_handle_touch_down(void *data,
>                                 struct wl_input_device *wl_input_device,
> -                               uint32_t time, struct wl_surface *surface,
> +                               uint32_t serial, uint32_t time,
> +			       struct wl_surface *surface,
>                                 int32_t id, int32_t x, int32_t y)
>  {
>  }
> @@ -423,7 +429,7 @@ input_device_handle_touch_down(void *data,
>  static void
>  input_device_handle_touch_up(void *data,
>                               struct wl_input_device *wl_input_device,
> -                             uint32_t time, int32_t id)
> +                             uint32_t serial, uint32_t time, int32_t id)
>  {
>  }
>  
> diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h
> index 87362f6..4d6fbab 100644
> --- a/hw/xfree86/xwayland/xwayland-private.h
> +++ b/hw/xfree86/xwayland/xwayland-private.h
> @@ -60,6 +60,7 @@ struct xwl_screen {
>      struct xorg_list		 input_device_list;
>      struct xorg_list		 damage_window_list;
>      struct xorg_list		 window_list;
> +    uint32_t			 serial;
>  
>      /* FIXME: Hack. */
>      int32_t			 width, height;
> @@ -96,7 +97,7 @@ struct xwl_input_device {
>      int32_t			 grab_x, grab_y;
>      uint32_t			 id;
>      uint32_t			 modifiers;
> -    uint32_t			 time;
> +    uint32_t			 pointer_enter_serial;
>      struct xorg_list		 link;
>  };
>  
> -- 
> 1.7.5.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