Menu/Win (Command) key support; OSX native shortcuts - close #121

This commit is contained in:
Vadim Lopatin 2016-01-26 21:00:19 +03:00
parent f3f89282f8
commit f4d26fa758
3 changed files with 8 additions and 3 deletions

View File

@ -769,7 +769,11 @@ enum KeyFlag : uint {
/// Left Shift key is down
LShift = 0x0204,
/// Left Alt key is down
LAlt = 0x0280
LAlt = 0x0280,
/// Left Menu/Win key is down
LMenu = 0x0240,
/// Right Menu/Win key is down
RMenu = 0x0140
}
/// Key code constants for KeyEvent

View File

@ -1555,6 +1555,7 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
/// handle keys
override bool onKeyEvent(KeyEvent event) {
//Log.d("onKeyEvent ", event.action, " ", event.keyCode, " flags ", event.flags);
if (focused) startCaretBlinking();
cancelHoverTimer();
bool ctrlOrAltPressed = false; //(event.flags & (KeyFlag.Control /* | KeyFlag.Alt */));
@ -1595,7 +1596,7 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
protected void onHover(Point pos) {
if (_hoverMousePosition == pos)
return;
Log.d("onHover ", pos);
//Log.d("onHover ", pos);
int x = pos.x - left - _leftPaneWidth;
int y = pos.y - top;
_hoverMousePosition = pos;

View File

@ -1100,7 +1100,7 @@ public:
if (keyEvent.assigned && keyEvent(this, event))
return true; // processed by external handler
if (event.action == KeyAction.KeyDown) {
Action action = findKeyAction(event.keyCode, event.flags & (KeyFlag.Shift | KeyFlag.Alt | KeyFlag.Control));
Action action = findKeyAction(event.keyCode, event.flags & (KeyFlag.Shift | KeyFlag.Alt | KeyFlag.Control | KeyFlag.Menu));
if (action !is null) {
return dispatchAction(action);
}