mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-24 16:47:41 +00:00
Fixes #364. Hotkeys in Windows are currently implemented using RegisterHotkey. However RegisterHotkey does not distinguish between left and right modifier keys, which means that they override some keyboards' RAlt combinations. This feature reimplements hotkey support in the low level keyboard hook, and adds a feature flag / debug flag Flag_UseRegisterHotkey to return to the RegisterHotkey model if that is so needed. I have made minimal refactoring changes to this code, although there are certainly functions here which could be improved. I have flagged a couple of potential improvements with TODO.
48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
/*
|
|
Name: hotkeys
|
|
Copyright: Copyright (C) SIL International.
|
|
Documentation:
|
|
Description:
|
|
Create Date: 1 Aug 2006
|
|
|
|
Modified Date: 25 Oct 2016
|
|
Authors: mcdurdin
|
|
Related Files:
|
|
Dependencies:
|
|
|
|
Bugs:
|
|
Todo:
|
|
Notes:
|
|
History: 01 Aug 2006 - mcdurdin - Initial version
|
|
11 Dec 2009 - mcdurdin - I934 - x64 - Initial version
|
|
03 Aug 2014 - mcdurdin - I4326 - V9.0 - Switch-off hotkey not working, then keyboard hotkey stopped working (win 8.1 jeremy) [High]
|
|
13 Oct 2014 - mcdurdin - I4451 - V9.0 - Language hotkeys are not working
|
|
25 Oct 2016 - mcdurdin - I5136 - Remove additional product references from Keyman Engine
|
|
*/
|
|
|
|
// TODO fix this yuk: dynamic alloc plz
|
|
#define MAX_HOTKEYS 1000
|
|
|
|
typedef enum { hktInterface, hktLanguage } HotkeyType;
|
|
|
|
struct Hotkey
|
|
{
|
|
HotkeyType HotkeyType; // I4451
|
|
DWORD HotkeyValue;
|
|
DWORD Target;
|
|
HKL hkl;
|
|
GUID profileGUID;
|
|
};
|
|
|
|
class Hotkeys
|
|
{
|
|
private:
|
|
int m_nHotkeys;
|
|
Hotkey m_hotkeys[MAX_HOTKEYS];
|
|
void Load();
|
|
public:
|
|
Hotkey *GetHotkey(DWORD hotkey);
|
|
static void Reload(); // I4326
|
|
static Hotkeys *Instance(); // I4326
|
|
static void Unload();
|
|
};
|