public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* Using the Canadian Multilingual Standard keyboard with Windows XP
@ 2010-06-03 20:17 Young, George
  2010-07-01 14:49 ` Jon TURNEY
  0 siblings, 1 reply; 8+ messages in thread
From: Young, George @ 2010-06-03 20:17 UTC (permalink / raw)
  To: cygwin-xfree

Using Windows XP and cygwin started with the command
%RUN% XWin -multiwindow -clipboard -silent-dup-error -xkblayout ca
-xkbvariant multix -xkbmodel pc104

If the Windows keyboard is set to US, cygwin works fine. If the Windows
keyboard is set to Canadian Multilingual Standard, cygwin doesn't get
the RightAlt and RightControl inputs.

Regards,
George R. Young

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using the Canadian Multilingual Standard keyboard with Windows XP
  2010-06-03 20:17 Using the Canadian Multilingual Standard keyboard with Windows XP Young, George
@ 2010-07-01 14:49 ` Jon TURNEY
  2010-07-02 13:27   ` Using the Canadian Multilingual Standard keyboard with WindowsXP Young, George
  0 siblings, 1 reply; 8+ messages in thread
From: Jon TURNEY @ 2010-07-01 14:49 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: George.Young

On 03/06/2010 21:17, Young, George wrote:
> Using Windows XP and cygwin started with the command
> %RUN% XWin -multiwindow -clipboard -silent-dup-error -xkblayout ca
> -xkbvariant multix -xkbmodel pc104
>
> If the Windows keyboard is set to US, cygwin works fine. If the Windows
> keyboard is set to Canadian Multilingual Standard, cygwin doesn't get
> the RightAlt and RightControl inputs.

I couldn't reproduce this.  Checking with xev, the right alt and right control 
keys generate key events when the Windows keyboard layout is Canadian 
Multilingual Standard, although it seems that right control generates the same 
X keysym as left control with that layout for some reason.

Can you clarify how you are checking for the keypresses?

Please attach your /var/log/XWin.0.log as well.

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Using the Canadian Multilingual Standard keyboard with WindowsXP
  2010-07-01 14:49 ` Jon TURNEY
@ 2010-07-02 13:27   ` Young, George
  2010-07-13 18:41     ` Jon TURNEY
  0 siblings, 1 reply; 8+ messages in thread
From: Young, George @ 2010-07-02 13:27 UTC (permalink / raw)
  To: cygwin-xfree

[-- Attachment #1: Type: text/plain, Size: 4361 bytes --]

Hello Jon,

With WIN XP keyboard set to Canadian Multilingual Standard:
Run xev, press Right Alt

KeyPress event, serial 24, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 175760620, (207,-35), root:(383,197),
    state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 27, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 175760620, (207,-35), root:(383,197),
    state 0x4, keycode 113 (keysym 0xfe03, ISO_Level3_Shift),
same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 27, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 175760720, (207,-35), root:(383,197),
    state 0x84, keycode 113 (keysym 0xfe03, ISO_Level3_Shift),
same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

press Right Ctrl

KeyRelease event, serial 27, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 175766418, (207,-35), root:(383,197),
    state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

press Right Ctrl again

KeyPress event, serial 27, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 175776102, (207,-35), root:(383,197),
    state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 27, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 175776182, (207,-35), root:(383,197),
    state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

With WIN XP keyboard set to US:
Run xev, press Right Alt

KeyPress event, serial 24, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 175606538, (643,593), root:(775,767),
    state 0x0, keycode 113 (keysym 0xfe03, ISO_Level3_Shift),
same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 27, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 175606608, (643,593), root:(775,767),
    state 0x80, keycode 113 (keysym 0xfe03, ISO_Level3_Shift),
same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

press Right Ctrl

KeyPress event, serial 27, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 175613939, (643,593), root:(775,767),
    state 0x0, keycode 109 (keysym 0xfe11, ISO_Level5_Shift),
same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 27, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 175614009, (643,593), root:(775,767),
    state 0x20, keycode 109 (keysym 0xfe11, ISO_Level5_Shift),
same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

The latter seems correct.

Regards,
George Young

 

-----Original Message-----
From: Jon TURNEY [mailto:jon.turney@dronecode.org.uk] 
Sent: July 1, 2010 10:50 AM
To: cygwin-xfree@cygwin.com
Cc: Young, George
Subject: Re: Using the Canadian Multilingual Standard keyboard with
WindowsXP

On 03/06/2010 21:17, Young, George wrote:
> Using Windows XP and cygwin started with the command %RUN% XWin 
> -multiwindow -clipboard -silent-dup-error -xkblayout ca -xkbvariant 
> multix -xkbmodel pc104
>
> If the Windows keyboard is set to US, cygwin works fine. If the 
> Windows keyboard is set to Canadian Multilingual Standard, cygwin 
> doesn't get the RightAlt and RightControl inputs.

I couldn't reproduce this.  Checking with xev, the right alt and right
control keys generate key events when the Windows keyboard layout is
Canadian Multilingual Standard, although it seems that right control
generates the same X keysym as left control with that layout for some
reason.

Can you clarify how you are checking for the keypresses?

Please attach your /var/log/XWin.0.log as well.

--
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

[-- Attachment #2: XWin.0.log --]
[-- Type: application/octet-stream, Size: 4957 bytes --]

Welcome to the XWin X Server
Vendor: The Cygwin/X Project
Release: 1.8.0.0 (10800000)
Build Date: 2010-04-02

Contact: cygwin-xfree@cygwin.com
XWin was started with the following command line:

/usr/bin/XWin -multiwindow -clipboard -silent-dup-error 
 -xkblayout ca -xkbvariant multix -xkbmodel pc104 

ddxProcessArgument - Initializing default screens
winInitializeDefaultScreens - primary monitor w 1280 h 1024
winInitializeDefaultScreens - native DPI x 96 y 96
winInitializeDefaultScreens - Returning
[174791.186] _XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
[174791.186] _XSERVTransOpen: transport open failed for inet6/IBBB00822x06:0
[174791.186] _XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6
[174791.516] winValidateArgs - g_iNumScreens: 1 iMaxConsecutiveScreen: 1
[174791.516] (II) xorg.conf is not supported
[174791.516] (II) See http://x.cygwin.com/docs/faq/cygwin-x-faq.html for more information
[174791.526] LoadPreferences: /home/g_young/.XWinrc not found
[174791.526] LoadPreferences: Loading /etc/X11/system.XWinrc
[174791.526] LoadPreferences: Done parsing the configuration file...
[174791.526] winGetDisplay: DISPLAY=:0.0
[174791.526] winDetectSupportedEngines - Windows NT/2000/XP
[174791.526] winDetectSupportedEngines - DirectDraw installed
[174791.526] winDetectSupportedEngines - DirectDraw4 installed
[174791.526] winDetectSupportedEngines - Returning, supported engines 00000007
[174791.526] winSetEngine - Multi Window or Rootless => ShadowGDI
[174791.526] winAdjustVideoModeShadowGDI - Using Windows display depth of 32 bits per pixel
[174791.546] winAllocateFBShadowGDI - Creating DIB with width: 1280 height: 1024 depth: 32
[174791.546] winFinishScreenInitFB - Masks: 00ff0000 0000ff00 000000ff
[174791.546] winInitVisualsShadowGDI - Masks 00ff0000 0000ff00 000000ff BPRGB 8 d 24 bpp 32
[174791.556] null screen fn ReparentWindow
[174791.556] null screen fn RestackWindow
[174791.556] InitQueue - Calling pthread_mutex_init
[174791.556] InitQueue - pthread_mutex_init returned
[174791.556] InitQueue - Calling pthread_cond_init
[174791.556] InitQueue - pthread_cond_init returned
[174791.566] winInitMultiWindowWM - Hello
[174791.566] winInitMultiWindowWM - Calling pthread_mutex_lock ()
[174791.566] winMultiWindowXMsgProc - Hello
[174791.566] winMultiWindowXMsgProc - Calling pthread_mutex_lock ()
[174791.566] Screen 0 added at virtual desktop coordinate (0,0).
[174791.587] MIT-SHM extension disabled due to lack of kernel support
[174791.597] XFree86-Bigfont extension local-client optimization disabled due to lack of shared memory support in the kernel
[174791.627] (II) AIGLX: Loaded and initialized /usr/lib/dri/swrast_dri.so
[174791.627] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[174791.657] [dix] Could not init font path element /usr/share/fonts/TTF/, removing from list!
[174791.657] [dix] Could not init font path element /usr/share/fonts/OTF/, removing from list!
[174791.657] [dix] Could not init font path element /usr/share/fonts/Type1/, removing from list!
[174792.578] winPointerWarpCursor - Discarding first warp: 640 512
[174792.578] (--) 3 mouse buttons found
[174792.578] (--) Setting autorepeat to delay=500, rate=31
[174792.578] (--) winConfigKeyboard - Layout: "00011009" (00011009) 
[174792.578] (EE) Keyboardlayout "Canadian Multilingual Standard" (00011009) is unknown
[174792.578] (++) XKB: model: "pc104"
[174792.578] (++) XKB: layout: "ca"
[174792.578] (++) XKB: variant: "multix"
[174792.578] Rules = "base" Model = "pc104" Layout = "ca" Variant = "multix" Options = ""
[174793.159] winInitMultiWindowWM - pthread_mutex_lock () returned.
[174793.169] winProcEstablishConnection - Hello
[174793.169] winInitClipboard ()
[174793.169] winMultiWindowXMsgProc - pthread_mutex_lock () returned.
[174793.169] winMultiWindowXMsgProc - pthread_mutex_unlock () returned.
[174793.169] winGetDisplay: DISPLAY=:0.0
[174793.169] winMultiWindowXMsgProc - DISPLAY=:0.0
[174793.169] winInitMultiWindowWM - pthread_mutex_unlock () returned.
[174793.169] winClipboardProc - Hello
[174793.169] DetectUnicodeSupport - Windows NT/2000/XP
[174793.169] winProcEstablishConnection - winInitClipboard returned.
[174793.179] winGetDisplay: DISPLAY=:0.0
[174793.179] winInitMultiWindowWM - DISPLAY=:0.0
[174793.179] winGetDisplay: DISPLAY=:0.0
[174793.179] winClipboardProc - DISPLAY=:0.0
[174793.189] winMultiWindowXMsgProc - XOpenDisplay () returned and successfully opened the display.
[174793.199] winClipboardProc - XOpenDisplay () returned and successfully opened the display.
[174793.209] winInitMultiWindowWM - XOpenDisplay () returned and successfully opened the display.
[176014.345] winDeinitMultiWindowWM - Noting shutdown in progress
[176014.345] winClipboardProc - winClipboardFlushWindowsMessageQueue trapped WM_QUIT message, exiting main loop.
[176014.345] winClipboardProc - XDestroyWindow succeeded.
[176014.355] winClipboardIOErrorHandler!


[-- Attachment #3: Type: text/plain, Size: 223 bytes --]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using the Canadian Multilingual Standard keyboard with WindowsXP
  2010-07-02 13:27   ` Using the Canadian Multilingual Standard keyboard with WindowsXP Young, George
@ 2010-07-13 18:41     ` Jon TURNEY
  2010-07-13 18:53       ` [PATCH] Fixes for Canadian Multilingual Standard keyboard layout handling Jon TURNEY
  2010-07-13 19:30       ` Using the Canadian Multilingual Standard keyboard with WindowsXP Young, George
  0 siblings, 2 replies; 8+ messages in thread
From: Jon TURNEY @ 2010-07-13 18:41 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: George.Young

On 02/07/2010 14:27, Young, George wrote:
> With WIN XP keyboard set to Canadian Multilingual Standard:
> Run xev, press Right Alt
[xev output snipped]

Thanks.  This helps a lot in understanding the problem.

There seem to be two things going on here:

1) In the Canadian Multilingual Standard layout, Ctrl-R is VK_OEM_8 (rather 
than the more normal VK_CONTROL) which isn't in the mapping table to ignore 
the VK code and use the scan code.

2) Windows generates an additional Ctrl-L key event before AltGr key event for 
international keyboard layouts.  There is code in the X server to try to 
identify and discard these extra events, but this doesn't seem to be working 
in your case (and there have been other reports of that)


I don't see why we can't just always load the US keyboard layout as all we 
care about are scan codes:  Patch to follow which adds a flag to do that and 
turn it on for Japanese (which already does that) and Canadian Multilingual 
Standard.

I've also added a keycode mapping for VK_OEM_8 in case that ever fails, and 
improved some logging related to the keyboard layout detection.

I've also added the multix layout to the list of autodetected layouts.


I've uploaded a build with this patch applied [1]. This seems to correctly 
generate ISO_Level3_Shift for AltGr and ISO_Level5_Shift for Ctrl-R in the 
multix layout. Perhaps you could try it out and see if it works for you?

Although I am still a bit unclear as to what exactly doesn't work for you. 
Originally you said "If the Windows keyboard is set to Canadian Multilingual 
Standard, cygwin doesn't get the RightAlt and RightControl inputs", whereas 
this xev output seems to demonstrate that the X server gets events, just not 
the right ones :-)

