Commit Graph

445 Commits

Author SHA1 Message Date
Alan Coopersmith
c9726bbe31 Update Sun license notices to current X.Org standard form
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-16 17:11:35 -08:00
Peter Hutterer
c20c889727 dix: fix memory leak, free event list on shutdown. (#25028)
X.Org Bug 25028 <http://bugs.freedesktop.org/show_bug.cgi?id=25028>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2009-12-03 08:23:53 +10:00
Jeremy Huddleston
7897b6c2d4 dix: Properly detect if the other device is frozen
Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
2009-11-03 16:44:24 -08:00
Eamon Walsh
4be354c4c2 Remove some debug messages that trigger on XACE event delivery failure.
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>
2009-10-14 19:19:19 -04:00
Eamon Walsh
8502c06e19 xace: Fake return values on denials in input polling requests.
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>
2009-10-14 19:19:19 -04:00
Peter Hutterer
72f5874434 dix: extend IsPointerDevice check to valuator-only devices.
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>
2009-10-13 10:04:50 -07:00
Jamey Sharp
b0dd6be2c8 Cast small-int values through intptr_t when passed as pointers
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>
2009-10-08 13:38:44 +11:00
Peter Hutterer
fd91313673 dix: plug memory leak in DeviceEnterLeaveEvents.
'event' must be freed before exiting.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-25 08:17:02 +10:00
Peter Hutterer
90aa0e4a49 input: don't use typecasts to access members of InternalEvent.
To avoid confusion, the member names are now postfixed with _event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22 11:15:32 +10:00
Peter Hutterer
d3c66d6b69 dix: FindChildForEvent needs init child to None.
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>
2009-09-14 09:32:53 +10:00
Peter Hutterer
219ae5b628 dix: hide the sequenceNumber key repeat hack behind two functions.
Just in case we figure out a better way to do it in the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-04 12:59:43 +10:00
Daniel Stone
bfb219f532 input: allow for detectable autorepeat.
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>
2009-09-04 12:59:41 +10:00
Daniel Stone
3d988e01e4 dix: improve code flow in TryClientEvents, better debugging messages.
Instead of a massive if (blah && blah), return early where possible.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-04 12:59:40 +10:00
Peter Hutterer
ef75301854 dix: FixUpEventFromWindow mustn't scramble non-device events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24 10:06:37 +10:00
Eamon Walsh
d4b8f7602b xace: fix access mode in dixLookupWindow call within ProcUngrabKey.
Referencing a window (as grab-window) only requires GetAttr access.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-08-17 14:51:11 -04:00
Peter Hutterer
dca4de72d3 dix: fix potential use of unused variable 'mask'.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17 10:14:20 +10:00
Peter Hutterer
6c292d1705 dix: update the sprite trace for all masters && floating slaves (#23257)
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>
2009-08-14 14:39:56 +10:00
Peter Hutterer
3abbd327f4 dix: detach SD during XI2 grabs only.
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>
2009-08-06 10:05:12 +10:00
Peter Hutterer
c29aa7da22 Revert "dix: Remove temporary detachment of slave devices."
This reverts commit 0c0ef42292.

Tested-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-06 10:05:12 +10:00
Peter Hutterer
46ac9f9241 dix: pass the sourceid around for enter/leave events.
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>
2009-07-30 11:04:28 +10:00
Peter Hutterer
845e65f080 xkb: move XkbFilterEvents to xkbsrv.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:14 +10:00
Peter Hutterer
4e9b2938cd include: untangle events.h from the SDK headers.
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>
2009-07-30 08:43:13 +10:00
Peter Hutterer
ecd618957e dix: fix null-pointer dereference on activating enter/focus grabs.
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>
2009-07-22 15:27:16 +10:00
Peter Hutterer
48585bd1e3 dix: use the event mask of the grab for TryClientEvents.
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>
2009-07-22 12:13:05 +10:00
Peter Hutterer
9a1bfa5664 input: remove XI2 keysym grabs, use keycode grabs instead.
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>
2009-07-22 12:12:51 +10:00
Peter Hutterer
d040af7fa3 Update to type-specific raw events - require inputproto 1.9.99.14.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-15 10:36:30 +10:00
Peter Hutterer
2d35ea8d95 dix: switch to byte-counting functions.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14 10:05:54 +10:00
Peter Hutterer
0c0ef42292 dix: Remove temporary detachment of slave devices.
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>
2009-07-12 21:54:35 +10:00
Eamon Walsh
00bc8d34c6 Xi: check for Use permission on the device in SetClientPointer().
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>
2009-06-23 20:50:29 -04:00
Peter Hutterer
5e0ca6fabd input: remove un-used "setter" argument from SetClientPointer.
It's obsolete, not likely to come back, let's drop it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-12 12:37:16 +10:00
Peter Hutterer
7348bf4935 dix: set the generic event type for implicit XI2 grabs.
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>
2009-06-07 09:31:08 +10:00
Eamon Walsh
da682abc78 xace: fix a bad send access hook call. 2009-06-04 17:33:25 -04:00
Peter Hutterer
08fd2ae652 dix: use GetMaster in PickPointer and PickKeyboard.
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>
2009-06-03 12:19:05 +10:00
Peter Hutterer
2bd5ea8065 dix: rework event conversion before delivery.
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>
2009-06-03 11:46:30 +10:00
Peter Hutterer
fc8cfc3a05 dix: ensure EventIsDeliverable has inputMasks set at all times.
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>
2009-06-02 16:57:20 +10:00
Peter Hutterer
a66686a83e input: add support for XIAllDevices and XIAllMasterDevices passive grabs.
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>
2009-06-02 16:02:31 +10:00
Peter Hutterer
f00cf76751 dix: get the current MD keyboard for the grab modifier state.
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.
2009-06-02 16:02:31 +10:00
Peter Hutterer
1cd7ed75d9 dix: float slave devices during passive grabs.
Exception - implicit passive grabs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02 16:02:29 +10:00
Peter Hutterer
f56ad22e8f dix: rework temporary slave detachment.
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.
2009-06-02 15:53:21 +10:00
Peter Hutterer
b3e4810a28 dix: move grab device assignment into GRABTYPE_CORE block.
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>
2009-06-02 10:41:10 +10:00
Peter Hutterer
18ae486708 dix: don't try to activate a passive grab on top of an active one.
If we already have an active grab on the device, don't attempt to activate
another one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02 10:41:10 +10:00
Peter Hutterer
080b0331b3 input: Add grabtype to GrabParameters.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-01 13:48:43 +10:00
Peter Hutterer
bee02a1541 dix: ensure implicit passive grabs have the xi2mask zeroed.
This fixes XI2 enter/leave events being sent to non-xi2 clients.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-01 13:45:30 +10:00
Peter Hutterer
0f47203a9a dix: Set the implicit passive grab flag for keyboards too.
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>
2009-05-29 14:19:35 +10:00
Peter Hutterer
75c73ddbfc dix: fix broken XI event delivery during grabs.
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>
2009-05-29 14:02:39 +10:00
Peter Hutterer
235cf5713a dix: init inputMasks to NULL to avoid random value dereference.
If the XI2 type is 0 (e.g. proximity events), inputMasks is never set and
may not be NULL.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-29 12:10:48 +10:00
Peter Hutterer
d7aef3f663 Merge branch 'master' into xi2
Conflicts:
	Xext/geext.c
	Xi/chdevcur.c
	Xi/extgrbdev.c
	Xi/xiproperty.c
	configure.ac
	dix/ptrveloc.c
	hw/xfree86/common/xf86Config.c
	mi/mipointer.h
	test/input.c
	xkb/xkb.c
2009-05-28 17:20:58 +10:00
Peter Hutterer
a25f248fc3 Xi: Send Enter or Leave events with XIPassive(Un)grabNotify
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>
2009-05-28 15:02:35 +10:00
Peter Hutterer
a7e23a79c1 Xi: Add support for Enter and FocusIn grabs.
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>
2009-05-27 14:40:58 +10:00
Peter Hutterer
b3463fd6a8 dix: convert window coordinates to FP1616 before calculating event_x/y
root_x/y are already in FP1616 at this point.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-27 13:54:19 +10:00