Skip to content

Commit 0840673

Browse files
author
zhourenjian
committed
Improve Tray corner to push more HTML elements away so Tray corner's shadow won't eclipse unexpected elements
1 parent d010c43 commit 0840673

File tree

1 file changed

+27
-6
lines changed
  • sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets

1 file changed

+27
-6
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Tray.java

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,36 @@ private void addTrayLine () {
149149
floatDiv1.className = "tray-float-block";
150150
Element floatDiv2 = document.createElement ("DIV");
151151
floatDiv2.className = "tray-float-block";
152-
floatDiv1.style.width = cellLines * 36 + "px";
153-
floatDiv2.style.width = (cellLines * 36 - 18) + "px";
154-
allFloats[cellLines * 2 - 2] = floatDiv2;
155-
allFloats[cellLines * 2 - 1] = floatDiv1;
152+
floatDiv1.style.width = (cellLines * 36 + 18) + "px";
153+
floatDiv2.style.width = cellLines * 36 + "px";
154+
Element floatDiv3 = null;
155+
if (cellLines == 1) {
156+
floatDiv3 = document.createElement ("DIV");
157+
floatDiv3.className = "tray-float-block";
158+
floatDiv3.style.width = (cellLines * 36 - 18) + "px";
159+
allFloats[0] = floatDiv3;
160+
}
161+
allFloats[cellLines * 2 - 1] = floatDiv2;
162+
allFloats[cellLines * 2] = floatDiv1;
156163
Element panel = document.getElementById("swt-desktop-panel");
157164
if (panel != null) {
165+
if (floatDiv3 != null) {
166+
if (panel.childNodes.length > 0) {
167+
panel.insertBefore (floatDiv3, panel.childNodes[0]);
168+
} else {
169+
panel.appendChild(floatDiv3);
170+
}
171+
}
158172
if (panel.childNodes.length > 0) {
159173
panel.insertBefore (floatDiv2, panel.childNodes[0]);
160174
} else {
161175
panel.appendChild(floatDiv2);
162176
}
163177
panel.insertBefore (floatDiv1, panel.childNodes[0]);
164178
} else {
179+
if (floatDiv3 != null) {
180+
document.body.insertBefore (floatDiv3, document.body.childNodes[0]);
181+
}
165182
document.body.insertBefore (floatDiv2, document.body.childNodes[0]);
166183
document.body.insertBefore (floatDiv1, document.body.childNodes[0]);
167184
}
@@ -203,10 +220,14 @@ private void removeTrayLine () {
203220
if (!supportNotificationCornerFloat) {
204221
return;
205222
}
223+
OS.destroyHandle(allFloats[cellLines * 2 + 2]);
224+
allFloats[cellLines * 2 + 2] = null;
206225
OS.destroyHandle(allFloats[cellLines * 2 + 1]);
207226
allFloats[cellLines * 2 + 1] = null;
208-
OS.destroyHandle(allFloats[cellLines * 2]);
209-
allFloats[cellLines * 2] = null;
227+
if (cellLines == 0) {
228+
OS.destroyHandle(allFloats[0]);
229+
allFloats[0] = null;
230+
}
210231
}
211232

212233
void initialize () {

0 commit comments

Comments
 (0)