[1] ftp://cygwin.com/pub/cygwinx/XWin.20100713-git-c54fb06114a2c0f1.exe.bz2

> -----Original Message-----
> On 03/06/2010 21:17, Young, George wrote:
>> Using Windows XP and cygwin started with the command %RUN% XWin
>> -multiwindow -clipboard -silent-dup-error -xkblayout ca -xkbvariant
>> multix -xkbmodel pc104
>>
>> If the Windows keyboard is set to US, cygwin works fine. If the
>> Windows keyboard is set to Canadian Multilingual Standard, cygwin
>> doesn't get the RightAlt and RightControl inputs.
>
> I couldn't reproduce this.  Checking with xev, the right alt and right
> control keys generate key events when the Windows keyboard layout is
> Canadian Multilingual Standard, although it seems that right control
> generates the same X keysym as left control with that layout for some
> reason.
>
> Can you clarify how you are checking for the keypresses?
>
> Please attach your /var/log/XWin.0.log as well.

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] Fixes for Canadian Multilingual Standard keyboard layout handling
  2010-07-13 18:41     ` Jon TURNEY
@ 2010-07-13 18:53       ` Jon TURNEY
  2010-07-13 19:30       ` Using the Canadian Multilingual Standard keyboard with WindowsXP Young, George
  1 sibling, 0 replies; 8+ messages in thread
From: Jon TURNEY @ 2010-07-13 18:53 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: Jon TURNEY

Try to make the keyboard detection logging a bit clearer

I don't see why we don't just always load the US keyboard layout as all we
care about are scan codes:  So add a flag to do that and turn it on for
Japanese (which already does that) and new layouts...

Add a keycode mapping for VK_OEM_8 which can be issued by Canadian Multilingual
Standard layout

Reformat the keyboard layout mapping table

Clarify XKB options in XWin man page

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
 hw/xwin/XWin.man.pre |    8 ++--
 hw/xwin/winconfig.c  |  108 ++++++++++++++++++++++++++++++-------------------
 hw/xwin/winkeybd.c   |    4 ++
 hw/xwin/winkeybd.h   |    2 +-
 hw/xwin/winlayouts.h |   83 +++++++++++++++++++-------------------
 5 files changed, 117 insertions(+), 88 deletions(-)

diff --git a/hw/xwin/XWin.man.pre b/hw/xwin/XWin.man.pre
index 6b28b51..51268f6 100644
--- a/hw/xwin/XWin.man.pre
+++ b/hw/xwin/XWin.man.pre
@@ -251,7 +251,7 @@ exit silently and don't display any error message.
 .B "\-xkbrules \fIrule\fP"
 .TP 8
 .B "\-xkbvariant \fIvariant\fp"
-These options implement the xkeyboard extension for loading
+These options configure the xkeyboard extension to load
 a particular keyboard map as the X server starts.  The behavior is similar
 to the \fIsetxkbmap\fP program.  The layout data is located at \fI
 __datadir__/X11/xkb/\fP.  Additional information is found in the
@@ -264,9 +264,9 @@ the options:
 Alternatively one may use the \fIsetxkbmap\fP program after \fIXWin\fP is
 running.
 
-The default is to select a layout matching your current layout as
-reported by \fIWindows\fP if known, or the default X server layout
-if no matching keyboard layout was found.
+The default is to select a configuration matching your current layout as
+reported by \fIWindows\fP, if known, or the default X server configuration
+if no matching keyboard configuration was found.
 
 .SH UNDOCUMENTED OPTIONS
 These options are undocumented.  Do not use them.
diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
index b05867b..3dc8ac4 100644
--- a/hw/xwin/winconfig.c
+++ b/hw/xwin/winconfig.c
@@ -240,6 +240,7 @@ Bool
 winConfigKeyboard (DeviceIntPtr pDevice)
 {
   char                          layoutName[KL_NAMELENGTH];
+  unsigned char                 layoutFriendlyName[256];
   static unsigned int           layoutNum = 0;
   int                           keyboardType;
 #ifdef XWIN_XF86CONFIG
@@ -291,19 +292,30 @@ winConfigKeyboard (DeviceIntPtr pDevice)
 	   Same might apply for chinese, korean and other symbol languages
 	   too */
         layoutNum = (layoutNum & 0xffff);
-	if (keyboardType == 7)
-	  {
-	    /* Japanese layouts have problems with key event messages
-	       such as the lack of WM_KEYUP for Caps Lock key.
-	       Loading US layout fixes this problem. */
-	    if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
-	      winMsg (X_INFO, "Loading US keyboard layout.\n");
-	    else
-	      winMsg (X_ERROR, "LoadKeyboardLaout 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, &regkey))
+          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++)
       {
@@ -311,46 +323,58 @@ winConfigKeyboard (DeviceIntPtr pDevice)
 	  continue;
 	if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType)
 	  continue;
-	
+
         bfound = TRUE;
 	winMsg (X_PROBED,
-		"Using preset keyboard for \"%s\" (%x), type \"%d\"\n",
-		pLayout->layoutname, pLayout->winlayout, keyboardType);
-	
+		"Found matching XKB configuration \"%s\"\n",
+		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.layout = pLayout->xkblayout;
 	g_winInfo.xkb.variant = pLayout->xkbvariant;
-	g_winInfo.xkb.options = pLayout->xkboptions; 
+	g_winInfo.xkb.options = pLayout->xkboptions;
+
+        /*
+          All we care about are getting keyboard scan codes.
+
+          Some keyboard layouts have lots of quirks we would need to
+          work around, for e.g.
+
+          - Japanese layouts have problems with key event messages
+          such as the lack of WM_KEYUP for Caps Lock key.
+
+          - Candian Multilingual Standard generates fake Ctrl_L keypress
+          before AltGr and maps the Ctrl_R key to VK_OEM_8
+
+          So for simple and predictable behaviour, load the US keyboard
+          layout to avoid these problems.  We could probably do this for
+          all layouts.
+        */
+        if (!pLayout->keeplayout)
+          {
+            if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
+              winMsg (X_INFO, "Loading Windows keyboard layout \"US\" to avoid layout quirks.\n");
+            else
+              winMsg (X_ERROR, "LoadKeyboardLayout failed.\n");
+          }
+
 	break;
       }
-    
+
     if (!bfound)
       {
-        HKEY                regkey = NULL;
-        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, &regkey) &&
-          !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);
+        winMsg (X_ERROR, "Keyboardlayout \"%s\" (%s) is unknown, using X server default layout\n", layoutFriendlyName, layoutName);
       }
-  }  
-  
+  }
+
   /* parse the configuration */
 #ifdef XWIN_XF86CONFIG
   if (g_cmdline.keyboard)
diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index ad9e66a..fa3e12f 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -73,6 +73,10 @@ winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
   int		iParam = HIWORD (lParam);
   int		iParamScanCode = LOBYTE (iParam);
 
+#if CYGDEBUG
+  ErrorF("winTranslateKey: wParam %04x lParam %08x\n", wParam, (unsigned int)lParam);
+#endif
+
 /* WM_ key messages faked by Vista speech recognition (WSR) don't have a
  * scan code.
  *
diff --git a/hw/xwin/winkeybd.h b/hw/xwin/winkeybd.h
index 5b2a589..90ad28e 100644
--- a/hw/xwin/winkeybd.h
+++ b/hw/xwin/winkeybd.h
@@ -266,7 +266,7 @@ g_iKeyMap [] = {
   /* 220 */	0,		0,		0,
   /* 221 */	0,		0,		0,
   /* 222 */	0,		0,		0,
-  /* 223 */	0,		0,		0,
+  /* 223 */	VK_OEM_8,	0,		KEY_RCtrl,  /* at least on Candian Multilingual Standard layout */
   /* 224 */	0,		0,		0,
   /* 225 */	0,		0,		0,
   /* 226 */	0,		0,		0,
diff --git a/hw/xwin/winlayouts.h b/hw/xwin/winlayouts.h
index 724465f..ad222bd 100644
--- a/hw/xwin/winlayouts.h
+++ b/hw/xwin/winlayouts.h
@@ -35,6 +35,7 @@ typedef struct
     char *xkblayout;
     char *xkbvariant;
     char *xkboptions;
+    Bool keeplayout;
     char *layoutname;
 } WinKBLayoutRec, *WinKBLayoutPtr;
 
@@ -44,47 +45,47 @@ typedef struct
 
 WinKBLayoutRec winKBLayouts[] = 
 {
-    {  0x404, -1, "pc105", "zh_TW",   NULL, NULL, "Chinese (Taiwan)"},
-    {  0x405, -1, "pc105", "cz",      NULL, NULL, "Czech"},
-    {0x10405, -1, "pc105", "cz_qwerty", NULL, NULL, "Czech (QWERTY)"},
-    {  0x406, -1, "pc105", "dk",      NULL, NULL, "Danish"},
-    {  0x407, -1, "pc105", "de",      NULL, NULL, "German (Germany)"},
-    {0x10407, -1, "pc105", "de",      NULL, NULL, "German (Germany, IBM)"},
-    {  0x807, -1, "pc105", "ch",      "de", NULL, "German (Switzerland)"},
-    {  0x409, -1, "pc105", "us",      NULL, NULL, "English (USA)"},
-    {0x10409, -1, "pc105", "dvorak",  NULL, NULL, "English (USA, Dvorak)"}, 
-    {0x20409, -1, "pc105", "us_intl", NULL, NULL, "English (USA, International)"}, 
-    {  0x809, -1, "pc105", "gb",      NULL, NULL, "English (United Kingdom)"},
-    { 0x1009, -1, "pc105", "ca",      "fr", NULL, "French (Canada)"},
-    {0x11009, -1, "pc105", "ca",      "multix", NULL, "Candian Multilingual Standard"},
-    { 0x1809, -1, "pc105", "ie",      NULL, NULL, "Irish"},
-    {  0x40a, -1, "pc105", "es",      NULL, NULL, "Spanish (Spain, Traditional Sort)"},
-    {  0x80a, -1, "pc105", "latam",   NULL, NULL, "Latin American"},
-    {  0x40b, -1, "pc105", "fi",      NULL, NULL, "Finnish"},
-    {  0x40c, -1, "pc105", "fr",      NULL, NULL, "French (Standard)"},
-    {  0x80c, -1, "pc105", "be",      NULL, NULL, "French (Belgian)"},
-    {  0xc0c, -1, "pc105", "ca",      "fr-legacy", NULL, "French (Canada) (Legacy)"},
-    { 0x100c, -1, "pc105", "ch",      "fr", NULL, "French (Switzerland)"},
-    {  0x40d, -1, "pc105", "il",      NULL, NULL, "Hebrew"},
-    {  0x40e, -1, "pc105", "hu",      NULL, NULL, "Hungarian"},
-    {  0x40f, -1, "pc105", "is",      NULL, NULL, "Icelandic"},
-    {  0x410, -1, "pc105", "it",      NULL, NULL, "Italian"},
-    {0x10410, -1, "pc105", "it",      NULL, NULL, "Italian (142)"},
-    {0xa0000410,-1, "macbook79","it",   "mac",NULL, "Italiano (Apple)"},
-    {  0x411,  7, "jp106", "jp",      NULL, NULL, "Japanese"},
-    {  0x413, -1, "pc105", "nl",      NULL, NULL, "Dutch"},
-    {  0x813, -1, "pc105", "be",      NULL, NULL, "Dutch (Belgian)"},  
-    {  0x414, -1, "pc105", "no",      NULL, NULL, "Norwegian"},
-    {  0x415, -1, "pc105", "pl",      NULL, NULL, "Polish (Programmers)"},
-    {  0x416, -1, "pc105", "br",      NULL, NULL, "Portuguese (Brazil, ABNT)"},
-    {0x10416, -1, "abnt2", "br",      NULL, NULL, "Portuguese (Brazil, ABNT2)"},
-    {  0x816, -1, "pc105", "pt",      NULL, NULL, "Portuguese (Portugal)"},
-    {  0x41a, -1, "pc105", "hr",      NULL, NULL, "Croatian"},
-    {  0x41d, -1, "pc105", "se",      NULL, NULL, "Swedish (Sweden)"},
-    {  0x424, -1, "pc105", "si",      NULL, NULL, "Slovenian"},
-    {  0x425, -1, "pc105", "ee",      NULL, NULL, "Estonian"},
-    {  0x452, -1, "pc105", "gb",      "intl", NULL, "United Kingdom (Extended)"},
-    {     -1, -1, NULL,    NULL,      NULL, NULL, NULL}
+    {  0x00000404, -1, "pc105", "zh_TW",     NULL, NULL, TRUE, "Chinese (Taiwan)"},
+    {  0x00000405, -1, "pc105", "cz",        NULL, NULL, TRUE, "Czech"},
+    {  0x00010405, -1, "pc105", "cz_qwerty", NULL, NULL, TRUE, "Czech (QWERTY)"},
+    {  0x00000406, -1, "pc105", "dk",        NULL, NULL, TRUE, "Danish"},
+    {  0x00000407, -1, "pc105", "de",        NULL, NULL, TRUE, "German (Germany)"},
+    {  0x00010407, -1, "pc105", "de",        NULL, NULL, TRUE, "German (Germany, IBM)"},
+    {  0x00000807, -1, "pc105", "ch",        "de", NULL, TRUE, "German (Switzerland)"},
+    {  0x00000409, -1, "pc105", "us",        NULL, NULL, TRUE, "English (USA)"},
+    {  0x00010409, -1, "pc105", "dvorak",    NULL, NULL, TRUE, "English (USA, Dvorak)"},
+    {  0x00020409, -1, "pc105", "us_intl",   NULL, NULL, TRUE, "English (USA, International)"},
+    {  0x00000809, -1, "pc105", "gb",        NULL, NULL, TRUE, "English (United Kingdom)"},
+    {  0x00001009, -1, "pc105", "ca",        "fr", NULL, TRUE, "French (Canada)"},
+    {  0x00011009, -1, "pc105", "ca",        "multix", NULL, FALSE, "Candian Multilingual Standard"},
+    {  0x00001809, -1, "pc105", "ie",        NULL, NULL, TRUE, "Irish"},
+    {  0x0000040a, -1, "pc105", "es",        NULL, NULL, TRUE, "Spanish (Spain, Traditional Sort)"},
+    {  0x0000080a, -1, "pc105", "latam",     NULL, NULL, TRUE, "Latin American"},
+    {  0x0000040b, -1, "pc105", "fi",        NULL, NULL, TRUE, "Finnish"},
+    {  0x0000040c, -1, "pc105", "fr",        NULL, NULL, TRUE, "French (Standard)"},
+    {  0x0000080c, -1, "pc105", "be",        NULL, NULL, TRUE, "French (Belgian)"},
+    {  0x00000c0c, -1, "pc105", "ca",        "fr-legacy", NULL, TRUE, "French (Canada, Legacy)"},
+    {  0x0000100c, -1, "pc105", "ch",        "fr", NULL, TRUE, "French (Switzerland)"},
+    {  0x0000040d, -1, "pc105", "il",        NULL, NULL, TRUE, "Hebrew"},
+    {  0x0000040e, -1, "pc105", "hu",        NULL, NULL, TRUE, "Hungarian"},
+    {  0x0000040f, -1, "pc105", "is",        NULL, NULL, TRUE, "Icelandic"},
+    {  0x00000410, -1, "pc105", "it",        NULL, NULL, TRUE, "Italian"},
+    {  0x00010410, -1, "pc105", "it",        NULL, NULL, TRUE, "Italian (142)"},
+    {  0xa0000410, -1, "macbook79","it",     "mac",NULL, TRUE, "Italiano (Apple)"},
+    {  0x00000411,  7, "jp106", "jp",        NULL, NULL, FALSE, "Japanese"},
+    {  0x00000413, -1, "pc105", "nl",        NULL, NULL, TRUE, "Dutch"},
+    {  0x00000813, -1, "pc105", "be",        NULL, NULL, TRUE, "Dutch (Belgian)"},
+    {  0x00000414, -1, "pc105", "no",        NULL, NULL, TRUE, "Norwegian"},
+    {  0x00000415, -1, "pc105", "pl",        NULL, NULL, TRUE, "Polish (Programmers)"},
+    {  0x00000416, -1, "pc105", "br",        NULL, NULL, TRUE, "Portuguese (Brazil, ABNT)"},
+    {  0x00010416, -1, "abnt2", "br",        NULL, NULL, TRUE, "Portuguese (Brazil, ABNT2)"},
+    {  0x00000816, -1, "pc105", "pt",        NULL, NULL, TRUE, "Portuguese (Portugal)"},
+    {  0x0000041a, -1, "pc105", "hr",        NULL, NULL, TRUE, "Croatian"},
+    {  0x0000041d, -1, "pc105", "se",        NULL, NULL, TRUE, "Swedish (Sweden)"},
+    {  0x00000424, -1, "pc105", "si",        NULL, NULL, TRUE, "Slovenian"},
+    {  0x00000425, -1, "pc105", "ee",        NULL, NULL, TRUE, "Estonian"},
+    {  0x00000452, -1, "pc105", "gb",        "intl", NULL, TRUE, "United Kingdom (Extended)"},
+    {          -1, -1, NULL,    NULL,        NULL, NULL, FALSE, NULL}
 };
 
 /*
-- 
1.7.1


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Using the Canadian Multilingual Standard keyboard with WindowsXP
  2010-07-13 18:41     ` Jon TURNEY
  2010-07-13 18:53       ` [PATCH] Fixes for Canadian Multilingual Standard keyboard layout handling Jon TURNEY
@ 2010-07-13 19:30       ` Young, George
  2010-07-16 14:04         ` Jon TURNEY
  1 sibling, 1 reply; 8+ messages in thread
From: Young, George @ 2010-07-13 19:30 UTC (permalink / raw)
  To: cygwin-xfree

Hello Jon,

I tried the patch and am very impressed. My WinXP was set up with English-Canada and 2 keyboards, Canadian Multilingual Standard and US. When I ran the cygwin patch, it added English-US with a US Keyboard, and switched to that.

In cygwin, the RightAlt and RightControl do what they're supposed to do (almost). There still seems to be a small problem with dead key stuff. 

When I first run the cygwin server, and press the keys for dead-cedilla (RtCtrl and =) then c, it just gives c. If I then run xev and stop it, the dead keys start to work and it gives ç.

Good stuff,
George R. Young


-----Original Message-----
From: Jon TURNEY [mailto:jon.turney@dronecode.org.uk] 
Sent: July 13, 2010 2:41 PM
To: cygwin-xfree@cygwin.com
Cc: Young, George
Subject: Re: Using the Canadian Multilingual Standard keyboard with WindowsXP

On 02/07/2010 14:27, Young, George wrote:
> With WIN XP keyboard set to Canadian Multilingual Standard:
> Run xev, press Right Alt
[xev output snipped]

Thanks.  This helps a lot in understanding the problem.

There seem to be two things going on here:

1) In the Canadian Multilingual Standard layout, Ctrl-R is VK_OEM_8 (rather than the more normal VK_CONTROL) which isn't in the mapping table to ignore the VK code and use the scan code.

2) Windows generates an additional Ctrl-L key event before AltGr key event for international keyboard layouts.  There is code in the X server to try to identify and discard these extra events, but this doesn't seem to be working in your case (and there have been other reports of that)


I don't see why we can't just always load the US keyboard layout as all we care about are scan codes:  Patch to follow which adds a flag to do that and turn it on for Japanese (which already does that) and Canadian Multilingual Standard.

I've also added a keycode mapping for VK_OEM_8 in case that ever fails, and improved some logging related to the keyboard layout detection.

I've also added the multix layout to the list of autodetected layouts.


I've uploaded a build with this patch applied [1]. This seems to correctly generate ISO_Level3_Shift for AltGr and ISO_Level5_Shift for Ctrl-R in the multix layout. Perhaps you could try it out and see if it works for you?

Although I am still a bit unclear as to what exactly doesn't work for you. 
Originally you said "If the Windows keyboard is set to Canadian Multilingual Standard, cygwin doesn't get the RightAlt and RightControl inputs", whereas this xev output seems to demonstrate that the X server gets events, just not the right ones :-)

[1] ftp://cygwin.com/pub/cygwinx/XWin.20100713-git-c54fb06114a2c0f1.exe.bz2

> -----Original Message-----
> On 03/06/2010 21:17, Young, George wrote:
>> Using Windows XP and cygwin started with the command %RUN% XWin 
>> -multiwindow -clipboard -silent-dup-error -xkblayout ca -xkbvariant 
>> multix -xkbmodel pc104
>>
>> If the Windows keyboard is set to US, cygwin works fine. If the 
>> Windows keyboard is set to Canadian Multilingual Standard, cygwin 
>> doesn't get the RightAlt and RightControl inputs.
>
> I couldn't reproduce this.  Checking with xev, the right alt and right 
> control keys generate key events when the Windows keyboard layout is 
> Canadian Multilingual Standard, although it seems that right control 
> generates the same X keysym as left control with that layout for some 
> reason.
>
> Can you clarify how you are checking for the keypresses?
>
> Please attach your /var/log/XWin.0.log as well.

--
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using the Canadian Multilingual Standard keyboard with WindowsXP
  2010-07-13 19:30       ` Using the Canadian Multilingual Standard keyboard with WindowsXP Young, George
