summaryrefslogtreecommitdiff
path: root/Xi
AgeCommit message (Collapse)AuthorFilesLines
2010-06-11Xi: don't copy the modifier key count when copying device classes (#25480)Peter Hutterer1-4/+0
The modifier key count is maintained by the XKB layer and increased/decreased for all modifiers that set state. Test case, MD/SD modifier key count in comment: 1. keyboard 1: press and hold Shift_L # SD:1 MD:1 2. keyboard 2: press and release Shift_L # SD:1,0 MD:1,0 <class copy happens> # SD:1 MD:1 3. keyboard 1: release Shift_L # SD:0 MD:1 4. keyboard 1: press and release Shift_L # SD:1,0 MD:2,1 The modifier is now logically down on the MD but not on keyboard 1 or keyboard 2. XKB is layered in before the DIX, it increases/decreases the modifier key count accordingly. In the above example, during (2), the MD gets the key release and thus clears the modifier bit. (3) doesn't forward the release to the MD because it is already cleared. The copy of modifierKeysDown when the lastSlave changes however increases the counter for the held key. On (4), the press and release are both forwarded to the MD, causing a offset by 1 and thus do not clear the logical modifier state. X.Org Bug 25480 <http://bugs.freedesktop.org/show_bug.cgi?id=25480> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Daniel Stone <daniel@fooishbar.org> (cherry picked from commit dc614484f93b67e8b62dbb1bb2fd247fe5a4c850)
2010-05-18Xi: reset the known properties at the end of the server generation.Peter Hutterer3-0/+13
Properties allocated through XIGetKnownProperty() aren't reset on the second server generation but keep the old value. As a result, wrong Atoms are supplied to the driver, resulting in potential data corruption or weird error message. Reproducible by running "xlsatom | grep FLOAT" twice on a plain X server. The second X server generation won't have the FLOAT atom defined anymore, despite the users of this atom not noticing any errors. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Keith Packard <keithp@keithp.com> (cherry picked from commit 9802839d35aaf788790f1d0e8300db4693a70096)
2010-03-12Record: Avoid duplicates from replaying frozen eventsDaniel Stone1-1/+1
Reintroduce a check which used to be there in the old ProcessKeyboardEvent/ProcessPointerEvent codepath, which avoids us recording events subject to a grab twice: once when it's first processed in EnqueueEvent, and then again when it's thawed and being replayed. This required a tiny amount of code motion to expose syncEvents. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-02-22Xi: assume BadMode for non-BadMatch errors returned from SetDeviceMode.Peter Hutterer1-0/+10
The XI protocol spec only allows for two errors on the SetDeviceMode requests: BadMatch or BadMode. BadMode however is a dynamically assigned extension error and the driver doesn't have access to the actual error number. Hence, if a SetDeviceMode driver returns an error other than BadMatch, assume BadMode. The two exceptions are BadAlloc and BadImplementations, pass these on to the client (any request is allowed to return either of those). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-02-22Re-enable RECORD extension.Chris Dekter1-5/+8
RECORD was disabled during the switch to internal events. This patch modifies the record callback to work with internal events instead of xEvents. The InternalEvents are converted to core/Xi events as needed. Since record is a loadable extension, the EventTo* calls must be externed. Signed-off-by: Chris Dekter <cdekter@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-02-15Xi: reset the sli pointers after copying device classes. (#25640)Peter Hutterer1-0/+20
If the indicator flags have the XkbSLI_IsDefault bit set, the indicator map and names aren't their own bit of memory but rather point into the device->key->xkbInfo->desc structure. XkbCopySrvLedInfo knows about this and leaves the pointers alone. When copying the classes from the slave to the master, these pointers are copied and still point to the dev->key class of the slave device. If the slave device is removed, the memory becomes invalid and a call to modify this data (e.g. XkbSetIndicators) may cause a deadlock. The copying of dev->key relies on dev->kbdfeed to be already set up. Hence the pointers need to be reset once _both_ kbdfeed and key have been copied into the master device. X.Org Bug 25640 <http://bugs.freedesktop.org/show_bug.cgi?id=25640> Fedora Bug 540584 <https://bugzilla.redhat.com/show_bug.cgi?id=540584> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-02-09Add labels for multitouch valuatorsBenjamin Tissoires1-0/+11
Thoses definitions have been included in the kernel but the X server is not updated accordingly. Without these definitions, the multitouch axes are not correctly labelled. Signed-off-by: Benjamin Tissoires <tissoire@cena.fr> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-22config: Introduce InputAttributes in NewInputDeviceRequestDan Nicholson1-1/+2
In order to give NewInputDeviceRequest more information, a new InputAttributes type is introduced. Currently, this collects the product and vendor name, device path, and sets booleans for attributes such as having keys and/or a pointer. Only the HAL backend fills in the attributes, though. Signed-off-by: Dan Nicholson <dbn.lists@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
2009-12-18Add type name argument to CreateNewResourceTypeAlan Coopersmith1-3/+2
Convert all calls of CreateNewResourceType to pass name argument Breaks DIX ABI. ABI versions bumped: Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-12-18Check for failures from CreateNewResourceTypeAlan Coopersmith1-0/+2
Make sure to check return value before setting bitmask flags. For most calls, just fails to init the extension. Since Xinput already calls FatalError() on initialization failure, so does failure to allocate Xinput's resource type. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2009-12-11Xi: reset device properties to NULL after deleting them. (#25374)Peter Hutterer1-0/+2
Commit 0e6cee853d8e5bef3274e632ef034d37f14674a9 introduced cleanup code to remove the accel properties when switching schemes. The same code is triggered by the default closedown code but only after unconditionally removing all device properties (as part of the cleanup). The properties, although deleted never got reset to NULL. X.Org Bug 25374 <http://bugs.freedesktop.org/show_bug.cgi?id=25374> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Andy Furniss <lists@andyfurniss.entadsl.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
2009-11-25Xi: when deleting all properties, reset property handler to NULL.Peter Hutterer1-0/+2
Trying to unregister property handlers during the device closure process leads to invalid memory accesses. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2009-11-22Xi: don't crash when deleting invalid device properties.Peter Hutterer1-0/+3
Deleting a property that was not set on a device leads to a null-pointer reference. The protocol allows deleting those properties - it has to be a noop. Reproducible: xinput --set-prop "My device" --type=int --format=8 "my property" 1 xinput --delete-prop "My other device" "my property" Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-10-14xace: Fake return values on denials in input polling requests.Eamon Walsh3-22/+41
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-09-27Xi: Make CopyKeyClass X_HIDDEN to avoid ugly ifdef-fuJeremy Huddleston1-3/+0
(cherry picked from commit 6d436e17a9ae7f4ce8537f3fabc052d4f07ca75f)
2009-09-26Xi: CopyKeyClass is not static for XQuartzJeremy Huddleston1-1/+4
(cherry picked from commit 85d6402354cdf143c6490f2725744c2f08b5605b)
2009-09-26Xi: update axisVals with the right subpixel data.Peter Hutterer1-1/+1
Subpixel data in data_frac is stored as FP32.32, hence we need to get that down again before adding it to the current value. Reported-by: Thomas Jaeger Tested-by: Thomas Jaeger Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-25Xi: fix length calculation for ValuatorState in QueryDeviceState reply.Peter Hutterer1-1/+1
The length field needs to include the bytes required for the valuators (INT32) as well. The reply length has the right value and since the valuator state is always last, clients didn't notice the wrong offset. Tested-by: Thomas Jaeger Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22input: don't use typecasts to access members of InternalEvent.Peter Hutterer1-2/+2
To avoid confusion, the member names are now postfixed with _event. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-21input: define server-supported protocol versions in one single file.Peter Hutterer1-5/+5
include/protocol-versions.h specifies each extension version as supported by the server and sent back on the wire to the client. This fixes up several issues with the server potentially reporting a higher version of the protocol if recompiled against a newer version of the protocol. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: RĂ©mi Cardona <remi@gentoo.org> Acked-by: Julien Cristau <jcristau@debian.org>
2009-09-04input: allow for detectable autorepeat.Daniel Stone1-1/+2
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-03Xi: return BadDevice for master kbds and attached slaves in XIWarpPointerPeter Hutterer1-0/+7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03Xi: return error values to client from XIWarpPointer.Peter Hutterer1-0/+5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03Xi: standardise XI2 headers.Peter Hutterer7-8/+33
Adding missing dix-config.h include, adding one missing header guard. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03Xi: if XISetEventMask fails, return this to the client.Peter Hutterer2-3/+8
The only failure point can be a BadAlloc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03Xi: fix broken swap code in XISelectEvents request processing.Peter Hutterer1-1/+1
The pointer advanced 12 bytes too short. Rather unfortunate if both the code and the test have the same bug. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03Xi: Unify checking for invalid bits in grab masks.Peter Hutterer3-19/+31
Bits above XI2LASTEVENT are invalid and cause in BadValues. These checks must be performed anywhere where a mask_len parameter is given. This patch also adds the missing checks to grab masks. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03Xi: don't overrun memory for grab masks.Peter Hutterer2-2/+6
A grab mask provided in the request may be larger than the one used in the server. Cut down to size before memcopying. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03Xi: don't try to set oversized or non-existing masks.Peter Hutterer1-3/+6
Fixes crash if the first XISelectEvents has a zero sized event mask. Fixes crash if the mask provided is larger than others->xi2mask[]. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03Xi: extra length checking for requests providing masks.Peter Hutterer1-0/+11
masks can be of arbitrary length. If the client did not initialize mask_len, some sort of boundary check is needed to avoid running over memory. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-01Input: Mark Xi input events as criticalDaniel Stone1-0/+5
Note that the Xi events are critical and should thus cause a flush to the client when an input event is pending. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-09-01Xi: Fix harmless ButtonPress/ButtonRelease confusionDaniel Stone1-0/+1
A missing break meant that ButtonPress would fall through into ButtonRelease, but luckily it appears to have been completely harmless. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-08-31Xi: silence compiler warning "type may be used uninitialized"Peter Hutterer1-2/+2
GrabKey and GrabButton are only called from XI/XI2 code. Set type to -1, just in case. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-27Xext: rename Xtst* to XTest*Peter Hutterer2-34/+34
This patch corrects a misnaming of XTest-related functions. The extension itself announces itself as XTEST. Xtst is the library name itself, but all library functions are prefixed by XTest. Same with the naming in the server. - Rename all *Xtst* functions to *XTest* for consistency with the library and in-server API. - Rename the "Xtst device" property to "XTEST device" for consistency with the extension naming. - Rename the device naming to "<master device name> XTEST device". The default xtest devices become "Virtual core XTEST pointer" and "Virtual core XTEST keyboard". Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-25Xi: fix XIWarpPointer up for FP3232 as input coordinates.Peter Hutterer1-10/+17
requires inputproto 1.9.99.902 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-25Xi: fix swapping for XIWarpPointer and XIChangeCursor requests.Peter Hutterer2-0/+12
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24input: move CorePointer/KeyboardProc declarations into header.Peter Hutterer1-4/+0
The extern declaration in xichangehierarchy.c was broken anyway. This fixes a crash on creating a new master device. Reported-by: Maxim Levitsky Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24Xi: add swapping hook for XIGetFocus reply.Peter Hutterer3-0/+13
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24Xi: correct length field for XIQueryPointer reply.Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24Xi: allow XIQueryPointer requests for master pointers and floating slaves.Peter Hutterer1-10/+19
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24Xi: fix swapping for XIQueryPointer request/reply handling.Peter Hutterer1-2/+14
buttons_size is necessary as WriteToClient swaps the buttons_len field, resulting in the wrong number of bytes being written later. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24Xi: return deviceid as error value in XIQueryPointer.Peter Hutterer1-0/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24Xi: return BadDevice for changing device cursors on non-master pointers.Peter Hutterer1-0/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17dix: rework DeviceChangedEvents a bit.Peter Hutterer1-9/+17
DCEs are now processed when sent throught the master device, not when sent through the slave device. This includes a removal of some un-used (or partly used) fields in the DCE itself to something more self-explanatory. TODO: if a device has events queued and its attachment is changed, the DCE is silently dropped now. Instead, it should be generated as soon as the first event after the attachment is sent. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17input: move DeviceChangedEvent conversion into eventconvert.cPeter Hutterer1-118/+5
The version in eventconvert.c was half broken and for some reason we ended up with a second version in exevents.c (which works). Move it over to where it belongs and call EventToXI2 instad of having a custom function for it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13Xi: fix up broken DeviceChangedEvent swapping codePeter Hutterer1-13/+20
2009-08-13Xi: add event swapping for XIRawEvents.Peter Hutterer1-0/+49
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13Xi: fix event swapping for XIDeviceEvents.Peter Hutterer1-5/+13
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13Xi: un-statify XI2EventSwap, it is needed for tests.Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13Xi: get device changed data from DeviceChangedEvents, not the device (#23100)Peter Hutterer1-3/+66
If a new device posts an event while the DCE is in the queue, getting the data from the device may result in invalid memory access. X.Org Bug 23100 <http://bugs.freedesktop.org/show_bug.cgi?id=23100>