Skip to content

Commit 4fdd937

Browse files
author
zhourenjian
committed
Fixed bug that Shell with style SWT.TOOL does not layout correctly.
1 parent 9fe0bc1 commit 4fdd937

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

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

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,9 @@ public Rectangle getClientArea () {
909909
//h -= 21;
910910
h -= 1 + OS.getContainerHeight(shellMenuBar);
911911
}
912+
} else if ((style & SWT.TOOL) != 0){
913+
h -= 2;
914+
w -= 2;
912915
} else {
913916
h -= 6;
914917
w -= 6;
@@ -2298,22 +2301,27 @@ protected boolean SetWindowPos(Object hWnd, Object hWndInsertAfter, int X, int Y
22982301
titleBar.style.width = ((width - dww) > 0 ? width - dww : 0) + "px";
22992302
updateShellTitle(width);
23002303
} else {
2301-
width -= 4;
2302-
height -= 4;
2303-
cx -= 4;
2304-
cy -= 4;
2305-
int dw = 4;
2306-
int dh = 4;
2304+
int dw = 8;
2305+
int dh = 8;
2306+
if ((style & SWT.TOOL) != 0) {
2307+
dw = 0;
2308+
dh = 0;
2309+
contentHandle.style.top = "0px";
2310+
contentHandle.style.left = "0px";
2311+
cx -= 2;
2312+
cy -= 2;
2313+
} else {
2314+
contentHandle.style.top = 3 + "px";
2315+
contentHandle.style.left = 1 + "px";
2316+
cx -= 4;
2317+
cy -= 4;
2318+
}
23072319
// if ((style & SWT.BORDER) != 0) {
23082320
// dw -= 2;
23092321
// dh -= 2;
23102322
// }
23112323
contentHandle.style.height = ((height - dh >= 0) ? height - dh : 0) + "px";
23122324
contentHandle.style.width = (width - dw > 0 ? width - dw : 0) + "px";
2313-
contentHandle.style.top = 3 + "px";
2314-
contentHandle.style.left = 1 + "px";
2315-
width += 4;
2316-
height += 4;
23172325
}
23182326
if ((style & SWT.BORDER) != 0) {
23192327
cx -= 4;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
z-index:3;
4040
}
4141
.shell-tool {
42-
margin:1px !important;
43-
margin-top:-1px !important;
42+
margin:0 !important;
4443
}
4544
.shell-menu-bar .shell-content {
4645
top:44px;

0 commit comments

Comments
 (0)