Commit Graph

659 Commits

Author SHA1 Message Date
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Matt Turner 61aa40aeb3 dix: Assert noPanoramiXExtension is false in PanoramiX code
When compiling with link time optimization, GCC thinks it's discovered
undefined behavior:

events.c: In function 'XineramaConfineCursorToWindow':
events.c:609:13: warning: iteration 2147483647 invokes undefined behavior [-Waggressive-loop-optimizations]
events.c:609:11: note: within this loop
events.c:605:49: warning: array subscript -1 is below array bounds of 'struct _Window *[16]' [-Warray-bounds]
events.c:606:31: warning: array subscript -1 is below array bounds of 'struct _Screen *[16]' [-Warray-bounds]
events.c:610:39: warning: array subscript -2 is below array bounds of 'struct _Screen *[16]' [-Warray-bounds]
events.c:617:38: warning: array subscript -2 is below array bounds of 'struct _Window *[16]' [-Warray-bounds]
events.c:619:35: warning: array subscript -2 is below array bounds of 'struct _Screen *[16]' [-Warray-bounds]

This results from

    i = PanoramiXNumScreens - 1;

    RegionCopy(&pSprite->Reg1, &pSprite->windows[i]->borderSize);
    off_x = screenInfo.screens[i]->x;
    off_y = screenInfo.screens[i]->y;

where GCC believes that PanoramiXNumScreens might be 0. Unfortunately
GCC is just smart enough to be an annoyance because this case is not
actually possible: XineramaConfineCursorToWindow() is only called when
noPanoramiXExtension is false, and if noPanoramiXExtension is false then
PanoramiXNumScreens must be >1 (see PanoramiXExtensionInit()).

So, add an assert(!noPanoramiXExtension), which to my surprise provides
GCC with information even in release builds and lets GCC understand that
the code is not doing anything that is undefined behavior.

I chose this solution instead of the proposed assert(i >= 0) because the
same pattern occurs in CheckVirtualMotion() but is inside an
'if (!noPanoramiXExtension)' and does not generate any warnings.

Fixes: xorg/xserver#590
Signed-off-by: Matt Turner <mattst88@gmail.com>
2019-08-09 20:45:01 -07:00
Samuel Thibault 364d649815 dix: do not send focus event when grab actually does not change
c67f2eac56 ("dix: always send focus event on grab change") made dix
always sent events when it's a NotifyGrab or NotifyUngrab, even if
from == to, because 'from' can just come from a previous XSetInputFocus
call.

However, when an application calls XGrabKeyboard several times on
the same window, we are now sending spurious FocusOut+FocusIn with
NotifyGrab, even if the grab does not actually change. This makes screen
readers for blind people spuriously emit activity events which disturb
screen reading workflow when e.g. switching between menus.

This commit avoids calling DoFocusEvents in that precise case, i.e. when
oldWin is a previous grab and the new grab is the same window.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-11-19 13:56:51 -05:00
Marco Trevisan (Treviño) 2118e4471b dix/events: reuse grab pointer value 2018-11-12 02:57:10 +00:00
Michal Srb 215f894965 dix: Disallow GenericEvent in SendEvent request.
The SendEvent request holds xEvent which is exactly 32 bytes long, no more,
no less. Both ProcSendEvent and SProcSendEvent verify that the received data
exactly match the request size. However nothing stops the client from passing
in event with xEvent::type = GenericEvent and any value of
xGenericEvent::length.

In the case of ProcSendEvent, the event will be eventually passed to
WriteEventsToClient which will see that it is Generic event and copy the
arbitrary length from the receive buffer (and possibly past it) and send it to
the other client. This allows clients to copy unitialized heap memory out of X
server or to crash it.

In case of SProcSendEvent, it will attempt to swap the incoming event by
calling a swapping function from the EventSwapVector array. The swapped event
is written to target buffer, which in this case is local xEvent variable. The
xEvent variable is 32 bytes long, but the swapping functions for GenericEvents
expect that the target buffer has size matching the size of the source
GenericEvent. This allows clients to cause stack buffer overflows.

Signed-off-by: Michal Srb <msrb@suse.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-19 11:58:50 +10:00
Carlos Garnacho f065721e6f dix: assume warping on the RootWindow always happens on visible coords
If the root window borderClip region is null, the PointInWindowIsVisible()
check fails if pointer warping is attempted on the root window, making
the warping operation bail out early.

Assume coordinates always lay inside the root window for this case,
the actual position will be clamped later within screen coordinates anyway.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-07 14:34:29 +10:00
Jonas Ådahl 5998da7855 dix: Incroduce CursorConfinedTo vfunc in Screen
This function will be called when a pointer is grabbed non-root window
set as the 'confineTo'. This will enable the ddx to handle the
confinement their own way.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-19 08:55:02 -07:00
Jonas Ådahl daf48a3aba dix: Introduce CursorWarpedTo vfunc in Screen
This new vfunc will be called, if set, after a client has issued a
WarpPointer request. This is necessary for implementing pointer warp
emulation in Xwayland.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-19 08:54:56 -07:00
Michael Thayer d8c288ec37 xi2: fix FocusIn grabs
Fix a couple of copy-and-paste errors preventing FocusIn grabs from working.
Perhaps the extension version should be bumped though to distinguish between
working and non-working extension versions.

Signed-off-by: Michael Thayer <michael.thayer@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-02 12:57:42 -04:00
Keith Packard 7c77c42fe8 dix: Don't update current time in the middle of input event processing
In patch 137ac094e7, Adam moved an
expensive call to UpdateCurrentTime out of the main dispatch
loop. That's a good change as the original fix from Chase was a bit
expensive. However, it breaks grab processing and so a couple of the
calls to UpdateCurrenTime need to be removed.

Input event processing can generate a stream of events; a button press
that activates a grab will send a press followed by a sequence of
enter/leave events. All of these should have the same time stamp on
the wire as they occur at the 'same' time.

More importantly, the grab time recorded in the device is pulled from
currentTime after all of the events are delivered, so if currentTime
doesn't match the time in the device event, then future grab
modifications will fail as the time marked in the device will be
'later' than the grab time known to the client (which is defined as
the timestamp from the activating input event).

A bit of history here -- it used to be that currentTime was driven
*entirely* by input events; those timestamps didn't even have to be
related to the system time in any way. Then we started doing ICCCM
stuff and people got confused when PropertyNotify events would have
the same timestamp even when delivered minutes apart because no input
events were delivered.

We added code in the server to go update the time, but only if no
input events were pending (so that the clock "wouldn't" go
backwards). The only places where this is necessary is in request
processing which may generate an event with a timestamp, and there
only at the very top of the request processing code so that the whole
request would be processed at the 'same time', just like events.

cc: Chase Douglas <chase.douglas@canonical.com>
cc: Peter Hutterer <peter.hutterer@who-t.net>
cc: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-01 10:31:52 -07:00
Adam Jackson 137ac094e7 dix: Push UpdateCurrentTimeIf down out of the main loop
This was added in:

    commit 312910b4e3
    Author: Chase Douglas <chase.douglas@canonical.com>
    Date:   Wed Apr 18 11:15:40 2012 -0700

        Update currentTime in dispatch loop

Unfortunately this is equivalent to calling GetTimeInMillis() once per
request. In the absolute best case (as on Linux) you're only hitting the
vDSO; on other platforms that's a syscall. Either way it puts a pretty
hard ceiling on request throughput.

Instead, push the call down to the requests that need it; basically,
grab processing and event generation.

Cc: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-05-04 10:58:01 -04:00
Rui Matos fa62ca68ef dix/events: Set currentTime to the given time stamp in NoticeTime
The refactoring in commit efc1035ca9
removed the actual update of currentTime.

