summaryrefslogtreecommitdiff
path: root/hw/dmx
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-04-03 11:21:50 -0600
committerBrian <brian@yutani.localnet.net>2007-04-03 11:21:50 -0600
commite1dea151db6405e12d991feacba9446320739ee8 (patch)
tree6783611c79ae86f9f15615553813d2dc7344ae5c /hw/dmx
parent0ee40c935750e25a9e178cdd70f6b2c667e79344 (diff)
Implement a minor hack in dmxCheckFunctionKeys() to detect special keys.
Keep track of status of (left) alt/ctrl keys so that ctrl-alt-q to exit can be detected. Not ideal, but works for now.
Diffstat (limited to 'hw/dmx')
-rw-r--r--hw/dmx/input/dmxevents.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index e4d556b07..4810b17bb 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -103,17 +103,36 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
{
DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
unsigned short state = 0;
-
+
+#if 1 /* hack to detect ctrl-alt-q, etc */
+ static int ctrl = 0, alt = 0;
+ /* keep track of ctrl/alt key status */
+ if (type == KeyPress && keySym == 0xffe3) {
+ ctrl = 1;
+ }
+ else if (type == KeyRelease && keySym == 0xffe3) {
+ ctrl = 0;
+ }
+ else if (type == KeyPress && keySym == 0xffe9) {
+ alt = 1;
+ }
+ else if (type == KeyRelease && keySym == 0xffe9) {
+ alt = 0;
+ }
+ if (!ctrl || !alt)
+ return 0;
+#else
if (dmxLocal->sendsCore)
state = dmxLocalCoreKeyboard->pDevice->key->state;
else if (dmxLocal->pDevice->key)
state = dmxLocal->pDevice->key->state;
- ErrorF/*DMXDBG3*/("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
+ DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
keySym, type == KeyPress ? "press" : "release", state);
if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
return 0;
+#endif
switch (keySym) {
case XK_g:
@@ -679,7 +698,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
xE.u.u.detail = dmxFixup(pDev, detail, keySym);
events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
- ErrorF("KEY %d sym %d\n", detail, (int) keySym);
+ /*ErrorF("KEY %d sym %d\n", detail, (int) keySym);*/
nevents = GetKeyboardEvents(events, p, type, detail);
for (i = 0; i < nevents; i++)
mieqEnqueue(p, events + i);