summaryrefslogtreecommitdiff
path: root/Xi
AgeCommit message (Collapse)AuthorFilesLines
2010-05-28dix: add 3x3 transformation matrix xinput property for multi-head handlingPeter Korsgaard1-1/+3
For absolute input devices (E.G. touchscreens) in multi-head setups, we need a way to bind the device to an randr output. This adds the infrastructure to the server to allow us to do so. positionSprite() scales input coordinates to the dimensions of the shared (total) screen frame buffer, so to restrict motion to an output we need to scale/rotate/translate device coordinates to a subset of the frame buffer before passing them on to positionSprite. This is done here using a 3x3 transformation matrix, which is applied to the device coordinates using homogeneous coordinates, E.G.: [ c0 c1 c2 ] [ x ] [ c3 c4 c5 ] * [ y ] [ c6 c7 c8 ] [ 1 ] Notice: As input devices have varying input ranges, the coordinates are first scaled to the [0..1] range for generality, and afterwards scaled back up. E.G. for a dual head setup (using same resolution) next to each other, you would want to scale the X coordinates of the touchscreen connected to the both heads by 50%, and translate (offset) the coordinates of the rightmost head by 50%, or in matrix form: left: right: [ 0.5 0 0 ] [ 0.5 0 0.5 ] [ 0 1 0 ] [ 0 1 0 ] [ 0 0 1 ] [ 0 0 0 ] Which can be done using xinput: xinput set-prop <left> --type=float "Coordinate Transformation Matrix" \ 0.5 0 0 0 1 0 0 0 1 xinput set-prop <right> --type=float "Coordinate Transformation Matrix" \ 0.5 0 0.5 0 1 0 0 0 1 Likewise more complication setups involving more heads, rotation or different resolution can be handled. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-26Revert "Add a "flags" field to DeleteInputDeviceRequest."Keith Packard1-1/+1
Peter wants to get a larger patch sequence put together and I didn't read past the commit message to see the 'don't take this patch please'. This reverts commit 531ff40301975519af7b20109c17d296312d3f2b.
2010-05-25Add a "flags" field to DeleteInputDeviceRequest.Peter Hutterer1-1/+1
Some input drivers need to implement an internal hotplugging scheme for dependent devices to provide multiple X devices off one kernel device file. Such dependent devices can be added with NewInputDeviceRequest() but they are not removed when the config backend calls DeleteInputDeviceRequest(), leaving the original device to clean up. Example of the wacom driver: config/udev calls NewInputDeviceRequest("stylus") wacom PreInit calls NewInputDeviceRequest("eraser") NewInputDeviceRequest("pad") NewInputDeviceRequest("cursor") PreInit finishes. When the device is removed, the config backend only calls DeleteInputDeviceRequest for "stylus". The driver needs to call DeleteInputDeviceRequest for the dependent devices eraser, pad and cursor to clean up properly. However, when the server terminates, DeleteInputDeviceRequest is called for all devices - the driver must not remove the dependent devices to avoid double-frees. There is no method for the driver to detect why a device is being removed, leading to elaborate guesswork and some amount of wishful thinking. Though the input driver's UnInit already supports flags, they are unused. This patch uses the flags to supply information where the DeleteInputDeviceRequest request originates from, allowing a driver to selectively call DeleteInputDeviceRequest when necessary. Also bumps XINPUT ABI. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-19Return an appropriately-typed error from dixLookupResourceByType.Jamey Sharp3-4/+4
Rather than always returning BadValue, associate an error status like BadWindow with a resource type like RT_WINDOW, and return the appropriate one for the requested type. This patch only touches the core protocol resource types. Others still return BadValue and need to be mapped appropriately. dixLookupResourceByType can now return BadImplementation, if the caller asked for a resource type that has not been allocated in the server. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-13Eliminate boilerplate around client->noClientException.Jamey Sharp1-1/+1
Just let Dispatch() check for a noClientException, rather than making every single dispatch procedure take care of it. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-05-13Replace X-allocation functions with their C89 counterpartsMikhail Gusarov17-77/+77
The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-07Xi: 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>
2010-04-30Replace some input devPrivates with regular struct fieldsKeith Packard1-39/+24
In the process, fixes a memory leak in CloseDevice, and an unchecked memory allocation in InitializePredictableAccelerationProperties. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-04-21Xi: check for NULL pointer before dereferences it in ListButtonInfoTiago Vignatti1-1/+4
Both dev and dev->button are already used before their checking were being performed. So check on the beginning. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-04-21Xi: fix not reached code in XSendExtensionEventTiago Vignatti1-1/+2
Error was introduced in 31a7994a. I.e., broken since 2007. I guess nobody uses XSendExtensionEvent. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
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>