Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 71418ca

Browse files
facchinmcmaglie
authored andcommitted
[Find/Replace][Win] grab focus when just opened
Solves #6951 (comment)
1 parent ce70d66 commit 71418ca

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎app/src/cc/arduino/view/findreplace/FindReplace.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ public FindReplace(Editor editor, Map<String, Object> state) {
6262
isTranslucencySupported();
6363
initComponents();
6464

65-
if (OSUtils.isWindows()) {
66-
setAutoRequestFocus(false);
67-
}
68-
6965
if (OSUtils.isMacOS()) {
7066
buttonsContainer.removeAll();
7167
buttonsContainer.add(replaceAllButton);
@@ -76,6 +72,9 @@ public FindReplace(Editor editor, Map<String, Object> state) {
7672
}
7773

7874
Base.registerWindowCloseKeys(getRootPane(), e -> {
75+
if (OSUtils.isWindows()) {
76+
setAutoRequestFocus(true);
77+
}
7978
setVisible(false);
8079
Base.FIND_DIALOG_STATE = findDialogState();
8180
});
@@ -86,6 +85,7 @@ public FindReplace(Editor editor, Map<String, Object> state) {
8685
public void windowActivated(WindowEvent e) {
8786
if (OSUtils.isWindows()) {
8887
toFront();
88+
setAutoRequestFocus(false);
8989
return;
9090
}
9191
findField.requestFocusInWindow();
@@ -128,6 +128,11 @@ public void windowDeactivated(WindowEvent e) {
128128
public void setVisible(boolean b) {
129129
getRootPane().setDefaultButton(findButton);
130130

131+
if (OSUtils.isWindows()) {
132+
// means we are restoring the window visibility
133+
setAutoRequestFocus(true);
134+
}
135+
131136
super.setVisible(b);
132137
}
133138

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /