summaryrefslogtreecommitdiff
path: root/dix
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
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')
-rw-r--r--dix/eventconvert.c7
-rw-r--r--dix/events.c53
2 files changed, 54 insertions, 6 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 07a8e5fb9..69d2f1fec 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -90,6 +90,8 @@ EventToCore(InternalEvent *event, xEvent *core)
core->u.keyButtonPointer.rootX = e->root_x;
core->u.keyButtonPointer.rootY = e->root_y;
core->u.keyButtonPointer.state = e->corestate;
+ if (e->type == ET_KeyPress && e->key_repeat)
+ core->u.u.sequenceNumber = 1;
}
break;
case ET_ProximityIn:
@@ -237,6 +239,8 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
kbp->root_y = ev->root_y;
kbp->deviceid = ev->deviceid;
kbp->state = ev->corestate;
+ if (ev->type == ET_KeyPress && ev->key_repeat)
+ kbp->sequenceNumber = 1;
if (num_events > 1)
kbp->deviceid |= MORE_EVENTS;
@@ -528,6 +532,9 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
xde->root_x = FP1616(ev->root_x, ev->root_x_frac);
xde->root_y = FP1616(ev->root_y, ev->root_y_frac);
+ if (ev->key_repeat)
+ xde->flags |= XIKeyRepeat;
+
xde->mods.base_mods = ev->mods.base;
xde->mods.latched_mods = ev->mods.latched;
xde->mods.locked_mods = ev->mods.locked;
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 &&