On Aug 19 13:08, Charles Wilson wrote:
> Corinna Vinschen wrote:
> >OTOH, if you have an idea how to solve the ALT + Cursor key problem....
> 
> No, nothing obvious. I'd just turn on some of the debugging in the main 
> loop and see what happens to the keystrokes.

Got it.  The Alt key is handled rather strange in Windows.  For some
reason, some of the Alt-key combinations generate a WM_SYSCHAR message,
while other Alt-key combinations (Alt-Cursor, Alt-Fkey, etc) generate a
WM_SYSKEYDOWN message only. 

rxvt already handles *one* *single* *key* *combination* specially,
Alt-F10.  I have no idea what's so special with Alt-F10, but there you
are.  This special handling is not necessary, it even looks a bit wrong.

The patch to get all missing Alt-key combinations working is quite
simple:

--- W11/w32/event.c.ORIG        2007-08-20 12:56:25.637210400 +0200
+++ W11/w32/event.c     2007-08-20 13:09:55.322732400 +0200
@@ -127,11 +127,6 @@ doTranslateMessage(MSG *m)
            ((m->wParam == VK_BACK) ||
             (((m->wParam == VK_ADD) || (m->wParam == VK_SUBTRACT)) &&
              (GetKeyState(VK_SHIFT) & 0x8000)))) return;
-       if ((m->message == WM_SYSKEYDOWN) && (m->wParam == VK_F10))
-       {
-           m->message = WM_KEYDOWN;
-           return;
-       }
        TranslateMessage(m);
 }
 
@@ -205,7 +200,8 @@ LONG NT_handleMsg(
        case WM_QUIT:
        case WM_CLOSE:
        case WM_DESTROY:
-       case WM_SYSCHAR:    /* alt-keys go here */
+       case WM_SYSKEYDOWN: /* Some alt-keys go here */
+       case WM_SYSCHAR:    /* Other alt-keys go here */
        case WM_CHAR:
        case WM_LBUTTONDBLCLK:
        case WM_MBUTTONDBLCLK:
@@ -543,6 +539,7 @@ WinEventToXEvent(
                }
                event->xkey.window=(Window)window;
                break;
+           case WM_SYSKEYDOWN:
            case WM_KEYDOWN:
                event->type=KeyPress;
                switch (wParam)

This works fine for me.  All other, already working Alt-key combinations
still work, plus the new Alt-Cursor, Alt_Fkey, etc.  Even Alt-F10 works
as before.  I'm going to use this patch locally anyway, but maybe that's
one for inclusion upstream?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

Reply via email to