1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-19 08:52:15 +01:00

macOS touchbar: Run event handler later to prevent hanging if a dialog needs to be open

This commit is contained in:
Sandeep Mistry 2019-01-24 11:58:37 -05:00
parent 980b70e3d6
commit 3c8f201024

View File

@ -188,7 +188,15 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
touchBarButtons[i] = new TouchBarButton();
touchBarButtons[i].setImage(touchBarImages[i][ROLLOVER]);
touchBarButtons[i].setAction(event -> handleSelectionPressed(selection));
touchBarButtons[i].setAction(event -> {
// Run event handler later to prevent hanging if a dialog needs to be open
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
handleSelectionPressed(selection);
}
});
});
TouchBarItem touchBarItem = new TouchBarItem(title[i], touchBarButtons[i], true);
touchBarItem.setCustomizationLabel(title[i]);