[PATCH] Xi: Call UpdateDeviceState() after the first emulated motion event
Peter Hutterer
peter.hutterer at who-t.net
Mon Oct 29 18:03:06 PDT 2012
On Mon, Oct 29, 2012 at 06:33:50PM +0100, Carlos Garnacho wrote:
> From: Carlos Garnacho <carlosg at gnome.org>
>
> The emulated motion event that happens before TouchBegin/ButtonPress should
> contain no buttons set in the mask, as it virtually happens at a time when
> the button is not yet pressed. This is known to confuse GTK+ and Abiword
> to different degrees, as enclosing button press/release events are expected
> around changes in the button mask.
>
> Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
thanks, patch does what it should, but unfortunately this this only fixes
part of the problem. Have a look at the test cases here:
http://cgit.freedesktop.org/~whot/xorg-integration-tests/commit/?h=carlos-update-device-state-fix&id=d1fc25e162d2e52395ae0032230b73f95701a680
Your patch fixes the problem of the motion event having the wrong state, but
ButtonPress and ButtonRelease too have the wrong state.
- XI2 button press event has button down (bad)
- XI2 button release event has state 0 (bad, should have button 1 mask set)
Filed https://bugs.freedesktop.org/56558
- core events are completely broken, we never see button events on the root
window
Filed https://bugs.freedesktop.org/56557
So, pointer emulation is pretty much broken, and those were only the issues
I found with the first couple of simple tests... :(
I'll hold out on this patch for now until we've figured out what the
complete patch would be
Cheers,
Peter
> ---
> Xi/exevents.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/Xi/exevents.c b/Xi/exevents.c
> index 6ed4991..8a2f7ee 100644
> --- a/Xi/exevents.c
> +++ b/Xi/exevents.c
> @@ -1568,15 +1568,16 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
> else
> touchid = ev->device_event.touchid;
>
> - if (emulate_pointer)
> - UpdateDeviceState(dev, &ev->device_event);
> -
> if (type == ET_TouchBegin) {
> ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
> emulate_pointer);
> }
> - else
> + else {
> + if (emulate_pointer)
> + UpdateDeviceState(dev, &ev->device_event);
> +
> ti = TouchFindByClientID(dev, touchid);
> + }
>
> /* Under the following circumstances we create a new touch record for an
> * existing touch:
> @@ -1615,8 +1616,12 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
> /* if emulate_pointer is set, emulate the motion event right
> * here, so we can ignore it for button event emulation. TouchUpdate
> * events which _only_ emulate motion just work normally */
> - if (emulate_pointer && ev->any.type != ET_TouchUpdate)
> + if (emulate_pointer && ev->any.type != ET_TouchUpdate) {
> DeliverEmulatedMotionEvent(dev, ti, ev);
> +
> + if (ev->any.type == ET_TouchBegin)
> + UpdateDeviceState(dev, &ev->device_event);
> + }
> if (emulate_pointer && IsMaster(dev))
> CheckMotion(&ev->device_event, dev);
>
> --
> 1.7.11.7
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
More information about the xorg-devel
mailing list