xserver: Branch 'master' - 16 commits
Peter Hutterer
whot at kemper.freedesktop.org
Sat Sep 12 17:37:15 PDT 2009
configure.ac | 4
hw/dmx/Makefile.am | 3
hw/dmx/config/dmxconfig.h | 2
hw/dmx/dmxcursor.c | 4
hw/dmx/dmxinput.c | 4
hw/dmx/dmxinput.h | 2
hw/dmx/input/Makefile.am | 2
hw/dmx/input/dmxcommon.c | 1
hw/dmx/input/dmxeq.c | 295 --------------------------------------------
hw/dmx/input/dmxeq.h | 43 ------
hw/dmx/input/dmxevents.c | 205 +++++++++++++-----------------
hw/dmx/input/dmxinputinit.c | 31 ++--
hw/dmx/input/lnx-keyboard.c | 17 +-
hw/dmx/input/usb-keyboard.c | 13 +
include/xkbsrv.h | 5
xkb/xkbActions.c | 29 ----
xkb/xkbUtils.c | 35 +++++
17 files changed, 175 insertions(+), 520 deletions(-)
New commits:
commit dfb106c846c880a06fa5caada92f45576eab7b00
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Sep 8 18:09:12 2009 +1000
configure: re-enable dmx build (default=auto)
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/configure.ac b/configure.ac
index f6284ad..7bc05b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -594,7 +594,7 @@ AC_ARG_ENABLE(int10-module, AS_HELP_STRING([--enable-int10-module], [Build X
dnl DDXes.
AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
-AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
+AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=auto])
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: yes)]), [XNEST=$enableval], [XNEST=yes])
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
commit 72607960c136894c4533a54cef7a9be64246f1a3
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Wed Sep 9 11:02:22 2009 +1000
dmx: Remove some dead code.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 992c32e..5c3d792 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -731,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
commit 88187ad889ab707fcae3f64890cdb291b567ec23
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Wed Sep 9 11:02:18 2009 +1000
dmx: purge DMX EQ leftovers
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/Makefile.am b/hw/dmx/input/Makefile.am
index 47dbd96..185aaf8 100644
--- a/hw/dmx/input/Makefile.am
+++ b/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/hw/dmx/input/dmxeq.c b/hw/dmx/input/dmxeq.c
deleted file mode 100644
index 812a8f5..0000000
--- a/hw/dmx/input/dmxeq.c
+++ /dev/null
@@ -1,90 +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 at 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
diff --git a/hw/dmx/input/dmxeq.h b/hw/dmx/input/dmxeq.h
deleted file mode 100644
index b38c519..0000000
--- a/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 at 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/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 0b0813a..992c32e 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/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"
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 58cafe2..d8402e8 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/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"
commit f3aaa46f27f802233e54b3c70ba827e0fcca2605
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Wed Sep 9 09:51:45 2009 +1000
dmx: formatting fix to improve readability
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 73e804b..58cafe2 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -605,8 +605,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);
commit 7a588c833e87dd07f167b9885d5ec43dde271ebe
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Sep 8 18:14:43 2009 +1000
dmx: Default rules are now base, not xfree86
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/config/dmxconfig.h b/hw/dmx/config/dmxconfig.h
index 7c9dbc7..477db4a 100644
--- a/hw/dmx/config/dmxconfig.h
+++ b/hw/dmx/config/dmxconfig.h
@@ -36,7 +36,7 @@
#ifndef _DMXCONFIG_H_
#define _DMXCONFIG_H_
-#define DMX_DEFAULT_XKB_RULES "xfree86"
+#define DMX_DEFAULT_XKB_RULES "base"
#define DMX_DEFAULT_XKB_MODEL "pc101"
#define DMX_DEFAULT_XKB_LAYOUT "us"
#define DMX_DEFAULT_XKB_VARIANT NULL
commit 33243ae971db90477a29dfb0e51cc00c95e561bc
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Aug 4 17:04:08 2009 +1000
dmx: include xfixes lib, reshuffle include order to resolve linker errors.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/configure.ac b/configure.ac
index 6345fd9..f6284ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1736,7 +1736,7 @@ if test "x$DMX" = xyes; then
fi
DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
XDMX_CFLAGS="$DMXMODULES_CFLAGS"
- XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB"
+ XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $FIXES_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB"
XDMX_SYS_LIBS="$DMXMODULES_LIBS"
AC_SUBST([XDMX_CFLAGS])
AC_SUBST([XDMX_LIBS])
diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index 9e9b39a..095c542 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -86,7 +86,8 @@ XDMX_LIBS = \
input/libdmxinput.a \
config/libdmxconfig.a \
$(MAIN_LIB) \
- $(XSERVER_LIBS)
+ $(XSERVER_LIBS) \
+ $(top_srcdir)/xfixes/libxfixes.la
Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
Xdmx_DEPENDENCIES= $(XDMX_LIBS)
commit 2d46678762b12c9746fc8f89821c15705680ba35
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Sep 8 17:46:06 2009 +1000
dmx: remove dmx-internal event queue.
The EQ is in the DIX now.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index e8a1845..cbadf62 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -195,8 +195,8 @@ miPointerScreenFuncRec dmxPointerCursorFuncs =
dmxCursorOffScreen,
dmxCrossScreen,
dmxWarpCursor,
- dmxeqEnqueue, /*XXX incompatible type/function! */
- dmxeqSwitchScreen
+ NULL,
+ NULL,
};
diff --git a/hw/dmx/dmxinput.c b/hw/dmx/dmxinput.c
index 83f8a4a..5203e1a 100644
--- a/hw/dmx/dmxinput.c
+++ b/hw/dmx/dmxinput.c
@@ -71,10 +71,6 @@ void InitInput(int argc, char **argv)
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
dmxInputInit(dmxInput);
- if (!dmxeqInitialized()) {
- dmxLog(dmxWarning, "Use keyboard/mouse pair with the first -input\n");
- dmxLog(dmxFatal, "At least one core keyboard/mouse pair required\n");
- }
mieqInit();
}
diff --git a/hw/dmx/dmxinput.h b/hw/dmx/dmxinput.h
index 7af7b18..c60ce95 100644
--- a/hw/dmx/dmxinput.h
+++ b/hw/dmx/dmxinput.h
@@ -140,8 +140,6 @@ extern void dmxInputLogDevices(void);
extern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow);
/* These functions are defined in input/dmxeq.c */
-extern Bool dmxeqInitialized(void);
-extern void dmxeqEnqueue(DeviceIntPtr pDev, xEvent *e);
extern void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool fromDIX);
/* This type is used in input/dmxevents.c. Also, these functions are
diff --git a/hw/dmx/input/dmxeq.c b/hw/dmx/input/dmxeq.c
index 3c2b44c..812a8f5 100644
--- a/hw/dmx/input/dmxeq.c
+++ b/hw/dmx/input/dmxeq.c
@@ -88,209 +88,3 @@
#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;
- deviceKeyButtonPointer *ev;
-
- 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 */
- 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/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index e7c382b..0b0813a 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -155,59 +155,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)
{
@@ -291,7 +238,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)
@@ -344,6 +291,8 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
int thisY = 0;
int i;
int count;
+ EventListPtr events;
+ int nevents;
memset(xE, 0, sizeof(xE));
@@ -422,8 +371,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();
}
@@ -431,14 +384,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 */
@@ -463,11 +416,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;
@@ -479,36 +432,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);
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index f92c888..73e804b 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -545,7 +545,7 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput)
{
int i;
- dmxeqProcessInputEvents();
+ mieqProcessInputEvents();
#if 00 /*BP*/
miPointerUpdate();
#endif
@@ -1071,12 +1071,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;
commit 545f11139d600febf1c5fd46b11bea4352b82c32
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Sep 8 17:14:53 2009 +1000
dmx: compiler warning fix (mixed declarations + code)
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/dmxeq.c b/hw/dmx/input/dmxeq.c
index 33e8771..3c2b44c 100644
--- a/hw/dmx/input/dmxeq.c
+++ b/hw/dmx/input/dmxeq.c
@@ -158,6 +158,7 @@ void dmxeqEnqueue(DeviceIntPtr pDev, xEvent *e)
{
HWEventQueueType oldtail, newtail;
Bool isMotion;
+ deviceKeyButtonPointer *ev;
oldtail = dmxEventQueue.tail;
isMotion = e->u.u.type == MotionNotify;
@@ -182,7 +183,7 @@ void dmxeqEnqueue(DeviceIntPtr pDev, xEvent *e)
dmxEventQueue.events[oldtail].pDev = pDev;
/* If this is an XInput event, store the
* valuator event, too */
- deviceKeyButtonPointer *ev = (deviceKeyButtonPointer *)e;
+ ev = (deviceKeyButtonPointer *)e;
if (e->u.u.type >= LASTEvent && (ev->deviceid & MORE_EVENTS))
dmxEventQueue.events[oldtail].valuator = *(deviceValuator *)(ev+1);
commit 7d703af74ced36968f4480507a7eb54d249b5edc
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Sep 8 17:13:38 2009 +1000
dmx: get the state from XKB for dmxCheckSpecialKeys
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 528e968..e7c382b 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -778,9 +778,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 */
commit 6e52f9233176986508356f6eee4fce86ba740e71
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Sep 8 17:10:22 2009 +1000
dmx: fix dmxKeySymToKeyCode to work with mandatory XKB.
Approach taken is inefficient, it converts the xkb symbol table to a core
symbol table first and then extracts the keycode from there.
Consider this a todo for a rainy afternoon when the beer fridge demands
emptying.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 235c8eb..528e968 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -625,13 +625,16 @@ out:
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;
commit 61ae0a5ca5de24590f444c405445124404ba9753
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Sep 8 17:05:12 2009 +1000
dmx: fix up dmxKeyCodeToKeySym for XKB-only.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 37f8cb3..235c8eb 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -58,6 +58,7 @@
#include "mi.h"
#include "exglobals.h"
+#include "xkbsrv.h"
#include "XIstubs.h"
static int dmxGlobalX, dmxGlobalY; /* Global cursor position */
@@ -600,24 +601,25 @@ 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,
commit 9caba3e2abceda0a1ff4ad4bf05708f0166c2218
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Aug 4 15:12:25 2009 +1000
dmx: fix two calls to InitKeyboardDeviceStruct.
Takes RMLVO now instead of the keysyms directly.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 5f3579b..f92c888 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -418,9 +418,7 @@ static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info)
dmxConfigGetXkbOptions()
? dmxConfigGetXkbOptions() : "");
}
- XkbInitKeyboardDeviceStruct(pDevice,
- &info->names,
- &info->keySyms,
+ InitKeyboardDeviceStruct(pDevice, &rmlvo,
dmxKeyboardBellProc,
dmxKeyboardKbdCtrlProc);
@@ -453,9 +451,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) {
commit 29b9a10dad1ca780dc90f4f1f63fd11fd7d1221b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Aug 4 15:04:45 2009 +1000
dmx: XkbComponentNamesRec doesn't have a keymap field anymore.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/dmxcommon.c b/hw/dmx/input/dmxcommon.c
index 2bffb17..8c8cefa 100644
--- a/hw/dmx/input/dmxcommon.c
+++ b/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/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 1646130..5f3579b 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -362,7 +362,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);
commit a6f3f6a63ae76afbe01eb9049a63609476d2ed4d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Sep 8 16:43:04 2009 +1000
dmx: switch lnx-input and usb-input over to xkb-only.
kbd*Convert are nearly identical, it just asks for merging. Not today
though.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c
index 744b6ac..939a32f 100644
--- a/hw/dmx/input/lnx-keyboard.c
+++ b/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/hw/dmx/input/usb-keyboard.c b/hw/dmx/input/usb-keyboard.c
index 12ca8ab..c4667a3 100644
--- a/hw/dmx/input/usb-keyboard.c
+++ b/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:
commit 5d81aee5f75e80ae9d3ac7cb32d293ade62d6c5c
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Aug 4 15:24:02 2009 +1000
dmx: include xkbsrv.h to silence compiler.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 666db21..1646130 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -72,6 +72,7 @@
#include "mipointer.h"
#include "windowstr.h"
#include "mi.h"
+#include "xkbsrv.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
commit 4da59f478686fa7e80a3837bf9fa61672c13c50b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Sep 8 16:30:36 2009 +1000
xkb: split effectiveGroup calculation into separate utility function.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 2c7d86a..ebc7cdb 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -945,6 +945,11 @@ extern void XkbFilterEvents(
int /* nEvents */,
xEvent* /* xE */);
+extern int XkbGetEffectiveGroup(
+ XkbSrvInfoPtr /* xkbi */,
+ XkbStatePtr /* xkbstate */,
+ CARD8 /* keycode */);
+
#include "xkbfile.h"
#include "xkbrules.h"
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 9c3184a..b0ab427 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -124,30 +124,11 @@ static XkbAction fake;
}
pActs= XkbKeyActionsPtr(xkb,key);
col= 0;
- effectiveGroup= xkbState->group;
- if (effectiveGroup!=XkbGroup1Index) {
- if (XkbKeyNumGroups(xkb,key)>(unsigned)1) {
- if (effectiveGroup>=XkbKeyNumGroups(xkb,key)) {
- unsigned gi= XkbKeyGroupInfo(xkb,key);
- switch (XkbOutOfRangeGroupAction(gi)) {
- default:
- case XkbWrapIntoRange:
- effectiveGroup %= XkbKeyNumGroups(xkb,key);
- break;
- case XkbClampIntoRange:
- effectiveGroup = XkbKeyNumGroups(xkb,key)-1;
- break;
- case XkbRedirectIntoRange:
- effectiveGroup= XkbOutOfRangeGroupInfo(gi);
- if (effectiveGroup>=XkbKeyNumGroups(xkb,key))
- effectiveGroup= 0;
- break;
- }
- }
- }
- else effectiveGroup= XkbGroup1Index;
- col+= (effectiveGroup*XkbKeyGroupsWidth(xkb,key));
- }
+
+ effectiveGroup = XkbGetEffectiveGroup(xkbi, xkbState, key);
+ if (effectiveGroup != XkbGroup1Index)
+ col += (effectiveGroup * XkbKeyGroupsWidth(xkb, key));
+
type= XkbKeyKeyType(xkb,key,effectiveGroup);
if (type->map!=NULL) {
register unsigned i,mods;
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 63b1e31..75e243c 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -2118,3 +2118,38 @@ XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src)
return ret;
}
+int
+XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode)
+{
+ XkbDescPtr xkb = xkbi->desc;
+ int effectiveGroup = xkbState->group;
+
+ if (!XkbKeycodeInRange(xkb, keycode))
+ return -1;
+
+ if (effectiveGroup == XkbGroup1Index)
+ return effectiveGroup;
+
+ if (XkbKeyNumGroups(xkb,keycode) > 1U) {
+ if (effectiveGroup >= XkbKeyNumGroups(xkb,keycode)) {
+ unsigned int gi = XkbKeyGroupInfo(xkb,keycode);
+ switch (XkbOutOfRangeGroupAction(gi)) {
+ default:
+ case XkbWrapIntoRange:
+ effectiveGroup %= XkbKeyNumGroups(xkb, keycode);
+ break;
+ case XkbClampIntoRange:
+ effectiveGroup = XkbKeyNumGroups(xkb, keycode) - 1;
+ break;
+ case XkbRedirectIntoRange:
+ effectiveGroup = XkbOutOfRangeGroupInfo(gi);
+ if (effectiveGroup >= XkbKeyNumGroups(xkb, keycode))
+ effectiveGroup = 0;
+ break;
+ }
+ }
+ }
+ else effectiveGroup = XkbGroup1Index;
+
+ return effectiveGroup;
+}
More information about the xorg-commit
mailing list