Piotr Caban : user32: Only use DIALOGINFO-> hwndFocus to store last focus of inactive windows.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Feb 5 10:42:43 CST 2015
Module: wine
Branch: master
Commit: 6c5d4cb07e6ddc578cd8f6b359f51c76c6231113
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6c5d4cb07e6ddc578cd8f6b359f51c76c6231113
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Feb 4 15:05:07 2015 +0100
user32: Only use DIALOGINFO->hwndFocus to store last focus of inactive windows.
---
dlls/user32/dialog.c | 8 ++++----
dlls/user32/tests/dialog.c | 13 ++++++++++++-
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index 497d545..3b48fbb 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -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 );
}
}
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index 63e76f7..3488f31 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -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);
More information about the wine-cvs
mailing list