Skip to content

Commit 1f8bd2d

Browse files
committed
Fix find/replace focus on Windows
Probably this approach could be adopted by all OSes with a little care on the window lifecycle.
1 parent ac8c83b commit 1f8bd2d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: app/src/cc/arduino/view/findreplace/FindReplace.java

+14
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public FindReplace(Editor editor, Map<String, Object> state) {
6262
isTranslucencySupported();
6363
initComponents();
6464

65+
if (OSUtils.isWindows()) {
66+
setAutoRequestFocus(false);
67+
}
68+
6569
if (OSUtils.isMacOS()) {
6670
buttonsContainer.removeAll();
6771
buttonsContainer.add(replaceAllButton);
@@ -80,6 +84,10 @@ public FindReplace(Editor editor, Map<String, Object> state) {
8084

8185
editor.addWindowListener(new WindowAdapter() {
8286
public void windowActivated(WindowEvent e) {
87+
if (OSUtils.isWindows()) {
88+
toFront();
89+
return;
90+
}
8391
findField.requestFocusInWindow();
8492
findField.selectAll();
8593
setAlwaysOnTop(true);
@@ -89,12 +97,18 @@ public void windowActivated(WindowEvent e) {
8997
}
9098
}
9199
public void windowDeactivated(WindowEvent e) {
100+
if (OSUtils.isWindows()) {
101+
return;
102+
}
92103
setAlwaysOnTop(false);
93104
}
94105
});
95106

96107
addWindowListener(new WindowAdapter() {
97108
public void windowActivated(WindowEvent e) {
109+
if (OSUtils.isWindows()) {
110+
return;
111+
}
98112
findField.requestFocusInWindow();
99113
findField.selectAll();
100114
setAlwaysOnTop(true);

0 commit comments

Comments
 (0)