summaryrefslogtreecommitdiff
path: root/hw/xfree86/common/xf86Kbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86/common/xf86Kbd.c')
-rw-r--r--hw/xfree86/common/xf86Kbd.c111
1 files changed, 32 insertions, 79 deletions
diff --git a/hw/xfree86/common/xf86Kbd.c b/hw/xfree86/common/xf86Kbd.c
index f263937a2..c1ad79778 100644
--- a/hw/xfree86/common/xf86Kbd.c
+++ b/hw/xfree86/common/xf86Kbd.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.14 1997/01/05 11:58:08 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.24 2002/05/31 18:45:58 dawes Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -21,7 +21,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $Xorg: xf86Kbd.c,v 1.3 2000/08/17 19:50:30 cpqbld Exp $ */
+/* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */
#include "X.h"
#include "Xmd.h"
@@ -30,13 +30,27 @@
#include "compiler.h"
-#include "xf86Procs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "atKeynames.h"
-#include "xf86_Config.h"
+#include "xf86Config.h"
#include "xf86Keymap.h"
+#if defined(KDGKBTYPE) && \
+ !defined(Lynx) && \
+ !defined(__UNIXOS2__) && !defined(__mips__) && \
+ !defined(__arm32__) && !defined(__GNU__) && !defined(__QNX__)
+#define HAS_GETKBTYPE
+#endif
+#if defined(GIO_KEYMAP) && \
+ !defined(Lynx) && \
+ !defined(__UNIXOS2__) && !defined(__mips__) && \
+ !defined(__arm32__) && !defined(__GNU__) && !defined(DGUX) && \
+ !defined(__QNX__)
+#define HAS_GETKEYMAP
+
#define KD_GET_ENTRY(i,n) \
eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
@@ -208,6 +222,7 @@ static KeySym eascii_to_x[512] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
};
+#endif /* HAS_GETKEYMAP */
/*
* LegalModifier --
@@ -238,14 +253,15 @@ xf86KbdGetMapping (pKeySyms, pModMap)
CARD8 *pModMap;
{
KeySym *k;
-#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__)
+#ifdef HAS_GETKEYMAP
keymap_t keymap;
-#endif /* !Lynx && !AMOEBA && !MINIX && !__OSF__ && !__EMX__ */
- char type;
- int i, j;
+#endif
+ int i;
KeySym *pMap;
+
+#ifdef HAS_GETKBTYPE
+ char type;
-#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__)
xf86Info.kbdType =
ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
if (xf86Info.kbdType == KB_84)
@@ -253,11 +269,14 @@ xf86KbdGetMapping (pKeySyms, pModMap)
else
pMap = map;
#else
+/* OS/2 sets the keyboard type during xf86OpenKbd */
+#ifndef __UNIXOS2__
xf86Info.kbdType = 0;
+#endif
pMap = map;
#endif
-#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__)
+#ifdef HAS_GETKEYMAP
/*
* use the keymap, which can be gotten from our oringinal vt??.
* ( ttymap(1) !!!! )
@@ -280,59 +299,7 @@ xf86KbdGetMapping (pKeySyms, pModMap)
if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
}
}
-#endif /* !Lynx && !AMOEBA && !MINIX && !__OSF__ && !__EMX__ */
-
- /*
- * Apply the special key mapping specified in XF86Config
- */
- for (k = pMap, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4) {
- switch (k[0]) {
- case XK_Alt_L:
- j = K_INDEX_LEFTALT;
- break;
- case XK_Alt_R:
- j = K_INDEX_RIGHTALT;
- break;
- case XK_Scroll_Lock:
- j = K_INDEX_SCROLLLOCK;
- break;
- case XK_Control_R:
- j = K_INDEX_RIGHTCTL;
- break;
- default:
- j = -1;
- }
- if (j >= 0)
- switch (xf86Info.specialKeyMap[j]) {
- case KM_META:
- if (k[0] == XK_Alt_R)
- k[1] = XK_Meta_R;
- else {
- k[0] = XK_Alt_L;
- k[1] = XK_Meta_L;
- }
- break;
- case KM_COMPOSE:
- k[0] = XK_Multi_key;
- break;
- case KM_MODESHIFT:
- k[0] = XK_Mode_switch;
- k[1] = NoSymbol;
- break;
- case KM_MODELOCK:
- k[0] = XK_Mode_switch;
- k[1] = XF86XK_ModeLock;
- break;
- case KM_SCROLLLOCK:
- k[0] = XK_Scroll_Lock;
- break;
- case KM_CONTROL:
- k[0] = XK_Control_R;
- break;
- }
- }
+#endif
/*
* compute the modifier map
@@ -366,7 +333,7 @@ xf86KbdGetMapping (pKeySyms, pModMap)
break;
case XK_Num_Lock:
- if (!xf86Info.serverNumLock) pModMap[i] = NumLockMask;
+ pModMap[i] = NumLockMask;
break;
case XK_Scroll_Lock:
@@ -386,22 +353,8 @@ xf86KbdGetMapping (pKeySyms, pModMap)
}
-#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__)
- xf86Info.kbdType =
- ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
-#else
-/* OS/2 sets the keyboard type during xf86OpenKbd */
-#ifndef __EMX__
- xf86Info.kbdType = 0;
-#endif
-#endif
-
-
pKeySyms->map = pMap;
pKeySyms->mapWidth = GLYPHS_PER_KEY;
pKeySyms->minKeyCode = MIN_KEYCODE;
- if (xf86Info.serverNumLock)
- pKeySyms->maxKeyCode = MAX_KEYCODE;
- else
- pKeySyms->maxKeyCode = MAX_STD_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
}