Altered change of focus algorithm when window destroyed
Dave Hawkes
daveh-wine at cadlink.com
Tue Dec 11 08:37:51 CST 2001
Altered the algorithm for selecting a new focus after a window is destroyed
that currently has the focus.
Dave Hawkes
-------------- next part --------------
Index: windows/winpos.c
===================================================================
RCS file: /home/wine/wine/windows/winpos.c,v
retrieving revision 1.129
diff -u -r1.129 winpos.c
--- windows/winpos.c 2001/12/06 22:33:58 1.129
+++ windows/winpos.c 2001/12/11 12:07:06
@@ -622,7 +622,6 @@
return (GetWindowLongW( hWnd, GWL_STYLE ) & WS_MAXIMIZE) != 0;
}
-
/*******************************************************************
* GetActiveWindow (USER32.@)
*/
@@ -647,8 +646,17 @@
*/
static BOOL WINPOS_CanActivate(HWND hwnd)
{
+ if (!hwnd) return FALSE;
+ return ((GetWindowLongW( hwnd, GWL_STYLE ) & (WS_DISABLED|WS_CHILD)) == 0);
+}
+
+/*******************************************************************
+ * WINPOS_CanActivate
+ */
+static BOOL WINPOS_IsVisible(HWND hwnd)
+{
if (!hwnd) return FALSE;
- return ((GetWindowLongW( hwnd, GWL_STYLE ) & (WS_DISABLED|WS_VISIBLE|WS_CHILD)) == WS_VISIBLE);
+ return ((GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE) == WS_VISIBLE);
}
@@ -1394,6 +1402,7 @@
{
HWND hwndActive = 0;
HWND hwndTo = 0;
+ HWND hwndDefaultTo = 0;
HWND owner;
/* Get current active window from the active queue */
@@ -1417,16 +1426,23 @@
if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) ||
!(owner = GetWindow( hwnd, GW_OWNER )) ||
- !WINPOS_CanActivate((hwndTo = GetAncestor( owner, GA_ROOT ))) )
+ !WINPOS_CanActivate((hwndTo = GetAncestor( owner, GA_ROOT ))) ||
+ !WINPOS_IsVisible(hwndTo))
{
HWND tmp = GetAncestor( hwnd, GA_ROOT );
hwndTo = hwndPrevActive;
- while( !WINPOS_CanActivate(hwndTo) )
+ while( !WINPOS_CanActivate(hwndTo) || !WINPOS_IsVisible(hwndTo))
{
/* by now owned windows should've been taken care of */
+ if(!hwndDefaultTo && WINPOS_CanActivate(hwndTo))
+ hwndDefaultTo = hwndTo;
tmp = hwndTo = GetWindow( tmp, GW_HWNDNEXT );
- if( !hwndTo ) break;
+ if( !hwndTo )
+ {
+ hwndTo = hwndDefaultTo;
+ break;
+ }
}
}
More information about the wine-patches
mailing list