[PATCH xserver] xwayland: send synthetic buttons up events when grabbing
Tiago Vignatti
tiago.vignatti at linux.intel.com
Mon Jun 11 08:39:20 PDT 2012
On 06/08/2012 08:17 PM, Kristian Høgsberg wrote:
> 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.
so it turned out that X is not sending those unwanted synthetic release
events with my patch after all. It's posting the events at
pointer_handle_enter when buttons are down, which happens, if I
understood correctly, only when a grab is being performed i.e. exactly when:
1) a click happened at the title-bar
2) mod+click binding is triggered to move the window
but on 2) the compositor is never going to send the events for xwayland
cause the binding swallows it (that was what we were missing in our IRC
chat last Fri). So the synthetic event ends up generated in fact only
for 1), which address the problem we're having.
Now I'm not sure if we need to change a bit our grab logic to make X
behave "as expected", sending the synthetic event at 2) as well. Seems
we'd need to swap weston_compositor_run_button_binding with
grab->interface->button() inside notify_button, and then go for the
solution of grabbing the device inside X to not send the event. But I
don't see a reason for that now.
Tiago
> 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
More information about the wayland-devel
mailing list