@ 2010-07-16 14:04         ` Jon TURNEY
  2010-07-16 17:13           ` Young, George
  0 siblings, 1 reply; 8+ messages in thread
From: Jon TURNEY @ 2010-07-16 14:04 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: George.Young

On 13/07/2010 20:30, Young, George wrote:
> I tried the patch and am very impressed. My WinXP was set up with
> English-Canada and 2 keyboards, Canadian Multilingual Standard and US. When
> I ran the cygwin patch, it added English-US with a US Keyboard, and
> switched to that.

Thanks for trying it out.

Hmm... this is a rather unfortunate side-effect of loading the US keyboard 
layout, and there doesn't seem to be a good way of preventing it appearing in 
the language bar.

I think maybe I should try the alternate approach of handling VK_OEM_8 
correctly and trying to work out why the code to discard the spurious Ctrl-L 
key events isn't always working (it works fine for me)

I've uploaded another build at [1] which tries that, with lots of extra 
debugging built in.  I wonder if you could check if Ctrl-R deadkeys work 
correctly with that, and also if you could provide me with the output of 'tail 
-f /var/log/XWin.0.log' and xev from pressing AltGr.

> In cygwin, the RightAlt and RightControl do what they're supposed to do
> (almost). There still seems to be a small problem with dead key stuff.
>
> When I first run the cygwin server, and press the keys for dead-cedilla
> (RtCtrl and =) then c, it just gives c. If I then run xev and stop it, the
> dead keys start to work and it gives ç.

