mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
Fix find/replace focus on Windows
Probably this approach could be adopted by all OSes with a little care on the window lifecycle.
This commit is contained in:
parent
449c99a2f5
commit
ce70d66095
@ -62,6 +62,10 @@ public class FindReplace extends javax.swing.JFrame {
|
||||
isTranslucencySupported();
|
||||
initComponents();
|
||||
|
||||
if (OSUtils.isWindows()) {
|
||||
setAutoRequestFocus(false);
|
||||
}
|
||||
|
||||
if (OSUtils.isMacOS()) {
|
||||
buttonsContainer.removeAll();
|
||||
buttonsContainer.add(replaceAllButton);
|
||||
@ -80,6 +84,10 @@ public class FindReplace extends javax.swing.JFrame {
|
||||
|
||||
editor.addWindowListener(new WindowAdapter() {
|
||||
public void windowActivated(WindowEvent e) {
|
||||
if (OSUtils.isWindows()) {
|
||||
toFront();
|
||||
return;
|
||||
}
|
||||
findField.requestFocusInWindow();
|
||||
findField.selectAll();
|
||||
setAlwaysOnTop(true);
|
||||
@ -89,12 +97,18 @@ public class FindReplace extends javax.swing.JFrame {
|
||||
}
|
||||
}
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
if (OSUtils.isWindows()) {
|
||||
return;
|
||||
}
|
||||
setAlwaysOnTop(false);
|
||||
}
|
||||
});
|
||||
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowActivated(WindowEvent e) {
|
||||
if (OSUtils.isWindows()) {
|
||||
return;
|
||||
}
|
||||
findField.requestFocusInWindow();
|
||||
findField.selectAll();
|
||||
setAlwaysOnTop(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user