Add Super
key support in global-shortcut API.
This commit is contained in:
parent
ca5ee0fc81
commit
0f67b1866a
4 changed files with 15 additions and 0 deletions
|
@ -58,6 +58,8 @@ void GlobalShortcutListenerWin::OnWndProc(HWND hwnd,
|
|||
modifiers |= (LOWORD(lparam) & MOD_SHIFT) ? ui::EF_SHIFT_DOWN : 0;
|
||||
modifiers |= (LOWORD(lparam) & MOD_ALT) ? ui::EF_ALT_DOWN : 0;
|
||||
modifiers |= (LOWORD(lparam) & MOD_CONTROL) ? ui::EF_CONTROL_DOWN : 0;
|
||||
modifiers |= (LOWORD(lparam) & MOD_WIN) ? ui::EF_COMMAND_DOWN : 0;
|
||||
|
||||
ui::Accelerator accelerator(
|
||||
ui::KeyboardCodeForWindowsKeyCode(key_code), modifiers);
|
||||
|
||||
|
@ -72,6 +74,8 @@ bool GlobalShortcutListenerWin::RegisterAcceleratorImpl(
|
|||
modifiers |= accelerator.IsShiftDown() ? MOD_SHIFT : 0;
|
||||
modifiers |= accelerator.IsCtrlDown() ? MOD_CONTROL : 0;
|
||||
modifiers |= accelerator.IsAltDown() ? MOD_ALT : 0;
|
||||
modifiers |= accelerator.IsCmdDown() ? MOD_WIN : 0;
|
||||
|
||||
static int hotkey_id = 0;
|
||||
bool success = !!RegisterHotKey(
|
||||
gfx::SingletonHwnd::GetInstance()->hwnd(),
|
||||
|
|
|
@ -35,6 +35,7 @@ int GetNativeModifiers(const ui::Accelerator& accelerator) {
|
|||
modifiers |= accelerator.IsShiftDown() ? ShiftMask : 0;
|
||||
modifiers |= accelerator.IsCtrlDown() ? ControlMask : 0;
|
||||
modifiers |= accelerator.IsAltDown() ? Mod1Mask : 0;
|
||||
modifiers |= accelerator.IsCmdDown() ? Mod4Mask : 0;
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
|
@ -148,6 +149,8 @@ void GlobalShortcutListenerX11::OnXKeyPressEvent(::XEvent* x_event) {
|
|||
modifiers |= (x_event->xkey.state & ShiftMask) ? ui::EF_SHIFT_DOWN : 0;
|
||||
modifiers |= (x_event->xkey.state & ControlMask) ? ui::EF_CONTROL_DOWN : 0;
|
||||
modifiers |= (x_event->xkey.state & Mod1Mask) ? ui::EF_ALT_DOWN : 0;
|
||||
// For Windows key
|
||||
modifiers |= (x_event->xkey.state & Mod4Mask) ? ui::EF_COMMAND_DOWN: 0;
|
||||
|
||||
ui::Accelerator accelerator(
|
||||
ui::KeyboardCodeFromXKeyEvent(x_event), modifiers);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue