Skip to content

Commit 5d7f500

Browse files
author
zhourenjian
committed
Fixed bug that hiding windows does not set next window active
1 parent 5d1594b commit 5d7f500

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ void bringToTop (boolean parentShell, boolean childShells) {
284284
Shell[] children = sh.getShells();
285285
for (int i = 0; i < children.length; i++) {
286286
Shell s = children[i];
287-
if ((s.style & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) != 0) {
287+
if ((s.style & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) != 0
288+
&& s.isVisible() && !s.isDisposed()) {
288289
s.bringToTop(false, true);
289290
}
290291
}
@@ -2263,9 +2264,11 @@ public void run() {
22632264
handle.appendChild(titleBar);
22642265
titleBar.onclick = new RunnableCompatibility() {
22652266
public void run() {
2266-
bringToTop();
2267-
if(contentHandle != null){
2268-
OS.SetFocus(contentHandle); //contentHandle.focus();
2267+
if (isVisible()) { // may be invisible after clicking close button
2268+
bringToTop();
2269+
if(contentHandle != null){
2270+
OS.SetFocus(contentHandle); //contentHandle.focus();
2271+
}
22692272
}
22702273
toReturn(true);
22712274
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4815,7 +4815,8 @@ public void run() {
48154815
Display disp = displs[i];
48164816
if (disp != null && !disp.isDisposed()) {
48174817
Control ctrl = disp.getControl(src);
4818-
if (ctrl != null && ctrl instanceof Shell) {
4818+
if (ctrl != null && ctrl instanceof Shell
4819+
&& ctrl.isVisible()) {
48194820
((Shell) ctrl).bringToTop();
48204821
}
48214822
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public Element addShortcut(String name, String icon, Object clickFun) {
280280
* @j2sNative
281281
if (typeof clickFun == "string") {
282282
itemDiv.href = clickFun;
283-
} else {
283+
} else if (clickFun != null) {
284284
itemDiv.href = "#";
285285
itemDiv.onclick = (function (f) {
286286
return function () {
@@ -298,7 +298,7 @@ public Element addShortcut(String name, String icon, Object clickFun) {
298298
* @j2sNative
299299
if (typeof clickFun == "string") {
300300
itemDiv.href = clickFun;
301-
} else {
301+
} else if (clickFun != null) {
302302
itemDiv.onclick = clickFun;
303303
}
304304
*/ {}

0 commit comments

Comments
 (0)