xserver: Branch 'master'

Brian Paul brianp at kemper.freedesktop.org
Tue Apr 3 20:21:54 EEST 2007


 hw/dmx/input/dmxevents.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

New commits:
diff-tree e1dea151db6405e12d991feacba9446320739ee8 (from 0ee40c935750e25a9e178cdd70f6b2c667e79344)
Author: Brian <brian at yutani.localnet.net>
Date:   Tue Apr 3 11:21:50 2007 -0600

    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.

diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index e4d556b..4810b17 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -103,17 +103,36 @@ static int dmxCheckFunctionKeys(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
             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);



More information about the xorg-commit mailing list