Skip to content

Commit 1d7f736

Browse files
author
zhourenjian
committed
Fixing Shell's focusing issue: Miminizing a Shell object will activate the next Shell object correctly
1 parent 54db23c commit 1d7f736

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,6 +2003,7 @@ public void setMinimized (boolean minimized) {
20032003
Shell topShell = Display.getTopShell();
20042004
if (topShell != null) {
20052005
topShell.bringToTop();
2006+
topShell.forceFocus();
20062007
} else
20072008
/**
20082009
* Return to default title
@@ -2205,6 +2206,8 @@ public void run() {
22052206
if (display.topBar != null) {
22062207
display.topBar.returnTopMaximized((Shell) shell);
22072208
}
2209+
toReturn(false);
2210+
new HTMLEventWrapper(getEvent()).stopPropagation();
22082211
}
22092212
};
22102213
}
@@ -2272,9 +2275,12 @@ public void run() {
22722275
public void run() {
22732276
if (isVisible()) { // may be invisible after clicking close button
22742277
bringToTop();
2278+
forceFocus();
2279+
/*
22752280
if(contentHandle != null){
22762281
OS.SetFocus(contentHandle); //contentHandle.focus();
22772282
}
2283+
*/
22782284
}
22792285
toReturn(true);
22802286
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
opacity:0.85;
4242
filter:Alpha(Opacity=85);
4343
}
44+
* html .shortcut-bar {
45+
bottom:-1px;
46+
}
47+
* html .shortcut-bar-minimized {
48+
bottom:-1px;
49+
}
4450
.shortcut-item:hover, a.shortcut-item:hover .shortcut-item-highlight {
4551
border:1px solid navy;
4652
background-color:highlight;

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,17 @@ public void close () {
501501
taskBar.setMinimized(false);
502502
taskBar.updateLastModified();
503503
}
504+
Shell nextShell = null;
505+
if (parent instanceof Shell) {
506+
nextShell = (Shell) parent;
507+
}
504508
closeWidget ();
505-
Shell topShell = Display.getTopShell();
506-
if (topShell != null && !topShell.isDisposed()) {
507-
topShell.bringToTop();
509+
if (nextShell == null || nextShell.isDisposed()) {
510+
nextShell = Display.getTopShell();
511+
}
512+
if (nextShell != null && !nextShell.isDisposed()) {
513+
nextShell.bringToTop();
514+
nextShell.forceFocus();
508515
} else
509516
/**
510517
* Return to default title

0 commit comments

Comments
 (0)