|
@@ -109,27 +109,30 @@ public class OsdManager {
|
109
|
109
|
public void closeWindow(final OsdWindow window) {
|
110
|
110
|
final String policy = IdentityManager.getGlobalConfig().getOption(
|
111
|
111
|
plugin.getDomain(), "newbehaviour");
|
112
|
|
- final int startY = IdentityManager.getGlobalConfig().getOptionInt(plugin.
|
113
|
|
- getDomain(), "locationY");
|
114
|
112
|
|
115
|
113
|
synchronized (OsdManager.this) {
|
116
|
114
|
UIUtilities.invokeAndWait(new Runnable() {
|
117
|
115
|
/** {@inheritDoc} */
|
118
|
116
|
@Override
|
119
|
117
|
public void run() {
|
|
118
|
+ int oldY = window.getY();
|
|
119
|
+ final int closedIndex = windowList.indexOf(window);
|
|
120
|
+
|
|
121
|
+ if (closedIndex == -1) {
|
|
122
|
+ return;
|
|
123
|
+ }
|
|
124
|
+
|
120
|
125
|
windowList.remove(window);
|
121
|
126
|
window.dispose();
|
122
|
|
- for (OsdWindow otherWindow : getWindowList()) {
|
123
|
|
- if (otherWindow.isVisible()) {
|
124
|
|
- if ("down".equals(policy)) {
|
125
|
|
- otherWindow.setLocation(otherWindow.getX(), Math.
|
126
|
|
- max(startY, otherWindow.getY()
|
127
|
|
- - otherWindow.getHeight() - WINDOW_GAP));
|
128
|
|
- } else if ("up".equals(policy)) {
|
129
|
|
- otherWindow.setLocation(otherWindow.getX(), Math.
|
130
|
|
- min(startY, otherWindow.getY()
|
131
|
|
- + otherWindow.getHeight() + WINDOW_GAP));
|
132
|
|
- }
|
|
127
|
+
|
|
128
|
+ final List<OsdWindow> newList = getWindowList();
|
|
129
|
+
|
|
130
|
+ for (OsdWindow otherWindow : newList.subList(closedIndex, newList.size())) {
|
|
131
|
+ final int currentY = otherWindow.getY();
|
|
132
|
+
|
|
133
|
+ if ("down".equals(policy) || "up".equals(policy)) {
|
|
134
|
+ otherWindow.setLocation(otherWindow.getX(), oldY);
|
|
135
|
+ oldY = currentY;
|
133
|
136
|
}
|
134
|
137
|
}
|
135
|
138
|
}
|
|
@@ -142,8 +145,7 @@ public class OsdManager {
|
142
|
145
|
* Destroy all OSD Windows.
|
143
|
146
|
*/
|
144
|
147
|
public void closeAll() {
|
145
|
|
- for (OsdWindow window : new ArrayList<OsdWindow>(windowList)) {
|
146
|
|
- window.setVisible(false);
|
|
148
|
+ for (OsdWindow window : getWindowList()) {
|
147
|
149
|
closeWindow(window);
|
148
|
150
|
}
|
149
|
151
|
}
|
|
@@ -179,14 +181,14 @@ public class OsdManager {
|
179
|
181
|
|
180
|
182
|
if ("down".equals(policy)) {
|
181
|
183
|
// Place our new window below old windows
|
182
|
|
- for (OsdWindow window : new ArrayList<OsdWindow>(getWindowList())) {
|
|
184
|
+ for (OsdWindow window : getWindowList()) {
|
183
|
185
|
if (window.isVisible()) {
|
184
|
186
|
y = Math.max(y, window.getY() + window.getHeight() + WINDOW_GAP);
|
185
|
187
|
}
|
186
|
188
|
}
|
187
|
189
|
} else if ("up".equals(policy)) {
|
188
|
190
|
// Place our new window above old windows
|
189
|
|
- for (OsdWindow window : new ArrayList<OsdWindow>(getWindowList())) {
|
|
191
|
+ for (OsdWindow window : getWindowList()) {
|
190
|
192
|
if (window.isVisible()) {
|
191
|
193
|
y = Math.min(y, window.getY() - window.getHeight() - WINDOW_GAP);
|
192
|
194
|
}
|