Mercurial > emacs
comparison src/w32fns.c @ 15314:796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
detected to have been released since Emacs lost focus.
(win32_wnd_proc): Have Windows translate VK_NUMLOCK and VK_SCROLL key
downs; don't reset the modifier state when Emacs loses focus.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 01 Jun 1996 12:19:27 +0000 |
parents | da73440fdb5f |
children | 65d9ff2c8602 |
comparison
equal
deleted
inserted
replaced
15313:0fad77a676b7 | 15314:796d825f4444 |
---|---|
1 /* Functions for the Win32 window system. | 1 /* Functions for the Win32 window system. |
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation. | 2 Copyright (C) 1989, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GNU Emacs. | 4 This file is part of GNU Emacs. |
5 | 5 |
6 GNU Emacs is free software; you can redistribute it and/or modify | 6 GNU Emacs is free software; you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
2753 it regains focus, be conservative and clear all modifiers since | 2753 it regains focus, be conservative and clear all modifiers since |
2754 we cannot reconstruct the left and right modifier state. */ | 2754 we cannot reconstruct the left and right modifier state. */ |
2755 static void | 2755 static void |
2756 reset_modifiers () | 2756 reset_modifiers () |
2757 { | 2757 { |
2758 SHORT ctrl, alt; | |
2759 | |
2758 if (!modifiers_recorded) | 2760 if (!modifiers_recorded) |
2759 return; | 2761 return; |
2760 bzero (modifiers, sizeof (modifiers)); | 2762 |
2763 ctrl = GetAsyncKeyState (VK_CONTROL); | |
2764 alt = GetAsyncKeyState (VK_MENU); | |
2765 | |
2766 if (ctrl == 0 || alt == 0) | |
2767 /* Emacs doesn't have keyboard focus. Do nothing. */ | |
2768 return; | |
2769 | |
2770 if (!(ctrl & 0x08000)) | |
2771 /* Clear any recorded control modifier state. */ | |
2772 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0; | |
2773 | |
2774 if (!(alt & 0x08000)) | |
2775 /* Clear any recorded alt modifier state. */ | |
2776 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; | |
2777 | |
2778 /* Otherwise, leave the modifier state as it was when Emacs lost | |
2779 keyboard focus. */ | |
2761 } | 2780 } |
2762 | 2781 |
2763 static int | 2782 static int |
2764 modifier_set (int vkey) | 2783 modifier_set (int vkey) |
2765 { | 2784 { |
2948 windows_translate = 1; | 2967 windows_translate = 1; |
2949 break; | 2968 break; |
2950 case VK_CONTROL: | 2969 case VK_CONTROL: |
2951 case VK_CAPITAL: | 2970 case VK_CAPITAL: |
2952 case VK_SHIFT: | 2971 case VK_SHIFT: |
2972 case VK_NUMLOCK: | |
2973 case VK_SCROLL: | |
2953 windows_translate = 1; | 2974 windows_translate = 1; |
2954 break; | 2975 break; |
2955 default: | 2976 default: |
2956 /* If not defined as a function key, change it to a WM_CHAR message. */ | 2977 /* If not defined as a function key, change it to a WM_CHAR message. */ |
2957 if (lispy_function_keys[wParam] == 0) | 2978 if (lispy_function_keys[wParam] == 0) |
3183 this message afterwards. So this is a good time to reset our | 3204 this message afterwards. So this is a good time to reset our |
3184 keyboard modifiers' state. */ | 3205 keyboard modifiers' state. */ |
3185 reset_modifiers (); | 3206 reset_modifiers (); |
3186 goto dflt; | 3207 goto dflt; |
3187 | 3208 |
3188 case WM_KILLFOCUS: | |
3189 case WM_SETFOCUS: | 3209 case WM_SETFOCUS: |
3190 reset_modifiers (); | 3210 reset_modifiers (); |
3211 case WM_KILLFOCUS: | |
3191 case WM_MOVE: | 3212 case WM_MOVE: |
3192 case WM_SIZE: | 3213 case WM_SIZE: |
3193 case WM_SYSCOMMAND: | 3214 case WM_SYSCOMMAND: |
3194 case WM_COMMAND: | 3215 case WM_COMMAND: |
3195 wmsg.dwModifiers = win32_get_modifiers (); | 3216 wmsg.dwModifiers = win32_get_modifiers (); |