user32: Go backwards when enumerating owned popups
Dmitry Timoshkov
dmitry at codeweavers.com
Thu Feb 7 09:03:04 CST 2008
Hello,
Alexandre suggested that changing the order of enumerating owned
popups may fix the z-order problem experienced in some apps.
This patch fixes the bug 11398.
Changelog:
user32: Go backwards when enumerating owned popups.
---
dlls/user32/winpos.c | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index 1eb15d6..3df00c0 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -1334,20 +1334,28 @@ struct move_owned_info
HWND insert_after;
};
-static BOOL CALLBACK move_owned_popups( HWND hwnd, LPARAM lparam )
+static void move_owned_popups( struct move_owned_info *info )
{
- struct move_owned_info *info = (struct move_owned_info *)lparam;
+ HWND *list;
+ int i;
+
+ if (!(list = WIN_ListChildren( GetDesktopWindow() ))) return;
+
+ i = 0;
+ while (list[i] && list[i] != info->owner) i++;
- if (hwnd == info->owner) return FALSE;
- if ((GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) &&
- GetWindow( hwnd, GW_OWNER ) == info->owner)
+ while (i--)
{
- SetWindowPos( hwnd, info->insert_after, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE |
- SWP_NOSENDCHANGING | SWP_DEFERERASE );
- info->insert_after = hwnd;
+ if ((GetWindowLongW( list[i], GWL_STYLE ) & WS_POPUP) &&
+ GetWindow( list[i], GW_OWNER ) == info->owner)
+ {
+ SetWindowPos( list[i], info->insert_after, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE |
+ SWP_NOSENDCHANGING | SWP_DEFERERASE );
+ info->insert_after = list[i];
+ }
}
- return TRUE;
+ HeapFree( GetProcessHeap(), 0, list );
}
/***********************************************************************
@@ -1388,7 +1396,7 @@ static HWND SWP_DoOwnedPopups(HWND hwnd, HWND hwndInsertAfter)
info.owner = hwnd;
info.insert_after = hwndInsertAfter;
- EnumWindows( move_owned_popups, (LPARAM)&info );
+ move_owned_popups( &info );
return info.insert_after;
}
--
1.5.4
More information about the wine-patches
mailing list