Community
Participate
Working Groups
Bug description: On GTK, Display.getActiveShell() often returns null on GTK while Eclipse is in the foreground. Consequence: This is causing problems in many areas, but most particularly with command handlers, since the command handler framework uses Display.getActiveShell() to supply the command handler with its shell. The consequence of initializing the active shell incorrectly is incorrectly parented and positioned dialog boxes, missing keybindings, and other issues. Analysis: I believe the entire process used SWT/gtk for determining the active shell is incorrect. It sets/clears the active shell pointer based on incoming focus events. This is inconsistent with Windows, which asks the OS for the active Shell on demand (and will therefore never report a null active shell while the application is active). Suggested solution: GTK allows the window with focus to be queried using a loop over gtk_window_list_toplevels () which invokes gtk_window_is_active () to test if the window is active. Both APIs should work as far back as GTK 2.4. This approach is described here: http://stackoverflow.com/questions/4166169/get-active-gtk-window-in-python
Note that a very similar issue was reported in bug 41400. I believe this technique would address that bug, too.
Note that if we want to maintain our own activeShell pointer separately from what's reported from GTK, we could still do so (if this were necessary for some reason to make the behavior more consistent between windows and GTK). The "search for active window" algorithm could be used to determine the new window with focus when opening shells or under focus changes and we could save the result in Display.activeShell if we want. This way we could still have control over when Display.activeShell updates but there would be no need to update it asynchronously or to have it set to null temporarily during focus changes.
*** Bug 286244 has been marked as a duplicate of this bug. ***
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.