[PATCH] default XKB settings

Alexander Gottwald Alexander.Gottwald@s1999.tu-chemnitz.de
Thu Feb 6 16:41:00 GMT 2003


Hi,

This is a patch to change the default settings for XKB depending on the 
settings windows reported. I've added the following keyboardtypes 
cz: Czech
dk: Danish
de: German (Germany)
gb: English (United Kingdom)
es: Spanish (Spain, Traditional Sort)
fi: Finnish
fr: French (Standard)
be: French (Belgian)
se: Swedish (Sweden)

Harold, can you add this to your builds?

bye
    ago

NP: VNV Nation - Electronaut
-- 
 Alexander.Gottwald@informatik.tu-chemnitz.de 
 http://www.gotti.org           ICQ: 126018723
-------------- next part --------------
Index: winconfig.c
===================================================================
RCS file: /cvs/xc/programs/Xserver/hw/xwin/winconfig.c,v
retrieving revision 1.1
diff -u -r1.1 winconfig.c
--- winconfig.c	2002/10/17 08:18:22	1.1
+++ winconfig.c	2003/02/06 16:36:34
@@ -213,9 +213,35 @@
 
 /* Set the keyboard configuration */
 
+typedef struct {
+    int winlayout;
+    int winkbtype;
+    char *xkbmodel;
+    char *xkblayout;
+    char *xkbvariant;
+    char *xkboptions;
+    char *layoutname;
+} WinKBLayoutRec, *WinKBLayoutPtr;
+
+WinKBLayoutRec winKBLayouts[] = {
+    {0x405, 4, "pc105", "cz", NULL,         NULL, "Czech"},
+    {0x406, 4, "pc105", "dk", NULL,         NULL, "Danish"},
+    {0x407, 4, "pc105", "de", "nodeadkeys", NULL, "German (Germany)"},
+    {0x809, 4, "pc105", "gb", NULL,         NULL, "English (United Kingdom)"},
+    {0x40a, 4, "pc105", "es", NULL,         NULL, "Spanish (Spain, Traditional Sort)"},
+    {0x40b, 4, "pc105", "fi", NULL,         NULL, "Finnish"},
+    {0x40c, 4, "pc105", "fr", NULL,         NULL, "French (Standard)"},
+    {0x80c, 4, "pc105", "be", NULL,         NULL, "French (Belgian)"},
+    {0x41d, 4, "pc105", "se", NULL,         NULL, "Swedish (Sweden)"},
+    {-1, -1, NULL, NULL, NULL, NULL, NULL}
+};
+
 Bool
 winConfigKeyboard (DeviceIntPtr pDevice)
 {
+  char                          layoutName[KL_NAMELENGTH];
+  int                           layoutNum;
+  int                           keyboardType;  
   XF86ConfInputPtr		kbd = NULL;
   XF86ConfInputPtr		input_list = NULL;
   MessageType			from = X_DEFAULT;
@@ -237,6 +263,31 @@
   g_winInfo.xkb.variant = NULL;
   g_winInfo.xkb.options = NULL;
 # endif	/* PC98 */
+
+  
+
+  keyboardType = GetKeyboardType(0);
+  if (keyboardType > 0 && GetKeyboardLayoutName(layoutName)) 
+  {
+    layoutNum = strtol(layoutName, (char **)NULL, 16);   
+    WinKBLayoutPtr pLayout = winKBLayouts;
+    for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++) {
+      if (pLayout->winlayout != layoutNum)
+        continue;
+      if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType)
+        continue;
+      
+	  winMsg (X_DEFAULT, "Using preset keyboard for \"%s\" (%s), type \"%d\"\n",
+              pLayout->layoutname, layoutName, keyboardType);
+
+      g_winInfo.xkb.model = pLayout->xkbmodel;
+      g_winInfo.xkb.layout = pLayout->xkblayout;
+      g_winInfo.xkb.variant = pLayout->xkbvariant;
+      g_winInfo.xkb.options = pLayout->xkboptions; 
+      break;
+    } 
+  }  
+  
   g_winInfo.xkb.initialMap = NULL;
   g_winInfo.xkb.keymap = NULL;
   g_winInfo.xkb.types = NULL;


More information about the Cygwin-xfree mailing list