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;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ Creates a new tray icon associated with the `image`.
|
|||
* `altKey` Boolean
|
||||
* `shiftKey` Boolean
|
||||
* `ctrlKey` Boolean
|
||||
* `metaKey` Boolean
|
||||
* `bounds` Object - the bounds of tray icon
|
||||
* `x` Integer
|
||||
* `y` Integer
|
||||
|
@ -67,6 +68,7 @@ __Note:__ The `bounds` payload is only implemented on OS X and Windows 7 or newe
|
|||
* `altKey` Boolean
|
||||
* `shiftKey` Boolean
|
||||
* `ctrlKey` Boolean
|
||||
* `metaKey` Boolean
|
||||
* `bounds` Object - the bounds of tray icon
|
||||
* `x` Integer
|
||||
* `y` Integer
|
||||
|
@ -83,6 +85,7 @@ __Note:__ This is only implemented on OS X and Windows.
|
|||
* `altKey` Boolean
|
||||
* `shiftKey` Boolean
|
||||
* `ctrlKey` Boolean
|
||||
* `metaKey` Boolean
|
||||
* `bounds` Object - the bounds of tray icon
|
||||
* `x` Integer
|
||||
* `y` Integer
|
||||
|
|
Loading…
Reference in a new issue