diff options
author | Ingo Bauersachs <ingo@jitsi.org> | 2017-01-18 21:59:38 +0100 |
---|---|---|
committer | Ingo Bauersachs <ingo@jitsi.org> | 2017-01-18 21:59:38 +0100 |
commit | 134da567cd83c6be630d7a37f64249005d7c2925 (patch) | |
tree | f4abde385815842632174ef424529197830b40a8 /src/net/java/sip/communicator/impl | |
parent | 38e1ebc48aa042bfcffa2c4763b9fdb1a6b1b754 (diff) | |
download | jitsi-134da567cd83c6be630d7a37f64249005d7c2925.zip jitsi-134da567cd83c6be630d7a37f64249005d7c2925.tar.gz jitsi-134da567cd83c6be630d7a37f64249005d7c2925.tar.bz2 |
Fix tray icon to open window on double click on Windows
Diffstat (limited to 'src/net/java/sip/communicator/impl')
-rw-r--r-- | src/net/java/sip/communicator/impl/osdependent/systemtray/awt/AWTTrayIcon.java | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/net/java/sip/communicator/impl/osdependent/systemtray/awt/AWTTrayIcon.java b/src/net/java/sip/communicator/impl/osdependent/systemtray/awt/AWTTrayIcon.java index 0aef71b..2fa0318 100644 --- a/src/net/java/sip/communicator/impl/osdependent/systemtray/awt/AWTTrayIcon.java +++ b/src/net/java/sip/communicator/impl/osdependent/systemtray/awt/AWTTrayIcon.java @@ -63,9 +63,17 @@ public class AWTTrayIcon } } - public void setDefaultAction(Object menuItem) + public void setDefaultAction(final Object menuItem) { - ActionListener[] listeners; + // clear all previous listeners + ActionListener[] previous = impl.getActionListeners(); + for (ActionListener l : previous) + { + impl.removeActionListener(l); + } + + // get the new handlers + final ActionListener[] listeners; if (menuItem instanceof JMenuItem) { listeners = ((JMenuItem) menuItem).getActionListeners(); @@ -79,10 +87,19 @@ public class AWTTrayIcon return; } - for (ActionListener l : listeners) + // create a custom handler to fake that the source is the menu item + impl.addActionListener(new ActionListener() { - impl.addActionListener(l); - } + @Override + public void actionPerformed(ActionEvent e) + { + for (ActionListener l : listeners) + { + l.actionPerformed(new ActionEvent(menuItem, + e.getID(), e.getActionCommand())); + } + } + }); } public void addBalloonActionListener(ActionListener listener) |