Commit 6c5d4cb0 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

user32: Only use DIALOGINFO->hwndFocus to store last focus of inactive windows.

parent 58cbdf26
......@@ -704,10 +704,10 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
/* By returning TRUE, app has requested a default focus assignment.
* WM_INITDIALOG may have changed the tab order, so find the first
* tabstop control again. */
dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
if (!dlgInfo->hwndFocus) dlgInfo->hwndFocus = GetNextDlgGroupItem( hwnd, 0, FALSE );
if( dlgInfo->hwndFocus )
SetFocus( dlgInfo->hwndFocus );
focus = GetNextDlgTabItem( hwnd, 0, FALSE );
if (!focus) focus = GetNextDlgGroupItem( hwnd, 0, FALSE );
if (focus)
SetFocus( focus );
}
}
......
......@@ -1227,7 +1227,12 @@ static void test_DisabledDialogTest(void)
static INT_PTR CALLBACK messageBoxFontDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam,
LPARAM lParam)
{
return (uiMsg == WM_INITDIALOG);
if (uiMsg == WM_INITDIALOG) {
SetFocus(hDlg);
return 1;
}
return 0;
}
static void test_MessageBoxFontTest(void)
......@@ -1337,6 +1342,12 @@ static void test_SaveRestoreFocus(void)
foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
ok (foundId == 1000, "First edit box should have gained focus on dialog creation. Expected: %d, Found: %ld\n", 1000, foundId);
SetFocus(GetNextDlgTabItem(hDlg, GetFocus(), FALSE));
SendMessageA(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_ACTIVE, 0), 0);
foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
ok (foundId == 1001, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);
SetFocus(GetNextDlgTabItem(hDlg, NULL, FALSE));
/* de- then reactivate the dialog */
SendMessageA(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), 0);
SendMessageA(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_ACTIVE, 0), 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment