summaryrefslogtreecommitdiff
path: root/dix/events.c
AgeCommit message (Collapse)AuthorFilesLines
2009-09-26dix: plug memory leak in DeviceEnterLeaveEvents.Peter Hutterer1-1/+3
'event' must be freed before exiting. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit fd913136732ff14a0484ca28f60ac1fbf49be81d)
2009-09-22input: don't use typecasts to access members of InternalEvent.Peter Hutterer1-5/+5
To avoid confusion, the member names are now postfixed with _event. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-14dix: FindChildForEvent needs init child to None.Peter Hutterer1-1/+1
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-04dix: hide the sequenceNumber key repeat hack behind two functions.Peter Hutterer1-3/+5
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-04input: allow for detectable autorepeat.Daniel Stone1-6/+47
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-04dix: improve code flow in TryClientEvents, better debugging messages.Daniel Stone1-52/+66
Instead of a massive if (blah && blah), return early where possible. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24dix: FixUpEventFromWindow mustn't scramble non-device events.Peter Hutterer1-1/+4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17xace: fix access mode in dixLookupWindow call within ProcUngrabKey.Eamon Walsh1-1/+1
Referencing a window (as grab-window) only requires GetAttr access. Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-08-17dix: fix potential use of unused variable 'mask'.Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-14dix: update the sprite trace for all masters && floating slaves (#23257)Peter Hutterer1-1/+1
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-06dix: detach SD during XI2 grabs only.Peter Hutterer1-4/+7
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-06Revert "dix: Remove temporary detachment of slave devices."Peter Hutterer1-0/+66
This reverts commit 0c0ef42292f4c910c73b308cd75d77637312da53. Tested-by: Thomas Jaeger Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30dix: pass the sourceid around for enter/leave events.Peter Hutterer1-9/+14
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-30xkb: move XkbFilterEvents to xkbsrv.hPeter Hutterer1-3/+0
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-22dix: fix null-pointer dereference on activating enter/focus grabs.Peter Hutterer1-1/+10
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-22dix: use the event mask of the grab for TryClientEvents.Peter Hutterer1-2/+5
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-22input: remove XI2 keysym grabs, use keycode grabs instead.Peter Hutterer1-3/+0
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-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-14dix: switch to byte-counting functions.Peter Hutterer1-2/+2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-12dix: Remove temporary detachment of slave devices.Peter Hutterer1-66/+0
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-06-23Xi: check for Use permission on the device in SetClientPointer().Eamon Walsh1-4/+8
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-12input: remove un-used "setter" argument from SetClientPointer.Peter Hutterer1-3/+2
It's obsolete, not likely to come back, let's drop it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-07dix: set the generic event type for implicit XI2 grabs.Peter Hutterer1-0/+3
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-04xace: fix a bad send access hook call.Eamon Walsh1-1/+1
2009-06-03dix: use GetMaster in PickPointer and PickKeyboard.Peter Hutterer1-3/+2
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-03dix: rework event conversion before delivery.Peter Hutterer1-159/+131
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-02dix: ensure EventIsDeliverable has inputMasks set at all times.Peter Hutterer1-2/+2
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-02input: add support for XIAllDevices and XIAllMasterDevices passive grabs.Peter Hutterer1-0/+12
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-02dix: get the current MD keyboard for the grab modifier state.Peter Hutterer1-0/+10
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-02dix: float slave devices during passive grabs.Peter Hutterer1-6/+8
Exception - implicit passive grabs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02dix: rework temporary slave detachment.Peter Hutterer1-29/+26
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-02dix: move grab device assignment into GRABTYPE_CORE block.Peter Hutterer1-13/+14
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-02dix: don't try to activate a passive grab on top of an active one.Peter Hutterer1-0/+3
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-01input: Add grabtype to GrabParameters.Peter Hutterer1-0/+2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-01dix: ensure implicit passive grabs have the xi2mask zeroed.Peter Hutterer1-0/+1
This fixes XI2 enter/leave events being sent to non-xi2 clients. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-29dix: Set the implicit passive grab flag for keyboards too.Peter Hutterer1-0/+1
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-29dix: fix broken XI event delivery during grabs.Peter Hutterer1-0/+3
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-29dix: init inputMasks to NULL to avoid random value dereference.Peter Hutterer1-1/+1
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-28Merge branch 'master' into xi2Peter Hutterer1-14/+14
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-28Xi: Send Enter or Leave events with XIPassive(Un)grabNotifyPeter Hutterer1-10/+25
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-17/+105
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-27dix: convert window coordinates to FP1616 before calculating event_x/yPeter Hutterer1-2/+2
root_x/y are already in FP1616 at this point. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-27dix: take grabs into account for XI_Enter/Leave events.Peter Hutterer1-7/+9
2009-05-27dix: set the right grab event type for implicit passive grabs.Peter Hutterer1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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: remove nested union from InternalEvent.Peter Hutterer1-16/+16
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-17/+24
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-19dix/events.c: Use wClient where appropriate.Eamon Walsh1-4/+3
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-05-19xace: Fix a bad device access hook call.Eamon Walsh1-3/+3
Add a proper access mode, and reverse the logic of the return value. Zero ("Success") is returned on success from the hook calls. Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>