1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Merge pull request #7935 from facchinm/fix_osx_slow_menus

Fix OSX "slow" menus
This commit is contained in:
Martino Facchin 2018-08-28 17:49:02 +02:00 committed by GitHub
commit bf42f26471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -262,8 +262,6 @@ public class Editor extends JFrame implements RunnerListener {
// added for 1.0.5 // added for 1.0.5
// http://dev.processing.org/bugs/show_bug.cgi?id=1260 // http://dev.processing.org/bugs/show_bug.cgi?id=1260
public void windowDeactivated(WindowEvent e) { public void windowDeactivated(WindowEvent e) {
fileMenu.remove(sketchbookMenu);
fileMenu.remove(examplesMenu);
List<Component> toolsMenuItemsToRemove = new LinkedList<>(); List<Component> toolsMenuItemsToRemove = new LinkedList<>();
for (Component menuItem : toolsMenu.getMenuComponents()) { for (Component menuItem : toolsMenu.getMenuComponents()) {
if (menuItem instanceof JComponent) { if (menuItem instanceof JComponent) {
@ -504,11 +502,11 @@ public class Editor extends JFrame implements RunnerListener {
fileMenu.addMenuListener(new StubMenuListener() { fileMenu.addMenuListener(new StubMenuListener() {
@Override @Override
public void menuSelected(MenuEvent e) { public void menuSelected(MenuEvent e) {
List<Component> components = Arrays.asList(fileMenu.getComponents()); List<Component> components = Arrays.asList(fileMenu.getMenuComponents());
if (!components.contains(sketchbookMenu)) { if (!components.contains(sketchbookMenu)) {
fileMenu.insert(sketchbookMenu, 3); fileMenu.insert(sketchbookMenu, 3);
} }
if (!components.contains(sketchbookMenu)) { if (!components.contains(examplesMenu)) {
fileMenu.insert(examplesMenu, 4); fileMenu.insert(examplesMenu, 4);
} }
fileMenu.revalidate(); fileMenu.revalidate();
@ -537,7 +535,7 @@ public class Editor extends JFrame implements RunnerListener {
toolsMenu.addMenuListener(new StubMenuListener() { toolsMenu.addMenuListener(new StubMenuListener() {
@Override @Override
public void menuSelected(MenuEvent e) { public void menuSelected(MenuEvent e) {
List<Component> components = Arrays.asList(toolsMenu.getComponents()); List<Component> components = Arrays.asList(toolsMenu.getMenuComponents());
int offset = 0; int offset = 0;
for (JMenu menu : base.getBoardsCustomMenus()) { for (JMenu menu : base.getBoardsCustomMenus()) {
if (!components.contains(menu)) { if (!components.contains(menu)) {