Community
Participate
Working Groups
Help browser on Windows needs to move above all shells, when called to display some help URL. When the browser window is open it appears on the top, but when it is subsequently called to display URLs and move above, it sometimes stays behind other windows. The browser window runs in a separate process from Eclipse. We have tried different combinations of: shell.setVisible(true); shell.moveAbove(null); shell.focus(); shell.forceFocus(); shell.open(); None seems to produce result that works all the time. It either works on some win2k systems, but not on others, or it works 2 times after opening shell and not the 3rd time, or it works if help browser is behind Eclipse, but not if behind other program window. One way to reproduce: 1. Launch Eclipse Workbench. 2. Select navigator view, press F1, chose one of the links -> help browser opens on top of Eclipse. 3. In workbench select navigator view, press F1, chose one of the links -> help browser moves above Eclipse. 4a. In workbench select navigator view, press F1, chose one of the links -> help browser stays behind Eclipse. 4b. If in 4a help browser moved above Eclipse try this: Open another application on the top of help browser, switch to Workbench, in workbench select navigator view, press F1, chose one of the links -> help browser stays behind Eclipse. If it helps to look or experiment with our code, the help browser is a org.eclipse.help.ui.internal.browser.win32.IEHost class in the org.eclipse.help.ui project.
There is no API currently for moving the window to the front of *all* windows on the desktop. "moveAbove" is only capable of moving a shell to the front of all shells created on a particular org.eclipse.swt.widgets.DIsplay. Focus setting API only control where keyboard focus -- it's typically under the window manager's control whether or not this leads to the widget being raised, and is one of those user configurable options that people get passionate about. Changing this bug to an "enhancement" to indicate that this is a new feature request.
On windows platforms prior to Win2K, the following line of code will bring a window in front of all others regardless of who created them: org.eclipse.swt.internal.win32.OS.SetForegroundWindow(shell.handle); Unfortunately, on Win2K and WinXP, if the process making the call isn't the front window, the above line of code simply causes "shell"'s title in the Windows task bar to flash. Note that this is *correct* behavior on these platforms. On these platforms, there is no guaranteed way to bring a window in front of all others. On X windows, the window manager has ultimate control over when a window will come to the front. In our code, moveAbove(...) calls XReconfigureWMWindow (with stack_mode == ABOVE), which should do the right thing. However, if it does not for a particular window manager, we can not fix it. So, _AS_A_TEST_ to see if the win32 behavior is acceptable on win2K and XP, I suggest you call the above SetForegroundWindow call yourself after you open the help window. If you think this works acceptably, then let us know and we will create a public API that provides access to it on win32, but is equivalent to "moveAbove(null)" on linux. This is the best we can do for you.
org.eclipse.swt.internal.win32.OS.SetForegroundWindow(shell.handle); does what I need. It is the expected behavior. If Windows 2000 and XP bring windows to top or flash task bar button is configurable. You can use Microsoft Tweak UI to change this. If you deselect "Prevent Application from stealing focus", the code that you suggested will bring the window to top as in older versions of Windows. Please, make the API public for doing org.eclipse.swt.internal.win32.OS.SetForegroundWindow(shell.handle); public, or cause shell.moveAbove(null); to call above behind scenes on Win32.
Fixed > 20020416. See Shell.setActive() and Shell.forceActive().