Restore correct focus handling for ShowWindow(SW_HIDE) case
Dmitry Timoshkov
dmitry at baikal.ru
Thu Apr 8 07:17:21 CDT 2004
Hello,
DestroyWindow path had 2 similar (but different enough) pieces of code
dealing with window focus. One of that pieces was recently removed by
my patch.
Unfortunately the second place was buggy, leading to a crash in one
of applications.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Restore correct focus handling for ShowWindow(SW_HIDE) case.
--- cvs/hq/wine/dlls/x11drv/winpos.c 2004-04-03 12:30:55.000000000 +0900
+++ wine/dlls/x11drv/winpos.c 2004-04-08 20:27:58.000000000 +0900
@@ -1353,6 +1353,8 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT c
newPos.right, newPos.bottom, LOWORD(swp) );
if (cmd == SW_HIDE)
{
+ HWND hFocus;
+
/* FIXME: This will cause the window to be activated irrespective
* of whether it is owned by the same thread. Has to be done
* asynchronously.
@@ -1362,8 +1364,13 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT c
WINPOS_ActivateOtherWindow(hwnd);
/* Revert focus to parent */
- if (hwnd == GetFocus() || IsChild(hwnd, GetFocus()))
- SetFocus( GetParent(hwnd) );
+ hFocus = GetFocus();
+ if (hwnd == hFocus || IsChild(hwnd, hFocus))
+ {
+ HWND parent = GetAncestor(hwnd, GA_PARENT);
+ if (parent == GetDesktopWindow()) parent = 0;
+ SetFocus(parent);
+ }
}
if (!IsWindow( hwnd )) goto END;
else if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_ShowIconTitle( hwnd, TRUE );
More information about the wine-patches
mailing list