diff-tree 052b861fc9980a133bebcabfa081ebe7ae53c044 (from 881953813c7307f2aac4057b48d233e5f4a574cd) Author: Kristian Høgsberg Date: Tue Jul 18 11:56:05 2006 -0400 Remove built-in keyboard driver. diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index 0fe8aff..e7e482b 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -21,8 +21,6 @@ RANDRSOURCES = xf86RandR.c BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES) -KBDSOURCES = xf86Kbd@XORG_OS_KBD@.c - MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes xf86DefModeSet.c: $(srcdir)/modeline2c.pl $(MODEDEFSOURCES) @@ -59,11 +57,6 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h DISTCLEANFILES = xf86Build.h CLEANFILES = $(BUILT_SOURCES) -# this is a hack for now. as above we don't have rules to build all of these -# yet, but we want to make sure they all get into the distball. this should -# eventually go away. -DISTKBDSOURCES = xf86Kbd.c xf86KbdBSD.c xf86KbdLnx.c xf86KbdMach.c - EXTRA_DIST = \ atKeynames.h \ compiler.h \ diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index bcad246..2474017 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -386,17 +386,6 @@ xf86DriverlistFromConfig() } -Bool -xf86BuiltinInputDriver(const char *name) -{ -#ifdef USE_DEPRECATED_KEYBOARD_DRIVER - if (xf86NameCmp(name, "keyboard") == 0) - return TRUE; - else -#endif - return FALSE; -} - char ** xf86InputDriverlistFromConfig() { @@ -421,8 +410,7 @@ xf86InputDriverlistFromConfig() if (xf86ConfigLayout.inputs) { idp = xf86ConfigLayout.inputs; while (idp->identifier) { - if (!xf86BuiltinInputDriver(idp->driver)) - count++; + count++; idp++; } } @@ -437,10 +425,8 @@ xf86InputDriverlistFromConfig() count = 0; idp = xf86ConfigLayout.inputs; while (idp->identifier) { - if (!xf86BuiltinInputDriver(idp->driver)) { - modulearray[count] = idp->driver; - count++; - } + modulearray[count] = idp->driver; + count++; idp++; } modulearray[count] = NULL; @@ -1151,304 +1137,6 @@ #endif } /* - * XXX This function is temporary, and will be removed when the keyboard - * driver is converted into a regular input driver. - */ -static Bool -configInputKbd(IDevPtr inputp) -{ - char *s; - MessageType from = X_DEFAULT; - Bool customKeycodesDefault = FALSE; - int verb = 0; -#if defined(XQUEUE) - char *kbdproto = "Xqueue"; -#else - char *kbdproto = "standard"; -#endif - - /* Initialize defaults */ - xf86Info.xleds = 0L; - xf86Info.kbdDelay = 500; - xf86Info.kbdRate = 30; - - xf86Info.kbdProc = NULL; - xf86Info.vtinit = NULL; - xf86Info.vtSysreq = VT_SYSREQ_DEFAULT; -#if defined(SVR4) && defined(i386) - xf86Info.panix106 = FALSE; -#endif - xf86Info.kbdCustomKeycodes = FALSE; -#ifdef WSCONS_SUPPORT - xf86Info.kbdFd = -1; -#endif -#ifdef XKB - if (!xf86IsPc98()) { - xf86Info.xkbrules = __XKBDEFRULES__; - xf86Info.xkbmodel = "pc105"; - xf86Info.xkblayout = "us"; - xf86Info.xkbvariant = NULL; - xf86Info.xkboptions = NULL; - } else { - xf86Info.xkbrules = "xfree98"; - xf86Info.xkbmodel = "pc98"; - xf86Info.xkblayout = "nec/jp"; - xf86Info.xkbvariant = NULL; - xf86Info.xkboptions = NULL; - } - xf86Info.xkbcomponents_specified = FALSE; - /* Should discourage the use of these. */ - xf86Info.xkbkeymap = NULL; - xf86Info.xkbtypes = NULL; - xf86Info.xkbcompat = NULL; - xf86Info.xkbkeycodes = NULL; - xf86Info.xkbsymbols = NULL; - xf86Info.xkbgeometry = NULL; -#endif - - s = xf86SetStrOption(inputp->commonOptions, "Protocol", kbdproto); - if (xf86NameCmp(s, "standard") == 0) { - xf86Info.kbdProc = xf86KbdProc; - xf86Info.kbdEvents = xf86KbdEvents; - xfree(s); - } else if (xf86NameCmp(s, "xqueue") == 0) { -#ifdef __UNIXWARE__ - /* - * To retain compatibility with older config files, on UnixWare, we - * accept the xqueue protocol but use the normal keyboard procs. - */ - xf86Info.kbdProc = xf86KbdProc; - xf86Info.kbdEvents = xf86KbdEvents; -#else -#ifdef XQUEUE - xf86Info.kbdProc = xf86XqueKbdProc; - xf86Info.kbdEvents = xf86XqueEvents; - xf86Msg(X_CONFIG, "Xqueue selected for keyboard input\n"); -#endif -#endif - xfree(s); -#ifdef WSCONS_SUPPORT - } else if (xf86NameCmp(s, "wskbd") == 0) { - xf86Info.kbdProc = xf86KbdProc; - xf86Info.kbdEvents = xf86WSKbdEvents; - xfree(s); - s = xf86SetStrOption(inputp->commonOptions, "Device", NULL); - xf86Msg(X_CONFIG, "Keyboard: Protocol: wskbd\n"); - if (s == NULL) { - xf86ConfigError("A \"device\" option is required with" - " the \"wskbd\" keyboard protocol"); - return FALSE; - } - xf86Info.kbdFd = open(s, O_RDWR | O_NONBLOCK | O_EXCL); - if (xf86Info.kbdFd == -1) { - xf86ConfigError("cannot open \"%s\"", s); - xfree(s); - return FALSE; - } - xfree(s); - /* Find out keyboard type */ - if (ioctl(xf86Info.kbdFd, WSKBDIO_GTYPE, &xf86Info.wsKbdType) == -1) { - xf86ConfigError("cannot get keyboard type"); - close(xf86Info.kbdFd); - return FALSE; - } - switch (xf86Info.wsKbdType) { - case WSKBD_TYPE_PC_XT: - xf86Msg(X_PROBED, "Keyboard type: XT\n"); - break; - case WSKBD_TYPE_PC_AT: - xf86Msg(X_PROBED, "Keyboard type: AT\n"); - break; - case WSKBD_TYPE_USB: - xf86Msg(X_PROBED, "Keyboard type: USB\n"); - break; -#ifdef WSKBD_TYPE_ADB - case WSKBD_TYPE_ADB: - xf86Msg(X_PROBED, "Keyboard type: ADB\n"); - break; -#endif -#ifdef WSKBD_TYPE_SUN - case WSKBD_TYPE_SUN: - xf86Msg(X_PROBED, "Keyboard type: Sun\n"); - break; -#endif -#ifdef WSKBD_TYPE_SUN5 - case WSKBD_TYPE_SUN5: - xf86Msg(X_PROBED, "Keyboard type: Sun5\n"); - break; -#endif - default: - xf86ConfigError("Unsupported wskbd type \"%d\"", - xf86Info.wsKbdType); - close(xf86Info.kbdFd); - return FALSE; - } -#endif - } else { - xf86ConfigError("\"%s\" is not a valid keyboard protocol name", s); - xfree(s); - return FALSE; - } - - s = xf86SetStrOption(inputp->commonOptions, "AutoRepeat", NULL); - if (s) { - if (sscanf(s, "%d %d", &xf86Info.kbdDelay, &xf86Info.kbdRate) != 2) { - xf86ConfigError("\"%s\" is not a valid AutoRepeat value", s); - xfree(s); - return FALSE; - } - xfree(s); - } - - s = xf86SetStrOption(inputp->commonOptions, "XLeds", NULL); - if (s) { - char *l, *end; - unsigned int i; - l = strtok(s, " \t\n"); - while (l) { - i = strtoul(l, &end, 0); - if (*end == '\0') - xf86Info.xleds |= 1L << (i - 1); - else { - xf86ConfigError("\"%s\" is not a valid XLeds value", l); - xfree(s); - return FALSE; - } - l = strtok(NULL, " \t\n"); - } - xfree(s); - } - -#ifdef XKB - from = X_DEFAULT; - if (noXkbExtension) - from = X_CMDLINE; - else if (xf86FindOption(inputp->commonOptions, "XkbDisable")) { - xf86Msg(X_WARNING, "KEYBOARD: XKB should be disabled in the " - "ServerFlags section instead\n" - "\tof in the \"keyboard\" InputDevice section.\n"); - noXkbExtension = - xf86SetBoolOption(inputp->commonOptions, "XkbDisable", FALSE); - from = X_CONFIG; - } - if (noXkbExtension) - xf86Msg(from, "XKB: disabled\n"); - -#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), (char *)NULL)) - - if (!noXkbExtension) { - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeymap", NULL))) { - xf86Info.xkbkeymap = NULL_IF_EMPTY(s); - xf86Msg(X_CONFIG, "XKB: keymap: \"%s\" " - "(overrides other XKB settings)\n", xf86Info.xkbkeymap); - } else { - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbCompat", NULL))) { - xf86Info.xkbcompat = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: compat: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbTypes", NULL))) { - xf86Info.xkbtypes = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: types: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeycodes", NULL))) { - xf86Info.xkbkeycodes = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: keycodes: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbGeometry", NULL))) { - xf86Info.xkbgeometry = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: geometry: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbSymbols", NULL))) { - xf86Info.xkbsymbols = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: symbols: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbRules", NULL))) { - xf86Info.xkbrules = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: rules: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbModel", NULL))) { - xf86Info.xkbmodel = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: model: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbLayout", NULL))) { - xf86Info.xkblayout = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: layout: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbVariant", NULL))) { - xf86Info.xkbvariant = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: variant: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbOptions", NULL))) { - xf86Info.xkboptions = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: options: \"%s\"\n", s); - } - } - } -#undef NULL_IF_EMPTY -#endif -#if defined(SVR4) && defined(i386) - if ((xf86Info.panix106 = - xf86SetBoolOption(inputp->commonOptions, "Panix106", FALSE))) { - xf86Msg(X_CONFIG, "PANIX106: enabled\n"); - } -#endif - - /* - * This was once a compile time option (ASSUME_CUSTOM_KEYCODES) - * defaulting to 1 on Linux/PPC. It is no longer necessary, but for - * backwards compatibility we provide 'Option "CustomKeycodes"' - * and try to autoprobe on Linux/PPC. - */ - from = X_DEFAULT; - verb = 2; -#if defined(__linux__) && defined(__powerpc__) - { - FILE *f; - - f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r"); - if (f) { - if (fgetc(f) == '0') { - customKeycodesDefault = TRUE; - from = X_PROBED; - verb = 1; - } - fclose(f); - } - } -#endif - if (xf86FindOption(inputp->commonOptions, "CustomKeycodes")) { - from = X_CONFIG; - verb = 1; - } - xf86Info.kbdCustomKeycodes = - xf86SetBoolOption(inputp->commonOptions, "CustomKeycodes", - customKeycodesDefault); - xf86MsgVerb(from, verb, "Keyboard: CustomKeycode %s\n", - xf86Info.kbdCustomKeycodes ? "enabled" : "disabled"); - - return TRUE; -} - -/* * Locate the core input devices. These can be specified/located in * the following ways, in order of priority: * @@ -2594,10 +2282,6 @@ configInput(IDevPtr inputp, XF86ConfInpu inputp->commonOptions = conf_input->inp_option_lst; inputp->extraOptions = NULL; - /* XXX This is required until the keyboard driver is converted */ - if (!xf86NameCmp(inputp->driver, "keyboard")) - return configInputKbd(inputp); - return TRUE; } diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 831c68a..b8e8166 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -403,679 +403,6 @@ #endif } } -/* - * xf86PostKbdEvent -- - * Translate the raw hardware KbdEvent into an XEvent, and tell DIX - * about it. Scancode preprocessing and so on is done ... - * - * OS/2 specific xf86PostKbdEvent(key) has been moved to os-support/os2/os2_kbd.c - * as some things differ, and I did not want to scatter this routine with - * ifdefs further (hv). - */ - -#ifdef __linux__ -extern u_char SpecialServerMap[]; -#endif - -#if !defined(__UNIXOS2__) -void -xf86PostKbdEvent(unsigned key) -{ - int scanCode = (key & 0x7f); - int specialkey = 0; - Bool down = (key & 0x80 ? FALSE : TRUE); - KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; - Bool updateLeds = FALSE; - Bool UsePrefix = FALSE; - Bool Direction = FALSE; - xEvent kevent; - KeySym *keysym; - int keycode; - static int lockkeys = 0; -#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) - static Bool first_time = TRUE; -#endif -#if defined(__sparc__) && defined(__linux__) - static int kbdSun = -1; -#endif - /* Disable any keyboard processing while in suspend */ - if (xf86inSuspend) - return; - -#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) - if (first_time) - { - first_time = FALSE; - VTSwitchEnabled = (xf86Info.consType == SYSCONS) - || (xf86Info.consType == PCVT); - } -#endif - -#if defined (__sparc__) && defined(__linux__) - if (kbdSun == -1) { - if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) - || (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun"))) - kbdSun = 1; - else - kbdSun = 0; - } - if (kbdSun) - goto special; -#endif /* __sparc__ && __linux__ */ - -#ifdef __linux__ - if (xf86Info.kbdCustomKeycodes) { - specialkey = SpecialServerMap[scanCode]; - goto customkeycodes; - } -#endif - - /* - * First do some special scancode remapping ... - */ - if (xf86Info.scanPrefix == 0) { - - switch (scanCode) { - case KEY_Prefix0: - case KEY_Prefix1: -#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) - if (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS - || xf86Info.consType == PCVT -#ifdef WSCONS_SUPPORT - || (xf86Info.consType == WSCONS && xf86Info.kbdEvents != xf86WSKbdEvents) -#endif - ) { -#endif - xf86Info.scanPrefix = scanCode; /* special prefixes */ - return; -#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) - } - break; -#endif - } -#if defined (i386) && defined (SVR4) - /* - * PANIX returns DICOP standards based keycodes in using 106jp - * keyboard. We need to remap some keys. - */ - if(xf86Info.panix106 == TRUE){ - switch (scanCode) { - case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */ - case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/ - case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */ - case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */ - case 0x6B: scanCode = KEY_Left; break; /* Cur Left */ - case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */ - case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */ - case 0x73: scanCode = KEY_RCtrl; break; /* not needed */ - } - } else -#endif /* i386 && SVR4 */ - { - switch (scanCode) { - case 0x59: scanCode = KEY_0x59; break; - case 0x5a: scanCode = KEY_0x5A; break; - case 0x5b: scanCode = KEY_0x5B; break; - case 0x5c: scanCode = KEY_KP_Equal; break; /* Keypad Equal */ - case 0x5d: scanCode = KEY_0x5D; break; - case 0x5e: scanCode = KEY_0x5E; break; - case 0x5f: scanCode = KEY_0x5F; break; - case 0x62: scanCode = KEY_0x62; break; - case 0x63: scanCode = KEY_0x63; break; - case 0x64: scanCode = KEY_0x64; break; - case 0x65: scanCode = KEY_0x65; break; - case 0x66: scanCode = KEY_0x66; break; - case 0x67: scanCode = KEY_0x67; break; - case 0x68: scanCode = KEY_0x68; break; - case 0x69: scanCode = KEY_0x69; break; - case 0x6a: scanCode = KEY_0x6A; break; - case 0x6b: scanCode = KEY_0x6B; break; - case 0x6c: scanCode = KEY_0x6C; break; - case 0x6d: scanCode = KEY_0x6D; break; - case 0x6e: scanCode = KEY_0x6E; break; - case 0x6f: scanCode = KEY_0x6F; break; - case 0x70: scanCode = KEY_0x70; break; - case 0x71: scanCode = KEY_0x71; break; - case 0x72: scanCode = KEY_0x72; break; - case 0x73: scanCode = KEY_0x73; break; - case 0x74: scanCode = KEY_0x74; break; - case 0x75: scanCode = KEY_0x75; break; - case 0x76: scanCode = KEY_0x76; break; - } - } - } - - else if ( -#ifdef CSRG_BASED - (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS - || xf86Info.consType == PCVT -#ifdef WSCONS_SUPPORT - || (xf86Info.consType == WSCONS && xf86Info.kbdEvents != - xf86WSKbdEvents) -#endif - ) && -#endif - (xf86Info.scanPrefix == KEY_Prefix0)) { - xf86Info.scanPrefix = 0; - - switch (scanCode) { - case KEY_KP_7: scanCode = KEY_Home; break; /* curs home */ - case KEY_KP_8: scanCode = KEY_Up; break; /* curs up */ - case KEY_KP_9: scanCode = KEY_PgUp; break; /* curs pgup */ - case KEY_KP_4: scanCode = KEY_Left; break; /* curs left */ - case KEY_KP_5: scanCode = KEY_Begin; break; /* curs begin */ - case KEY_KP_6: scanCode = KEY_Right; break; /* curs right */ - case KEY_KP_1: scanCode = KEY_End; break; /* curs end */ - case KEY_KP_2: scanCode = KEY_Down; break; /* curs down */ - case KEY_KP_3: scanCode = KEY_PgDown; break; /* curs pgdown */ - case KEY_KP_0: scanCode = KEY_Insert; break; /* curs insert */ - case KEY_KP_Decimal: scanCode = KEY_Delete; break; /* curs delete */ - case KEY_Enter: scanCode = KEY_KP_Enter; break; /* keypad enter */ - case KEY_LCtrl: scanCode = KEY_RCtrl; break; /* right ctrl */ - case KEY_KP_Multiply: scanCode = KEY_Print; break; /* print */ - case KEY_Slash: scanCode = KEY_KP_Divide; break; /* keyp divide */ - case KEY_Alt: scanCode = KEY_AltLang; break; /* right alt */ - case KEY_ScrollLock: scanCode = KEY_Break; break; /* curs break */ - case 0x5b: scanCode = KEY_LMeta; break; - case 0x5c: scanCode = KEY_RMeta; break; - case 0x5d: scanCode = KEY_Menu; break; - case KEY_F3: scanCode = KEY_F13; break; - case KEY_F4: scanCode = KEY_F14; break; - case KEY_F5: scanCode = KEY_F15; break; - case KEY_F6: scanCode = KEY_F16; break; - case KEY_F7: scanCode = KEY_F17; break; - case KEY_KP_Plus: scanCode = KEY_KP_DEC; break; - /* - * Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) - */ - case 0x2A: - case 0x36: - return; - default: - xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n", - scanCode); - /* - * "Internet" keyboards are generating lots of new codes. Let them - * pass. There is little consistency between them, so don't bother - * with symbolic names at this level. - */ - scanCode += 0x78; - } - } - - else if (xf86Info.scanPrefix == KEY_Prefix1) - { - xf86Info.scanPrefix = (scanCode == KEY_LCtrl) ? KEY_LCtrl : 0; - return; - } - - else if (xf86Info.scanPrefix == KEY_LCtrl) - { - xf86Info.scanPrefix = 0; - if (scanCode != KEY_NumLock) return; - scanCode = KEY_Pause; /* pause */ - } - -#ifndef __sparc64__ - /* - * PC keyboards generate separate key codes for - * Alt+Print and Control+Pause but in the X keyboard model - * they need to get the same key code as the base key on the same - * physical keyboard key. - */ - if (scanCode == KEY_SysReqest) - scanCode = KEY_Print; - else if (scanCode == KEY_Break) - scanCode = KEY_Pause; -#endif - - /* - * and now get some special keysequences - */ - - specialkey = scanCode; - -#ifdef __linux__ -customkeycodes: -#endif -#if defined(i386) || defined(__i386__) - if (xf86IsPc98()) { - switch (scanCode) { - case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */ - case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */ - case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */ - - /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */ - - case 0x62: specialkey = 0x3b; break; /* KEY_F1 */ - case 0x63: specialkey = 0x3c; break; /* KEY_F2 */ - case 0x64: specialkey = 0x3d; break; /* KEY_F3 */ - case 0x65: specialkey = 0x3e; break; /* KEY_F4 */ - case 0x66: specialkey = 0x3f; break; /* KEY_F5 */ - case 0x67: specialkey = 0x40; break; /* KEY_F6 */ - case 0x68: specialkey = 0x41; break; /* KEY_F7 */ - case 0x69: specialkey = 0x42; break; /* KEY_F8 */ - case 0x6a: specialkey = 0x43; break; /* KEY_F9 */ - case 0x6b: specialkey = 0x44; break; /* KEY_F10 */ - /* case 0x73: specialkey = 0x38; break; KEY_Alt */ - /* case 0x74: specialkey = 0x1d; break; KEY_LCtrl */ - default: specialkey = 0x00; break; - } - } -#endif -#if defined (__sparc__) && defined(__linux__) -special: - if (kbdSun) { - switch (scanCode) { - case 0x2b: specialkey = KEY_BackSpace; break; - case 0x47: specialkey = KEY_KP_Minus; break; - case 0x7d: specialkey = KEY_KP_Plus; break; - - /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */ - - case 0x05: specialkey = KEY_F1; break; - case 0x06: specialkey = KEY_F2; break; - case 0x08: specialkey = KEY_F3; break; - case 0x0a: specialkey = KEY_F4; break; - case 0x0c: specialkey = KEY_F5; break; - case 0x0e: specialkey = KEY_F6; break; - case 0x10: specialkey = KEY_F7; break; - case 0x11: specialkey = KEY_F8; break; - case 0x12: specialkey = KEY_F9; break; - case 0x07: specialkey = KEY_F10; break; - case 0x09: specialkey = KEY_F11; break; - case 0x0b: specialkey = KEY_F12; break; - default: specialkey = 0; break; - } - /* - * XXX XXX XXX: - * - * I really don't know what's wrong here, but passing the real - * scanCode offsets by one from XKB's point of view. - * - * (ecd@skynet.be, 980405) - */ - scanCode--; - } -#endif /* defined (__sparc__) && defined(__linux__) */ - -#ifdef XKB - if ((xf86Info.ddxSpecialKeys == SKWhenNeeded && - !xf86Info.ActionKeyBindingsSet) || - noXkbExtension || xf86Info.ddxSpecialKeys == SKAlways) { -#endif - if (!(ModifierDown(ShiftMask)) && - ((ModifierDown(ControlMask | AltMask)) || - (ModifierDown(ControlMask | AltLangMask)))) - { - switch (specialkey) { - - case KEY_BackSpace: - xf86ProcessActionEvent(ACTION_TERMINATE, NULL); - break; - - /* - * Check grabs - */ - case KEY_KP_Divide: - xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL); - break; - case KEY_KP_Multiply: - xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL); - break; - - /* - * Video mode switches - */ - case KEY_KP_Minus: /* Keypad - */ - if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL); - if (!xf86Info.dontZoom) return; - break; - - case KEY_KP_Plus: /* Keypad + */ - if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL); - if (!xf86Info.dontZoom) return; - break; - - /* Under QNX4, we set the vtPending flag for VT switching and - * let the VT switch function do the rest... - * This is a little different from the other OS'es. - */ -#if defined(QNX4) - case KEY_1: - case KEY_2: - case KEY_3: - case KEY_4: - case KEY_5: - case KEY_6: - case KEY_7: - case KEY_8: - case KEY_9: - if (VTSwitchEnabled && !xf86Info.dontVTSwitch) { - if (down) { - int vtno = specialkey - KEY_1 + 1; - xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno); - } - return; - } - break; -#endif - -#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) || defined(__SCO__) || defined(__UNIXWARE__) - /* - * Under Linux, the raw keycodes are consumed before the kernel - * does any processing on them, so we must emulate the vt switching - * we want ourselves. - */ - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - case KEY_F11: - case KEY_F12: - if ((VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) -#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) - && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) -#endif - ) { - int vtno = specialkey - KEY_F1 + 1; - if (specialkey == KEY_F11 || specialkey == KEY_F12) - vtno = specialkey - KEY_F11 + 11; - if (down) - xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno); - return; - } - break; -#endif /* linux || BSD with VTs */ - - /* just worth mentioning here: any 386bsd keyboard driver - * (pccons.c or co_kbd.c) catches CTRL-ALT-DEL and CTRL-ALT-ESC - * before any application (e.g. XF86) will see it - * OBS: syscons does not, nor does pcvt ! - */ - } - } - - /* - * Start of actual Solaris VT switching code. - * This should pretty much emulate standard SVR4 switching keys. - * - * DWH 12/2/93 - */ - -#ifdef USE_VT_SYSREQ - if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch) - { - switch (specialkey) - { - /* - * syscons on *BSD doesn't have a VT #0 -- don't think Linux does - * either - */ -#if defined (sun) && defined (i386) && defined (SVR4) - case KEY_H: - if (VTSysreqToggle && down) - { - xf86ProcessActionEvent(ACTION_SWITCHSCREEN, NULL); - VTSysreqToggle = 0; - return; - } - break; - - /* - * Yah, I know the N, and P keys seem backwards, however that's - * how they work under Solaris - * XXXX N means go to next active VT not necessarily vtno+1 (or vtno-1) - */ - - case KEY_N: - if (VTSysreqToggle && down) - { - xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL); - VTSysreqToggle = FALSE; - return; - } - break; - - case KEY_P: - if (VTSysreqToggle && down) - { - xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL); - VTSysreqToggle = FALSE; - return; - } - break; -#endif - - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - case KEY_F11: - case KEY_F12: - if (VTSysreqToggle && down) - { int vtno = specialkey - KEY_F1 + 1; - if (specialkey == KEY_F11 || specialkey == KEY_F12) - vtno = specialkey - KEY_F11 + 11; - xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno); - VTSysreqToggle = FALSE; - return; - } - break; - - /* Ignore these keys -- ie don't let them cancel an alt-sysreq */ - case KEY_Alt: - case KEY_AltLang: - break; - - case KEY_SysReqest: - if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask))) - VTSysreqToggle = TRUE; - break; - - default: - if (VTSysreqToggle) - { - /* - * We only land here when Alt-SysReq is followed by a - * non-switching key. - */ - VTSysreqToggle = FALSE; - - } - } - } - -#endif /* USE_VT_SYSREQ */ - -#ifdef __SCO__ - /* - * With the console in raw mode, SCO will not switch consoles, - * you get around this by activating the next console along, if - * this fails then go back to console 0, if there is only one - * then it doesn't matter, switching to yourself is a nop as far - * as the console driver is concerned. - * We could do something similar to linux here but SCO ODT uses - * Ctrl-PrintScrn, so why change? - */ - if (specialkey == KEY_Print && ModifierDown(ControlMask)) { - if (down) - xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL); - return; - } -#endif /* __SCO__ */ -#ifdef XKB - } -#endif - - /* - * Now map the scancodes to real X-keycodes ... - */ - keycode = scanCode + MIN_KEYCODE; - keysym = (keyc->curKeySyms.map + - keyc->curKeySyms.mapWidth * - (keycode - keyc->curKeySyms.minKeyCode)); -#ifdef XKB - if (noXkbExtension) { -#endif - /* - * Filter autorepeated caps/num/scroll lock keycodes. - */ -#define CAPSFLAG 0x01 -#define NUMFLAG 0x02 -#define SCROLLFLAG 0x04 -#define MODEFLAG 0x08 - if( down ) { - switch( keysym[0] ) { - case XK_Caps_Lock : - if (lockkeys & CAPSFLAG) - return; - else - lockkeys |= CAPSFLAG; - break; - - case XK_Num_Lock : - if (lockkeys & NUMFLAG) - return; - else - lockkeys |= NUMFLAG; - break; - - case XK_Scroll_Lock : - if (lockkeys & SCROLLFLAG) - return; - else - lockkeys |= SCROLLFLAG; - break; - } - if (keysym[1] == XF86XK_ModeLock) - { - if (lockkeys & MODEFLAG) - return; - else - lockkeys |= MODEFLAG; - } - - } - else { - switch( keysym[0] ) { - case XK_Caps_Lock : - lockkeys &= ~CAPSFLAG; - break; - - case XK_Num_Lock : - lockkeys &= ~NUMFLAG; - break; - - case XK_Scroll_Lock : - lockkeys &= ~SCROLLFLAG; - break; - } - if (keysym[1] == XF86XK_ModeLock) - lockkeys &= ~MODEFLAG; - } - - /* - * LockKey special handling: - * ignore releases, toggle on & off on presses. - * Don't deal with the Caps_Lock keysym directly, but check the lock modifier - */ - if (keyc->modifierMap[keycode] & LockMask || - keysym[0] == XK_Scroll_Lock || - keysym[1] == XF86XK_ModeLock || - keysym[0] == XK_Num_Lock) - { - Bool flag; - - if (!down) return; - if (KeyPressed(keycode)) { - down = !down; - flag = FALSE; - } - else - flag = TRUE; - - if (keyc->modifierMap[keycode] & LockMask) xf86Info.capsLock = flag; - if (keysym[0] == XK_Num_Lock) xf86Info.numLock = flag; - if (keysym[0] == XK_Scroll_Lock) xf86Info.scrollLock = flag; - if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag; - updateLeds = TRUE; - } - - if (!xf86Info.kbdCustomKeycodes) { - /* - * normal, non-keypad keys - */ - if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { -#if !defined(CSRG_BASED) && \ - !defined(__GNU__) && \ - defined(KB_84) - /* - * magic ALT_L key on AT84 keyboards for multilingual support - */ - if (xf86Info.kbdType == KB_84 && - ModifierDown(AltMask) && - keysym[2] != NoSymbol) - { - UsePrefix = TRUE; - Direction = TRUE; - } -#endif /* !CSRG_BASED && ... */ - } - } - if (updateLeds) xf86UpdateKbdLeds(); -#ifdef XKB - } -#endif - - /* - * check for an autorepeat-event - */ - if (down && KeyPressed(keycode)) { - KbdFeedbackClassRec *kbdfeed = ((DeviceIntPtr)xf86Info.pKeyboard)->kbdfeed; - if ((xf86Info.autoRepeat != AutoRepeatModeOn) || - keyc->modifierMap[keycode] || - (kbdfeed && !(kbdfeed->ctrl.autoRepeats[keycode>>3] & ( 1<<(keycode&7) )))) - return; - } - - - xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis(); - /* - * And now send these prefixes ... - * NOTE: There cannot be multiple Mode_Switch keys !!!! - */ - if (UsePrefix) - { - ENQUEUE(&kevent, - keyc->modifierKeyMap[keyc->maxKeysPerModifier*7], - (Direction ? KeyPress : KeyRelease), - XE_KEYBOARD); - ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); - ENQUEUE(&kevent, - keyc->modifierKeyMap[keyc->maxKeysPerModifier*7], - (Direction ? KeyRelease : KeyPress), - XE_KEYBOARD); - } - else - { - ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); - } -} -#endif /* !__UNIXOS2__ */ - #define ModifierIsSet(k) ((modifiers & (k)) == (k)) _X_EXPORT Bool @@ -1137,8 +464,6 @@ #if !defined(__UNIXOS2__) && !defined(__ XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices); if (XFD_ANYSET(&devicesWithInput)) { - if (xf86Info.kbdEvents) - (xf86Info.kbdEvents)(); pInfo = xf86InputDevs; while (pInfo) { if (pInfo->read_input && pInfo->fd >= 0 && @@ -1161,8 +486,6 @@ #else /* __UNIXOS2__ and __QNX__ */ InputInfoPtr pInfo; - (xf86Info.kbdEvents)(); /* Under OS/2 and QNX, always call */ - pInfo = xf86InputDevs; while (pInfo) { if (pInfo->read_input && pInfo->fd >= 0) { @@ -1757,31 +1080,3 @@ xf86ReloadInputDevs(int sig) return; } - -#ifdef WSCONS_SUPPORT - -/* XXX Currently XKB is mandatory. */ - -extern int WSKbdToKeycode(int); - -void -xf86PostWSKbdEvent(struct wscons_event *event) -{ - int type = event->type; - int value = event->value; - unsigned int keycode; - int blocked; - - if (type == WSCONS_EVENT_KEY_UP || type == WSCONS_EVENT_KEY_DOWN) { - Bool down = (type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE); - - /* map the scancodes to standard XFree86 scancode */ - keycode = WSKbdToKeycode(value); - if (!down) keycode |= 0x80; - /* It seems better to block SIGIO there */ - blocked = xf86BlockSIGIO(); - xf86PostKbdEvent(keycode); - xf86UnblockSIGIO(blocked); - } -} -#endif /* WSCONS_SUPPORT */ diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index b3b5c1b..002b149 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -95,35 +95,12 @@ InputInfoPtr xf86InputDevs = NULL; xf86InfoRec xf86Info = { NULL, /* pKeyboard */ - NULL, /* kbdProc */ - NULL, /* kbdEvents */ -1, /* consoleFd */ - -1, /* kbdFd */ -1, /* vtno */ - -1, /* kbdType */ - -1, /* kbdRate */ - -1, /* kbdDelay */ - -1, /* bell_pitch */ - -1, /* bell_duration */ - TRUE, /* autoRepeat */ - 0, /* leds */ - 0, /* xleds */ NULL, /* vtinit */ - 0, /* scanPrefix */ - FALSE, /* capsLock */ - FALSE, /* numLock */ - FALSE, /* scrollLock */ - FALSE, /* modeSwitchLock */ - FALSE, /* composeLock */ - FALSE, /* vtSysreq */ + FALSE, /* vtSysreq */ SKWhenNeeded, /* ddxSpecialKeys */ - FALSE, /* ActionKeyBindingsSet */ -#if defined(SVR4) && defined(i386) - FALSE, /* panix106 */ -#endif -#if defined(__OpenBSD__) || defined(__NetBSD__) - 0, /* wskbdType */ -#endif + NULL, /* pMouse */ #ifdef XINPUT NULL, /* mouseLocal */ diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 3aed369..fd39fc0 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -141,16 +141,6 @@ static int numFormats = 6; #endif static Bool formatsDone = FALSE; -InputDriverRec XF86KEYBOARD = { - 1, - "keyboard", - NULL, - NULL, - NULL, - NULL, - 0 -}; - static Bool xf86CreateRootWindow(WindowPtr pWin) { @@ -415,10 +405,6 @@ #ifdef XFree86LOADER xfree(modulelist); } -#ifdef USE_DEPRECATED_KEYBOARD_DRIVER - /* Setup the builtin input drivers */ - xf86AddInputDriver(&XF86KEYBOARD, NULL, 0); -#endif /* Load all input driver modules specified in the config file. */ if ((modulelist = xf86InputDriverlistFromConfig())) { xf86LoadModules(modulelist, NULL); @@ -1036,18 +1022,6 @@ InitInput(argc, argv) if (serverGeneration == 1) { /* Call the PreInit function for each input device instance. */ for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) { -#ifdef USE_DEPRECATED_KEYBOARD_DRIVER - /* XXX The keyboard driver is a special case for now. */ - if (!xf86NameCmp(pDev->driver, "keyboard")) { - xf86MsgVerb(X_WARNING, 0, "*** WARNING the legacy keyboard driver \"keyboard\" is deprecated\n"); - xf86MsgVerb(X_WARNING, 0, "*** and will be removed in the next release of the Xorg server.\n"); - xf86MsgVerb(X_WARNING, 0, "*** Please consider using the the new \"kbd\" driver for \"%s\".\n", - pDev->identifier); - - continue; - } -#endif - if ((pDrv = MatchInput(pDev)) == NULL) { xf86Msg(X_ERROR, "No Input driver matching `%s'\n", pDev->driver); /* XXX For now, just continue. */ @@ -1122,17 +1096,9 @@ #endif pInfo = pInfo->next; } - if (coreKeyboard) { + if (coreKeyboard) xf86Info.pKeyboard = coreKeyboard->dev; - xf86Info.kbdEvents = NULL; /* to prevent the internal keybord driver usage*/ - } - else { -#ifdef USE_DEPRECATED_KEYBOARD_DRIVER - /* Only set this if we're allowing the old driver. */ - if (xf86Info.kbdProc != NULL) - xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE); -#endif - } + if (corePointer) xf86Info.pMouse = corePointer->dev; if (xf86Info.pKeyboard) @@ -1265,12 +1231,6 @@ AbortDDX() int i; /* - * try to deinitialize all input devices - */ - if (xf86Info.kbdProc && xf86Info.pKeyboard) - (xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE); - - /* * try to restore the original video state */ #ifdef HAS_USL_VTS diff --git a/hw/xfree86/common/xf86Io.c b/hw/xfree86/common/xf86Io.c index 4dbbd7e..5e1980c 100644 --- a/hw/xfree86/common/xf86Io.c +++ b/hw/xfree86/common/xf86Io.c @@ -68,6 +68,7 @@ #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSlib.h" #include "mipointer.h" +#include "xf86OSKbd.h" #ifdef XINPUT #include "xf86Xinput.h" @@ -75,400 +76,19 @@ #include #include "exevents.h" #endif -#ifdef XKB -#include -#include -#include -#endif - -unsigned int xf86InitialCaps = 0; -unsigned int xf86InitialNum = 0; -unsigned int xf86InitialScroll = 0; - -#include "atKeynames.h" - -/* - * xf86KbdBell -- - * Ring the terminal/keyboard bell for an amount of time proportional to - * "loudness". - */ - -void -xf86KbdBell(percent, pKeyboard, ctrl, unused) - int percent; /* Percentage of full volume */ - DeviceIntPtr pKeyboard; /* Keyboard to ring */ - pointer ctrl; - int unused; -{ - xf86SoundKbdBell(percent, xf86Info.bell_pitch, xf86Info.bell_duration); -} - -void -xf86UpdateKbdLeds() -{ - int leds = 0; - if (xf86Info.capsLock) leds |= XLED1; - if (xf86Info.numLock) leds |= XLED2; - if (xf86Info.scrollLock || xf86Info.modeSwitchLock) leds |= XLED3; - if (xf86Info.composeLock) leds |= XLED4; - xf86Info.leds = (xf86Info.leds & xf86Info.xleds) | (leds & ~xf86Info.xleds); - xf86KbdLeds(); -} - -void -xf86KbdLeds () -{ - int leds, real_leds = 0; - -#if defined (__sparc__) && defined(__linux__) - static int kbdSun = -1; - if (kbdSun == -1) { - if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) || - (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun"))) - kbdSun = 1; - else - kbdSun = 0; - } - if (kbdSun) { - if (xf86Info.leds & 0x08) real_leds |= XLED1; - if (xf86Info.leds & 0x04) real_leds |= XLED3; - if (xf86Info.leds & 0x02) real_leds |= XLED4; - if (xf86Info.leds & 0x01) real_leds |= XLED2; - leds = real_leds; - real_leds = 0; - } else { - leds = xf86Info.leds; - } -#else - leds = xf86Info.leds; -#endif /* defined (__sparc__) */ - -#ifdef LED_CAP - if (leds & XLED1) real_leds |= LED_CAP; - if (leds & XLED2) real_leds |= LED_NUM; - if (leds & XLED3) real_leds |= LED_SCR; -#ifdef LED_COMP - if (leds & XLED4) real_leds |= LED_COMP; -#else - if (leds & XLED4) real_leds |= LED_SCR; -#endif -#endif -#ifdef sun - /* Pass through any additional LEDs, such as Kana LED on Sun Japanese kbd */ - real_leds |= (leds & 0xFFFFFFF0); -#endif - xf86SetKbdLeds(real_leds); - (void)leds; -} - -/* - * xf86KbdCtrl -- - * Alter some of the keyboard control parameters. All special protocol - * values are handled by dix (ProgChangeKeyboardControl) - */ - -void -xf86KbdCtrl (pKeyboard, ctrl) - DevicePtr pKeyboard; /* Keyboard to alter */ - KeybdCtrl *ctrl; -{ - int leds; - xf86Info.bell_pitch = ctrl->bell_pitch; - xf86Info.bell_duration = ctrl->bell_duration; - xf86Info.autoRepeat = ctrl->autoRepeat; - - xf86Info.composeLock = (ctrl->leds & XCOMP) ? TRUE : FALSE; - - leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR)); -#ifdef XKB - if (noXkbExtension) { -#endif - xf86Info.leds = (leds & xf86Info.xleds)|(xf86Info.leds & ~xf86Info.xleds); -#ifdef XKB - } else { - xf86Info.leds = leds; - } -#endif - - xf86KbdLeds(); -} - -/* - * xf86InitKBD -- - * Reinitialize the keyboard. Only set Lockkeys according to ours leds. - * Depress all other keys. - */ - -void -xf86InitKBD(init) -Bool init; -{ - char leds = 0, rad; - unsigned int i; - xEvent kevent; - DeviceIntPtr pKeyboard = xf86Info.pKeyboard; - KeyClassRec *keyc = xf86Info.pKeyboard->key; - KeySym *map = keyc->curKeySyms.map; - - kevent.u.keyButtonPointer.time = GetTimeInMillis(); - kevent.u.keyButtonPointer.rootX = 0; - kevent.u.keyButtonPointer.rootY = 0; - - /* - * Hmm... here is the biggest hack of every time ! - * It may be possible that a switch-vt procedure has finished BEFORE - * you released all keys neccessary to do this. That peculiar behavior - * can fool the X-server pretty much, cause it assumes that some keys - * were not released. TWM may stuck alsmost completly.... - * OK, what we are doing here is after returning from the vt-switch - * exeplicitely unrelease all keyboard keys before the input-devices - * are reenabled. - */ - for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map; - i < keyc->curKeySyms.maxKeyCode; - i++, map += keyc->curKeySyms.mapWidth) - if (KeyPressed(i)) - { - switch (*map) { - /* Don't release the lock keys */ - case XK_Caps_Lock: - case XK_Shift_Lock: - case XK_Num_Lock: - case XK_Scroll_Lock: - case XK_Kana_Lock: - break; - default: - kevent.u.u.detail = i; - kevent.u.u.type = KeyRelease; - (* pKeyboard->public.processInputProc)(&kevent, pKeyboard, 1); - } - } - - xf86Info.scanPrefix = 0; - - if (init) - { - /* - * we must deal here with the fact, that on some cases the numlock or - * capslock key are enabled BEFORE the server is started up. So look - * here at the state on the according LEDS to determine whether a - * lock-key is already set. - */ - - xf86Info.capsLock = FALSE; - xf86Info.numLock = FALSE; - xf86Info.scrollLock = FALSE; - xf86Info.modeSwitchLock = FALSE; - xf86Info.composeLock = FALSE; - -#ifdef LED_CAP -#ifdef INHERIT_LOCK_STATE - leds = xf86Info.leds; - - for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map; - i < keyc->curKeySyms.maxKeyCode; - i++, map += keyc->curKeySyms.mapWidth) - - switch(*map) { - - case XK_Caps_Lock: - case XK_Shift_Lock: - if (leds & LED_CAP) - { - xf86InitialCaps = i; - xf86Info.capsLock = TRUE; - } - break; - - case XK_Num_Lock: - if (leds & LED_NUM) - { - xf86InitialNum = i; - xf86Info.numLock = TRUE; - } - break; - - case XK_Scroll_Lock: - case XK_Kana_Lock: - if (leds & LED_SCR) - { - xf86InitialScroll = i; - xf86Info.scrollLock = TRUE; - } - break; - } -#endif /* INHERIT_LOCK_STATE */ - xf86SetKbdLeds(leds); -#endif /* LED_CAP */ - (void)leds; - - if (xf86Info.kbdDelay <= 375) rad = 0x00; - else if (xf86Info.kbdDelay <= 625) rad = 0x20; - else if (xf86Info.kbdDelay <= 875) rad = 0x40; - else rad = 0x60; - - if (xf86Info.kbdRate <= 2) rad |= 0x1F; - else if (xf86Info.kbdRate >= 30) rad |= 0x00; - else rad |= ((58 / xf86Info.kbdRate) - 2); - - xf86SetKbdRepeat(rad); - } -} - /* - * xf86KbdProc -- - * Handle the initialization, etc. of a keyboard. + * LegalModifier -- + * determine whether a key is a legal modifier key, i.e send a + * press/release sequence. */ -int -xf86KbdProc (pKeyboard, what) - DeviceIntPtr pKeyboard; /* Keyboard to manipulate */ - int what; /* What to do to it */ +/*ARGSUSED*/ +Bool +LegalModifier(key, pDev) + unsigned int key; + DevicePtr pDev; { - KeySymsRec keySyms; - CARD8 modMap[MAP_LENGTH]; - int kbdFd; - - switch (what) { - - case DEVICE_INIT: - /* - * First open and find the current state of the keyboard. - */ - - xf86KbdInit(); - - xf86KbdGetMapping(&keySyms, modMap); - - -#ifndef XKB - defaultKeyboardControl.leds = xf86GetKbdLeds(); -#else - defaultKeyboardControl.leds = 0; -#endif - - /* - * Perform final initialization of the system private keyboard - * structure and fill in various slots in the device record - * itself which couldn't be filled in before. - */ - - pKeyboard->public.on = FALSE; - -#ifdef XKB - if (noXkbExtension) { -#endif - InitKeyboardDeviceStruct((DevicePtr)xf86Info.pKeyboard, - &keySyms, - modMap, - xf86KbdBell, - (KbdCtrlProcPtr)xf86KbdCtrl); -#ifdef XKB - } else { - XkbComponentNamesRec names; - XkbDescPtr desc; - Bool foundTerminate = FALSE; - int keyc; - if (xf86Info.xkbkeymap) { - names.keymap = xf86Info.xkbkeymap; - names.keycodes = NULL; - names.types = NULL; - names.compat = NULL; - names.symbols = NULL; - names.geometry = NULL; - } else { - names.keymap = NULL; - names.keycodes = xf86Info.xkbkeycodes; - names.types = xf86Info.xkbtypes; - names.compat = xf86Info.xkbcompat; - names.symbols = xf86Info.xkbsymbols; - names.geometry = xf86Info.xkbgeometry; - } - if ((xf86Info.xkbkeymap || xf86Info.xkbcomponents_specified) - && (xf86Info.xkbmodel == NULL || xf86Info.xkblayout == NULL)) { - xf86Info.xkbrules = NULL; - } - XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel, - xf86Info.xkblayout, xf86Info.xkbvariant, - xf86Info.xkboptions); - - XkbInitKeyboardDeviceStruct(pKeyboard, - &names, - &keySyms, - modMap, - xf86KbdBell, - (KbdCtrlProcPtr)xf86KbdCtrl); - - /* Search keymap for Terminate action */ - desc = pKeyboard->key->xkbInfo->desc; - for (keyc = desc->min_key_code; keyc <= desc->max_key_code; keyc++) { - int i; - for (i = 1; i <= XkbKeyNumActions(desc, keyc); i++) { - if (XkbKeyAction(desc, keyc, i) - && XkbKeyAction(desc, keyc, i)->type == XkbSA_Terminate) { - foundTerminate = TRUE; - goto searchdone; - } - } - } -searchdone: - xf86Info.ActionKeyBindingsSet = foundTerminate; - if (!foundTerminate) - xf86Msg(X_INFO, "Server_Terminate keybinding not found\n"); - } -#endif - - xf86InitKBD(TRUE); - break; - - case DEVICE_ON: - /* - * Set the keyboard into "direct" mode and turn on - * event translation. - */ - - kbdFd = xf86KbdOn(); - /* - * Discard any pending input after a VT switch to prevent the server - * passing on parts of the VT switch sequence. - */ - sleep(1); -#if defined(WSCONS_SUPPORT) - if (xf86Info.consType != WSCONS) { -#endif - if (kbdFd != -1) { - char buf[16]; - read(kbdFd, buf, 16); - } -#if defined(WSCONS_SUPPORT) - } -#endif - -#if !defined(__UNIXOS2__) /* Under EMX, keyboard cannot be select()'ed */ - if (kbdFd != -1) - AddEnabledDevice(kbdFd); -#endif /* __UNIXOS2__ */ - - pKeyboard->public.on = TRUE; - xf86InitKBD(FALSE); - break; - - case DEVICE_CLOSE: - case DEVICE_OFF: - /* - * Restore original keyboard directness and translation. - */ - - kbdFd = xf86KbdOff(); - - if (kbdFd != -1) - RemoveEnabledDevice(kbdFd); - - pKeyboard->public.on = FALSE; - break; - - } - return (Success); + return (TRUE); } #if defined(DDXTIME) && !defined(QNX4) diff --git a/hw/xfree86/common/xf86Kbd.c b/hw/xfree86/common/xf86Kbd.c deleted file mode 100644 index 85f9e34..0000000 --- a/hw/xfree86/common/xf86Kbd.c +++ /dev/null @@ -1,395 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.26 2003/08/24 17:36:53 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * 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, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 1992-2003 by The XFree86 Project, Inc. - * - * 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 - * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - -/* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "atKeynames.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]] - -/* - * NOTE: Not all possible remappable symbols are remapped. There are two main - * reasons: - * a) The mapping between scancode and SYSV/386 - symboltable - * is inconsistent between different versions and has some - * BIG mistakes. - * b) In X-Windows there is a difference between numpad-keys - * and normal keys. SYSV/386 uses for both kinds of keys - * the same symbol. - * - * Thus only the alpha keypad and the function keys are translated. - * Also CapsLock, NumLock, ScrollLock, Shift, Control & Alt. - */ - -static unsigned char remap[128] = { - 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ - 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ - 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ - 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ -}; - -static KeySym eascii_to_x[512] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_Delete, - XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex, - XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla, - XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis, - XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring, - XK_Eacute, XK_ae, XK_AE, XK_ocircumflex, - XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave, - XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent, - XK_sterling, XK_yen, XK_paragraph, XK_section, - XK_aacute, XK_iacute, XK_oacute, XK_uacute, - XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine, - XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf, - XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi, - XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau, - XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta, - XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection, - XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal, - XK_topintegral, XK_botintegral, XK_division, XK_similarequal, - XK_degree, NoSymbol, NoSymbol, XK_radical, - XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol, - - /* - * special marked entries (256 + x) - */ - - NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, - XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, - NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R, - XK_Control_L, XK_Control_R, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_F1, - XK_F2, XK_F3, XK_F4, XK_F5, - XK_F6, XK_F7, XK_F8, XK_F9, - XK_F10, XK_F11, XK_F12, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - }; - -#endif /* HAS_GETKEYMAP */ - -/* - * LegalModifier -- - * determine whether a key is a legal modifier key, i.e send a - * press/release sequence. - */ - -/*ARGSUSED*/ -Bool -LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; -{ - return (TRUE); -} - - - -/* - * xf86KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -void -xf86KbdGetMapping (pKeySyms, pModMap) - KeySymsPtr pKeySyms; - CARD8 *pModMap; -{ - KeySym *k; -#ifdef HAS_GETKEYMAP - keymap_t keymap; -#endif - int i; - KeySym *pMap; - -#ifdef HAS_GETKBTYPE - char type; - - xf86Info.kbdType = - ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101; - if (xf86Info.kbdType == KB_84) - pMap = map84; - else - pMap = map; -#else -/* OS/2 sets the keyboard type during xf86OpenKbd */ -#ifndef __UNIXOS2__ - xf86Info.kbdType = 0; -#endif - pMap = map; -#endif - -#ifdef HAS_GETKEYMAP - /* - * use the keymap, which can be gotten from our oringinal vt??. - * ( ttymap(1) !!!! ) - */ - if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) { - for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++) - - if (remap[i]) { - - k = pMap + (remap[i] << 2); - - k[0] = KD_GET_ENTRY(i,0); /* non-shifed */ - k[1] = KD_GET_ENTRY(i,1); /* shifted */ - k[2] = KD_GET_ENTRY(i,4); /* alt */ - k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */ - - if (k[3] == k[2]) k[3] = NoSymbol; - if (k[2] == k[1]) k[2] = NoSymbol; - if (k[1] == k[0]) k[1] = NoSymbol; - if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol; - } - } -#endif - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = pMap, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - pKeySyms->map = pMap; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; -} diff --git a/hw/xfree86/common/xf86KbdBSD.c b/hw/xfree86/common/xf86KbdBSD.c deleted file mode 100644 index c1f6156..0000000 --- a/hw/xfree86/common/xf86KbdBSD.c +++ /dev/null @@ -1,1266 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.22 2003/10/07 22:00:52 herrb Exp $ */ -/* - * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk) - * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * and from xf86KbdCODrv.c by Holger Veit - * - * 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, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Copyright (c) 1994-2002 by The XFree86 Project, Inc. - * - * 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 - * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - -/* $XConsortium: xf86KbdBSD.c /main/6 1996/10/23 13:12:27 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "atKeynames.h" -#include "xf86Keymap.h" - -#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP) -#define KD_GET_ENTRY(i,n) \ - eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] - -static unsigned char remap[NUM_KEYCODES] = { - 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ - 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ - 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ - 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ -}; - -/* This table assumes the ibm code page 437 coding for characters - * > 0x80. They are returned in this form by PCVT */ -static KeySym eascii_to_x[512] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_Delete, - XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex, - XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla, - XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis, - XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring, - XK_Eacute, XK_ae, XK_AE, XK_ocircumflex, - XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave, - XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent, - XK_sterling, XK_yen, XK_paragraph, XK_section, - XK_aacute, XK_iacute, XK_oacute, XK_uacute, - XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine, - XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf, - XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi, - XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau, - XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta, - XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection, - XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal, - XK_topintegral, XK_botintegral, XK_division, XK_similarequal, - XK_degree, NoSymbol, NoSymbol, XK_radical, - XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol, - - /* - * special marked entries (256 + x) - */ - -#if 1 - /* This has been checked against what syscons actually does */ - NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, - XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, - XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_F1, - XK_F2, XK_F3, XK_F4, XK_F5, - XK_F6, XK_F7, XK_F8, XK_F9, - XK_F10, XK_F11, XK_F12, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol -#else - /* The old table, supposedly for pcvt. */ - NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, - XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, - NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R, - XK_Control_L, XK_Control_R, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_F1, - XK_F2, XK_F3, XK_F4, XK_F5, - XK_F6, XK_F7, XK_F8, XK_F9, - XK_F10, XK_F11, XK_F12, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol -#endif - }; - -#ifdef __OpenBSD__ -/* don't mark AltR and CtrlR for remapping, since they - * cannot be remapped by pccons */ -static unsigned char pccons_remap[128] = { - 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ - 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ - 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x77 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ -}; - -/* This table assumes an iso8859_1 encoding for the characters - * > 80, as returned by pccons */ -static KeySym latin1_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_Delete, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling, - XK_currency, XK_yen, XK_brokenbar, XK_section, - XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft, - XK_notsign, XK_hyphen, XK_registered, XK_macron, - XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior, - XK_acute, XK_mu, XK_paragraph, XK_periodcentered, - XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright, - XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown, - XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde, - XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla, - XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, - XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, - XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, - XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply, - XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex, - XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp, - XK_agrave, XK_aacute, XK_acircumflex, XK_atilde, - XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla, - XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, - XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis, - XK_eth, XK_ntilde, XK_ograve, XK_oacute, - XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division, - XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex, - XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis - }; -#endif -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ -/* - * LegalModifier -- - * determine whether a key is a legal modifier key, i.e send a - * press/release sequence. - */ - -/*ARGSUSED*/ -Bool -LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; -{ - return (TRUE); -} - -/* - * xf86KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -void -xf86KbdGetMapping (pKeySyms, pModMap) - KeySymsPtr pKeySyms; - CARD8 *pModMap; -{ - KeySym *k; - int i; - -#ifndef __bsdi__ - switch (xf86Info.consType) { - -#ifdef PCCONS_SUPPORT - case PCCONS: -#if defined(__OpenBSD__) - /* - * on OpenBSD, the pccons keymap is programmable, too - */ - { - pccons_keymap_t keymap[KB_NUM_KEYS]; - if (ioctl(xf86Info.consoleFd, CONSOLE_GET_KEYMAP, &keymap) != -1) { - for (i = 0; i < KB_NUM_KEYS; i++) - if (pccons_remap[i]) { - k = map + (pccons_remap[i] << 2); - switch (keymap[i].type) { - case KB_ASCII: - /* For ASCII keys, there is only one char in the keymap */ - k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]]; - k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]]; - k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]]; - k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]]; - break; - case KB_SCROLL: - k[0] = XK_Scroll_Lock; - goto special; - case KB_NUM: - k[0] = XK_Num_Lock; - goto special; - case KB_CAPS: - k[0] = XK_Caps_Lock; - goto special; - case KB_SHIFT: - switch (keymap[i].unshift[0]) { - case 1: - /* left shift */ - k[0] = XK_Shift_L; - break; - case 2: - /* right shift */ - k[0] = XK_Shift_R; - break; - default: - k[0] = NoSymbol; - } - goto special; - case KB_CTL: - k[0] = XK_Control_L; - goto special; - case KB_ALT: - k[0] = XK_Alt_L; - goto special; - case KB_FUNC: - switch (keymap[i].unshift[2]) { - case 'M': - k[0] = XK_F1; - break; - case 'N': - k[0] = XK_F2; - break; - case 'O': - k[0] = XK_F3; - break; - case 'P': - k[0] = XK_F4; - break; - case 'Q': - k[0] = XK_F5; - break; - case 'R': - k[0] = XK_F6; - break; - case 'S': - k[0] = XK_F7; - break; - case 'T': - k[0] = XK_F8; - break; - case 'U': - k[0] = XK_F9; - break; - case 'V': - k[0] = XK_F10; - break; - case 'W': - k[0] = XK_F11; - break; - case 'X': - k[0] = XK_F12; - break; - default: - k[0] = NoSymbol; - break; - } - goto special; - default: - k[0] = NoSymbol; - special: - k[1] = k[2] = k[3] = NoSymbol; - } - } - } else { - ErrorF("Can't read pccons keymap\n"); - } - } -#endif /* __OpenBSD__ */ - break; -#endif - -/* - * XXX wscons has no GIO_KEYMAP - */ -#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP) - case SYSCONS: - case PCVT: - { - keymap_t keymap; - - if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) { - for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++) - if (remap[i]) { - k = map + (remap[i] << 2); - k[0] = KD_GET_ENTRY(i,0); /* non-shifed */ - k[1] = KD_GET_ENTRY(i,1); /* shifted */ - k[2] = KD_GET_ENTRY(i,4); /* alt */ - k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */ - if (k[3] == k[2]) k[3] = NoSymbol; - if (k[2] == k[1]) k[2] = NoSymbol; - if (k[1] == k[0]) k[1] = NoSymbol; - if (k[0] == k[2] && k[1] == k[3]) - k[2] = k[3] = NoSymbol; - } - } - } - break; -#endif /* SYSCONS || PCVT */ - - } -#endif /* !bsdi */ - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = map, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - xf86Info.kbdType = 0; - - pKeySyms->map = map; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; - -} - -#ifdef WSCONS_SUPPORT -#include "atKeynames.h" - -static CARD8 wsUsbMap[] = { - /* 0 */ KEY_NOTUSED, - /* 1 */ KEY_NOTUSED, - /* 2 */ KEY_NOTUSED, - /* 3 */ KEY_NOTUSED, - /* 4 */ KEY_A, - /* 5 */ KEY_B, - /* 6 */ KEY_C, - /* 7 */ KEY_D, - /* 8 */ KEY_E, - /* 9 */ KEY_F, - /* 10 */ KEY_G, - /* 11 */ KEY_H, - /* 12 */ KEY_I, - /* 13 */ KEY_J, - /* 14 */ KEY_K, - /* 15 */ KEY_L, - /* 16 */ KEY_M, - /* 17 */ KEY_N, - /* 18 */ KEY_O, - /* 19 */ KEY_P, - /* 20 */ KEY_Q, - /* 21 */ KEY_R, - /* 22 */ KEY_S, - /* 23 */ KEY_T, - /* 24 */ KEY_U, - /* 25 */ KEY_V, - /* 26 */ KEY_W, - /* 27 */ KEY_X, - /* 28 */ KEY_Y, - /* 29 */ KEY_Z, - /* 30 */ KEY_1, /* 1 !*/ - /* 31 */ KEY_2, /* 2 @ */ - /* 32 */ KEY_3, /* 3 # */ - /* 33 */ KEY_4, /* 4 $ */ - /* 34 */ KEY_5, /* 5 % */ - /* 35 */ KEY_6, /* 6 ^ */ - /* 36 */ KEY_7, /* 7 & */ - /* 37 */ KEY_8, /* 8 * */ - /* 38 */ KEY_9, /* 9 ( */ - /* 39 */ KEY_0, /* 0 ) */ - /* 40 */ KEY_Enter, /* Return */ - /* 41 */ KEY_Escape, /* Escape */ - /* 42 */ KEY_BackSpace, /* Backspace Delete */ - /* 43 */ KEY_Tab, /* Tab */ - /* 44 */ KEY_Space, /* Space */ - /* 45 */ KEY_Minus, /* - _ */ - /* 46 */ KEY_Equal, /* = + */ - /* 47 */ KEY_LBrace, /* [ { */ - /* 48 */ KEY_RBrace, /* ] } */ - /* 49 */ KEY_BSlash, /* \ | */ - /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */ - /* 51 */ KEY_SemiColon, /* ; : */ - /* 52 */ KEY_Quote, /* ' " */ - /* 53 */ KEY_Tilde, /* ` ~ */ - /* 54 */ KEY_Comma, /* , < */ - /* 55 */ KEY_Period, /* . > */ - /* 56 */ KEY_Slash, /* / ? */ - /* 57 */ KEY_CapsLock, /* Caps Lock */ - /* 58 */ KEY_F1, /* F1 */ - /* 59 */ KEY_F2, /* F2 */ - /* 60 */ KEY_F3, /* F3 */ - /* 61 */ KEY_F4, /* F4 */ - /* 62 */ KEY_F5, /* F5 */ - /* 63 */ KEY_F6, /* F6 */ - /* 64 */ KEY_F7, /* F7 */ - /* 65 */ KEY_F8, /* F8 */ - /* 66 */ KEY_F9, /* F9 */ - /* 67 */ KEY_F10, /* F10 */ - /* 68 */ KEY_F11, /* F11 */ - /* 69 */ KEY_F12, /* F12 */ - /* 70 */ KEY_Print, /* PrintScrn SysReq */ - /* 71 */ KEY_ScrollLock, /* Scroll Lock */ - /* 72 */ KEY_Pause, /* Pause Break */ - /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */ - /* 74 */ KEY_Home, /* Home */ - /* 75 */ KEY_PgUp, /* Page Up */ - /* 76 */ KEY_Delete, /* Delete */ - /* 77 */ KEY_End, /* End */ - /* 78 */ KEY_PgDown, /* Page Down */ - /* 79 */ KEY_Right, /* Right Arrow */ - /* 80 */ KEY_Left, /* Left Arrow */ - /* 81 */ KEY_Down, /* Down Arrow */ - /* 82 */ KEY_Up, /* Up Arrow */ - /* 83 */ KEY_NumLock, /* Num Lock */ - /* 84 */ KEY_KP_Divide, /* Keypad / */ - /* 85 */ KEY_KP_Multiply, /* Keypad * */ - /* 86 */ KEY_KP_Minus, /* Keypad - */ - /* 87 */ KEY_KP_Plus, /* Keypad + */ - /* 88 */ KEY_KP_Enter, /* Keypad Enter */ - /* 89 */ KEY_KP_1, /* Keypad 1 End */ - /* 90 */ KEY_KP_2, /* Keypad 2 Down */ - /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */ - /* 92 */ KEY_KP_4, /* Keypad 4 Left */ - /* 93 */ KEY_KP_5, /* Keypad 5 */ - /* 94 */ KEY_KP_6, /* Keypad 6 */ - /* 95 */ KEY_KP_7, /* Keypad 7 Home */ - /* 96 */ KEY_KP_8, /* Keypad 8 Up */ - /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */ - /* 98 */ KEY_KP_0, /* Keypad 0 Ins */ - /* 99 */ KEY_KP_Decimal, /* Keypad . Del */ - /* 100 */ KEY_Less, /* < > on some keyboards */ - /* 101 */ KEY_Menu, /* Menu */ - /* 102 */ KEY_NOTUSED, - /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */ - /* 104 */ KEY_NOTUSED, - /* 105 */ KEY_NOTUSED, - /* 106 */ KEY_NOTUSED, - /* 107 */ KEY_NOTUSED, - /* 108 */ KEY_NOTUSED, - /* 109 */ KEY_NOTUSED, - /* 110 */ KEY_NOTUSED, - /* 111 */ KEY_NOTUSED, - /* 112 */ KEY_NOTUSED, - /* 113 */ KEY_NOTUSED, - /* 114 */ KEY_NOTUSED, - /* 115 */ KEY_NOTUSED, - /* 116 */ KEY_NOTUSED, - /* 117 */ KEY_NOTUSED, - /* 118 */ KEY_NOTUSED, - /* 119 */ KEY_NOTUSED, - /* 120 */ KEY_NOTUSED, - /* 121 */ KEY_NOTUSED, - /* 122 */ KEY_NOTUSED, - /* 123 */ KEY_NOTUSED, - /* 124 */ KEY_NOTUSED, - /* 125 */ KEY_NOTUSED, - /* 126 */ KEY_NOTUSED, - /* 127 */ KEY_NOTUSED, - /* 128 */ KEY_NOTUSED, - /* 129 */ KEY_NOTUSED, - /* 130 */ KEY_NOTUSED, - /* 131 */ KEY_NOTUSED, - /* 132 */ KEY_NOTUSED, - /* 133 */ KEY_NOTUSED, - /* 134 */ KEY_NOTUSED, - /* 135 */ KEY_NOTUSED, - /* 136 */ KEY_NOTUSED, - /* 137 */ KEY_NOTUSED, - /* 138 */ KEY_NOTUSED, - /* 139 */ KEY_NOTUSED, - /* 140 */ KEY_NOTUSED, - /* 141 */ KEY_NOTUSED, - /* 142 */ KEY_NOTUSED, - /* 143 */ KEY_NOTUSED, - /* 144 */ KEY_NOTUSED, - /* 145 */ KEY_NOTUSED, - /* 146 */ KEY_NOTUSED, - /* 147 */ KEY_NOTUSED, - /* 148 */ KEY_NOTUSED, - /* 149 */ KEY_NOTUSED, - /* 150 */ KEY_NOTUSED, - /* 151 */ KEY_NOTUSED, - /* 152 */ KEY_NOTUSED, - /* 153 */ KEY_NOTUSED, - /* 154 */ KEY_NOTUSED, - /* 155 */ KEY_NOTUSED, - /* 156 */ KEY_NOTUSED, - /* 157 */ KEY_NOTUSED, - /* 158 */ KEY_NOTUSED, - /* 159 */ KEY_NOTUSED, - /* 160 */ KEY_NOTUSED, - /* 161 */ KEY_NOTUSED, - /* 162 */ KEY_NOTUSED, - /* 163 */ KEY_NOTUSED, - /* 164 */ KEY_NOTUSED, - /* 165 */ KEY_NOTUSED, - /* 166 */ KEY_NOTUSED, - /* 167 */ KEY_NOTUSED, - /* 168 */ KEY_NOTUSED, - /* 169 */ KEY_NOTUSED, - /* 170 */ KEY_NOTUSED, - /* 171 */ KEY_NOTUSED, - /* 172 */ KEY_NOTUSED, - /* 173 */ KEY_NOTUSED, - /* 174 */ KEY_NOTUSED, - /* 175 */ KEY_NOTUSED, - /* 176 */ KEY_NOTUSED, - /* 177 */ KEY_NOTUSED, - /* 178 */ KEY_NOTUSED, - /* 179 */ KEY_NOTUSED, - /* 180 */ KEY_NOTUSED, - /* 181 */ KEY_NOTUSED, - /* 182 */ KEY_NOTUSED, - /* 183 */ KEY_NOTUSED, - /* 184 */ KEY_NOTUSED, - /* 185 */ KEY_NOTUSED, - /* 186 */ KEY_NOTUSED, - /* 187 */ KEY_NOTUSED, - /* 188 */ KEY_NOTUSED, - /* 189 */ KEY_NOTUSED, - /* 190 */ KEY_NOTUSED, - /* 191 */ KEY_NOTUSED, - /* 192 */ KEY_NOTUSED, - /* 193 */ KEY_NOTUSED, - /* 194 */ KEY_NOTUSED, - /* 195 */ KEY_NOTUSED, - /* 196 */ KEY_NOTUSED, - /* 197 */ KEY_NOTUSED, - /* 198 */ KEY_NOTUSED, - /* 199 */ KEY_NOTUSED, - /* 200 */ KEY_NOTUSED, - /* 201 */ KEY_NOTUSED, - /* 202 */ KEY_NOTUSED, - /* 203 */ KEY_NOTUSED, - /* 204 */ KEY_NOTUSED, - /* 205 */ KEY_NOTUSED, - /* 206 */ KEY_NOTUSED, - /* 207 */ KEY_NOTUSED, - /* 208 */ KEY_NOTUSED, - /* 209 */ KEY_NOTUSED, - /* 210 */ KEY_NOTUSED, - /* 211 */ KEY_NOTUSED, - /* 212 */ KEY_NOTUSED, - /* 213 */ KEY_NOTUSED, - /* 214 */ KEY_NOTUSED, - /* 215 */ KEY_NOTUSED, - /* 216 */ KEY_NOTUSED, - /* 217 */ KEY_NOTUSED, - /* 218 */ KEY_NOTUSED, - /* 219 */ KEY_NOTUSED, - /* 220 */ KEY_NOTUSED, - /* 221 */ KEY_NOTUSED, - /* 222 */ KEY_NOTUSED, - /* 223 */ KEY_NOTUSED, - /* 224 */ KEY_LCtrl, /* Left Control */ - /* 225 */ KEY_ShiftL, /* Left Shift */ - /* 226 */ KEY_Alt, /* Left Alt */ - /* 227 */ KEY_LMeta, /* Left Meta */ - /* 228 */ KEY_RCtrl, /* Right Control */ - /* 229 */ KEY_ShiftR, /* Right Shift */ - /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */ - /* 231 */ KEY_LMeta, /* Right Meta XXX */ -}; - -#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char)) - -/* Map for adb keyboards */ -static CARD8 wsAdbMap[] = { - /* 0 */ KEY_A, - /* 1 */ KEY_S, - /* 2 */ KEY_D, - /* 3 */ KEY_F, - /* 4 */ KEY_H, - /* 5 */ KEY_G, - /* 6 */ KEY_Z, - /* 7 */ KEY_X, - /* 8 */ KEY_C, - /* 9 */ KEY_V, - /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */ - /* 11 */ KEY_B, - /* 12 */ KEY_Q, - /* 13 */ KEY_W, - /* 14 */ KEY_E, - /* 15 */ KEY_R, - /* 16 */ KEY_Y, - /* 17 */ KEY_T, - /* 18 */ KEY_1, - /* 19 */ KEY_2, - /* 20 */ KEY_3, - /* 21 */ KEY_4, - /* 22 */ KEY_6, - /* 23 */ KEY_5, - /* 24 */ KEY_Equal, - /* 25 */ KEY_9, - /* 26 */ KEY_7, - /* 27 */ KEY_Minus, - /* 28 */ KEY_8, - /* 29 */ KEY_0, - /* 30 */ KEY_RBrace, - /* 31 */ KEY_O, - /* 32 */ KEY_U, - /* 33 */ KEY_LBrace, - /* 34 */ KEY_I, - /* 35 */ KEY_P, - /* 36 */ KEY_Enter, - /* 37 */ KEY_L, - /* 38 */ KEY_J, - /* 39 */ KEY_Quote, - /* 40 */ KEY_K, - /* 41 */ KEY_SemiColon, - /* 42 */ KEY_BSlash, - /* 43 */ KEY_Comma, - /* 44 */ KEY_Slash, - /* 45 */ KEY_N, - /* 46 */ KEY_M, - /* 47 */ KEY_Period, - /* 48 */ KEY_Tab, - /* 49 */ KEY_Space, - /* 50 */ KEY_Tilde, - /* 51 */ KEY_Delete, - /* 52 */ KEY_AltLang, - /* 53 */ KEY_Escape, - /* 54 */ KEY_LCtrl, - /* 55 */ KEY_Alt, - /* 56 */ KEY_ShiftL, - /* 57 */ KEY_CapsLock, - /* 58 */ KEY_LMeta, - /* 59 */ KEY_Left, - /* 60 */ KEY_Right, - /* 61 */ KEY_Down, - /* 62 */ KEY_Up, - /* 63 */ KEY_UNKNOWN, /* Fn */ - /* 64 */ KEY_NOTUSED, - /* 65 */ KEY_KP_Decimal, - /* 66 */ KEY_NOTUSED, - /* 67 */ KEY_KP_Multiply, - /* 68 */ KEY_NOTUSED, - /* 69 */ KEY_KP_Plus, - /* 70 */ KEY_NOTUSED, - /* 71 */ KEY_UNKNOWN, /* Clear */ - /* 72 */ KEY_NOTUSED, - /* 73 */ KEY_NOTUSED, - /* 74 */ KEY_NOTUSED, - /* 75 */ KEY_KP_Divide, - /* 76 */ KEY_KP_Enter, - /* 77 */ KEY_NOTUSED, - /* 78 */ KEY_KP_Minus, - /* 79 */ KEY_NOTUSED, - /* 80 */ KEY_NOTUSED, - /* 81 */ KEY_KP_Equal, /* Keypad = */ - /* 82 */ KEY_KP_0, - /* 83 */ KEY_KP_1, - /* 84 */ KEY_KP_2, - /* 85 */ KEY_KP_3, - /* 86 */ KEY_KP_4, - /* 87 */ KEY_KP_5, - /* 88 */ KEY_KP_6, - /* 89 */ KEY_KP_7, - /* 90 */ KEY_NOTUSED, - /* 91 */ KEY_KP_8, - /* 92 */ KEY_KP_9, - /* 93 */ KEY_NOTUSED, - /* 94 */ KEY_NOTUSED, - /* 95 */ KEY_UNKNOWN, /* Keypad , */ - /* 96 */ KEY_F5, - /* 97 */ KEY_F6, - /* 98 */ KEY_F7, - /* 99 */ KEY_F3, - /* 100 */ KEY_F8, - /* 101 */ KEY_F9, - /* 102 */ KEY_NOTUSED, - /* 103 */ KEY_F11, - /* 104 */ KEY_NOTUSED, - /* 105 */ KEY_NOTUSED, - /* 106 */ KEY_KP_Enter, - /* 107 */ KEY_NOTUSED, - /* 108 */ KEY_NOTUSED, - /* 109 */ KEY_F10, - /* 110 */ KEY_NOTUSED, - /* 111 */ KEY_F12, - /* 112 */ KEY_NOTUSED, - /* 113 */ KEY_NOTUSED, - /* 114 */ KEY_NOTUSED, - /* 115 */ KEY_Home, - /* 116 */ KEY_PgUp, - /* 117 */ KEY_NOTUSED, - /* 118 */ KEY_F4, - /* 119 */ KEY_End, - /* 120 */ KEY_F2, - /* 121 */ KEY_PgDown, - /* 122 */ KEY_F1, - /* 123 */ KEY_NOTUSED, - /* 124 */ KEY_NOTUSED, - /* 125 */ KEY_NOTUSED, - /* 126 */ KEY_NOTUSED, - /* 127 */ KEY_NOTUSED, - /* 128 */ KEY_NOTUSED, - /* 129 */ KEY_NOTUSED, - /* 130 */ KEY_NOTUSED, - /* 131 */ KEY_NOTUSED, - /* 132 */ KEY_NOTUSED, - /* 133 */ KEY_NOTUSED, - /* 134 */ KEY_NOTUSED, - /* 135 */ KEY_NOTUSED, - /* 136 */ KEY_NOTUSED, - /* 137 */ KEY_NOTUSED, - /* 138 */ KEY_NOTUSED, - /* 139 */ KEY_NOTUSED, - /* 140 */ KEY_NOTUSED, - /* 141 */ KEY_NOTUSED, - /* 142 */ KEY_NOTUSED, - /* 143 */ KEY_NOTUSED, - /* 144 */ KEY_NOTUSED, - /* 145 */ KEY_NOTUSED, - /* 146 */ KEY_NOTUSED, - /* 147 */ KEY_NOTUSED, - /* 148 */ KEY_NOTUSED, - /* 149 */ KEY_NOTUSED, - /* 150 */ KEY_NOTUSED, - /* 151 */ KEY_NOTUSED, - /* 152 */ KEY_NOTUSED, - /* 153 */ KEY_NOTUSED, - /* 154 */ KEY_NOTUSED, - /* 155 */ KEY_NOTUSED, - /* 156 */ KEY_NOTUSED, - /* 157 */ KEY_NOTUSED, - /* 158 */ KEY_NOTUSED, - /* 159 */ KEY_NOTUSED, - /* 160 */ KEY_NOTUSED, - /* 161 */ KEY_NOTUSED, - /* 162 */ KEY_NOTUSED, - /* 163 */ KEY_NOTUSED, - /* 164 */ KEY_NOTUSED, - /* 165 */ KEY_NOTUSED, - /* 166 */ KEY_NOTUSED, - /* 167 */ KEY_NOTUSED, - /* 168 */ KEY_NOTUSED, - /* 169 */ KEY_NOTUSED, - /* 170 */ KEY_NOTUSED, - /* 171 */ KEY_NOTUSED, - /* 172 */ KEY_NOTUSED, - /* 173 */ KEY_NOTUSED, - /* 174 */ KEY_NOTUSED, - /* 175 */ KEY_NOTUSED, - /* 176 */ KEY_NOTUSED, - /* 177 */ KEY_NOTUSED, - /* 178 */ KEY_NOTUSED, - /* 179 */ KEY_NOTUSED, - /* 180 */ KEY_NOTUSED, - /* 181 */ KEY_NOTUSED, - /* 182 */ KEY_NOTUSED, - /* 183 */ KEY_NOTUSED, - /* 184 */ KEY_NOTUSED, - /* 185 */ KEY_NOTUSED, - /* 186 */ KEY_NOTUSED, - /* 187 */ KEY_NOTUSED, - /* 188 */ KEY_NOTUSED, - /* 189 */ KEY_NOTUSED, - /* 190 */ KEY_NOTUSED, - /* 191 */ KEY_NOTUSED, - /* 192 */ KEY_NOTUSED, - /* 193 */ KEY_NOTUSED, - /* 194 */ KEY_NOTUSED, - /* 195 */ KEY_NOTUSED, - /* 196 */ KEY_NOTUSED, - /* 197 */ KEY_NOTUSED, - /* 198 */ KEY_NOTUSED, - /* 199 */ KEY_NOTUSED, - /* 200 */ KEY_NOTUSED, - /* 201 */ KEY_NOTUSED, - /* 202 */ KEY_NOTUSED, - /* 203 */ KEY_NOTUSED, - /* 204 */ KEY_NOTUSED, - /* 205 */ KEY_NOTUSED, - /* 206 */ KEY_NOTUSED, - /* 207 */ KEY_NOTUSED, - /* 208 */ KEY_NOTUSED, - /* 209 */ KEY_NOTUSED, - /* 210 */ KEY_NOTUSED, - /* 211 */ KEY_NOTUSED, - /* 212 */ KEY_NOTUSED, - /* 213 */ KEY_NOTUSED, - /* 214 */ KEY_NOTUSED, - /* 215 */ KEY_NOTUSED, - /* 216 */ KEY_NOTUSED, - /* 217 */ KEY_NOTUSED, - /* 218 */ KEY_NOTUSED, - /* 219 */ KEY_NOTUSED, - /* 220 */ KEY_NOTUSED, - /* 221 */ KEY_NOTUSED, - /* 222 */ KEY_NOTUSED, - /* 223 */ KEY_NOTUSED, -}; - -#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char)) - -static CARD8 wsSunMap[] = { - /* 0x00 */ KEY_NOTUSED, - /* 0x01 */ KEY_NOTUSED, /* stop */ - /* 0x02 */ KEY_NOTUSED, /* BrightnessDown / S-VolumeDown */ - /* 0x03 */ KEY_NOTUSED, /* again */ - /* 0x04 */ KEY_NOTUSED, /* BridgtnessUp / S-VolumeUp */ - /* 0x05 */ KEY_F1, - /* 0x06 */ KEY_F2, - /* 0x07 */ KEY_F10, - /* 0x08 */ KEY_F3, - /* 0x09 */ KEY_F11, - /* 0x0a */ KEY_F4, - /* 0x0b */ KEY_F12, - /* 0x0c */ KEY_F5, - /* 0x0d */ KEY_AltLang, - /* 0x0e */ KEY_F6, - /* 0x0f */ KEY_NOTUSED, - /* 0x10 */ KEY_F7, - /* 0x11 */ KEY_F8, - /* 0x12 */ KEY_F9, - /* 0x13 */ KEY_Alt, - /* 0x14 */ KEY_Up, - /* 0x15 */ KEY_Pause, - /* 0x16 */ KEY_Print, - /* 0x17 */ KEY_NOTUSED, /* props */ - /* 0x18 */ KEY_Left, - /* 0x19 */ KEY_ScrollLock, - /* 0x1a */ KEY_NOTUSED, /* undo */ - /* 0x1b */ KEY_Down, - /* 0x1c */ KEY_Right, - /* 0x1d */ KEY_Escape, - /* 0x1e */ KEY_1, - /* 0x1f */ KEY_2, - /* 0x20 */ KEY_3, - /* 0x21 */ KEY_4, - /* 0x22 */ KEY_5, - /* 0x23 */ KEY_6, - /* 0x24 */ KEY_7, - /* 0x25 */ KEY_8, - /* 0x26 */ KEY_9, - /* 0x27 */ KEY_0, - /* 0x28 */ KEY_Minus, - /* 0x29 */ KEY_Equal, - /* 0x2a */ KEY_Tilde, - /* 0x2b */ KEY_BackSpace, - /* 0x2c */ KEY_Insert, - /* 0x2d */ KEY_KP_Equal, - /* 0x2e */ KEY_KP_Divide, - /* 0x2f */ KEY_KP_Multiply, - /* 0x30 */ KEY_NOTUSED, - /* 0x31 */ KEY_NOTUSED, /* front */ - /* 0x32 */ KEY_KP_Decimal, - /* 0x33 */ KEY_NOTUSED, /* copy */ - /* 0x34 */ KEY_Home, - /* 0x35 */ KEY_Tab, - /* 0x36 */ KEY_Q, - /* 0x37 */ KEY_W, - /* 0x38 */ KEY_E, - /* 0x39 */ KEY_R, - /* 0x3a */ KEY_T, - /* 0x3b */ KEY_Y, - /* 0x3c */ KEY_U, - /* 0x3d */ KEY_I, - /* 0x3e */ KEY_O, - /* 0x3f */ KEY_P, - /* 0x40 */ KEY_LBrace, - /* 0x41 */ KEY_RBrace, - /* 0x42 */ KEY_Delete, - /* 0x43 */ KEY_NOTUSED, /* compose */ - /* 0x44 */ KEY_KP_7, - /* 0x45 */ KEY_KP_8, - /* 0x46 */ KEY_KP_9, - /* 0x47 */ KEY_KP_Minus, - /* 0x48 */ KEY_NOTUSED, /* open */ - /* 0x49 */ KEY_NOTUSED, /* paste */ - /* 0x4a */ KEY_End, - /* 0x4b */ KEY_NOTUSED, - /* 0x4c */ KEY_LCtrl, - /* 0x4d */ KEY_A, - /* 0x4e */ KEY_S, - /* 0x4f */ KEY_D, - /* 0x50 */ KEY_F, - /* 0x51 */ KEY_G, - /* 0x52 */ KEY_H, - /* 0x53 */ KEY_J, - /* 0x54 */ KEY_K, - /* 0x55 */ KEY_L, - /* 0x56 */ KEY_SemiColon, - /* 0x57 */ KEY_Quote, - /* 0x58 */ KEY_BSlash, - /* 0x59 */ KEY_Enter, - /* 0x5a */ KEY_KP_Enter, - /* 0x5b */ KEY_KP_4, - /* 0x5c */ KEY_KP_5, - /* 0x5d */ KEY_KP_6, - /* 0x5e */ KEY_KP_0, - /* 0x5f */ KEY_NOTUSED, /* find */ - /* 0x60 */ KEY_PgUp, - /* 0x61 */ KEY_NOTUSED, /* cut */ - /* 0x62 */ KEY_NumLock, - /* 0x63 */ KEY_ShiftL, - /* 0x64 */ KEY_Z, - /* 0x65 */ KEY_X, - /* 0x66 */ KEY_C, - /* 0x67 */ KEY_V, - /* 0x68 */ KEY_B, - /* 0x69 */ KEY_N, - /* 0x6a */ KEY_M, - /* 0x6b */ KEY_Comma, - /* 0x6c */ KEY_Period, - /* 0x6d */ KEY_Slash, - /* 0x6e */ KEY_ShiftR, - /* 0x6f */ KEY_NOTUSED, /* linefeed */ - /* 0x70 */ KEY_KP_1, - /* 0x71 */ KEY_KP_2, - /* 0x72 */ KEY_KP_3, - /* 0x73 */ KEY_NOTUSED, - /* 0x74 */ KEY_NOTUSED, - /* 0x75 */ KEY_NOTUSED, - /* 0x76 */ KEY_NOTUSED, /* help */ - /* 0x77 */ KEY_CapsLock, - /* 0x78 */ KEY_LMeta, - /* 0x79 */ KEY_Space, - /* 0x7a */ KEY_RMeta, - /* 0x7b */ KEY_PgDown, - /* 0x7c */ KEY_NOTUSED, - /* 0x7d */ KEY_KP_Plus, - /* 0x7e */ KEY_NOTUSED, - /* 0x7f */ KEY_NOTUSED -}; - -#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char)) - -/* - * Translate raw wskbd keyboard event values to XFree86 standard keycodes - * (based on the AT keyboard scan codes using the tables above - */ -int -WSKbdToKeycode(int keycode) -{ - switch (xf86Info.wsKbdType) { - case WSKBD_TYPE_PC_XT: - case WSKBD_TYPE_PC_AT: - /* No translation needed */ - return keycode; - case WSKBD_TYPE_USB: - if (keycode < 0 || keycode >= WS_USB_MAP_SIZE) - return KEY_UNKNOWN; - else - return wsUsbMap[keycode]; -#ifdef WSKBD_TYPE_ADB - case WSKBD_TYPE_ADB: - if (keycode < 0 || keycode >= WS_ADB_MAP_SIZE) - return KEY_UNKNOWN; - else - return wsAdbMap[keycode]; -#endif -#ifdef WSKBD_TYPE_SUN - case WSKBD_TYPE_SUN: -#ifdef WSKBD_TYPE_SUN5 - case WSKBD_TYPE_SUN5: -#endif - if (keycode < 0 || keycode >= WS_SUN_MAP_SIZE) - return KEY_UNKNOWN; - else - return wsSunMap[keycode]; -#endif - default: - ErrorF("Unknown wskbd type %d\n", xf86Info.wsKbdType); - return KEY_UNKNOWN; - } -} - -#endif /* WSCONS_SUPPORT */ diff --git a/hw/xfree86/common/xf86KbdLnx.c b/hw/xfree86/common/xf86KbdLnx.c deleted file mode 100644 index c5361f5..0000000 --- a/hw/xfree86/common/xf86KbdLnx.c +++ /dev/null @@ -1,651 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.17 2003/08/24 17:36:53 dawes Exp $ */ -/* - * Linux version of keymapping setup. The kernel (since 0.99.14) has support - * for fully remapping the keyboard, but there are some differences between - * the Linux map and the SVR4 map (esp. in the extended keycodes). We also - * remove the restriction on what keycodes can be remapped. - * Orest Zborowski. - */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * 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, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 1994-2001 by The XFree86 Project, Inc. - * - * 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 - * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - -/* $XConsortium: xf86KbdLnx.c /main/7 1996/10/19 17:59:00 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "atKeynames.h" - -#include "xf86Keymap.h" - -/* - * LegalModifier -- - * determine whether a key is a legal modifier key, i.e send a - * press/release sequence. - */ - -/*ARGSUSED*/ -Bool -LegalModifier(unsigned int key, DevicePtr pDev) -{ - return (TRUE); -} - -/* - * xf86KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -static void readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap); - -void -xf86KbdGetMapping (KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - KeySym *k; - char type; - int i; - - readKernelMapping(pKeySyms, pModMap); - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = map, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - xf86Info.kbdType = - ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101; - - pKeySyms->map = map; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; -} - -#include - -static KeySym linux_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling, - XK_currency, XK_yen, XK_brokenbar, XK_section, - XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft, - XK_notsign, XK_hyphen, XK_registered, XK_macron, - XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior, - XK_acute, XK_mu, XK_paragraph, XK_periodcentered, - XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright, - XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown, - XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde, - XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla, - XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, - XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, - XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, - XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply, - XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex, - XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp, - XK_agrave, XK_aacute, XK_acircumflex, XK_atilde, - XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla, - XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, - XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis, - XK_eth, XK_ntilde, XK_ograve, XK_oacute, - XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division, - XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex, - XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis -}; - -/* - * Maps the AT keycodes to Linux keycodes - */ -static unsigned char at2lnx[NUM_KEYCODES] = -{ - 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */ - 0x03, /* KEY_2 */ 0x04, /* KEY_3 */ - 0x05, /* KEY_4 */ 0x06, /* KEY_5 */ - 0x07, /* KEY_6 */ 0x08, /* KEY_7 */ - 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */ - 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */ - 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */ - 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */ - 0x11, /* KEY_W */ 0x12, /* KEY_E */ - 0x13, /* KEY_R */ 0x14, /* KEY_T */ - 0x15, /* KEY_Y */ 0x16, /* KEY_U */ - 0x17, /* KEY_I */ 0x18, /* KEY_O */ - 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */ - 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */ - 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */ - 0x1f, /* KEY_S */ 0x20, /* KEY_D */ - 0x21, /* KEY_F */ 0x22, /* KEY_G */ - 0x23, /* KEY_H */ 0x24, /* KEY_J */ - 0x25, /* KEY_K */ 0x26, /* KEY_L */ - 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */ - 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */ - 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */ - 0x2d, /* KEY_X */ 0x2e, /* KEY_C */ - 0x2f, /* KEY_V */ 0x30, /* KEY_B */ - 0x31, /* KEY_N */ 0x32, /* KEY_M */ - 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */ - 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */ - 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */ - 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */ - 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */ - 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */ - 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */ - 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */ - 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */ - 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */ - 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */ - 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */ - 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */ - 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */ - 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */ - 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */ - 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */ - 0x00, /* 0x55 */ 0x56, /* KEY_Less */ - 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */ - 0x66, /* KEY_Home */ 0x67, /* KEY_Up */ - 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */ - 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */ - 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */ - 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */ - 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */ - 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */ - 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */ - 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */ - 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */ - 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */ - 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */ - 0x00, /* 0x71 */ 0x00, /* 0x72 */ - 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */ - 0x00, /* 0x75 */ 0x00, /* 0x76 */ - 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */ - 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */ - 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */ - 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */ - 0x00, /* 0x7f */ -}; -#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0])) - -#define NUM_CUSTOMKEYS NR_KEYS - -u_char SpecialServerMap[NUM_CUSTOMKEYS]; - -static void -readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - KeySym *k; - int i; - int maxkey; - static unsigned char tbl[GLYPHS_PER_KEY] = - { - 0, /* unshifted */ - 1, /* shifted */ - 0, /* modeswitch unshifted */ - 0 /* modeswitch shifted */ - }; - - /* - * Read the mapping from the kernel. - * Since we're still using the XFree86 scancode->AT keycode mapping - * routines, we need to convert the AT keycodes to Linux keycodes, - * then translate the Linux keysyms into X keysyms. - * - * First, figure out which tables to use for the modeswitch columns - * above, from the XF86Config fields. - */ - tbl[2] = 8; /* alt */ - tbl[3] = tbl[2] | 1; - - if (xf86Info.kbdCustomKeycodes) { - k = map; - maxkey = NUM_CUSTOMKEYS; - } - else { - k = map+GLYPHS_PER_KEY; - maxkey = NUM_AT2LNX; - } - - for (i = 0; i < maxkey; ++i) - { - struct kbentry kbe; - int j; - - if (xf86Info.kbdCustomKeycodes) - kbe.kb_index = i; - else - kbe.kb_index = at2lnx[i]; - - for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) - { - unsigned short kval; - - *k = NoSymbol; - - kbe.kb_table = tbl[j]; - if ( - (!xf86Info.kbdCustomKeycodes && kbe.kb_index == 0) || - ioctl(xf86Info.consoleFd, KDGKBENT, &kbe)) - continue; - - kval = KVAL(kbe.kb_value); - switch (KTYP(kbe.kb_value)) - { - case KT_LATIN: - case KT_LETTER: - *k = linux_to_x[kval]; - break; - - case KT_FN: - if (kval <= 19) - *k = XK_F1 + kval; - else switch (kbe.kb_value) - { - case K_FIND: - *k = XK_Home; /* or XK_Find */ - break; - case K_INSERT: - *k = XK_Insert; - break; - case K_REMOVE: - *k = XK_Delete; - break; - case K_SELECT: - *k = XK_End; /* or XK_Select */ - break; - case K_PGUP: - *k = XK_Prior; - break; - case K_PGDN: - *k = XK_Next; - break; - case K_HELP: - *k = XK_Help; - break; - case K_DO: - *k = XK_Execute; - break; - case K_PAUSE: - *k = XK_Pause; - break; - case K_MACRO: - *k = XK_Menu; - break; - default: - break; - } - break; - - case KT_SPEC: - switch (kbe.kb_value) - { - case K_ENTER: - *k = XK_Return; - break; - case K_BREAK: - *k = XK_Break; - break; - case K_CAPS: - *k = XK_Caps_Lock; - break; - case K_NUM: - *k = XK_Num_Lock; - break; - case K_HOLD: - *k = XK_Scroll_Lock; - break; - case K_COMPOSE: - *k = XK_Multi_key; - break; - default: - break; - } - break; - - case KT_PAD: - switch (kbe.kb_value) - { - case K_PPLUS: - *k = XK_KP_Add; - break; - case K_PMINUS: - *k = XK_KP_Subtract; - break; - case K_PSTAR: - *k = XK_KP_Multiply; - break; - case K_PSLASH: - *k = XK_KP_Divide; - break; - case K_PENTER: - *k = XK_KP_Enter; - break; - case K_PCOMMA: - *k = XK_KP_Separator; - break; - case K_PDOT: - *k = XK_KP_Decimal; - break; - case K_PPLUSMINUS: - *k = XK_KP_Subtract; - break; - default: - if (kval <= 9) - *k = XK_KP_0 + kval; - break; - } - break; - - /* - * KT_DEAD keys are for accelerated diacritical creation. - */ - case KT_DEAD: - switch (kbe.kb_value) - { - case K_DGRAVE: - *k = XK_dead_grave; - break; - case K_DACUTE: - *k = XK_dead_acute; - break; - case K_DCIRCM: - *k = XK_dead_circumflex; - break; - case K_DTILDE: - *k = XK_dead_tilde; - break; - case K_DDIERE: - *k = XK_dead_diaeresis; - break; - } - break; - - case KT_CUR: - switch (kbe.kb_value) - { - case K_DOWN: - *k = XK_Down; - break; - case K_LEFT: - *k = XK_Left; - break; - case K_RIGHT: - *k = XK_Right; - break; - case K_UP: - *k = XK_Up; - break; - } - break; - - case KT_SHIFT: - switch (kbe.kb_value) - { - case K_ALTGR: - *k = XK_Alt_R; - break; - case K_ALT: - *k = (kbe.kb_index == 0x64 ? - XK_Alt_R : XK_Alt_L); - break; - case K_CTRL: - *k = (kbe.kb_index == 0x61 ? - XK_Control_R : XK_Control_L); - break; - case K_CTRLL: - *k = XK_Control_L; - break; - case K_CTRLR: - *k = XK_Control_R; - break; - case K_SHIFT: - *k = (kbe.kb_index == 0x36 ? - XK_Shift_R : XK_Shift_L); - break; - case K_SHIFTL: - *k = XK_Shift_L; - break; - case K_SHIFTR: - *k = XK_Shift_R; - break; - default: - break; - } - break; - - /* - * KT_ASCII keys accumulate a 3 digit decimal number that gets - * emitted when the shift state changes. We can't emulate that. - */ - case KT_ASCII: - break; - - case KT_LOCK: - if (kbe.kb_value == K_SHIFTLOCK) - *k = XK_Shift_Lock; - break; - - default: - break; - } - } - - if (k[-1] == k[-2]) k[-1] = NoSymbol; - if (k[-2] == k[-3]) k[-2] = NoSymbol; - if (k[-3] == k[-4]) k[-3] = NoSymbol; - if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol; - if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol; - } - - if (!xf86Info.kbdCustomKeycodes) - return; - - /* - * Find the Mapping for the special server functions - */ - for (i = 0; i < NUM_CUSTOMKEYS; ++i) { - struct kbentry kbe; - int special = 0; - - kbe.kb_index = i; - kbe.kb_table = 0; /* Plain map */ - if (!ioctl(xf86Info.consoleFd, KDGKBENT, &kbe)) - switch (kbe.kb_value) { - case K(KT_LATIN,0x7f): /* This catches DEL too... But who cares? */ - special = KEY_BackSpace; - break; - case K_PMINUS: - special = KEY_KP_Minus; - break; - case K_PPLUS: - special = KEY_KP_Plus; - break; - case K_F1: - special = KEY_F1; - break; - case K_F2: - special = KEY_F2; - break; - case K_F3: - special = KEY_F3; - break; - case K_F4: - special = KEY_F4; - break; - case K_F5: - special = KEY_F5; - break; - case K_F6: - special = KEY_F6; - break; - case K_F7: - special = KEY_F7; - break; - case K_F8: - special = KEY_F8; - break; - case K_F9: - special = KEY_F9; - break; - case K_F10: - special = KEY_F10; - break; - case K_F11: - special = KEY_F11; - break; - case K_F12: - special = KEY_F12; - break; - case K_ALT: - special = KEY_Alt; - break; - case K_ALTGR: - special = KEY_AltLang; - break; - case K_CONS: - special = KEY_SysReqest; - break; - } - SpecialServerMap[i] = special; - } -} diff --git a/hw/xfree86/common/xf86KbdMach.c b/hw/xfree86/common/xf86KbdMach.c deleted file mode 100644 index 89c23c2..0000000 --- a/hw/xfree86/common/xf86KbdMach.c +++ /dev/null @@ -1,317 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c,v 3.7.4.2 1998/06/04 17:35:20 dawes Exp $ */ -/* - ***************************************************************************** - * HISTORY - * Log: xf86KbdMach.c,v - * Revision 2.1.2.1 92/06/25 10:32:08 moore - * Incorporate the Elliot Dresselhaus's, Ernest Hua's and local changes - * to run Thomas Roell's I386 color X11R5. Original code only worked - * with SCO Unix. New code works with 2.5 and 3.0 Mach - * [92/06/24 rvb] - * - * EndLog - * - ***************************************************************************** - */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * 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, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: xf86KbdMach.c /main/9 1996/02/21 17:38:43 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "atKeynames.h" -#include "xf86Config.h" - -#include "xf86Keymap.h" - -static KeySym ascii_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_Delete, - XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex, - XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla, - XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis, - XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring, - XK_Eacute, XK_ae, XK_AE, XK_ocircumflex, - XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave, - XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent, - XK_sterling, XK_yen, XK_paragraph, XK_section, - XK_aacute, XK_iacute, XK_oacute, XK_uacute, - XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine, - XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf, - XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi, - XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau, - XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta, - XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection, - XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal, - XK_topintegral, XK_botintegral, XK_division, XK_similarequal, - XK_degree, NoSymbol, NoSymbol, XK_radical, - XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol, - }; - -/* - * LegalModifier -- - * determine whether a key is a legal modifier key, i.e send a - * press/release sequence. - */ - -/*ARGSUSED*/ -Bool -LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; -{ - return (TRUE); -} - - - -/* - * xf86KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -void -xf86KbdGetMapping (pKeySyms, pModMap) - KeySymsPtr pKeySyms; - CARD8 *pModMap; -{ - KeySym *k; - struct kbentry kbe; - char type; - int i, j; - - for (i = 0; i < NUMKEYS; i++) - { - static int states[] = { NORM_STATE, SHIFT_STATE, ALT_STATE, SHIFT_ALT }; - int j; - - k = &map[i*4]; - kbe.kb_index = i; - - for (j = 0; j < 4; j++) - { - kbe.kb_state = states[j]; - - if (ioctl (xf86Info.consoleFd, KDGKBENT, &kbe) != -1) - continue; - - if (kbe.kb_value [0] == K_SCAN) - { - int keycode = -1; - switch (kbe.kb_value [1]) - { - case K_CTLSC: keycode = XK_Control_L; break; - case K_LSHSC: keycode = XK_Shift_L; break; - case K_RSHSC: keycode = XK_Shift_R; break; - case K_ALTSC: keycode = XK_Alt_L; break; - case K_CLCKSC: keycode = XK_Caps_Lock; break; - case K_NLCKSC: keycode = XK_Num_Lock; break; - default: break; - } - if (keycode > 0) - k[j] = keycode; - } - else if (kbe.kb_value[1] != NC) - { - /* How to handle multiple characters? - Ignore them for now. */ - } - else - { - k[j] = ascii_to_x[kbe.kb_value[0]]; - } - } - } - - /* - * Apply the special key mapping specified in XF86Config - */ - for (k = map, 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; - } - } - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = map, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - if (!xf86Info.serverNumLock) pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - xf86Info.kbdType = - ioctl(xf86Info.kbdFd, KDGKBDTYPE, &type) != -1 ? type : KB_VANILLAKB; - - pKeySyms->map = map; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - if (xf86Info.serverNumLock) - pKeySyms->maxKeyCode = MAX_KEYCODE; - else - pKeySyms->maxKeyCode = MAX_STD_KEYCODE; - -} diff --git a/hw/xfree86/common/xf86MiscExt.c b/hw/xfree86/common/xf86MiscExt.c index 80fbf41..184f649 100644 --- a/hw/xfree86/common/xf86MiscExt.c +++ b/hw/xfree86/common/xf86MiscExt.c @@ -90,6 +90,7 @@ typedef struct { int rate; int delay; int serverNumLock; /* obsolete */ + pointer private; } kbdParamsRec, *kbdParamsPtr; /* @@ -257,15 +258,20 @@ _X_EXPORT Bool MiscExtGetKbdSettings(pointer *kbd) { kbdParamsPtr kbdptr; + InputInfoPtr pInfo; + KbdDevPtr pKbd; DEBUG_P("MiscExtGetKbdSettings"); kbdptr = MiscExtCreateStruct(MISC_KEYBOARD); if (!kbdptr) return FALSE; - kbdptr->type = xf86Info.kbdType; - kbdptr->rate = xf86Info.kbdRate; - kbdptr->delay = xf86Info.kbdDelay; + pInfo = inputInfo.keyboard->public.devicePrivate; + pKbd = (KbdDevPtr) pInfo->private; + + kbdptr->type = pKbd->kbdType; + kbdptr->rate = pKbd->rate; + kbdptr->delay = pKbd->delay; *kbd = kbdptr; return TRUE; } @@ -379,7 +385,7 @@ MiscExtCreateStruct(MiscExtStructType ms return mseptr; } case MISC_KEYBOARD: - return xcalloc(sizeof(kbdParamsRec),1); + return xcalloc(sizeof(kbdParamsRec),1); } return 0; } @@ -595,6 +601,11 @@ #endif } if (mse_or_kbd == MISC_KEYBOARD) { kbdParamsPtr kbd = structure; + InputInfoPtr pInfo; + KbdDevPtr pKbd; + + pInfo = inputInfo.keyboard->public.devicePrivate; + pKbd = (KbdDevPtr) pInfo->private; if (kbd->rate < 0) return MISC_RET_BADVAL; @@ -603,24 +614,24 @@ #endif if (kbd->type < KTYPE_UNKNOWN || kbd->type > KTYPE_XQUEUE) return MISC_RET_BADKBDTYPE; - if (xf86Info.kbdRate!=kbd->rate || xf86Info.kbdDelay!=kbd->delay) { + if (pKbd->rate!=kbd->rate || pKbd->delay!=kbd->delay) { char rad; - xf86Info.kbdRate = kbd->rate; - xf86Info.kbdDelay = kbd->delay; - if (xf86Info.kbdDelay <= 375) rad = 0x00; - else if (xf86Info.kbdDelay <= 625) rad = 0x20; - else if (xf86Info.kbdDelay <= 875) rad = 0x40; - else rad = 0x60; + pKbd->rate = kbd->rate; + pKbd->delay = kbd->delay; + if (pKbd->delay <= 375) rad = 0x00; + else if (pKbd->delay <= 625) rad = 0x20; + else if (pKbd->delay <= 875) rad = 0x40; + else rad = 0x60; - if (xf86Info.kbdRate <= 2) rad |= 0x1F; - else if (xf86Info.kbdRate >= 30) rad |= 0x00; - else rad |= ((58/xf86Info.kbdRate)-2); + if (pKbd->rate <= 2) rad |= 0x1F; + else if (pKbd->rate >= 30) rad |= 0x00; + else rad |= ((58/pKbd->rate)-2); - xf86SetKbdRepeat(rad); + pKbd->SetKbdRepeat(pInfo, rad); } #if 0 /* Not done yet */ - xf86Info.kbdType = kbd->kbdtype; + pKdb->kbdType = kbd->kbdtype; #endif } return MISC_RET_SUCCESS; diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index 0794de7..3521bed 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -200,17 +200,7 @@ int xf86SetLogVerbosity(int verb); /* xf86Io.c */ -void xf86KbdBell(int percent, DeviceIntPtr pKeyboard, pointer ctrl, - int unused); -void xf86KbdLeds(void); void xf86UpdateKbdLeds(void); -void xf86KbdCtrl(DevicePtr pKeyboard, KeybdCtrl *ctrl); -void xf86InitKBD(Bool init); -int xf86KbdProc(DeviceIntPtr pKeyboard, int what); - -/* xf86Kbd.c */ - -void xf86KbdGetMapping(KeySymsPtr pKeySyms, CARD8 *pModMap); /* xf86Lock.c */ diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index a35de20..729dd46 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -71,35 +71,11 @@ typedef struct { /* keyboard part */ DeviceIntPtr pKeyboard; - DeviceProc kbdProc; /* procedure for initializing */ - void (* kbdEvents)(void); /* proc for processing events */ int consoleFd; - int kbdFd; int vtno; - int kbdType; /* AT84 / AT101 */ - int kbdRate; - int kbdDelay; - int bell_pitch; - int bell_duration; - Bool autoRepeat; - unsigned long leds; - unsigned long xleds; - char * vtinit; - int scanPrefix; /* scancode-state */ - Bool capsLock; - Bool numLock; - Bool scrollLock; - Bool modeSwitchLock; - Bool composeLock; + char * vtinit; Bool vtSysreq; SpecialKeysInDDX ddxSpecialKeys; - Bool ActionKeyBindingsSet; -#if defined(SVR4) && defined(i386) - Bool panix106; -#endif /* SVR4 && i386 */ -#if defined(__OpenBSD__) || defined(__NetBSD__) - int wsKbdType; -#endif /* mouse part */ DeviceIntPtr pMouse; diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am index d492f96..2e279ae 100644 --- a/hw/xfree86/os-support/linux/Makefile.am +++ b/hw/xfree86/os-support/linux/Makefile.am @@ -19,7 +19,7 @@ APM_SOURCES = lnx_apm.c XORG_CFLAGS += -DHAVE_APM endif -liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_io.c lnx_kbd.c lnx_mouse.c \ +liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_kbd.c lnx_mouse.c \ lnx_pci.c lnx_agp.c lnx_kmod.c lnx_KbdMap.c \ $(srcdir)/../shared/bios_mmap.c \ $(srcdir)/../shared/VTsw_usl.c \ diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c deleted file mode 100644 index eb8cd53..0000000 --- a/hw/xfree86/os-support/linux/lnx_io.c +++ /dev/null @@ -1,247 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.25 2003/08/19 17:32:34 tsi Exp $ */ -/* - * Copyright 1992 by Orest Zborowski - * Copyright 1993 by David Dawes - * - * 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, and that the names of Orest Zborowski and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Orest Zborowski - * and David Dawes make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * OREST ZBOROWSKI AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID DAWES BE LIABLE - * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: lnx_io.c /main/8 1996/10/19 18:06:28 kaleb $ */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */ - -_X_EXPORT void -xf86SoundKbdBell(int loudness, int pitch, int duration) -{ - if (loudness && pitch) - { - ioctl(xf86Info.consoleFd, KDMKTONE, - ((1193190 / pitch) & 0xffff) | - (((unsigned long)duration * - loudness / 50) << 16)); - } -} - -void -xf86SetKbdLeds(int leds) -{ - ioctl(xf86Info.consoleFd, KDSETLED, leds); -} - -int -xf86GetKbdLeds() -{ - int leds = 0; - - ioctl(xf86Info.consoleFd, KDGETLED, &leds); - return(leds); -} - -static int -KDKBDREP_ioctl_ok(int rate, int delay) { -#if defined(KDKBDREP) && !defined(__sparc__) - /* This ioctl is defined in but is not - implemented anywhere - must be in some m68k patches. */ - struct kbd_repeat kbdrep_s; - - /* don't change, just test */ - kbdrep_s.LNX_KBD_PERIOD_NAME = -1; - kbdrep_s.delay = -1; - if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { - return 0; - } - /* do the change */ - if (rate == 0) /* switch repeat off */ - kbdrep_s.LNX_KBD_PERIOD_NAME = 0; - else - kbdrep_s.LNX_KBD_PERIOD_NAME = 10000 / rate; /* convert cps to msec */ - if (kbdrep_s.LNX_KBD_PERIOD_NAME < 1) - kbdrep_s.LNX_KBD_PERIOD_NAME = 1; - kbdrep_s.delay = delay; - if (kbdrep_s.delay < 1) - kbdrep_s.delay = 1; - - if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { - return 0; - } - - return 1; /* success! */ -#else /* no KDKBDREP */ - return 0; -#endif /* KDKBDREP */ -} - -static int -KIOCSRATE_ioctl_ok(int rate, int delay) { -#ifdef KIOCSRATE - struct kbd_rate kbdrate_s; - int fd; - - fd = open("/dev/kbd", O_RDONLY); - if (fd == -1) - return 0; - - kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */ - kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */ - if (kbdrate_s.rate > 50) - kbdrate_s.rate = 50; - - if (ioctl( fd, KIOCSRATE, &kbdrate_s )) { - return 0; - } - - close( fd ); - - return 1; -#else /* no KIOCSRATE */ - return 0; -#endif /* KIOCSRATE */ -} - -void xf86SetKbdRepeat(char rad) -{ -#ifdef __sparc__ - int rate = 500; /* Default rate */ - int delay = 200; /* Default delay */ -#else - int rate = 300; /* Default rate */ - int delay = 250; /* Default delay */ -#endif - -#if defined(__alpha__) || defined (__i386__) || defined(__ia64__) - int i; - int timeout; - int value = 0x7f; /* Maximum delay with slowest rate */ - - static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150, - 133, 120, 109, 100, 92, 86, 80, 75, 67, - 60, 55, 50, 46, 43, 40, 37, 33, 30, 27, - 25, 23, 21, 20 }; -#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int )) - - static int valid_delays[] = { 250, 500, 750, 1000 }; -#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int )) -#endif - - if (xf86Info.kbdRate >= 0) - rate = xf86Info.kbdRate * 10; - if (xf86Info.kbdDelay >= 0) - delay = xf86Info.kbdDelay; - - if(KDKBDREP_ioctl_ok(rate, delay)) /* m68k? */ - return; - - if(KIOCSRATE_ioctl_ok(rate, delay)) /* sparc? */ - return; - - if (xf86IsPc98()) - return; - -#if defined(__alpha__) || defined (__i386__) || defined(__ia64__) - - /* The ioport way */ - - for (i = 0; i < RATE_COUNT; i++) - if (rate >= valid_rates[i]) { - value &= 0x60; - value |= i; - break; - } - - for (i = 0; i < DELAY_COUNT; i++) - if (delay <= valid_delays[i]) { - value &= 0x1f; - value |= i << 5; - break; - } - - timeout = KBC_TIMEOUT; - while (((inb(0x64) & 2) == 2) && --timeout) - usleep(1000); /* wait */ - - if (timeout == 0) - return; - - outb(0x60, 0xf3); /* set typematic rate */ - while (((inb(0x64) & 2) == 2) && --timeout) - usleep(1000); /* wait */ - - usleep(10000); - outb(0x60, value); - -#endif /* __alpha__ || __i386__ || __ia64__ */ -} - -static int kbdtrans; -static struct termios kbdtty; - -void -xf86KbdInit() -{ - ioctl (xf86Info.consoleFd, KDGKBMODE, &kbdtrans); - tcgetattr (xf86Info.consoleFd, &kbdtty); -} - -int -xf86KbdOn() -{ - struct termios nTty; - -#ifdef __powerpc__ - if (xf86Info.kbdCustomKeycodes) - ioctl(xf86Info.consoleFd, KDSKBMODE, K_MEDIUMRAW); - else -#endif - ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW); - - nTty = kbdtty; - nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); - nTty.c_oflag = 0; - nTty.c_cflag = CREAD | CS8; - nTty.c_lflag = 0; - nTty.c_cc[VTIME]=0; - nTty.c_cc[VMIN]=1; - cfsetispeed(&nTty, 9600); - cfsetospeed(&nTty, 9600); - tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); - return(xf86Info.consoleFd); -} - -int -xf86KbdOff() -{ - ioctl(xf86Info.consoleFd, KDSKBMODE, kbdtrans); - tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty); - return(xf86Info.consoleFd); -} -