It is normal for XACE to deny an event delivery, so these log messages
shouldn't trigger when that happens. Just drop them for now.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Instead of returning BadAccess when "read" permission is denied
on a device, falsify the device state (buttons down, keys pressed).
This is nicer to applications, but may still have undesired side
effects. The long-term solution is not to use these requests in
event-driven code!
Requests affected: QueryPointer, QueryKeymap, XiQueryDevice.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
A device with valuators but no keys is definitely a pointer device and needs
to be attached to the VCP. Otherwise, the class copying happens on the VCK
and the VCP isn't updated with the events that are to be sent through it.
This addresses the trigger for #24441, not the actual issue.
Jury is still out on valuator+key devices.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
On 64-bit systems, int and pointers don't have the same size, so GCC gives
warnings about casts between int and pointer types. However, in the cases
covered by this patch, it's always a value that fits in int being stored
temporarily as a pointer and then converted back later, which is safe.
Casting through the pointer-sized integer type intptr_t convinces the
compiler that this is OK.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
silences compiler warning:
events.c: In function 'FixUpEventFromWindow':
events.c:2262: warning: 'child' may be used uninitialized in this function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
For core and XI1 events, store the key_repeat flag in the sequence number
until TryClientEvents. The sequenceNumber is unset until TryClientEvents.
[Also thrown in, some random indentation changes. Thanks]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
When the windows are restructured, CheckMotion needs to be called for all
masters and floating slaves to update the spriteTrace.
X.Org Bug 23257 <http://bugs.freedesktop.org/show_bug.cgi?id=23257>
Tested-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
XI1 grabs on slave devices leave the device attached - just like in earlier
versions of XI.
Tested-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The sourceid for enter/leave events as a result of pointer motion is the ID
of the slave device. The sourceid for those as a result of a grab activating
is the device itself.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
InternalEvents shouldn't be used anywhere outside the X server itself. Split
up into events.h for opaque typedefs for the events needed by various
headers and eventstr.h for the actual struct definitions.
eventstr.h must only be included by code that requires internal events and
is not part of the SDK.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
EventToXI2 returns a NULL event for enter/focus events since these events
aren't yet wrapped into internal events. This is a quickfix only, it works
thanks to the alignment of internal and XI2 event types.
Eventually, enter/leave events should be wrapped into internal events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
A client that grabs for button/key events may not have the
ButtonPress/KeyPress mask set and should not receive an event in that case.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Keysym grabs are tricky in the details, keycode grabs are known to work. So
for now, provide keycode grabs only.
Requires inputproto 1.9.99.15.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Previously, an active grab on an attached slave device would send the device
floating for the duration of the grab. This breaks existing XI applications
(e.g. the GIMP) since they grab all devices automatically - resulting in the
loss of control over the VCP.
The behaviour of extended input devices during a grab in relation to the
core pointer is not specified in the XI protocol specification.
The removal of the temporary detachment restores the behaviour of extended
input devices as present in currently released servers - even if a device is
grabbed, an event from this device will result in an event from the core
pointer.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Presumably, some intelligent, XI2-aware management app will be calling
XISetClientPointer on behalf of other clients; this check makes sure
the target client has permission on the device.
Requires changing the prototype to return status code instead of Bool.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
event->type is always GenericEvent for XI2 events. Instead, XI_ButtonPress
(the generic event's evtype must be stored.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
GetMaster is more reliable than GetPairedDevice, it always returns the
keyboard/pointer if desired, even if the wrong device was passed in.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Let EventToXI, EventToCore and EventToXI2 return BadMatch if there's no
matching event for this protocol spec.
Adjust the delivery paths to cope with BadMatch errors (and clean them up on
the way).
As a side-effect, this fixes server crashes on proximity events for a
grabbed device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
For proximity events, the XI2 type is 0 and inputMasks never got set in the
preceding condition. As a result, proximity events got never delivered.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
These grabs are suported through two fake devices inputInfo.all_devices and
inputInfo.all_master_devices. These devices are not part of the device list
and are only initialised for their device id, nothing else.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
A passive XI2 grab always uses the paired master device as a modifier
device. After issuing a passive grab, the slave may be reattached to a
different master and hence the modifier device may change.
Rework addresses two issues:
- storing the master device's pointer is a bad idea, we need to store the ID
of the device in case it disappears during the grab.
- restoring the old master did not actually reattach the device. Fixed now.
grab->type is the device type and XI2 types overlap with core events (being
less than GenericEvent). Thus, for passive grabs the grab device would be
overwritten with whatever device was activating it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Extension devices have ActivateKeyboardGrab as their grab activation
function, hence we need to ensure the implicit passive grab flag is set
accordingly in the grab for further event delivery.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
If an implicit passive grab is active, the XI event mask is in
grab->deviceMask. Otherwise, for explicit grabs, the XI event mask is in
grab->eventMask.
Reported-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
If a passive enter or focus in grab activates, send additional enter or
focus events with mode XIPassiveGrabNotify to the grabbing client.
Likewise, if the grab deactivates, send additional leave or focus out
events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Enter grabs are checked for in CheckMotion(), each time the sprite window
changes the current grab is deactivated (if applicable) and the new grab is
activated (if applicable). Exception - if the grab is on a parent window of
the current window since we keep the grab across descendants.
Since CheckMotion() may change the grab status of a device, we mustn't get
"dev->deviceGrab.grab" in ProcessOtherEvents until after CheckMotion().
FocusIn grabs are checked in much the same manner.
The event delivery for grabs replaces the NotifyNormal on window change with
a NotifyGrab on window change. Note that this happens before the grab
activates, so the EnterNotify(NotifyGrab) is still delivered to the window,
not to the grabbing client. This is in line with the core protocol semantics
for NotifyGrab events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>