[PATCH xserver] xwayland: send synthetic buttons up events when grabbing

Kristian Høgsberg hoegsberg at gmail.com
Fri Jun 8 10:17:56 PDT 2012


On Fri, Jun 08, 2012 at 08:10:49PM +0300, Tiago Vignatti wrote:
> Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
> ---
> 
> I haven't thought much whether xwm now will really need to grab the pointer
> during move/resize.

Ah, this was only half of what we discussed in IRC.  This still sends
button release events to happens to receive the pointer.  We just need
to clear the state, not send out events, since the buttons have
already been released.  How about just

	dev->button->down = 0;

Kristian

>  hw/xfree86/xwayland/xwayland-input.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c
> index 517ad30..079ba4f 100644
> --- a/hw/xfree86/xwayland/xwayland-input.c
> +++ b/hw/xfree86/xwayland/xwayland-input.c
> @@ -275,10 +275,18 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
>  
>      xwl_seat->xwl_screen->serial = serial;
>      xwl_seat->pointer_enter_serial = serial;
> +    DeviceIntPtr dev = xwl_seat->pointer;
> +    int i;
>  
>      xwl_seat->focus_window = wl_surface_get_user_data(surface);
>  
>      SetDeviceRedirectWindow(xwl_seat->pointer, xwl_seat->focus_window->window);
> +
> +    /* grab swallows all events until it's over, so we need to send synthetic
> +     * release events on this case */
> +    for (i = 0; i < dev->button->numButtons; i++)
> +	if (BitIsOn(dev->button->down, i))
> +		xf86PostButtonEvent(dev, TRUE, i, 0, 0, 0);
>  }
>  
>  static void
> -- 
> 1.7.9.5
> 
> _______________________________________________
> 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