mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
focus tranfer on inactive application fix
This commit is contained in:
+22
-14
@@ -2047,7 +2047,9 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!myApp.isActive() && !canExecuteOnInactiveApplication(cmd)) {
|
||||
boolean doNotExecuteBecauseAppIsInactive = !myApp.isActive()
|
||||
&& (!canExecuteOnInactiveApplication(cmd) && Registry.is("actionSystem.suspendFocusTransferIfApplicationInactive"));
|
||||
if (doNotExecuteBecauseAppIsInactive) {
|
||||
if (myCallbackOnActivation != null) {
|
||||
myCallbackOnActivation.setRejected();
|
||||
}
|
||||
@@ -2138,26 +2140,32 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applicationActivated(IdeFrame ideFrame) {
|
||||
public void applicationActivated(final IdeFrame ideFrame) {
|
||||
final FocusCommand cmd = myFocusCommandOnAppActivation;
|
||||
ActionCallback callback = myCallbackOnActivation;
|
||||
myFocusCommandOnAppActivation = null;
|
||||
myCallbackOnActivation = null;
|
||||
if (cmd != null && !cmd.isExpired()) {
|
||||
requestFocus(cmd, true).notifyWhenDone(callback);
|
||||
}
|
||||
else {
|
||||
final KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
|
||||
|
||||
if (ideFrame == myWindowManager.getFrame(myProject)) {
|
||||
final Component owner = mgr.getFocusOwner();
|
||||
Component old = myFocusedComponentOnDeactivation != null ? myFocusedComponentOnDeactivation.get() : null;
|
||||
|
||||
if (owner == null && old != null && old.isShowing()) {
|
||||
requestFocus(old, false);
|
||||
if (cmd != null) {
|
||||
requestFocus(cmd, true).notify(callback).doWhenRejected(new Runnable() {
|
||||
public void run() {
|
||||
focusLastFocusedComponent(ideFrame);
|
||||
}
|
||||
myFocusedComponentOnDeactivation = null;
|
||||
});
|
||||
} else {
|
||||
focusLastFocusedComponent(ideFrame);
|
||||
}
|
||||
}
|
||||
|
||||
private void focusLastFocusedComponent(IdeFrame ideFrame) {
|
||||
final KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
|
||||
if (ideFrame == myWindowManager.getFrame(myProject)) {
|
||||
final Component owner = mgr.getFocusOwner();
|
||||
Component old = myFocusedComponentOnDeactivation != null ? myFocusedComponentOnDeactivation.get() : null;
|
||||
if (owner == null && old != null && old.isShowing()) {
|
||||
requestFocus(old, false);
|
||||
}
|
||||
myFocusedComponentOnDeactivation = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ actionSystem.playback.description=Delay between events generated by the playback
|
||||
actionSystem.focusIdleTimeout=20
|
||||
actionSystem.mac.screenMenuNotUpdatedFix=true
|
||||
actionSystem.keyGestures.enabled=false
|
||||
actionSystem.suspendFocusTransferIfApplicationInactive=true
|
||||
|
||||
ide.debugMode=true
|
||||
ide.debugMode.description=Record additonal information to make bug reports more informative
|
||||
|
||||
Reference in New Issue
Block a user