Tk Source Code

View Ticket
Login
Ticket UUID: 220352
Title: Handle ALT keys on Windows
Type: Bug Version: obsolete: 8.0p2
Submitter: welch Created on: 2000-10-31 23:17:05
Subsystem: 68. Win Window Operations Assigned To: nobody
Priority: 2 Severity:
Status: Closed Last Modified: 2001-03-23 08:55:03
Resolution: Fixed Closed By: dgp
    Closed on: 2001-03-23 01:55:03
Description:
OriginalBugID: 590 Bug
Version: 8.0p2
SubmitDate: '1998-05-21'
LastModified: '1998-08-05'
Severity: LOW
Status: Released
Submitter: stanton
ChangedBy: stanton
OS: All Windows
OSVersion: NA
Machine: NA
FixedInVersion: 8.0.3
ClosedDate: '1998-08-05'


On Windows, ALT accelerator keys will arrive as WM_MENUCHAR messages.

Tk8.0p2 and Tk8.1a2 ignore such messages.



I have appended a patch to fix this.  This patch is due to Tom Tromey.



Ian Taylor

[email protected]



*** /5g/ian/tk8.0p2/win/tkWinX.c        Thu Oct  9 13:40:16 1997

--- tkWinX.c    Wed Apr 15 16:16:17 1998

***************

*** 16,21 ****

--- 16,30 ----

  #include "tkWinInt.h"

  

  /*

+  * MNC_CLOSE is not defined on Windows NT 3.5, but the value 1 is

+  * the right thing to use.

+  */

+ 

+ #ifndef MNC_CLOSE

+ #define MNC_CLOSE 1

+ #endif

+ 

+ /*

   * Definitions of extern variables supplied by this file.

   */

  

*************** Tk_TranslateWinEvent(hwnd, message, wPar

*** 593,598 ****

--- 602,612 ----

        case WM_KEYUP:

            GenerateXEvent(hwnd, message, wParam, lParam);

            return 1;

+ 

+       case WM_MENUCHAR:

+           GenerateXEvent(hwnd, message, wParam, lParam);

+           *resultPtr = MAKELONG (0, MNC_CLOSE);

+           return 1;

      }

      return 0;

  }

*************** GenerateXEvent(hwnd, message, wParam, lP

*** 693,698 ****

--- 707,713 ----

            event.xselectionclear.time = TkpGetMS();

            break;

            

+       case WM_MENUCHAR:

        case WM_CHAR:

        case WM_SYSKEYDOWN:

        case WM_SYSKEYUP:

*************** GenerateXEvent(hwnd, message, wParam, lP

*** 765,770 ****

--- 780,793 ----

                    event.xkey.keycode = wParam;

                    event.xkey.nchars = 0;

                    break;

+ 

+               case WM_MENUCHAR:

+                   /*

+                    * For a WM_MENUCHAR message, the character code

+                    * is only the low word.

+                    */

+                   wParam = LOWORD (wParam);

+                   /* Fall through.  */

  

                case WM_CHAR:

                    /*





this patch has been applied