summaryrefslogtreecommitdiff
path: root/Xi/exevents.c
AgeCommit message (Collapse)AuthorFilesLines
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 Gusarov1-27/+27
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-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-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-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>
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-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-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: if XISetEventMask fails, return this to the client.Peter Hutterer1-2/+5
The only failure point can be a BadAlloc. 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-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-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: 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>
2009-07-30Xi: set the sourceid for focus devices to the device id.Peter Hutterer1-1/+1
Unlike Enter/Leave events generated by a device pushing the pointer around, a device doesn't change focus all by itself. It's a result of a SetInputFocus call, a window becoming unviewable or a grab activating. As such, the sourceid for focus events is always the deviceid itself. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30input: switch internal event types to enums.Peter Hutterer1-0/+6
Use enum EventType instead of ints. This requires a load of default cases in various switch statements to silence compiler warnings. Reported-by: Aaron Plattner Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30include: untangle events.h from the SDK headers.Peter Hutterer1-0/+1
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-15Update to type-specific raw events - require inputproto 1.9.99.14.Peter Hutterer1-1/+5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14Xi: use byte-counting macros instead of manual calculation.Peter Hutterer1-5/+5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-12input: include effective modifiers in device events.Peter Hutterer1-0/+4
Require inputproto 1.9.99.13 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-23Xi: fix up access modes for calls to dixLookupDevice().Eamon Walsh1-1/+1
New access modes are being passed to the device access hook for XI2: DixCreateAccess for creating a new master device; DixAdd/RemoveAccess for attaching/removing slave devices to a master; and DixListProp/GetProp/SetPropAccess for device properties. Refer to the XACE-Spec document in xorg-docs, section "Device Access." Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-06-18input: unify button numbers on master devices.Peter Hutterer1-6/+5
Master devices provide the union of all attached slave devices' buttons, i.e. the number of buttons on the master device is always the number of buttons of the slave device with the highest number of buttons. When slaves are attached or detached, the master device adjusts the button number to reflect the new buttons. On a slave switch, this slave's button labels are copied into the master (up to slave->num_buttons). The remaining button labels (if any) stay as they are. Thus, if any of the higher buttons is still pressed, it reflects the label of the last pressed device that provided this button. If two devices press the same button and it is differently labelled the last pressed one will be reflected in the master device. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18Xi: copy the valuator mode from SD to MD.Peter Hutterer1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18input: Add labels to buttons and valuators - ABI_XINPUT_VERSION 7Peter Hutterer1-1/+2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18input: change axisVal from uint to double.Peter Hutterer1-2/+3
With subpixel support, uint just doesn't cut it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18Xi: last_valuator is used like an index, so range it accordingly.Peter Hutterer1-2/+2
The previous code would always skip the last valuator due to a wrong upper boundary in the loop. last_valuator is the index of the last set valuator - which also means it must be initialized to -1, not 0. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18Xi: Motion events update the device state too.Peter Hutterer1-0/+1
Without this line the device's axis values don't get updated properly for pure motion events. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18Xi: include button state in XIButtonInfo.Peter Hutterer1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-17Xi: Add support for sourceid in the device classes.Peter Hutterer1-0/+9
2009-06-17Xi: namespace XI2 files.Peter Hutterer1-1/+1
Some files (notably those merged with MPX before XI2 came along) didn't use a 'xi' prefix. This patch changes all of them to meaningful names. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-11Xi: XISetEventMask needs to clear the mask if len is 0Peter Hutterer1-1/+4
zero-length masks are supposed to clear the device's mask. ProcXISelectEvents passes these masks through directly, so we need to clear the bits here if such a mask is supplied. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02dix: protect against floating slaves in DeviceFocusEvent.Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02input: add support for XIAnyModifier in passive XI2 grabs.Peter Hutterer1-1/+4
2009-06-01input: Add grabtype to GrabParameters.Peter Hutterer1-0/+8
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-28Xi: Send Enter or Leave events with XIPassive(Un)grabNotifyPeter Hutterer1-5/+5
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-27Xi: Add support for Enter and FocusIn grabs.Peter Hutterer1-6/+58
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-27Xi: fix an inputInfo.keyboard usage.Peter Hutterer1-4/+8
In the case of a RevertToFollowKeyboard, the master device should be used (since this is the closest equivalent to the VCK as before). Only if the master keyboard is the same as the device, revert to the VCK itself.
2009-05-27Xi: only deactivate passive grabs if the event type matches.Peter Hutterer1-3/+10
This didn't use to be a problem when devices could only be pointers or keyboards, not both. Nowadays, slave devices may have both buttons and keyboards, and in this case we don't want to deactivate a passive keyboard grab when a button release is detected.
2009-05-22input: allow for master pointers to not have a button class.Peter Hutterer1-2/+2
There's devices (e.g. some barcode readers) that have axes but no buttons. When such a device sends a motion event, the valuator and button class is copied into the master pointer (i.e. removing the button class). So we need a couple of extra sanity checks for the button class to exist. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22input: introduce partial class copying depending on the event.Peter Hutterer1-132/+154
Copying all classes into the master device has drawbacks for hybrid devices (devices that are both mice and keyboards). If such a device posts an event, it's key classes are moved into the VCP. The key event itself is unaffected by keyboard grabs and the like. Partial class copying copies depending on the event and copies the classes into the right master device (i.e. the VCK for key events, the VCP for pointer events). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22input: remove nested union from InternalEvent.Peter Hutterer1-2/+2
There's no need for internal events to be a struct with a single nested union, we might as well make the union itself the InternalEvent. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22Input: rename DeviceIntRec->isMaster to ->type.Peter Hutterer1-5/+5
isMaster is not enough as long as we differ between master pointers and keyboard. With flexible device classes, the usual checks for whether a master device is a pointer (currently check for ->button, ->valuators or ->key) do not work as an SD may post an event through a master and mess this check up. Example, a device with valuators but no buttons would remove the button class from the VCP and thus result in the IsPointerDevice(inputInfo.pointer) == FALSE. This will become worse in the future when new device classes are introduced that aren't provided in the current system (e.g. a switch class). This patch replaces isMaster with "type", one of SLAVE, MASTER_POINTER and MASTER_KEYBOARD. All checks for dev->isMaster are replaced with an IsMaster(dev).
2009-05-22Split the signal-handler's lastSlave out into a separate variable.Peter Hutterer1-1/+0
dev->u.lastSlave was not signal safe since it was accessed by the DIX and during signal handling. Replaced with: 'dev->last.slave' for the signal handler's lastSlave (used to generate DeviceChangedEvents), . 'dev->u.lastSlave' for the DIX lastSlave (currently only used in change_modmap) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-08input: update to inputproto 1.9.99.8 XI2 defines.Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-06Xi: add GrabButton and GrabKeysym code.Peter Hutterer1-10/+24
We don't do keycode grabs in XI2, they're pointless.
2009-05-06Xi: access the prev_state to get group/modifier state for key events.Peter Hutterer1-7/+14
Key events may change the modifier state, so we need to get the prev_state for those (i.e. without the changes by the event already applied). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>