• Jussi Lahdenniemi's avatar
    Improve the register-hotkey functionality on MS-Windows · 97d7a0b8
    Jussi Lahdenniemi authored
    * src/w32fns.c (_WIN32_WINNT): Define to 0x0600, needed for
    keyboard hook functionality.
    Include w32inevt.h, basetyps.h and unknwn.h.
    (VK_ANY, WM_WTSSESSION_CHANGE, WTS_SESSION_LOCK): New macros.
    (kbdhook): A new struct definition.
    (funhook, setup_w32_kbdhook, remove_w32_kbdhook, hook_w32_key)
    (check_w32_winkey_state, reset_w32_kbdhook_state): New functions.
    (modifier_set): Call check_w32_winkey_state if a Win key was
    pressed and the keyboard hook is active.
    (w32_wnd_proc): Don't handle Win key combinations if the keyboard
    hook is active.  Only register/unregister the hotkeys if the
    keyboard hook is not active.  When WM_CREATE is received, call
    setup_w32_kbdhook.  When WM_DESTROY is received, call
    reset_w32_kbdhook_state.
    (lookup_vk_code): When the keyboard hook is active, map
    alphanumeric characters to themselves.
    (w32_parse_and_hook_hot_key): Renamed from w32_parse_hot_key.  Map
    modified keys to VK_ANY if the keyboard hook is active.  Register
    Alt-x and Win-x combinations.
    (Fw32_shell_execute): Update doc string to reflect new
    functionality.  Bypass the code that posts the
    WM_EMACS_REGISTER_HOT_KEY message if the keyboard hook is active.
    (Fw32_unregister_hot_key): Bypass the code that posts the
    WM_EMACS_UNREGISTER_HOT_KEY message if the keyboard hook is active.
    (syms_of_w32fns) <w32-pass-lwindow-to-system>
    <w32-pass-rwindow-to-system, w32-phantom-key-code>
    <w32-lwindow-modifier, w32-rwindow-modifier>: Update doc strings
    to reflect the new functionality.
    * src/w32console.c (initialize_w32_display): Install the low-level
    keyboard hook.
    * src/w32inevt.c (key_event): Handle Win-x combinations only if
    the keyboard hook is not active.  If the hook is active, use
    check_w32_winkey_state instead.
    * src/w32term.h (setup_w32_kbdhook, remove_w32_kbdhook)
    (check_w32_winkey_state): Add prototypes.
    (w32_kbdhook_active): New macro.
    
    * doc/emacs/msdos.texi (Windows Keyboard): Update to reflect the
    new functionality.
    97d7a0b8
w32inevt.c 23.2 KB