Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
8025b29a
Commit
8025b29a
authored
Nov 02, 2015
by
Christian Schudt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore tray icon click functionality after moving to AWT tray.
parent
a414d781
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
12 deletions
+45
-12
Launcher.java
src/java/org/jivesoftware/openfire/launcher/Launcher.java
+45
-12
No files found.
src/java/org/jivesoftware/openfire/launcher/Launcher.java
View file @
8025b29a
...
@@ -37,6 +37,8 @@ import java.awt.SystemTray;
...
@@ -37,6 +37,8 @@ import java.awt.SystemTray;
import
java.awt.TrayIcon
;
import
java.awt.TrayIcon
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.ActionListener
;
import
java.awt.event.MouseEvent
;
import
java.awt.event.MouseListener
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
java.awt.event.WindowEvent
;
import
java.io.BufferedOutputStream
;
import
java.io.BufferedOutputStream
;
...
@@ -69,6 +71,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
...
@@ -69,6 +71,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Element
;
import
org.w3c.dom.Element
;
/**
/**
* Graphical launcher for Openfire.
* Graphical launcher for Openfire.
*
*
...
@@ -279,18 +282,7 @@ public class Launcher {
...
@@ -279,18 +282,7 @@ public class Launcher {
System
.
exit
(
0
);
System
.
exit
(
0
);
}
}
else
if
(
"Hide/Show"
.
equals
(
e
.
getActionCommand
())
||
"PressAction"
.
equals
(
e
.
getActionCommand
()))
{
else
if
(
"Hide/Show"
.
equals
(
e
.
getActionCommand
())
||
"PressAction"
.
equals
(
e
.
getActionCommand
()))
{
// Hide/Unhide the window if the user clicked in the system tray icon or
toggleVisibility
(
showMenuItem
);
// selected the menu option
if
(
frame
.
isVisible
())
{
frame
.
setVisible
(
false
);
frame
.
setState
(
Frame
.
ICONIFIED
);
showMenuItem
.
setLabel
(
"Show"
);
}
else
{
frame
.
setVisible
(
true
);
frame
.
setState
(
Frame
.
NORMAL
);
showMenuItem
.
setLabel
(
"Hide"
);
}
}
}
}
}
};
};
...
@@ -312,7 +304,35 @@ public class Launcher {
...
@@ -312,7 +304,35 @@ public class Launcher {
trayIcon
=
new
TrayIcon
(
offIcon
.
getImage
(),
appName
,
menu
);
trayIcon
=
new
TrayIcon
(
offIcon
.
getImage
(),
appName
,
menu
);
trayIcon
.
setImageAutoSize
(
true
);
trayIcon
.
setImageAutoSize
(
true
);
trayIcon
.
addActionListener
(
actionListener
);
trayIcon
.
addActionListener
(
actionListener
);
trayIcon
.
addMouseListener
(
new
MouseListener
()
{
@Override
public
void
mouseClicked
(
MouseEvent
e
)
{
// Left click
if
(
e
.
getButton
()
==
1
)
{
toggleVisibility
(
showMenuItem
);
}
}
@Override
public
void
mousePressed
(
MouseEvent
e
)
{
}
@Override
public
void
mouseReleased
(
MouseEvent
e
)
{
}
@Override
public
void
mouseEntered
(
MouseEvent
e
)
{
}
@Override
public
void
mouseExited
(
MouseEvent
e
)
{
}
});
if
(
tray
!=
null
)
{
if
(
tray
!=
null
)
{
tray
.
add
(
trayIcon
);
tray
.
add
(
trayIcon
);
}
}
...
@@ -391,6 +411,19 @@ public class Launcher {
...
@@ -391,6 +411,19 @@ public class Launcher {
new
Launcher
();
new
Launcher
();
}
}
private
void
toggleVisibility
(
MenuItem
showMenuItem
)
{
// Hide/Unhide the window if the user clicked in the system tray icon or
// selected the menu option
if
(
frame
.
isVisible
())
{
frame
.
setVisible
(
false
);
showMenuItem
.
setLabel
(
"Show"
);
}
else
{
frame
.
setVisible
(
true
);
frame
.
setState
(
Frame
.
NORMAL
);
showMenuItem
.
setLabel
(
"Hide"
);
}
}
private
synchronized
void
startApplication
()
{
private
synchronized
void
startApplication
()
{
if
(
openfired
==
null
)
{
if
(
openfired
==
null
)
{
try
{
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment