Module Name:    xsrc
Committed By:   mrg
Date:           Sun Jul 24 00:06:38 UTC 2011

Modified Files:
        xsrc/external/mit/xf86-input-keyboard/dist/src: bsd_KbdMap.c bsd_kbd.c
            kbd.c

Log Message:
merge xf86-input-keyboard-1.6.0


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
    xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c
cvs rdiff -u -r1.12 -r1.13 \
    xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c
diff -u xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c:1.5 xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c:1.6
--- xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c:1.5	Mon Apr 18 23:31:06 2011
+++ xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_KbdMap.c	Sun Jul 24 00:06:38 2011
@@ -189,98 +189,6 @@
 	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol
 };
 
-#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
-
 #ifdef SYSCONS_SUPPORT
 static
 unsigned char sysconsCODEMap[] = {
@@ -1076,112 +984,6 @@
 #ifndef __bsdi__
   switch (pKbd->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(pInfo->fd, 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
  */
@@ -1264,8 +1066,6 @@
       break;
 
     }
-  
-  pKbd->kbdType = 0;
 
   pKeySyms->map        = map;
   pKeySyms->mapWidth   = GLYPHS_PER_KEY;

Index: xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c
diff -u xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c:1.12 xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c:1.13
--- xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c:1.12	Mon Apr 18 23:30:11 2011
+++ xsrc/external/mit/xf86-input-keyboard/dist/src/bsd_kbd.c	Sun Jul 24 00:06:38 2011
@@ -25,11 +25,7 @@
 #include "xf86Xinput.h"
 #include "xf86OSKbd.h"
 #include "atKeynames.h"
-
-extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
-                          CARD8 *pModMap);
-
-extern Bool VTSwitchEnabled;
+#include "bsd_kbd.h"
 
 static KbdProtocolRec protocols[] = {
    {"standard", PROT_STD },
@@ -142,25 +138,6 @@
     return(leds);
 }
 
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
-    KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-    switch (pKbd->consType) {
-
-#ifdef PCCONS_SUPPORT
-	case PCCONS:
-		break;
-#endif
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
-	case SYSCONS:
-	case PCVT:
-		ioctl(pInfo->fd, KDSETRAD, rad);
-		break;
-#endif
-    }
-}
-
 static int
 KbdOn(InputInfoPtr pInfo, int what)
 {
@@ -377,11 +354,10 @@
 #endif
         default:
            xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s);
-           xfree(s);
+           free(s);
            return FALSE;
     }
-    xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s);
-    xfree(s);
+    free(s);
 
     if (prot == PROT_WSCONS) {
 	s = xf86SetStrOption(pInfo->options, "Device", "/dev/wskbd");
@@ -396,12 +372,12 @@
 	pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
 	if (pInfo->fd == -1) {
            xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
-           xfree(s);
+           free(s);
            return FALSE;
        }
        pKbd->isConsole = FALSE;
        pKbd->consType = xf86Info.consType;
-       xfree(s);
+       free(s);
     }
 
 #ifdef WSCONS_SUPPORT
@@ -446,7 +422,7 @@
                break;
 #endif
 #ifdef WSKBD_TYPE_SUN5
-     case WSKBD_TYPE_SUN5:
+           case WSKBD_TYPE_SUN5:
                printWsType("Sun5", pInfo->name);
                break;
 #endif
@@ -480,16 +456,13 @@
     pKbd->Bell		= SoundBell;
     pKbd->SetLeds	= SetKbdLeds;
     pKbd->GetLeds	= GetKbdLeds;
-    pKbd->SetKbdRepeat	= SetKbdRepeat;
     pKbd->KbdGetMapping	= KbdGetMapping;
 
     pKbd->RemapScanCode = NULL;
 
     pKbd->OpenKeyboard = OpenKeyboard;
-    pKbd->vtSwitchSupported = FALSE;
-    pKbd->CustomKeycodes = FALSE;
-    
-    pKbd->private = xcalloc(sizeof(BsdKbdPrivRec), 1);
+
+    pKbd->private = calloc(sizeof(BsdKbdPrivRec), 1);
     if (pKbd->private == NULL) {
        xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
        return FALSE;

Index: xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c
diff -u xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c:1.4 xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c:1.5
--- xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c:1.4	Thu Apr 28 23:27:02 2011
+++ xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c	Sun Jul 24 00:06:38 2011
@@ -49,14 +49,17 @@
 /* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */
 #define INITFLAG	(1U << 31)
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
 static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags);