Signed-off-by: Rui Matos <tiagomatos@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-05-11 15:40:04 -07:00
Alan Coopersmith b9e665c8b2 Convert dix/* to new *allocarray functions
v2: remove now useless parentheses

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:57:08 -07:00
Alan Coopersmith 9e002dfcd7 Get rid of const warnings in XSERVER_INPUT_EVENT dtrace probe calls
Use typedefs to work around dtrace dropping const qualifiers from probe
arguments when generating Xserver-dtrace.h.   Add new probes.h header to
avoid having to replicate these typedefs in every file with dtrace probes.

Gets rid of these warnings from gcc 4.8:
 getevents.c:1096:9:
  warning: passing argument 6 of '__dtrace_Xserver___input__event' discards
  'const' qualifier from pointer target type [enabled by default]
 getevents.c:1096:9:
  warning: passing argument 7 of '__dtrace_Xserver___input__event' disards
  'const' qualifier from pointer target type [enabled by default]
 getevents.c:1651:9:
  warning: passing argument 6 of '__dtrace_Xserver___input__event' disards
  'const' qualifier from pointer target type [enabled by default]
 getevents.c:1651:9:
  warning: passing argument 7 of '__dtrace_Xserver___input__event' disards
  'const' qualifier from pointer target type [enabled by default]
 getevents.c:1791:9:
  warning: passing argument 6 of '__dtrace_Xserver___input__event' disards
  'const' qualifier from pointer target type [enabled by default]
 getevents.c:1791:9:
  warning: passing argument 7 of '__dtrace_Xserver___input__event' disards
  'const' qualifier from pointer target type [enabled by default]
 getevents.c:1921:9:
  warning: passing argument 6 of '__dtrace_Xserver___input__event' disards
  'const' qualifier from pointer target type [enabled by default]
 getevents.c:1921:9:
  warning: passing argument 7 of '__dtrace_Xserver___input__event' disards
  'const' qualifier from pointer target type [enabled by default]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-10 18:14:44 -08:00
Brendan King a99c061aaf dix: reference the cursor just once in InitializeSprite()
The new current cursor was being referenced twice, resulting in a
memory leak when the current server generation ended.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-06-04 21:32:14 -07:00
Peter Hutterer e06fbe4dc8 dix: remove a now-superfluous comment
Obsolete since 93945b0a74

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-29 10:06:25 +10:00
Keith Packard 73698d41e4 Make XYToWindow a screen function
This allows DDXen to override the window picking to account for
native windows not seen by the X server.  The bulk of the picking logic
is exposed as a new helper function, miSpriteTrace().  This function
completes the sprite trace filled out by the caller, and can be set up
to start the search from a given toplevel window.

v2: Leave existing XYToWindow API in place for API compatibility

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-04-01 10:30:42 -07:00
Keith Packard 25ebb9dbc9 Merge remote-tracking branch 'whot/for-keith' 2014-01-22 11:33:53 -08:00
Keith Packard 60014a4a98 Replace 'pointer' type with 'void *'
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12 10:24:11 -08:00
Keith Packard d89b42bda4 Clean up warnings in DIX
As usual, mostly const char changes. However, filter_device_events had
a potentially uninitialized value, 'raw', which I added a bunch of
checks for. I suspect most of those are 'can't happen', but it's hard
to see that inside the function.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:49 -08:00
Alan Coopersmith 863d2ad5c0 CheckPassiveGrabsOnWindow() needs to handle NULL return value from AllocGrab()
CheckPassiveGrabsOnWindow() calls AllocGrab() which can fail and return NULL.
This return value is not checked, and can cause NULL pointer dereferences.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-09 13:36:29 +10:00
Alan Coopersmith 5493a67ec2 GrabDevice() needs to handle NULL return value from AllocGrab()
GrabDevice() calls AllocGrab() which can fail and return NULL.
This return value is not checked, and can cause NULL pointer dereferences.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-09 13:36:29 +10:00
Peter Hutterer 929795d50d dix: fix check for grab type
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-11 14:00:50 +10:00
Peter Hutterer 06b87aa528 sync: if the idle time was reset, force alarms to trigger (#70476)
The time between the idle reset and the IdleTimeWakeupHandler to be called is
indeterminate. Clients with an PositiveTransition or NegativeTransition alarm
on a low threshold may miss an alarm.

Work around this by keeping a reset flag for each device. When the
WakeupHandler triggers and the reset flag is set, we force a re-calculation of
everything and pretend the current idle time is zero. Immediately after is the
next calculation with the real idle time.

Relatively reproducible test case: Set up a XSyncNegativeTransition alarm for
a threshold of 1 ms. May trigger, may not.

X.Org Bug 70476 <http://bugs.freedesktop.org/show_bug.cgi?id=70476>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-10-18 16:44:32 +10:00
Peter Hutterer efc1035ca9 dix: provide accessor methods for the last device event time
And now that we have the accessors, localize it. No functional changes, just
preparing for a future change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-10-18 16:44:32 +10:00
Peter Hutterer 7cf1b595c8 dix: only deliver for the current grab type
Use the grabtype to determine which type of event to send - all other events
are pointless and may result in erroneous events being delivered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-14 11:07:38 +10:00
Peter Hutterer 78944d62ff dix: don't attempt to deliver an event for a different grabtype
For an active grab, grab->eventMask can be either the core or the XI1 mask.
With the overlap of event filters, calling DeliverOneGrabbedEvent(XI1) for a
ProximityOut event will trigger if the client has selected for enter events -
the filter is the same for both.

Thus, we end up delivering a proximity event to a client not expecting one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-14 11:07:38 +10:00
Peter Hutterer be6ea80b79 dix: only allow button and key events to freeze a sync'd pointer
If a client calls XAllowEvents(SyncPointer) it expects events as normal until
the next button press or release event - that freezes the device. An e.g.
proximity event must thus not freeze the pointer.

As per the spec, only button and key events may do so, so narrow it to these
cases.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-14 11:07:37 +10:00
Peter Hutterer 82939e0239 dix: check for grab type before checking XI2 mask
if the grab type isn't XI2, grab->xi2mask is random. That random data may
have the enter/leave mask set, leading to events sent to the client that the
client can't handler.

Source of these errors:
  _xgeWireToEvent: Unknown extension 131, this should never happen.

Simplest reproducer:
   Start Xephyr, press button inside window, move out. As the pointer leaves
   the Xephyr window, the errors appear.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-08-30 14:26:55 +10:00
Egbert Eich 05ea6307fa DIX/Xi: Pass correct client to CheckDeviceGrabAndHintWindow()
If we have a client which has registered for a DeviceButton grab
be sure to pass this to CheckDeviceGrabAndHintWindow(). Since the
order of clients is arbitrary there is no guarantee that the last
client in the list is the one that belongs to this class.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-30 14:26:55 +10:00
Peter Hutterer 0e3be0b25f dix: UpdateTouchesForGrab must only free the listener grab if it is non-NULL
If a client calls XIGrabDevice in response to a ButtonPress event (regular
event selection), the device will have a grab, but listener->grab is NULL.

Check for that, to avoid logspam.

[ 26293.863] (EE) BUG: triggered 'if (!pGrab)'
[ 26293.863] (EE) BUG: grabs.c:256 in FreeGrab()
[ 26293.863] (EE)
[ 26293.863] (EE) Backtrace:
[ 26293.864] (EE) 0: /usr/bin/Xorg (FreeGrab+0x54) [0x45d3fc]
[ 26293.864] (EE) 1: /usr/bin/Xorg (UpdateTouchesForGrab+0x135) [0x447d4e]
[ 26293.864] (EE) 2: /usr/bin/Xorg (ActivatePointerGrab+0x1ba) [0x447f3d]
[ 26293.864] (EE) 3: /usr/bin/Xorg (GrabDevice+0x3e6) [0x4503bc]
[ 26293.864] (EE) 4: /usr/bin/Xorg (ProcXIGrabDevice+0x1f9) [0x5981b1]
[ 26293.865] (EE) 5: /usr/bin/Xorg (ProcIDispatch+0x78) [0x58aa17]
[ 26293.865] (EE) 6: /usr/bin/Xorg (Dispatch+0x30d) [0x43347e]
[ 26293.865] (EE) 7: /usr/bin/Xorg (main+0x61d) [0x498175]
[ 26293.865] (EE) 8: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x3df5621b75]
[ 26293.865] (EE) 9: /usr/bin/Xorg (_start+0x29) [0x423a19]
[ 26293.866] (EE) 10: ? (?+0x29) [0x29]
[ 26293.866] (EE)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-07-17 14:27:26 +10:00
Peter Hutterer 8eeaa74bc2 dix: when ungrabbing an active grab, accept pointer grabs (#66720)
Ungrabbing a device during an active touch grab rejects the grab. Ungrabbing
a device during an active pointer grab accepts the grab.

Rejection is not really an option for a pointer-emulated grab, if a client
has a button mask on the window it would get a ButtonPress emulated after
UngrabDevice. That is against the core grab behaviour.

X.Org Bug 66720 <http://bugs.freedesktop.org/show_bug.cgi?id=66720>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2013-07-11 07:38:57 +10:00
Peter Hutterer 9a5ad65330 Abstract cursor refcounting
Too many callers relied on the refcnt being handled correctly. Use a simple
wrapper to handle that case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-15 19:17:57 +10:00
Peter Hutterer 481702101b dix: fix cursor refcounting
The cursor is referenced during CopyGrab(), thus doesn't need to be handled
manually anymore. It does need to be refcounted for temp grabs though.

The oldGrab handling in ProcGrabPointer is a leftover from the cursor in the
grab being refcounted, but the grab itself being a static struct in the
DeviceIntRec. Now that all grabs are copied, this lead to a double-free of
the cursor (Reproduced in Thunderbird, dragging an email twice (or more
often) causes a crash).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-15 19:16:59 +10:00
Peter Hutterer 3093f78d17 dix: free the old grab when activating a new grab
A client may call XIGrabDevice twice, overwriting the existing grab. Thus,
make sure we free the old copy after we copied it. Free it last, to make
sure our refcounts don't run to 0 and inadvertantly free something on the
way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-10 14:32:38 +10:00
Peter Hutterer 395124bd27 dix: always copy grabs, don't reference them
Introduced in xorg-server-1.13.99.901-2-g9ad0fdb. Storing the grab pointer
in the listener turns out to be a bad idea. If the grab is not an active
grab or an implicit grab, the pointer stored is the one to the grab attached
on the window. This grab may be removed if the client calls UngrabButton or
similar while the touch is still active, leaving a dangling pointer.

To avoid this, copy the grab wherever we need to reference it later. This
is also what we do for pointer/keyboard grabs, where we copy the grab as
soon as it becomes active.

Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-10 14:32:38 +10:00
Peter Hutterer 925e35122e dix: AllocGrab can copy if an argument is passed in
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-10 14:32:37 +10:00
Peter Hutterer ccfa0f2d5d dix: use a temporary variable for listeners[0]
no functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-10 14:32:37 +10:00
Peter Hutterer 5363433a5c dix: drop DeviceIntRec's activeGrab struct
Obsolete since 4bc2761ad5. This struct
existed so copying a passive grab could be simply done by
  activeGrab = *grab

and thus have a copy of the GrabPtr we'd get from various sources but still
be able to check device->grab for NULL.

Since 4bc2761 activeGrab is a pointer itself and points to the same memory
as grabinfo->grab, leaving us with the potential of dangling pointers if
either calls FreeGrab() and doesn't reset the other one.

There is no reader of activeGrab anyway, so simply removing it is
sufficient.

Note: field is merely renamed to keep the ABI. Should be removed in the
future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-10 14:32:37 +10:00
Peter Hutterer 5174b1f982 dix: XAllowEvents() on a touch event means accepting it
A sync grab is the owner once it gets events. If it doesn't replay the
event it will get all events from this touch, equivalent to accepting it.

If the touch has ended before XAllowEvents() is called, we also now need to
send the TouchEnd event and clean-up since we won't see anything more from
this touch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-10 14:32:36 +10:00
Peter Hutterer 2fdde2c40d dix: update coords for touch events in PlayReleasedEvents
Note: this is only hit for #ifdef PANORAMIX

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-03-25 10:34:23 +10:00
Carlos Garnacho 509b3c3dc8 dix: Set focus field on XI2 crossing events
Set on DeviceEnterLeaveEvent() the xXIEnterEvent->focus field
similarly to how the CoreEnterLeaveEvent() function above does
for core events.

This fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=677329
reported to GTK+, where focus handling on window managers with
sloppy focus or no window manager present was broken due to this
field being always set to FALSE.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-02-08 16:09:27 +10:00
Peter Hutterer fa6ab7d9b2 Merge branch 'pointer-emulation-fixes-56558-v2' into for-keith 2013-01-11 14:58:17 +10:00
Peter Hutterer 4e13dd9014 dix: don't filter RawEvents if the grab window is not the root window (#53897)
If a XI2.1+ client has a grab on a non-root window, it  must still receive
raw events on the root window.

Test case: register for XI_ButtonPress on window and XI_RawMotion on root.
No raw events are received once the press activates an implicit grab on the
window.

X.Org Bug 53897 <http://bugs.freedesktop.org/show_bug.cgi?id=53897>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-01-11 14:57:29 +10:00
Peter Hutterer 0e1ab433f4 dix: remove already-moved hunk
Should've been removed in bc1f90a615018c05994fae3e678dd2341256cd82a, but got
left here due to a botched rebase.

Fixes stray button events sent to clients after deactivating an async
pointer grab on a pointer-emulating-touch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-01-09 12:33:49 +10:00
Peter Hutterer 32a6d8a6b5 dix: check for the right device's xi2 mask
events.c: In function 'DeactivatePointerGrab':
events.c:1524:51: warning: 'dev' may be used uninitialized in this function
[-Wuninitialized

dev is unset when we get here, the device to check is "mouse".
Introduced in ece8157a59.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-01-09 12:33:43 +10:00
Keith Packard 9ad0fdb135 input: Record grab pointer in TouchListener
This places a pointer to the grab related to a TouchListener directly
in the TouchListener structure rather than hoping to find the grab
later on using the resource ID.

Passive grabs have resource ID in the resource DB so they can be
removed when a client exits, and those resource IDs get copied when
activated, but implicit grabs are constructed on-the-fly and have no
resource DB entry.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-09 12:33:33 +10:00
Keith Packard 014a5c8a9d Merge remote-tracking branch 'whot/barriers'
Conflicts:
	Xi/xichangehierarchy.c

Small conflict with the patch from

	Xi: don't use devices after removing them

Was easily resolved by hand.

Signed-off-by: Keith Packard <keithp@keithp.com>
2012-12-19 12:09:31 -08:00
Peter Hutterer dd3242c87a dix: don't allow overriding a grab with a different type of grab (#58255)
If a client has a core grab, don't allow re-grabbing with type XI2, etc.
This was the intent of the original commit
xorg-server-1.5.99.1-782-g09f9a86, but ineffective.

X.Org Bug 58255 <http://bugs.freedesktop.org/show_bug.cgi?id=58255>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-12-18 08:53:41 +10:00
Peter Hutterer 3b16140170 dix: ignore barrier events in FixUpEventFromWindow
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17 15:03:32 +10:00