1
|
=== modified file 'src/com/goldencode/p2j/ui/chui/ThinClient.java'
|
2
|
--- src/com/goldencode/p2j/ui/chui/ThinClient.java 2016-01-29 15:50:34 +0000
|
3
|
+++ src/com/goldencode/p2j/ui/chui/ThinClient.java 2016-03-17 22:05:43 +0000
|
4
|
@@ -3087,7 +3087,7 @@
|
5
|
*/
|
6
|
public synchronized void refreshHover()
|
7
|
{
|
8
|
- Window wnd = WindowManager.getActiveWindow();
|
9
|
+ TopLevelWindow wnd = WindowManager.getActiveWindow();
|
10
|
if (recentlyHovered != null && recentlyHovered.windowId() == wnd.getId().asInt())
|
11
|
{
|
12
|
recentlyHovered.updateCursor();
|
13
|
@@ -18989,7 +18989,7 @@
|
14
|
independentEventDrawingBracket(activeDropDown, activeDropDown.deactivateCode());
|
15
|
}
|
16
|
|
17
|
- Window wnd = WindowManager.getActiveWindow();
|
18
|
+ TopLevelWindow wnd = WindowManager.getActiveWindow();
|
19
|
if (wnd != null)
|
20
|
{
|
21
|
try
|
22
|
|
23
|
=== modified file 'src/com/goldencode/p2j/ui/client/TopLevelWindow.java'
|
24
|
--- src/com/goldencode/p2j/ui/client/TopLevelWindow.java 2016-03-10 19:49:42 +0000
|
25
|
+++ src/com/goldencode/p2j/ui/client/TopLevelWindow.java 2016-03-17 22:51:19 +0000
|
26
|
@@ -726,64 +726,80 @@
|
27
|
WindowManager.setActiveWindow(tlw);
|
28
|
}
|
29
|
}
|
30
|
- else if ((oldActive != this && !(oldActive != null && oldActive.isOverlay())) ||
|
31
|
- activated.withNativeWindow())
|
32
|
+ else
|
33
|
{
|
34
|
- // the ACTIVE-WINDOW handle is updated before the LEAVE/ENTRY events are sent
|
35
|
- // if LEAVE event returns NO-APPLY, ENTRY is no longer sent
|
36
|
-
|
37
|
- TopLevelWindow<?> owner = getOwner();
|
38
|
- if (owner != null)
|
39
|
- {
|
40
|
- // this is a window connected to an owner, move the owner to top
|
41
|
- WindowManager.moveToTop(owner);
|
42
|
-
|
43
|
- // and also all the other dialogs owned by the owner, make sure
|
44
|
- // the z-order is preserved
|
45
|
- int oId = owner.getId().asInt();
|
46
|
- WindowManager.getModalsOwnedBy(oId, true).stream()
|
47
|
- .forEach(w -> WindowManager.moveToTop(w));
|
48
|
-
|
49
|
- // and finally move us to top
|
50
|
- WindowManager.moveToTop(this);
|
51
|
- }
|
52
|
- else
|
53
|
- {
|
54
|
- // this is a main window, move us to top
|
55
|
- WindowManager.moveToTop(this);
|
56
|
-
|
57
|
- // move to top the modal windows owned by this window, preserve z-order
|
58
|
- WindowManager.getModalsOwnedBy(getId().asInt(), true).stream()
|
59
|
- .forEach(w -> WindowManager.moveToTop(w));
|
60
|
- }
|
61
|
-
|
62
|
- // the active-window handle is set BEFORE executing the LEAVE/ENTRY triggers
|
63
|
- WindowManager.setActiveWindow(owner != null ? owner : this);
|
64
|
+ boolean oldNotOverlay = !(oldActive != null && oldActive.isOverlay());
|
65
|
+ boolean needRebuildZorder = (oldActive != this && oldNotOverlay) ||
|
66
|
+ activated.withNativeWindow();
|
67
|
+ if (needRebuildZorder)
|
68
|
+ {
|
69
|
+ // the ACTIVE-WINDOW handle is updated before the LEAVE/ENTRY events are sent
|
70
|
+ // if LEAVE event returns NO-APPLY, ENTRY is no longer sent
|
71
|
+
|
72
|
+ TopLevelWindow<?> owner = getOwner();
|
73
|
+ if (owner != null)
|
74
|
+ {
|
75
|
+ // this is a window connected to an owner, move the owner to top
|
76
|
+ WindowManager.moveToTop(owner);
|
77
|
+
|
78
|
+ // and also all the other dialogs owned by the owner, make sure
|
79
|
+ // the z-order is preserved
|
80
|
+ int oId = owner.getId().asInt();
|
81
|
+ WindowManager.getModalsOwnedBy(oId, true).stream()
|
82
|
+ .forEach(w -> WindowManager.moveToTop(w));
|
83
|
+
|
84
|
+ // and finally move us to top
|
85
|
+ WindowManager.moveToTop(this);
|
86
|
+ }
|
87
|
+ else
|
88
|
+ {
|
89
|
+ // this is a main window, move us to top
|
90
|
+ WindowManager.moveToTop(this);
|
91
|
+
|
92
|
+ // move to top the modal windows owned by this window, preserve z-order
|
93
|
+ WindowManager.getModalsOwnedBy(getId().asInt(), true).stream()
|
94
|
+ .forEach(w -> WindowManager.moveToTop(w));
|
95
|
+ }
|
96
|
+
|
97
|
+ // the active-window handle is set BEFORE executing the LEAVE/ENTRY triggers
|
98
|
+ WindowManager.setActiveWindow(owner != null ? owner : this);
|
99
|
+ }
|
100
|
+ else if (!isOverlay())
|
101
|
+ {
|
102
|
+ WindowManager.setActiveWindow(this);
|
103
|
+ }
|
104
|
|
105
|
// do not use the top-level window here as it may not be the active one
|
106
|
// (consider the TOP-ONLY attribute)
|
107
|
TopLevelWindow<?> actualActive = WindowManager.getActiveWindow();
|
108
|
|
109
|
- if (oldActive != actualActive)
|
110
|
+ if (needRebuildZorder || !isOverlay())
|
111
|
{
|
112
|
final boolean[] entry = new boolean[1];
|
113
|
- // send leave, only if prev focus was within P2J
|
114
|
- ThinClient.getInstance().independentEventDrawingBracket(oldActive, new Runnable()
|
115
|
+ if (oldActive != actualActive)
|
116
|
{
|
117
|
- @Override
|
118
|
- public void run()
|
119
|
+ // send leave, only if prev focus was within P2J
|
120
|
+ ThinClient.getInstance().independentEventDrawingBracket(oldActive, new Runnable()
|
121
|
{
|
122
|
- // old top receives LEAVE event
|
123
|
- entry[0] = activated.withNativeWindow() ||
|
124
|
- ThinClient.getInstance().sendLeave(oldActive);
|
125
|
- EventManager.postEvent(new FocusEvent(oldActive, EventType.FOCUS_LOST));
|
126
|
- oldActive.repaint();
|
127
|
- if (oldActive.currentFocus() != null)
|
128
|
+ @Override
|
129
|
+ public void run()
|
130
|
{
|
131
|
- oldActive.currentFocus().repaint();
|
132
|
+ // old top receives LEAVE event
|
133
|
+ entry[0] = activated.withNativeWindow() ||
|
134
|
+ ThinClient.getInstance().sendLeave(oldActive);
|
135
|
+ EventManager.postEvent(new FocusEvent(oldActive, EventType.FOCUS_LOST));
|
136
|
+ oldActive.repaint();
|
137
|
+ if (oldActive.currentFocus() != null)
|
138
|
+ {
|
139
|
+ oldActive.currentFocus().repaint();
|
140
|
+ }
|
141
|
}
|
142
|
- }
|
143
|
- });
|
144
|
+ });
|
145
|
+ }
|
146
|
+ else
|
147
|
+ {
|
148
|
+ entry[0] = true;
|
149
|
+ }
|
150
|
|
151
|
if (entry[0])
|
152
|
{
|
153
|
@@ -796,10 +812,7 @@
|
154
|
}
|
155
|
}
|
156
|
}
|
157
|
- }
|
158
|
- else if (!isOverlay())
|
159
|
- {
|
160
|
- WindowManager.setActiveWindow(this);
|
161
|
+
|
162
|
}
|
163
|
|
164
|
// title repaint should be done after activation change
|
165
|
|
166
|
=== modified file 'src/com/goldencode/p2j/ui/client/WindowManager.java'
|
167
|
--- src/com/goldencode/p2j/ui/client/WindowManager.java 2016-03-16 06:04:22 +0000
|
168
|
+++ src/com/goldencode/p2j/ui/client/WindowManager.java 2016-03-17 21:52:50 +0000
|
169
|
@@ -518,13 +518,13 @@
|
170
|
* @return See above.
|
171
|
*/
|
172
|
@SuppressWarnings("unchecked")
|
173
|
- public static <O extends OutputManager<?>> Window<O> getActiveWindow()
|
174
|
+ public static <O extends OutputManager<?>> TopLevelWindow<O> getActiveWindow()
|
175
|
{
|
176
|
TopLevelWindow<O> active = (TopLevelWindow<O>) activeWnd.get();
|
177
|
|
178
|
// if the top-level active window is not the main window, return its
|
179
|
// main window owner
|
180
|
- return active == null ? null : active.window();
|
181
|
+ return active == null ? null : active;
|
182
|
}
|
183
|
|
184
|
/**
|
185
|
|
186
|
=== modified file 'src/com/goldencode/p2j/ui/client/widget/AbstractContainer.java'
|
187
|
--- src/com/goldencode/p2j/ui/client/widget/AbstractContainer.java 2016-03-16 06:04:22 +0000
|
188
|
+++ src/com/goldencode/p2j/ui/client/widget/AbstractContainer.java 2016-03-17 16:41:26 +0000
|
189
|
@@ -1042,8 +1042,7 @@
|
190
|
{
|
191
|
TopLevelWindow<O> window = topLevelWindow();
|
192
|
|
193
|
- if (WindowManager.topLevelWindow() != window ||
|
194
|
- WindowManager.getActiveModalWindow() == window)
|
195
|
+ if (WindowManager.topLevelWindow() != window)
|
196
|
{
|
197
|
// activate the related window
|
198
|
WindowManager.activateWindow(window);
|
199
|
|