Fix for inactive titlebar in notepad and winecfg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

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.

-- 
Regards,
Pavel Roskin
--- dlls/user/focus.c
+++ dlls/user/focus.c
@@ -258,6 +258,7 @@ HWND WINAPI SetFocus( HWND hwnd )
             HWND parent;
             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;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux