Cygwin/X: Make the keyboard layout detection logging a bit clearer
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
		
							parent
							
								
									57ca09441e
								
							
						
					
					
						commit
						ae99a6f895
					
				| 
						 | 
					@ -240,6 +240,7 @@ Bool
 | 
				
			||||||
winConfigKeyboard (DeviceIntPtr pDevice)
 | 
					winConfigKeyboard (DeviceIntPtr pDevice)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  char                          layoutName[KL_NAMELENGTH];
 | 
					  char                          layoutName[KL_NAMELENGTH];
 | 
				
			||||||
 | 
					  unsigned char                 layoutFriendlyName[256];
 | 
				
			||||||
  static unsigned int           layoutNum = 0;
 | 
					  static unsigned int           layoutNum = 0;
 | 
				
			||||||
  int                           keyboardType;
 | 
					  int                           keyboardType;
 | 
				
			||||||
#ifdef XWIN_XF86CONFIG
 | 
					#ifdef XWIN_XF86CONFIG
 | 
				
			||||||
| 
						 | 
					@ -299,11 +300,32 @@ winConfigKeyboard (DeviceIntPtr pDevice)
 | 
				
			||||||
	    if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
 | 
						    if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
 | 
				
			||||||
	      winMsg (X_INFO, "Loading US keyboard layout.\n");
 | 
						      winMsg (X_INFO, "Loading US keyboard layout.\n");
 | 
				
			||||||
	    else
 | 
						    else
 | 
				
			||||||
	      winMsg (X_ERROR, "LoadKeyboardLaout failed.\n");
 | 
						      winMsg (X_ERROR, "LoadKeyboardLayout failed.\n");
 | 
				
			||||||
	  }
 | 
						  }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    winMsg (X_PROBED, "winConfigKeyboard - Layout: \"%s\" (%08x) \n", 
 | 
					
 | 
				
			||||||
            layoutName, layoutNum);
 | 
					    /* Discover the friendly name of the current layout */
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      HKEY                regkey = NULL;
 | 
				
			||||||
 | 
					      const char          regtempl[] = "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
 | 
				
			||||||
 | 
					      char                *regpath;
 | 
				
			||||||
 | 
					      DWORD               namesize = sizeof(layoutFriendlyName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1);
 | 
				
			||||||
 | 
					      strcpy(regpath, regtempl);
 | 
				
			||||||
 | 
					      strcat(regpath, layoutName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, ®key))
 | 
				
			||||||
 | 
					          RegQueryValueEx(regkey, "Layout Text", 0, NULL, layoutFriendlyName, &namesize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      /* Close registry key */
 | 
				
			||||||
 | 
					      if (regkey)
 | 
				
			||||||
 | 
					        RegCloseKey (regkey);
 | 
				
			||||||
 | 
					      free(regpath);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    winMsg (X_PROBED, "Windows keyboard layout: \"%s\" (%08x) \"%s\", type %d\n",
 | 
				
			||||||
 | 
					            layoutName, layoutNum, layoutFriendlyName, keyboardType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++)
 | 
					    for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
| 
						 | 
					@ -314,40 +336,29 @@ winConfigKeyboard (DeviceIntPtr pDevice)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bfound = TRUE;
 | 
					        bfound = TRUE;
 | 
				
			||||||
	winMsg (X_PROBED,
 | 
						winMsg (X_PROBED,
 | 
				
			||||||
		"Using preset keyboard for \"%s\" (%x), type \"%d\"\n",
 | 
							"Found matching XKB configuration \"%s\"\n",
 | 
				
			||||||
		pLayout->layoutname, pLayout->winlayout, keyboardType);
 | 
							pLayout->layoutname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        winMsg(X_PROBED,
 | 
				
			||||||
 | 
					               "Model = \"%s\" Layout = \"%s\""
 | 
				
			||||||
 | 
					               " Variant = \"%s\" Options = \"%s\"\n",
 | 
				
			||||||
 | 
					               pLayout->xkbmodel ? pLayout->xkbmodel : "none",
 | 
				
			||||||
 | 
					               pLayout->xkblayout ? pLayout->xkblayout : "none",
 | 
				
			||||||
 | 
					               pLayout->xkbvariant ? pLayout->xkbvariant : "none",
 | 
				
			||||||
 | 
					               pLayout->xkboptions ? pLayout->xkboptions : "none");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	g_winInfo.xkb.model = pLayout->xkbmodel;
 | 
						g_winInfo.xkb.model = pLayout->xkbmodel;
 | 
				
			||||||
	g_winInfo.xkb.layout = pLayout->xkblayout;
 | 
						g_winInfo.xkb.layout = pLayout->xkblayout;
 | 
				
			||||||
	g_winInfo.xkb.variant = pLayout->xkbvariant;
 | 
						g_winInfo.xkb.variant = pLayout->xkbvariant;
 | 
				
			||||||
	g_winInfo.xkb.options = pLayout->xkboptions;
 | 
						g_winInfo.xkb.options = pLayout->xkboptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	break;
 | 
						break;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!bfound)
 | 
					    if (!bfound)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        HKEY                regkey = NULL;
 | 
					        winMsg (X_ERROR, "Keyboardlayout \"%s\" (%s) is unknown, using X server default layout\n", layoutFriendlyName, layoutName);
 | 
				
			||||||
        const char          regtempl[] = 
 | 
					 | 
				
			||||||
          "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
 | 
					 | 
				
			||||||
        char                *regpath;
 | 
					 | 
				
			||||||
        unsigned char       lname[256];
 | 
					 | 
				
			||||||
        DWORD               namesize = sizeof(lname);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1);
 | 
					 | 
				
			||||||
        strcpy(regpath, regtempl);
 | 
					 | 
				
			||||||
        strcat(regpath, layoutName);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, ®key) &&
 | 
					 | 
				
			||||||
          !RegQueryValueEx(regkey, "Layout Text", 0, NULL, lname, &namesize))
 | 
					 | 
				
			||||||
          {
 | 
					 | 
				
			||||||
	    winMsg (X_ERROR,
 | 
					 | 
				
			||||||
		"Keyboardlayout \"%s\" (%s) is unknown\n", lname, layoutName);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Close registry key */
 | 
					 | 
				
			||||||
	if (regkey)
 | 
					 | 
				
			||||||
	  RegCloseKey (regkey);
 | 
					 | 
				
			||||||
        free(regpath);
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue