Code cleanup

This commit is contained in:
nathan 2016-10-10 22:42:36 +02:00
parent 09143f7630
commit d08904d634
4 changed files with 6 additions and 11 deletions

View File

@ -140,7 +140,7 @@ class TrayPopup extends JPopupMenu {
hiddenDialog.dispatchEvent(new WindowEvent(hiddenDialog, WindowEvent.WINDOW_CLOSING));
}
void doShow(final MenuImpl systemTray, final Point point, int offset) {
void doShow(final Point point, int offset) {
Dimension size = getPreferredSize();
Rectangle bounds = ScreenUtil.getScreenBoundsAt(point);
@ -174,19 +174,14 @@ class TrayPopup extends JPopupMenu {
// critical to get the keyboard listeners working for the popup menu
setInvoker(hiddenDialog.getContentPane());
hiddenDialog.setLocation(x, y);
hiddenDialog.setVisible(true);
setLocation(x, y);
setVisible(true);
// when the menu entries are changed, this makes sure to correctly show them
invalidate();
revalidate();
doLayout();
requestFocusInWindow();
((EntryImpl) systemTray.getFirst())._native.requestFocusInWindow();
}
}

View File

@ -145,7 +145,7 @@ class _AppIndicatorTray extends MenuImpl {
.getLocation();
TrayPopup popupMenu = (TrayPopup) _native;
popupMenu.doShow(_AppIndicatorTray.this, point, SystemTray.DEFAULT_TRAY_SIZE);
popupMenu.doShow(point, SystemTray.DEFAULT_TRAY_SIZE);
}
};

View File

@ -81,7 +81,7 @@ class _GtkStatusIconTray extends MenuImpl {
.getLocation();
TrayPopup popupMenu = (TrayPopup) _native;
popupMenu.doShow(_GtkStatusIconTray.this, point, 0);
popupMenu.doShow(point, 0);
}
};

View File

@ -100,7 +100,7 @@ class _SwingTray extends MenuImpl {
public
void mousePressed(MouseEvent e) {
TrayPopup popupMenu = (TrayPopup) _native;
popupMenu.doShow(_SwingTray.this, e.getPoint(), 0);
popupMenu.doShow(e.getPoint(), 0);
}
});