From 763bf230b429ec837cfa70ee3d4cb9cb32bf8129 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sat, 16 Oct 2010 20:22:58 +0300 Subject: user32: Update last active popup for all parents --- dlls/user32/tests/win.c | 23 +++++++++++++++++++++++ server/window.c | 10 +++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 12f2e1c..0acd704 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -6256,6 +6256,28 @@ todo_wine ok( found != NULL, "found is NULL, expected a valid hwnd\n" ); } +static void test_GetLastActivePopup(void) +{ + HWND hwndOwner, hwndPopup1, hwndPopup2; + + hwndOwner = CreateWindowExA(0, "MainWindowClass", NULL, + WS_VISIBLE | WS_POPUPWINDOW, + 100, 100, 200, 200, + NULL, 0, GetModuleHandle(0), NULL); + hwndPopup1 = CreateWindowExA(0, "MainWindowClass", NULL, + WS_VISIBLE | WS_POPUPWINDOW, + 100, 100, 200, 200, + hwndOwner, 0, GetModuleHandle(0), NULL); + hwndPopup2 = CreateWindowExA(0, "MainWindowClass", NULL, + WS_VISIBLE | WS_POPUPWINDOW, + 100, 100, 200, 200, + hwndPopup1, 0, GetModuleHandle(0), NULL); + ok( GetLastActivePopup(hwndOwner) == hwndPopup2, "wrong last active popup\n" ); + DestroyWindow( hwndPopup2 ); + DestroyWindow( hwndPopup1 ); + DestroyWindow( hwndOwner ); +} + START_TEST(win) { HMODULE user32 = GetModuleHandleA( "user32.dll" ); @@ -6329,6 +6351,7 @@ START_TEST(win) test_children_zorder(hwndMain); test_popup_zorder(hwndMain2, hwndMain, WS_POPUP); test_popup_zorder(hwndMain2, hwndMain, 0); + test_GetLastActivePopup(); test_keyboard_input(hwndMain); test_mouse_input(hwndMain); test_validatergn(hwndMain); diff --git a/server/window.c b/server/window.c index 503f37e..635dd9b 100644 --- a/server/window.c +++ b/server/window.c @@ -569,9 +569,13 @@ int make_window_active( user_handle_t window ) if (!win) return 0; - /* set last active for window and its owner */ - win->last_active = win->handle; - if ((owner = get_user_object( win->owner, USER_WINDOW ))) owner->last_active = win->handle; + /* set last active for window and its owners */ + owner = win; + while (owner) + { + owner->last_active = win->handle; + owner = get_user_object( owner->owner, USER_WINDOW ); + } return 1; } -- 1.7.0.4