From 0fe2caca4f8a0f6df9733c7638ac73e6eb746260 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 14 Jan 2014 13:29:54 +0100 Subject: [PATCH] don't call robot on alt on Windows and when window is inactive --- .../platform-impl/src/com/intellij/ide/IdeEventQueue.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java index a7f8d1e90c60..96d11aa2a2e3 100644 --- a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java +++ b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java @@ -897,6 +897,8 @@ public class IdeEventQueue extends EventQueue { boolean dispatch = true; if (e instanceof KeyEvent) { KeyEvent ke = (KeyEvent)e; + final Component component = ke.getComponent(); + final Window window = component == null ? null : SwingUtilities.windowForComponent(component); boolean pureAlt = ke.getKeyCode() == KeyEvent.VK_ALT && (ke.getModifiers() | InputEvent.ALT_MASK) == InputEvent.ALT_MASK; if (!pureAlt) { myPureAltWasPressed = false; @@ -925,10 +927,14 @@ public class IdeEventQueue extends EventQueue { } else { myWaiterScheduled = true; + //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { + if (SystemInfo.isWindows || window == null || !window.isActive()) { + return; + } myWaitingForAltRelease = true; if (myRobot == null) { myRobot = new Robot();