mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-144702 Unable to use Windows as a modifier key in keymap (registry key keymap.windows.as.meta=true by default)
This commit is contained in:
@@ -138,6 +138,7 @@ public class IdeEventQueue extends EventQueue {
|
||||
|
||||
private boolean myKeyboardBusy;
|
||||
private boolean myDispatchingFocusEvent;
|
||||
private boolean myWinMetaPressed;
|
||||
|
||||
private int myInputMethodLock;
|
||||
|
||||
@@ -370,6 +371,9 @@ public class IdeEventQueue extends EventQueue {
|
||||
e = fixNonEnglishKeyboardLayouts(e);
|
||||
|
||||
e = mapEvent(e);
|
||||
if (Registry.is("keymap.windows.as.meta")) {
|
||||
e = mapMetaState(e);
|
||||
}
|
||||
|
||||
boolean wasInputEvent = myIsInInputEvent;
|
||||
myIsInInputEvent = e instanceof InputEvent || e instanceof InputMethodEvent || e instanceof WindowEvent || e instanceof ActionEvent;
|
||||
@@ -530,6 +534,38 @@ public class IdeEventQueue extends EventQueue {
|
||||
return e;
|
||||
}
|
||||
|
||||
private AWTEvent mapMetaState(AWTEvent e) {
|
||||
if (myWinMetaPressed) {
|
||||
Application app = ApplicationManager.getApplication();
|
||||
if (app == null || !app.isActive()) {
|
||||
myWinMetaPressed = false;
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
if (e instanceof KeyEvent) {
|
||||
KeyEvent ke = (KeyEvent)e;
|
||||
if (ke.getKeyCode() == KeyEvent.VK_WINDOWS) {
|
||||
if (ke.getID() == KeyEvent.KEY_PRESSED) myWinMetaPressed = true;
|
||||
if (ke.getID() == KeyEvent.KEY_RELEASED) myWinMetaPressed = false;
|
||||
return new KeyEvent(ke.getComponent(), ke.getID(), ke.getWhen(), ke.getModifiers(), KeyEvent.VK_META, ke.getKeyChar(),
|
||||
ke.getKeyLocation());
|
||||
}
|
||||
if (myWinMetaPressed) {
|
||||
return new KeyEvent(ke.getComponent(), ke.getID(), ke.getWhen(), ke.getModifiers() | InputEvent.META_MASK, ke.getKeyCode(),
|
||||
ke.getKeyChar(), ke.getKeyLocation());
|
||||
}
|
||||
}
|
||||
|
||||
if (myWinMetaPressed && e instanceof MouseEvent && ((MouseEvent)e).getButton() != 0) {
|
||||
MouseEvent me = (MouseEvent)e;
|
||||
return new MouseEvent(me.getComponent(), me.getID(), me.getWhen(), me.getModifiers() | InputEvent.META_MASK, me.getX(), me.getY(),
|
||||
me.getClickCount(), me.isPopupTrigger(), me.getButton());
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
public void _dispatchEvent(@NotNull AWTEvent e, boolean typeAheadFlushing) {
|
||||
if (e.getID() == MouseEvent.MOUSE_DRAGGED) {
|
||||
DnDManagerImpl dndManager = (DnDManagerImpl)DnDManager.getInstance();
|
||||
|
||||
@@ -280,6 +280,7 @@ find.search.in.project.files=true
|
||||
structureView.coalesceTime=500
|
||||
|
||||
keymap.show.alias.actions=false
|
||||
keymap.windows.as.meta=true
|
||||
frameworks.download.libraries.server.url=http://pluginsrepo-test:8080
|
||||
caches.indexerThreadsCount=-1
|
||||
navBar.updateMergeTime=100
|
||||
|
||||
Reference in New Issue
Block a user