Fix for inactive titlebar in notepad and winecfg
proski at gnu.org
Fri Oct 3 11:57:34 CDT 2003
I posted this to wine-devel and there were no answers. Presumably it
works for everybody. I feel much stronger now about the patch.
When wine uses non-managed windows or desktop, some programs start with
inactive caption, yet they accept keyboard focus.
It turns out they call SetFocus() on windows that are not shown yet.
While Windows simply ignores SetFocus(), Wine tries to focus the window.
The window is erroneously marked as active. When it's finally shown, it's
not brought to the foreground because it's "already active". But when
it's activated, the caption is drawn in inactive colors because the window
in not in foreground.
The internal functions in focus.c don't make some checks for optimization
reasons. But the API function should make sanity checks before they call
internal functions. SetFocus() filters out minimized and disabled
windows. Invisible windows belong to the same category, and sould not
accept focus either.
-------------- next part --------------
@@ -258,6 +258,7 @@ HWND WINAPI SetFocus( HWND hwnd )
LONG style = GetWindowLongW( hwndTop, GWL_STYLE );
if (style & (WS_MINIMIZE | WS_DISABLED)) return 0;
+ if (!(style & WS_VISIBLE)) return 0;
parent = GetAncestor( hwndTop, GA_PARENT );
if (!parent || parent == GetDesktopWindow()) break;
hwndTop = parent;
More information about the wine-patches