summaryrefslogtreecommitdiff
path: root/dix/events.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2009-08-21 16:03:36 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-09-04 12:59:41 +1000
commitbfb219f532f3c78ba905424365ee7c5f7b5f21a2 (patch)
tree82762cc287549124d1e04788b465525dc326aa3d /dix/events.c
parent3d988e01e41e98fc5160f825a250522ba274d09f (diff)
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>
Diffstat (limited to 'dix/events.c')
-rw-r--r--dix/events.c53
1 files changed, 47 insertions, 6 deletions
diff --git a/dix/events.c b/dix/events.c
index acc1803ef..62eb6c225 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1941,12 +1941,53 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
pEvents->u.u.detail = NotifyNormal;
}
}
- else
+ else if (type == DeviceMotionNotify)
{
- if ((type == DeviceMotionNotify) &&
- MaybeSendDeviceMotionNotifyHint
- ((deviceKeyButtonPointer*)pEvents, mask) != 0)
+ if (MaybeSendDeviceMotionNotifyHint((deviceKeyButtonPointer*)pEvents,
+ mask) != 0)
return 1;
+ } else if (type == KeyPress)
+ {
+ /* sequenceNumber == 1 if autorepeat is set */
+ if (pEvents->u.u.sequenceNumber)
+ {
+ if (!_XkbWantsDetectableAutoRepeat(client))
+ {
+ xEvent release = *pEvents;
+ release.u.u.type = KeyRelease;
+ release.u.u.sequenceNumber = client->sequence;
+ WriteEventsToClient(client, 1, &release);
+#ifdef DEBUG_EVENTS
+ ErrorF(" (plus fake core release for repeat)");
+#endif
+ } else
+ {
+#ifdef DEBUG_EVENTS
+ ErrorF(" (detectable autorepeat for core)");
+#endif
+ }
+ }
+
+ } else if (type == DeviceKeyPress)
+ {
+ if (((deviceKeyButtonPointer *)pEvents)->sequenceNumber)
+ {
+ if (!_XkbWantsDetectableAutoRepeat(client))
+ {
+ deviceKeyButtonPointer release = *(deviceKeyButtonPointer *)pEvents;
+ release.type = DeviceKeyRelease;
+ release.sequenceNumber = client->sequence;
+#ifdef DEBUG_EVENTS
+ ErrorF(" (plus fake xi1 release for repeat)");
+#endif
+ WriteEventsToClient(client, 1, (xEvent *) &release);
+ }
+ else {
+#ifdef DEBUG_EVENTS
+ ErrorF(" (detectable autorepeat for core)");
+#endif
+ }
+ }
}
type &= 0177;
@@ -5622,8 +5663,8 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
int i,
eventlength = sizeof(xEvent);
- if (!XkbFilterEvents(pClient, count, events))
- return;
+ /* Let XKB rewrite the state, as it depends on client preferences. */
+ XkbFilterEvents(pClient, count, events);
#ifdef PANORAMIX
if(!noPanoramiXExtension &&