Add metaKey
This commit is contained in:
parent
3e1a5b229c
commit
b2f03fc2d8
3 changed files with 12 additions and 0 deletions
|
@ -136,6 +136,7 @@ v8::Local<v8::Object> Tray::ModifiersToObject(v8::Isolate* isolate,
|
|||
obj.Set("shiftKey", static_cast<bool>(modifiers & ui::EF_SHIFT_DOWN));
|
||||
obj.Set("ctrlKey", static_cast<bool>(modifiers & ui::EF_CONTROL_DOWN));
|
||||
obj.Set("altKey", static_cast<bool>(modifiers & ui::EF_ALT_DOWN));
|
||||
obj.Set("metaKey", static_cast<bool>(modifiers & ui::EF_COMMAND_DOWN));
|
||||
return obj.GetHandle();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "atom/browser/ui/win/notify_icon_host.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
#include <winuser.h>
|
||||
|
||||
#include "atom/browser/ui/win/notify_icon.h"
|
||||
#include "base/bind.h"
|
||||
|
@ -28,6 +29,11 @@ const UINT kBaseIconId = 2;
|
|||
|
||||
const wchar_t kNotifyIconHostWindowClass[] = L"Electron_NotifyIconHostWindow";
|
||||
|
||||
bool IsWinPressed() {
|
||||
return ((::GetKeyState(VK_LWIN) & 0x8000) == 0x8000) ||
|
||||
((::GetKeyState(VK_RWIN) & 0x8000) == 0x8000);
|
||||
}
|
||||
|
||||
int GetKeyboardModifers() {
|
||||
int modifiers = ui::EF_NONE;
|
||||
if (base::win::IsShiftPressed())
|
||||
|
@ -36,6 +42,8 @@ int GetKeyboardModifers() {
|
|||
modifiers |= ui::EF_CONTROL_DOWN;
|
||||
if (base::win::IsAltPressed())
|
||||
modifiers |= ui::EF_ALT_DOWN;
|
||||
if (IsWinPressed())
|
||||
modifiers |= ui::EF_COMMAND_DOWN;
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue