diff options
author | marha <marha@users.sourceforge.net> | 2009-09-15 10:39:59 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-15 10:39:59 +0000 |
commit | a233ed27754bb0d373d63569d9a28aeb8fee5b82 (patch) | |
tree | 2732a9434bbc102653dc22df9887d94e19570836 /xorg-server/hw/dmx/input | |
parent | a915739887477b28d924ecc8417ee107d125bd6c (diff) | |
download | vcxsrv-a233ed27754bb0d373d63569d9a28aeb8fee5b82.tar.gz vcxsrv-a233ed27754bb0d373d63569d9a28aeb8fee5b82.tar.bz2 vcxsrv-a233ed27754bb0d373d63569d9a28aeb8fee5b82.zip |
Checked in xorg-server-1.6.99.901
Diffstat (limited to 'xorg-server/hw/dmx/input')
-rw-r--r-- | xorg-server/hw/dmx/input/Makefile.am | 2 | ||||
-rw-r--r-- | xorg-server/hw/dmx/input/Makefile.in | 55 | ||||
-rw-r--r-- | xorg-server/hw/dmx/input/dmxcommon.c | 1 | ||||
-rw-r--r-- | xorg-server/hw/dmx/input/dmxeq.c | 295 | ||||
-rw-r--r-- | xorg-server/hw/dmx/input/dmxeq.h | 43 | ||||
-rw-r--r-- | xorg-server/hw/dmx/input/dmxevents.c | 205 | ||||
-rw-r--r-- | xorg-server/hw/dmx/input/dmxinputinit.c | 31 | ||||
-rw-r--r-- | xorg-server/hw/dmx/input/lnx-keyboard.c | 17 | ||||
-rw-r--r-- | xorg-server/hw/dmx/input/usb-keyboard.c | 13 |
9 files changed, 160 insertions, 502 deletions
diff --git a/xorg-server/hw/dmx/input/Makefile.am b/xorg-server/hw/dmx/input/Makefile.am index 47dbd967b..185aaf84e 100644 --- a/xorg-server/hw/dmx/input/Makefile.am +++ b/xorg-server/hw/dmx/input/Makefile.am @@ -41,8 +41,6 @@ DMXSRCS = dmxinputinit.c \ dmxxinput.c \ dmxmotion.c \ dmxmotion.h \ - dmxeq.c \ - dmxeq.h \ dmxmap.c \ dmxmap.h diff --git a/xorg-server/hw/dmx/input/Makefile.in b/xorg-server/hw/dmx/input/Makefile.in index aba7574db..9104ced27 100644 --- a/xorg-server/hw/dmx/input/Makefile.in +++ b/xorg-server/hw/dmx/input/Makefile.in @@ -57,6 +57,12 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru +AM_V_AR = $(am__v_AR_$(V)) +am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY)) +am__v_AR_0 = @echo " AR " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ libdmxinput_a_AR = $(AR) $(ARFLAGS) libdmxinput_a_LIBADD = am__libdmxinput_a_SOURCES_DIST = ChkNotMaskEv.c ChkNotMaskEv.h \ @@ -67,7 +73,7 @@ am__libdmxinput_a_SOURCES_DIST = ChkNotMaskEv.c ChkNotMaskEv.h \ dmxconsole.c dmxconsole.h dmxcommon.c dmxcommon.h \ dmxinputinit.c dmxinputinit.h dmxarg.c dmxarg.h dmxsigio.c \ dmxsigio.h dmxevents.c dmxevents.h dmxxinput.c dmxmotion.c \ - dmxmotion.h dmxeq.c dmxeq.h dmxmap.c dmxmap.h + dmxmotion.h dmxmap.c dmxmap.h @DMX_BUILD_LNX_TRUE@am__objects_1 = lnx-keyboard.$(OBJEXT) \ @DMX_BUILD_LNX_TRUE@ lnx-ms.$(OBJEXT) lnx-ps2.$(OBJEXT) @DMX_BUILD_USB_TRUE@am__objects_2 = usb-keyboard.$(OBJEXT) \ @@ -77,7 +83,7 @@ am__objects_3 = dmxdummy.$(OBJEXT) dmxbackend.$(OBJEXT) \ dmxconsole.$(OBJEXT) dmxcommon.$(OBJEXT) am__objects_4 = dmxinputinit.$(OBJEXT) dmxarg.$(OBJEXT) \ dmxsigio.$(OBJEXT) dmxevents.$(OBJEXT) dmxxinput.$(OBJEXT) \ - dmxmotion.$(OBJEXT) dmxeq.$(OBJEXT) dmxmap.$(OBJEXT) + dmxmotion.$(OBJEXT) dmxmap.$(OBJEXT) am_libdmxinput_a_OBJECTS = ChkNotMaskEv.$(OBJEXT) $(am__objects_1) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) libdmxinput_a_OBJECTS = $(am_libdmxinput_a_OBJECTS) @@ -87,10 +93,22 @@ am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libdmxinput_a_SOURCES) DIST_SOURCES = $(am__libdmxinput_a_SOURCES_DIST) ETAGS = etags @@ -101,9 +119,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_MAKEFLAGS = @AM_MAKEFLAGS@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ -APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ @@ -192,6 +210,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LAUNCHD_ID_PREFIX = @LAUNCHD_ID_PREFIX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ @@ -425,8 +444,6 @@ DMXSRCS = dmxinputinit.c \ dmxxinput.c \ dmxmotion.c \ dmxmotion.h \ - dmxeq.c \ - dmxeq.h \ dmxmap.c \ dmxmap.h @@ -485,9 +502,9 @@ $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libdmxinput.a: $(libdmxinput_a_OBJECTS) $(libdmxinput_a_DEPENDENCIES) - -rm -f libdmxinput.a - $(libdmxinput_a_AR) libdmxinput.a $(libdmxinput_a_OBJECTS) $(libdmxinput_a_LIBADD) - $(RANLIB) libdmxinput.a + $(AM_V_at)-rm -f libdmxinput.a + $(AM_V_AR)$(libdmxinput_a_AR) libdmxinput.a $(libdmxinput_a_OBJECTS) $(libdmxinput_a_LIBADD) + $(AM_V_at)$(RANLIB) libdmxinput.a mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -501,7 +518,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxcommon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxconsole.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxdummy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxeq.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxevents.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxinputinit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxmap.Po@am__quote@ @@ -517,22 +533,25 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-other.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< diff --git a/xorg-server/hw/dmx/input/dmxcommon.c b/xorg-server/hw/dmx/input/dmxcommon.c index 2bffb17e7..8c8cefa53 100644 --- a/xorg-server/hw/dmx/input/dmxcommon.c +++ b/xorg-server/hw/dmx/input/dmxcommon.c @@ -264,7 +264,6 @@ void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) dmxCommonSaveState(priv); if (priv->xkb) { - info->names.keymap = NULL; #define NAME(x) \ priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL info->names.keycodes = NAME(keycodes); diff --git a/xorg-server/hw/dmx/input/dmxeq.c b/xorg-server/hw/dmx/input/dmxeq.c deleted file mode 100644 index 33e8771c9..000000000 --- a/xorg-server/hw/dmx/input/dmxeq.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * - * Copyright 1990, 1998 The Open Group - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of The Open Group shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - -/* - * dmxeq.c is derived from mi/mieq.c so that XInput events can be handled - * - * Modified by: Rickard E. (Rik) Faith <faith@redhat.com> - * - * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation on the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** \file - * This file provides an event queue that knows about XInput events. - * All of the code is based on mi/mieq.c and was modified as little as - * possible to provide XInput event support (the copyright and some of - * the comments are from The Open Group, Keith Packard, MIT X - * Consortium). (Another example of similar code is provided in - * hw/xfree86/common/xf86Xinput.c.) */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_EQ_DEBUG 0 - -#include "dmx.h" -#include "dmxeq.h" -#include "dmxinput.h" -#include "dmxlog.h" -#include "dmxdpms.h" - -#include "inputstr.h" -#include "scrnintstr.h" /* For screenInfo */ - -#include <X11/extensions/XIproto.h> - -#if DMX_EQ_DEBUG -#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) -#else -#define DMXDBG2(f,a,b) -#define DMXDBG5(f,a,b,c,d,e) -#endif - -/** The size of our queue. (The queue provided by mi/mieq.c has a size - * of 256.) */ -#define QUEUE_SIZE 256 - -/** Information about the event. */ -typedef struct _Event { - xEvent event; /**< Event. */ - ScreenPtr pScreen; /**< Screen on which event occurred. */ - deviceValuator valuator; /**< XInput device valuator information. */ - DeviceIntPtr pDev; -} EventRec, *EventPtr; - -/** Event queue. */ -typedef struct _EventQueue { - HWEventQueueType head; /**< Queue head; must be long for SetInputCheck. */ - HWEventQueueType tail; /**< Queue tail; must be long for SetInputCheck. */ - CARD32 lastEventTime; /**< To avoid time running backwards. */ - Bool lastMotion; /**< True if last event was motion. */ - EventRec events[QUEUE_SIZE]; /**< Static allocation for signals. */ - DevicePtr pKbd, pPtr; /**< Device pointers (to get funcs) */ - ScreenPtr pEnqueueScreen;/**< Screen events are delivered to. */ - ScreenPtr pDequeueScreen;/**< Screen events are dispatched to. */ -} EventQueueRec, *EventQueuePtr; - -static EventQueueRec dmxEventQueue; -static Bool dmxeqInitializedFlag = FALSE; - -Bool dmxeqInitialized(void) -{ - return dmxeqInitializedFlag; -} - -Bool dmxeqInit(DevicePtr pKbd, DevicePtr pPtr) -{ - static unsigned long dmxGeneration = 0; - - if (dmxGeneration == serverGeneration && dmxeqInitializedFlag) - return FALSE; - dmxGeneration = serverGeneration; - dmxeqInitializedFlag = TRUE; - dmxEventQueue.head = 0; - dmxEventQueue.tail = 0; - dmxEventQueue.lastEventTime = GetTimeInMillis(); - dmxEventQueue.pKbd = pKbd; - dmxEventQueue.pPtr = pPtr; - dmxEventQueue.lastMotion = FALSE; - dmxEventQueue.pEnqueueScreen = screenInfo.screens[0]; - dmxEventQueue.pDequeueScreen = dmxEventQueue.pEnqueueScreen; - SetInputCheck(&dmxEventQueue.head, &dmxEventQueue.tail); - return TRUE; -} - -/** - * This function adds an event to the end of the queue. If the event is - * an XInput event, then the next event (the valuator event) is also - * stored in the queue. If the new event has a time before the time of - * the last event currently on the queue, then the time is updated for - * the new event. - * - * Must be reentrant with ProcessInputEvents. Assumption: dmxeqEnqueue - * will never be interrupted. If this is called from both signal - * handlers and regular code, make sure the signal is suspended when - * called from regular code. - */ - -void dmxeqEnqueue(DeviceIntPtr pDev, xEvent *e) -{ - HWEventQueueType oldtail, newtail; - Bool isMotion; - - oldtail = dmxEventQueue.tail; - isMotion = e->u.u.type == MotionNotify; - if (isMotion - && dmxEventQueue.lastMotion - && oldtail != dmxEventQueue.head) { - if (oldtail == 0) oldtail = QUEUE_SIZE; - oldtail = oldtail - 1; - } else { - newtail = oldtail + 1; - if (newtail == QUEUE_SIZE) newtail = 0; - /* Toss events which come in late */ - if (newtail == dmxEventQueue.head) return; - dmxEventQueue.tail = newtail; - } - DMXDBG2("dmxeqEnqueue %d %d\n", dmxEventQueue.head, dmxEventQueue.tail); - dmxEventQueue.lastMotion = isMotion; - dmxEventQueue.events[oldtail].pScreen = dmxEventQueue.pEnqueueScreen; - - /* Store the event in the queue */ - dmxEventQueue.events[oldtail].event = *e; - dmxEventQueue.events[oldtail].pDev = pDev; - /* If this is an XInput event, store the - * valuator event, too */ - deviceKeyButtonPointer *ev = (deviceKeyButtonPointer *)e; - if (e->u.u.type >= LASTEvent && (ev->deviceid & MORE_EVENTS)) - dmxEventQueue.events[oldtail].valuator = *(deviceValuator *)(ev+1); - - /* Make sure that event times don't go - * backwards - this is "unnecessary", - * but very useful */ - if (e->u.keyButtonPointer.time < dmxEventQueue.lastEventTime - && dmxEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) { - dmxEventQueue.events[oldtail].event.u.keyButtonPointer.time = - dmxEventQueue.lastEventTime; - } -} - -/** Make \a pScreen the new screen for enqueueing events. If \a fromDIX - * is TRUE, also make \a pScreen the new screen for dequeuing events. */ -void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool fromDIX) -{ - dmxEventQueue.pEnqueueScreen = pScreen; - if (fromDIX) dmxEventQueue.pDequeueScreen = pScreen; -} - -static void dmxeqProcessXInputEvent(xEvent *xe, EventRec *e) -{ - deviceKeyButtonPointer *ev = (deviceKeyButtonPointer *)xe; - int id = ev->deviceid & DEVICE_BITS; - DeviceIntPtr pDevice; - - dixLookupDevice(&pDevice, id, serverClient, DixUnknownAccess); - if (!pDevice) { - dmxLog(dmxError, "dmxeqProcessInputEvents: id %d not found\n", id); - return; - } - - if (!pDevice->public.processInputProc) { - dmxLog(dmxError, - "dmxeqProcessInputEvents: no processInputProc for" - " device id %d (%s)\n", id, pDevice->name); - return; - } - - if (ev->deviceid & MORE_EVENTS) { - xe[1] = *(xEvent *)(&e->valuator); - pDevice->public.processInputProc(xe, pDevice, 2); - } else { - pDevice->public.processInputProc(xe, pDevice, 1); - } -} - -/** - * This function is called from #ProcessInputEvents() to remove events - * from the queue and process them. - */ -void dmxeqProcessInputEvents(void) -{ - EventRec *e; - int x, y; - xEvent xe[2]; - - while (dmxEventQueue.head != dmxEventQueue.tail) { - dmxDPMSWakeup(); /* Handles screen saver and DPMS */ - e = &dmxEventQueue.events[dmxEventQueue.head]; - DMXDBG5("dmxeqProcessInputEvents: type=%d screen=%p,%p root=%d,%d\n", - e->event.u.u.type, - e->pScreen, dmxEventQueue.pDequeueScreen, - e->event.u.keyButtonPointer.rootX, - e->event.u.keyButtonPointer.rootY); - /* - * Assumption - screen switching can only occur on core motion events - */ - if (e->event.u.u.type == MotionNotify - && e->pScreen != dmxEventQueue.pDequeueScreen) { - dmxEventQueue.pDequeueScreen = e->pScreen; - x = e->event.u.keyButtonPointer.rootX; - y = e->event.u.keyButtonPointer.rootY; - if (dmxEventQueue.head == QUEUE_SIZE - 1) dmxEventQueue.head = 0; - else ++dmxEventQueue.head; - NewCurrentScreen(e->pDev, dmxEventQueue.pDequeueScreen, x, y); - } else { - xe[0] = e->event; - if (dmxEventQueue.head == QUEUE_SIZE - 1) dmxEventQueue.head = 0; - else ++dmxEventQueue.head; - switch (xe[0].u.u.type) { - case KeyPress: - case KeyRelease: - if (!dmxEventQueue.pKbd) { - dmxLog(dmxError, "dmxeqProcessInputEvents: No keyboard\n"); - return; - } - dmxEventQueue.pKbd - ->processInputProc(xe, - (DeviceIntPtr)dmxEventQueue.pKbd, 1); - break; - default: - dmxeqProcessXInputEvent(xe, e); - break; - case ButtonPress: - case ButtonRelease: - case MotionNotify: - if (!dmxEventQueue.pPtr) { - dmxLog(dmxError, "dmxeqProcessInputEvents: No mouse\n"); - return; - } - dmxEventQueue.pPtr - ->processInputProc(xe, - (DeviceIntPtr)dmxEventQueue.pPtr, 1); - break; - } - } - } -} diff --git a/xorg-server/hw/dmx/input/dmxeq.h b/xorg-server/hw/dmx/input/dmxeq.h deleted file mode 100644 index b38c519df..000000000 --- a/xorg-server/hw/dmx/input/dmxeq.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation on the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to the event queue support. Some of these functions are - * included in dmxinput.h, since they are used by top-level .c - * files. \see dmxeq.c \see dmxinput.h */ - -#ifndef _DMXEQ_H_ -#define _DMXEQ_H_ -extern Bool dmxeqInit(DevicePtr pKbd, DevicePtr pPtr); -extern void dmxeqProcessInputEvents(void); -#endif diff --git a/xorg-server/hw/dmx/input/dmxevents.c b/xorg-server/hw/dmx/input/dmxevents.c index 37f8cb33b..5c3d79215 100644 --- a/xorg-server/hw/dmx/input/dmxevents.c +++ b/xorg-server/hw/dmx/input/dmxevents.c @@ -47,7 +47,6 @@ #include "dmxcommon.h" #include "dmxcursor.h" #include "dmxmotion.h" -#include "dmxeq.h" #include "dmxsigio.h" #include "dmxmap.h" @@ -58,6 +57,7 @@ #include "mi.h" #include "exglobals.h" +#include "xkbsrv.h" #include "XIstubs.h" static int dmxGlobalX, dmxGlobalY; /* Global cursor position */ @@ -154,59 +154,6 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal, return 0; } -static void dmxEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xEvent *e, - DMXBlockType block) -{ - xEvent xE[2]; - deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *)xE; - deviceValuator *xv = (deviceValuator *)xev+1; - DeviceIntPtr pDevice = dmxLocal->pDevice; - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - int type = e->u.u.type; - - switch (e->u.u.type) { - case KeyPress: - type = DeviceKeyPress; - break; - case KeyRelease: - type = DeviceKeyRelease; - break; - case ButtonPress: - type = DeviceButtonPress; - break; - case ButtonRelease: - type = DeviceButtonRelease; - break; - case MotionNotify: - dmxLog(dmxError, - "dmxEnqueueExtEvent: MotionNotify not allowed here\n"); - return; - default: - if (e->u.u.type == ProximityIn || e->u.u.type == ProximityOut) - break; - dmxLogInput(dmxInput, - "dmxEnqueueExtEvent: Unhandled %s event (%d)\n", - e->u.u.type >= LASTEvent ? "extension" : "non-extension", - e->u.u.type); - return; - } - - xev->type = type; - xev->detail = e->u.u.detail; - xev->deviceid = pDevice->id | MORE_EVENTS; - xev->time = e->u.keyButtonPointer.time; - - xv->type = DeviceValuator; - xv->deviceid = pDevice->id; - xv->num_valuators = 0; - xv->first_valuator = 0; - - if (block) - dmxSigioBlock(); - dmxeqEnqueue(pDevice, xE); - if (block) - dmxSigioUnblock(); -} DMXScreenInfo *dmxFindFirstScreen(int x, int y) { @@ -290,7 +237,7 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) pScreen->myNum, dmxScreen->index, localX, localY); if (block) dmxSigioBlock(); - dmxeqProcessInputEvents(); + mieqProcessInputEvents(); miPointerSetScreen(inputInfo.pointer, dmxScreen->index, localX, localY); if (pDev) @@ -343,6 +290,8 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, int thisY = 0; int i; int count; + EventListPtr events; + int nevents; memset(xE, 0, sizeof(xE)); @@ -421,8 +370,12 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, if (block) dmxSigioBlock(); - dmxPointerPutMotionEvent(pDevice, firstAxis, axesCount, v, xev->time); - dmxeqEnqueue(pDevice, xE); + GetEventList(&events); + nevents = GetPointerEvents(events, pDevice, MotionNotify, 0, POINTER_ABSOLUTE, + firstAxis, axesCount, v); + for (i = 0; i < nevents; i++) + mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); + if (block) dmxSigioUnblock(); } @@ -430,14 +383,14 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, XEvent *e, DMXBlockType block) { - xEvent xE[2]; - deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *)xE; - deviceValuator *xv = (deviceValuator *)xev+1; int type; int event = -1; XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e; XDeviceMotionEvent *me = (XDeviceMotionEvent *)e; DeviceIntPtr pDevice = dmxLocal->pDevice; + int valuators[6]; + EventListPtr events; + int nevents, i; if (!e) return -1; /* No extended event passed, cannot handle */ @@ -462,11 +415,11 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, switch (type) { case XI_DeviceValuator: event = DeviceValuator; break; - case XI_DeviceKeyPress: event = DeviceKeyPress; break; - case XI_DeviceKeyRelease: event = DeviceKeyRelease; break; - case XI_DeviceButtonPress: event = DeviceButtonPress; break; - case XI_DeviceButtonRelease: event = DeviceButtonRelease; break; - case XI_DeviceMotionNotify: event = DeviceMotionNotify; break; + case XI_DeviceKeyPress: event = KeyPress; break; + case XI_DeviceKeyRelease: event = KeyRelease; break; + case XI_DeviceButtonPress: event = ButtonPress; break; + case XI_DeviceButtonRelease: event = ButtonRelease; break; + case XI_DeviceMotionNotify: event = MotionNotify; break; case XI_DeviceFocusIn: event = DeviceFocusIn; break; case XI_DeviceFocusOut: event = DeviceFocusOut; break; case XI_ProximityIn: event = ProximityIn; break; @@ -478,36 +431,63 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, case XI_DeviceButtonstateNotify: event = DeviceStateNotify; break; } +#define EXTRACT_VALUATORS(ke, valuators) \ + valuators[0] = ke->axis_data[0]; \ + valuators[1] = ke->axis_data[1]; \ + valuators[2] = ke->axis_data[2]; \ + valuators[3] = ke->axis_data[3]; \ + valuators[4] = ke->axis_data[4]; \ + valuators[5] = ke->axis_data[5]; \ + switch (type) { - case XI_DeviceKeyPress: + case XI_DeviceKeyPress: case XI_DeviceKeyRelease: + EXTRACT_VALUATORS(ke, valuators); + if (block) + dmxSigioBlock(); + GetEventList(&events); + nevents = GetKeyboardValuatorEvents(events, pDevice, event, + ke->keycode, ke->first_axis, + ke->axes_count, valuators); + for (i = 0; i < nevents; i++) + mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); + + if (block) + dmxSigioUnblock(); + break; case XI_DeviceButtonPress: case XI_DeviceButtonRelease: + EXTRACT_VALUATORS(ke, valuators); + if (block) + dmxSigioBlock(); + GetEventList(&events); + nevents = GetPointerEvents(events, pDevice, event, ke->keycode, + POINTER_ABSOLUTE, ke->first_axis, + ke->axes_count, valuators); + for (i = 0; i < nevents; i++) + mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); + + if (block) + dmxSigioUnblock(); + break; case XI_ProximityIn: case XI_ProximityOut: - xev->type = event; - xev->detail = ke->keycode; /* same as ->button */ - xev->deviceid = dmxLocal->pDevice->id | MORE_EVENTS; - xev->time = GetTimeInMillis(); - - xv->type = DeviceValuator; - xv->deviceid = dmxLocal->pDevice->id; - xv->num_valuators = ke->axes_count; - xv->first_valuator = ke->first_axis; - xv->valuator0 = ke->axis_data[0]; - xv->valuator1 = ke->axis_data[1]; - xv->valuator2 = ke->axis_data[2]; - xv->valuator3 = ke->axis_data[3]; - xv->valuator4 = ke->axis_data[4]; - xv->valuator5 = ke->axis_data[5]; - + EXTRACT_VALUATORS(ke, valuators); if (block) dmxSigioBlock(); - dmxeqEnqueue(pDevice, xE); + GetEventList(&events); + nevents = GetProximityEvents(events, pDevice, event, + ke->first_axis, ke->axes_count, + valuators); + for (i = 0; i < nevents; i++) + mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); + if (block) dmxSigioUnblock(); break; + break; + case XI_DeviceMotionNotify: dmxExtMotion(dmxLocal, me->axis_data, me->first_axis, me->axes_count, DMX_ABSOLUTE, block); @@ -600,36 +580,40 @@ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount, static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal, KeyCode keyCode) { - KeySymsPtr pKeySyms = NULL; + KeySym keysym = NoSymbol; + int effectiveGroup; + XkbSrvInfoPtr xkbi; if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key) - return NoSymbol; - pKeySyms = &dmxLocal->pDevice->key->curKeySyms; - if (!pKeySyms) - return NoSymbol; - - if (keyCode > pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) { - DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n", - keyCode, - pKeySyms->map[(keyCode - pKeySyms->minKeyCode) - * pKeySyms->mapWidth]); - - return pKeySyms->map[(keyCode - pKeySyms->minKeyCode) - * pKeySyms->mapWidth]; - } - return NoSymbol; + goto out; + + xkbi = dmxLocal->pDevice->key->xkbInfo; + effectiveGroup = XkbGetEffectiveGroup(xkbi, &xkbi->state, keyCode); + + if (effectiveGroup == -1) + goto out; + + keysym = XkbKeySym(xkbi->desc, keyCode, effectiveGroup); + DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n", + keyCode, keysym); + +out: + return keysym; } static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym, int tryFirst) { - KeySymsPtr pKeySyms = &dmxLocal->pDevice->key->curKeySyms; + /* FIXME: this is quite ineffective, converting to a core map first and + * then extracting the info from there. It'd be better to run the actual + * xkb map */ + XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo; + KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice); int i; /* Optimize for similar maps */ - if (tryFirst >= pKeySyms->minKeyCode - && tryFirst <= pKeySyms->maxKeyCode - && pKeySyms->map[(tryFirst - pKeySyms->minKeyCode) + if (XkbKeycodeInRange(xkbi->desc, tryFirst) + && pKeySyms->map[(tryFirst - xkbi->desc->min_key_code) * pKeySyms->mapWidth] == keySym) return tryFirst; @@ -747,17 +731,6 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, return; } -#if 00 /* dead code? */ - memset(&xE, 0, sizeof(xE)); - xE.u.u.type = type; - xE.u.u.detail = detail; - xE.u.keyButtonPointer.time = GetTimeInMillis(); - - if (!dmxLocal->sendsCore) - dmxEnqueueExtEvent(dmxLocal, &xE, block); - else - dmxeqEnqueue(&xE); -#endif /*00*/ } /** A pointer to this routine is passed to low-level input drivers so @@ -773,9 +746,9 @@ int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym) unsigned short state = 0; if (dmxLocal->sendsCore) - state = dmxLocalCoreKeyboard->pDevice->key->state; + state = XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo->state); else if (dmxLocal->pDevice->key) - state = dmxLocal->pDevice->key->state; + state = XkbStateFieldFromRec(&dmxLocal->pDevice->key->xkbInfo->state); if (!dmxLocal->sendsCore) return 0; /* Only for core devices */ diff --git a/xorg-server/hw/dmx/input/dmxinputinit.c b/xorg-server/hw/dmx/input/dmxinputinit.c index 666db2138..d8402e87f 100644 --- a/xorg-server/hw/dmx/input/dmxinputinit.c +++ b/xorg-server/hw/dmx/input/dmxinputinit.c @@ -51,7 +51,6 @@ #include "dmxcommon.h" #include "dmxevents.h" #include "dmxmotion.h" -#include "dmxeq.h" #include "dmxprop.h" #include "config/dmxconfig.h" #include "dmxcursor.h" @@ -72,6 +71,7 @@ #include "mipointer.h" #include "windowstr.h" #include "mi.h" +#include "xkbsrv.h" #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> @@ -361,7 +361,6 @@ void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, static void dmxKeyboardFreeNames(XkbComponentNamesPtr names) { - if (names->keymap) XFree(names->keymap); if (names->keycodes) XFree(names->keycodes); if (names->types) XFree(names->types); if (names->compat) XFree(names->compat); @@ -418,9 +417,7 @@ static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info) dmxConfigGetXkbOptions() ? dmxConfigGetXkbOptions() : ""); } - XkbInitKeyboardDeviceStruct(pDevice, - &info->names, - &info->keySyms, + InitKeyboardDeviceStruct(pDevice, &rmlvo, dmxKeyboardBellProc, dmxKeyboardKbdCtrlProc); @@ -453,9 +450,16 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) break; } if (info.keyClass) { - DevicePtr pDev = (DevicePtr) pDevice; - InitKeyboardDeviceStruct(pDev, - &info.keySyms, + XkbRMLVOSet rmlvo; + + rmlvo.rules = dmxConfigGetXkbRules(); + rmlvo.model = dmxConfigGetXkbModel(); + rmlvo.layout = dmxConfigGetXkbLayout(); + rmlvo.variant = dmxConfigGetXkbVariant(); + rmlvo.options = dmxConfigGetXkbOptions(); + + InitKeyboardDeviceStruct(pDevice, + &rmlvo, dmxBell, dmxKbdCtrl); } if (info.buttonClass) { @@ -540,7 +544,7 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput) { int i; - dmxeqProcessInputEvents(); + mieqProcessInputEvents(); #if 00 /*BP*/ miPointerUpdate(); #endif @@ -600,8 +604,7 @@ static void dmxCollectAll(DMXInputInfo *dmxInput) return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) if (dmxInput->devs[i]->collect_events) - dmxInput->devs[i]->collect_events(&dmxInput->devs[i] - ->pDevice->public, + dmxInput->devs[i]->collect_events(&dmxInput->devs[i]->pDevice->public, dmxMotion, dmxEnqueue, dmxCheckSpecialKeys, DMX_BLOCK); @@ -1066,12 +1069,6 @@ void dmxInputInit(DMXInputInfo *dmxInput) } } - if (pPointer && pKeyboard) { - if (dmxeqInit(&pKeyboard->public, &pPointer->public)) - dmxLogInput(dmxInput, "Using %s and %s as true core devices\n", - pKeyboard->name, pPointer->name); - } - dmxInput->processInputEvents = dmxProcessInputEvents; dmxInput->detached = False; diff --git a/xorg-server/hw/dmx/input/lnx-keyboard.c b/xorg-server/hw/dmx/input/lnx-keyboard.c index 744b6ace5..939a32f07 100644 --- a/xorg-server/hw/dmx/input/lnx-keyboard.c +++ b/xorg-server/hw/dmx/input/lnx-keyboard.c @@ -167,6 +167,7 @@ #include "xf86Keymap.h" #endif #include <linux/keyboard.h> +#include <xkbsrv.h> #define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0])) #define NUM_STATE_ENTRIES (256/32) @@ -660,7 +661,7 @@ static void kbdLinuxConvert(DevicePtr pDev, BLOCK block) { GETPRIV; - KeySymsPtr pKeySyms = &priv->pKeyboard->key->curKeySyms; + XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo; int type; KeySym keySym = NoSymbol; int keyCode; @@ -673,10 +674,14 @@ static void kbdLinuxConvert(DevicePtr pDev, keyCode = (scanCode & 0x7f) + MIN_KEYCODE; /* Handle repeats */ - - if (keyCode >= pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) { - keySym = pKeySyms->map[(keyCode - pKeySyms->minKeyCode) - * pKeySyms->mapWidth]; + + if (keyCode >= xkbi->desc->min_key_code && + keyCode <= xkbi->desc->max_key_code) { + + int effectiveGroup = XkbGetEffectiveGroup(xkbi, + &xkbi->state, + scanCode); + keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup); #if 0 switch (keySym) { case XK_Num_Lock: @@ -690,7 +695,7 @@ static void kbdLinuxConvert(DevicePtr pDev, break; } #endif - + /* If key is already down, ignore or autorepeat */ if (type == KeyPress && kbdLinuxKeyDown(priv, keyCode)) { KbdFeedbackClassRec *feed = priv->pKeyboard->kbdfeed; diff --git a/xorg-server/hw/dmx/input/usb-keyboard.c b/xorg-server/hw/dmx/input/usb-keyboard.c index 12ca8ab96..c4667a3c3 100644 --- a/xorg-server/hw/dmx/input/usb-keyboard.c +++ b/xorg-server/hw/dmx/input/usb-keyboard.c @@ -85,6 +85,7 @@ * part of the Xserver tree. All calls to the dmx* layer are #defined * here for the .c file. The .h file will also have to be edited. */ #include "usb-keyboard.h" +#include <xkbsrv.h> #define GETPRIV myPrivate *priv \ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private @@ -296,7 +297,7 @@ static void kbdUSBConvert(DevicePtr pDev, BLOCK block) { GETPRIV; - KeySymsPtr pKeySyms = &priv->pDevice->key->curKeySyms; + XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo; int type; int keyCode; KeySym keySym = NoSymbol; @@ -308,9 +309,13 @@ static void kbdUSBConvert(DevicePtr pDev, /* Handle repeats */ - if (keyCode >= pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) { - keySym = pKeySyms->map[(keyCode - pKeySyms->minKeyCode) - * pKeySyms->mapWidth]; + if (keyCode >= xkbi->desc->min_key_code && + keyCode <= xkbi->desc->max_key_code) { + + int effectiveGroup = XkbGetEffectiveGroup(xkbi, + &xkbi->state, + scanCode); + keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup); #if 0 switch (keySym) { case XK_Num_Lock: |