+#else
+static int KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
+#endif
 static int KbdProc(DeviceIntPtr device, int what);
 static void KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl);
 static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused);
 static void PostKbdEvent(InputInfoPtr pInfo, unsigned int key, Bool down);
 
 static void InitKBD(InputInfoPtr pInfo, Bool init);
-static void SetXkbOption(InputInfoPtr pInfo, char *name, char **option);
 static void UpdateLeds(InputInfoPtr pInfo);
 
 _X_EXPORT InputDriverRec KBD = {
@@ -85,29 +88,19 @@
     "Protocol",		"standard",
 #endif
 #else /* NetBSD */
-#ifdef XQUEUE 
-    "Protocol",		"Xqueue",
-#else
     "Protocol",		"standard",
-#endif
 #endif /* NetBSD */
     "XkbRules",		"base",
     "XkbModel",		"pc105",
     "XkbLayout",	"us",
-    "CustomKeycodes",	"off",
     NULL
 };
 
 static const char *kbd98Defaults[] = {
-#ifdef XQUEUE
-    "Protocol",		"Xqueue",
-#else
     "Protocol",		"standard",
-#endif
     "XkbRules",		"xfree98",
     "XkbModel",		"pc98",
     "XkbLayout",	"jp",
-    "CustomKeycodes",	"off",
     NULL
 };
 
@@ -117,37 +110,51 @@
 static char *xkb_variant;
 static char *xkb_options;
 
-static void
-SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
-{
-   char *s;
-
-   if ((s = xf86SetStrOption(pInfo->options, name, NULL))) {
-       if (!s[0]) {
-           free(s);
-           *option = NULL;
-       } else {
-           *option = s;
-           xf86Msg(X_CONFIG, "%s: %s: \"%s\"\n", pInfo->name, name, s);
-       }
-    }
-}
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
+static int
+NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
 
 static InputInfoPtr
 KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 {
     InputInfoPtr pInfo;
-    KbdDevPtr pKbd;
-    MessageType from = X_DEFAULT;
-    char *s;
 
     if (!(pInfo = xf86AllocateInput(drv, 0)))
 	return NULL;
 
-    /* Initialise the InputInfoRec. */
     pInfo->name = dev->identifier;
-    pInfo->type_name = XI_KEYBOARD;
     pInfo->flags = XI86_KEYBOARD_CAPABLE;
+    pInfo->conversion_proc = NULL;
+    pInfo->reverse_conversion_proc = NULL;
+    pInfo->private_flags = 0;
+    pInfo->always_core_feedback = NULL;
+    pInfo->conf_idev = dev;
+    pInfo->close_proc = NULL;
+
+    if (NewKbdPreInit(drv, pInfo, flags) == Success)
+    {
+        pInfo->flags |= XI86_CONFIGURED;
+        return pInfo;
+    }
+
+    xf86DeleteInput(pInfo, 0);
+    return NULL;
+}
+
+static int
+NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+#else
+static int
+KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+#endif
+{
+    KbdDevPtr pKbd;
+    char *s;
+    const char **defaults;
+    int rc = Success;
+
+    /* Initialise the InputInfoRec. */
+    pInfo->type_name = XI_KEYBOARD;
     pInfo->device_control = KbdProc;
     /*
      * We don't specify our own read_input function. We expect
@@ -155,33 +162,37 @@
      */
     pInfo->read_input = NULL;
     pInfo->control_proc = NULL;
-    pInfo->close_proc = NULL;
     pInfo->switch_mode = NULL;
-    pInfo->conversion_proc = NULL;
-    pInfo->reverse_conversion_proc = NULL;
     pInfo->fd = -1;
     pInfo->dev = NULL;
-    pInfo->private_flags = 0;
-    pInfo->always_core_feedback = NULL;
-    pInfo->conf_idev = dev;
 
     if (!xf86IsPc98())
-        xf86CollectInputOptions(pInfo, kbdDefaults, NULL);
+        defaults = kbdDefaults;
     else
-        xf86CollectInputOptions(pInfo, kbd98Defaults, NULL);
+        defaults = kbd98Defaults;
+    xf86CollectInputOptions(pInfo, defaults
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
+            , NULL
+#endif
+            );
     xf86ProcessCommonOptions(pInfo, pInfo->options); 
 
-    if (!(pKbd = calloc(sizeof(KbdDevRec), 1)))
-        return pInfo;
+    if (!(pKbd = calloc(sizeof(KbdDevRec), 1))) {
+        rc = BadAlloc;
+        goto out;
+    }
 
     pInfo->private = pKbd;
     pKbd->PostEvent = PostKbdEvent;
 
-    if (!xf86OSKbdPreInit(pInfo))
-        return pInfo;
+    if (!xf86OSKbdPreInit(pInfo)) {
+        rc = BadAlloc;
+        goto out;
+    }
 
     if (!pKbd->OpenKeyboard(pInfo)) {
-        return pInfo;
+        rc = BadMatch;
+        goto out;
     }
 
     if ((s = xf86SetStrOption(pInfo->options, "XLeds", NULL))) {
@@ -200,26 +211,17 @@
         free(s);
     }
 
-    SetXkbOption(pInfo, "XkbRules", &xkb_rules);
-    SetXkbOption(pInfo, "XkbModel", &xkb_model);
-    SetXkbOption(pInfo, "XkbLayout", &xkb_layout);
-    SetXkbOption(pInfo, "XkbVariant", &xkb_variant);
-    SetXkbOption(pInfo, "XkbOptions", &xkb_options);
-
-  pKbd->CustomKeycodes = FALSE;
-  from = X_DEFAULT; 
-  if (xf86FindOption(pInfo->options, "CustomKeycodes")) {
-      pKbd->CustomKeycodes = xf86SetBoolOption(pInfo->options, "CustomKeycodes",
-                                               pKbd->CustomKeycodes);
-     from = X_CONFIG;
-  }
-
-  xf86Msg(from, "%s: CustomKeycodes %s\n",
-               pInfo->name, pKbd->CustomKeycodes ? "enabled" : "disabled");
+    xkb_rules = xf86SetStrOption(pInfo->options, "XkbRules", NULL);
+    xkb_model = xf86SetStrOption(pInfo->options, "XkbModel", NULL);
+    xkb_layout = xf86SetStrOption(pInfo->options, "XkbLayout", NULL);
+    xkb_variant = xf86SetStrOption(pInfo->options, "XkbVariant", NULL);
+    xkb_options = xf86SetStrOption(pInfo->options, "XkbOptions", NULL);
 
-  pInfo->flags |= XI86_CONFIGURED;
+    pKbd->CustomKeycodes = xf86SetBoolOption(pInfo->options, "CustomKeycodes",
+                                             FALSE);
 
-  return pInfo;
+out:
+  return rc;
 }
 
 static void
@@ -282,51 +284,7 @@
 static void
 InitKBD(InputInfoPtr pInfo, Bool init)
 {
-  xEvent          kevent;
   KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 1
-  DeviceIntPtr    pKeyboard = pInfo->dev;
-  KeyClassRec     *keyc = pKeyboard->key;
-  KeySym          *map = keyc->curKeySyms.map;
-  unsigned int    i;
-#endif
-
-  kevent.u.keyButtonPointer.time = GetTimeInMillis();
-  kevent.u.keyButtonPointer.rootX = 0;
-  kevent.u.keyButtonPointer.rootY = 0;
-
-/* The server does this for us with i-h. */
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 1
-  /*
-   * 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);
-        }
-      }
-#endif
 
   pKbd->scanPrefix      = 0;
 
@@ -451,10 +409,6 @@
   ErrorF("kbd driver rec scancode: 0x02%x %s\n", scanCode, down?"down":"up");
 #endif
 	  
-  /* Disable any keyboard processing while in suspend */
-  if (xf86inSuspend)
-      return;
-
   /*
    * First do some special scancode remapping ...
    */

Reply via email to