I'm afraid I can't reproduce this, I always get a ç, but I may not be doing 
the right thing.  Can you give me some more detailed steps about how you are 
starting the Xserver, and the application you are typing into?

[1] ftp://cygwin.com/pub/cygwinx/XWin.20100716-git-26e4d8f804b5cfdc.exe.bz2

>
> Good stuff, George R. Young
>
>
> -----Original Message----- From: Jon TURNEY
> [mailto:jon.turney@dronecode.org.uk] Sent: July 13, 2010 2:41 PM To:
> cygwin-xfree@cygwin.com Cc: Young, George Subject: Re: Using the Canadian
> Multilingual Standard keyboard with WindowsXP
>
> On 02/07/2010 14:27, Young, George wrote:
>> With WIN XP keyboard set to Canadian Multilingual Standard: Run xev,
>> press Right Alt
> [xev output snipped]
>
> Thanks.  This helps a lot in understanding the problem.
>
> There seem to be two things going on here:
>
> 1) In the Canadian Multilingual Standard layout, Ctrl-R is VK_OEM_8 (rather
> than the more normal VK_CONTROL) which isn't in the mapping table to ignore
> the VK code and use the scan code.
>
> 2) Windows generates an additional Ctrl-L key event before AltGr key event
> for international keyboard layouts.  There is code in the X server to try
> to identify and discard these extra events, but this doesn't seem to be
> working in your case (and there have been other reports of that)
>
>
> I don't see why we can't just always load the US keyboard layout as all we
> care about are scan codes:  Patch to follow which adds a flag to do that
> and turn it on for Japanese (which already does that) and Canadian
> Multilingual Standard.
>
> I've also added a keycode mapping for VK_OEM_8 in case that ever fails, and
> improved some logging related to the keyboard layout detection.
>
> I've also added the multix layout to the list of autodetected layouts.
>
>
> I've uploaded a build with this patch applied [1]. This seems to correctly
> generate ISO_Level3_Shift for AltGr and ISO_Level5_Shift for Ctrl-R in the
> multix layout. Perhaps you could try it out and see if it works for you?
>
> Although I am still a bit unclear as to what exactly doesn't work for you.
> Originally you said "If the Windows keyboard is set to Canadian
> Multilingual Standard, cygwin doesn't get the RightAlt and RightControl
> inputs", whereas this xev output seems to demonstrate that the X server
> gets events, just not the right ones :-)

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Using the Canadian Multilingual Standard keyboard with WindowsXP
  2010-07-16 14:04         ` Jon TURNEY
@ 2010-07-16 17:13           ` Young, George
  0 siblings, 0 replies; 8+ messages in thread
From: Young, George @ 2010-07-16 17:13 UTC (permalink / raw)
  To: cygwin-xfree

Hello Jon,

With this patch, Right Alt gives

$ tail -f /var/log/XWin.0.log
[610937.742] winWindowProc - Message WM_KEYDOWN
[610937.742]    hwnd 0x700d2 wParam 0xd lParam 0x1c0001 timestamp 610937742
[610937.742] winTranslateKey: wParam 000d lParam 001c0001 timestamp 610937742
[610937.742] winSendKeyEvent: dwKey: 28, fDown: 1, nEvents 2
[610937.802] winTopLevelWindowProc - Message WM_KEYUP
[610937.802]    hwnd 0xa0150 wParam 0xd lParam 0xc01c0001 timestamp 610937802
[610937.802] winWindowProc - Message WM_KEYUP
[610937.802]    hwnd 0x700d2 wParam 0xd lParam 0xc01c0001 timestamp 610937802
[610937.802] winTranslateKey: wParam 000d lParam c01c0001 timestamp 610937802
[610937.802] winSendKeyEvent: dwKey: 28, fDown: 0, nEvents 2
[610941.938] winTopLevelWindowProc - Message WM_KEYDOWN
[610941.938]    hwnd 0xa0150 wParam 0x11 lParam 0x1d0001 timestamp 610941938
[610941.938] winWindowProc - Message WM_KEYDOWN
[610941.938]    hwnd 0x700d2 wParam 0x11 lParam 0x1d0001 timestamp 610941938
[610941.938] winTopLevelWindowProc - Message WM_KEYDOWN
[610941.938]    hwnd 0xa0150 wParam 0x12 lParam 0x21380001 timestamp 610941938
[610941.938] winWindowProc - Message WM_KEYDOWN
[610941.938]    hwnd 0x700d2 wParam 0x12 lParam 0x21380001 timestamp 610941938
[610941.938] winTranslateKey: wParam 0012 lParam 21380001 timestamp 610941938
[610941.938] winSendKeyEvent: dwKey: 105, fDown: 1, nEvents 2
[610942.018] winTopLevelWindowProc - Message WM_SYSKEYUP
[610942.018]    hwnd 0xa0150 wParam 0x11 lParam 0xe01d0001 timestamp 610942018
[610942.018] winWindowProc - Message WM_SYSKEYUP
[610942.018]    hwnd 0x700d2 wParam 0x11 lParam 0xe01d0001 timestamp 610942018
[610942.018] winTopLevelWindowProc - Message WM_KEYUP
[610942.018]    hwnd 0xa0150 wParam 0x12 lParam 0xc1380001 timestamp 610942018
[610942.018] winWindowProc - Message WM_KEYUP
[610942.018]    hwnd 0x700d2 wParam 0x12 lParam 0xc1380001 timestamp 610942018
[610942.018] winTranslateKey: wParam 0012 lParam c1380001 timestamp 610942018
[610942.018] winSendKeyEvent: dwKey: 105, fDown: 0, nEvents 2


KeyPress event, serial 24, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 611127124, (353,21), root:(485,195),
    state 0x0, keycode 113 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 27, synthetic NO, window 0xa00001,
    root 0x101, subw 0x0, time 611127184, (353,21), root:(485,195),
    state 0x80, keycode 113 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False



For the dead-cedilla problem, the server is started with 

%RUN% XWin -multiwindow -clipboard -silent-dup-error -xkblayout ca -xkbvariant multix -xkbmodel pc104
%RUN% xterm +tb -e /usr/bin/bash -l

and I'm just typing in the xterm window. Immediately afer starting the server, RtCtrl = c gives c. After running some other application (e.g. xev, xterm +tb), it starts giving ç. And sometimes just to tease, it gives ç immediately upon startup.

In any event, this patch seems to work as well as the last one, and it doesn't visibly impact the WinXP language selector thingie.

So again, good stuff.
Regards,
George. 

-----Original Message-----
From: Jon TURNEY [mailto:jon.turney@dronecode.org.uk] 
Sent: July 16, 2010 10:05 AM
To: cygwin-xfree@cygwin.com
Cc: Young, George
Subject: Re: Using the Canadian Multilingual Standard keyboard with WindowsXP

On 13/07/2010 20:30, Young, George wrote:
> I tried the patch and am very impressed. My WinXP was set up with 
> English-Canada and 2 keyboards, Canadian Multilingual Standard and US. 
> When I ran the cygwin patch, it added English-US with a US Keyboard, 
> and switched to that.

Thanks for trying it out.

Hmm... this is a rather unfortunate side-effect of loading the US keyboard layout, and there doesn't seem to be a good way of preventing it appearing in the language bar.

I think maybe I should try the alternate approach of handling VK_OEM_8 correctly and trying to work out why the code to discard the spurious Ctrl-L key events isn't always working (it works fine for me)

I've uploaded another build at [1] which tries that, with lots of extra debugging built in.  I wonder if you could check if Ctrl-R deadkeys work correctly with that, and also if you could provide me with the output of 'tail -f /var/log/XWin.0.log' and xev from pressing AltGr.

> In cygwin, the RightAlt and RightControl do what they're supposed to 
> do (almost). There still seems to be a small problem with dead key stuff.
>
> When I first run the cygwin server, and press the keys for 
> dead-cedilla (RtCtrl and =) then c, it just gives c. If I then run xev 
> and stop it, the dead keys start to work and it gives ç.

I'm afraid I can't reproduce this, I always get a ç, but I may not be doing the right thing.  Can you give me some more detailed steps about how you are starting the Xserver, and the application you are typing into?

[1] ftp://cygwin.com/pub/cygwinx/XWin.20100716-git-26e4d8f804b5cfdc.exe.bz2

>
> Good stuff, George R. Young
>
>
> -----Original Message----- From: Jon TURNEY 
> [mailto:jon.turney@dronecode.org.uk] Sent: July 13, 2010 2:41 PM To:
> cygwin-xfree@cygwin.com Cc: Young, George Subject: Re: Using the 
> Canadian Multilingual Standard keyboard with WindowsXP
>
> On 02/07/2010 14:27, Young, George wrote:
>> With WIN XP keyboard set to Canadian Multilingual Standard: Run xev, 
>> press Right Alt
> [xev output snipped]
>
> Thanks.  This helps a lot in understanding the problem.
>
> There seem to be two things going on here:
>
> 1) In the Canadian Multilingual Standard layout, Ctrl-R is VK_OEM_8 
> (rather than the more normal VK_CONTROL) which isn't in the mapping 
> table to ignore the VK code and use the scan code.
>
> 2) Windows generates an additional Ctrl-L key event before AltGr key 
> event for international keyboard layouts.  There is code in the X 
> server to try to identify and discard these extra events, but this 
> doesn't seem to be working in your case (and there have been other 
> reports of that)
>
>
> I don't see why we can't just always load the US keyboard layout as 
> all we care about are scan codes:  Patch to follow which adds a flag 
> to do that and turn it on for Japanese (which already does that) and 
> Canadian Multilingual Standard.
>
> I've also added a keycode mapping for VK_OEM_8 in case that ever 
> fails, and improved some logging related to the keyboard layout detection.
>
> I've also added the multix layout to the list of autodetected layouts.
>
>
> I've uploaded a build with this patch applied [1]. This seems to 
> correctly generate ISO_Level3_Shift for AltGr and ISO_Level5_Shift for 
> Ctrl-R in the multix layout. Perhaps you could try it out and see if it works for you?
>
> Although I am still a bit unclear as to what exactly doesn't work for you.
> Originally you said "If the Windows keyboard is set to Canadian 
> Multilingual Standard, cygwin doesn't get the RightAlt and 
> RightControl inputs", whereas this xev output seems to demonstrate 
> that the X server gets events, just not the right ones :-)

--
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-07-16 17:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-03 20:17 Using the Canadian Multilingual Standard keyboard with Windows XP Young, George
2010-07-01 14:49 ` Jon TURNEY
2010-07-02 13:27   ` Using the Canadian Multilingual Standard keyboard with WindowsXP Young, George
2010-07-13 18:41     ` Jon TURNEY
2010-07-13 18:53       ` [PATCH] Fixes for Canadian Multilingual Standard keyboard layout handling Jon TURNEY
2010-07-13 19:30       ` Using the Canadian Multilingual Standard keyboard with WindowsXP Young, George
2010-07-16 14:04         ` Jon TURNEY
2010-07-16 17:13           ` Young, George

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).