Piotr Caban : user32: Only store dialog focus when window is hidden or inactive.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jan 7 17:15:37 CST 2015
Module: wine
Branch: master
Commit: 91eced0ce5279b59715330466742925d89e8d0f5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=91eced0ce5279b59715330466742925d89e8d0f5
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Dec 22 16:36:48 2014 +0100
user32: Only store dialog focus when window is hidden or inactive.
---
dlls/user32/defdlg.c | 4 +---
dlls/user32/tests/dialog.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/defdlg.c b/dlls/user32/defdlg.c
index e4b55f3..00a73c6 100644
--- a/dlls/user32/defdlg.c
+++ b/dlls/user32/defdlg.c
@@ -105,9 +105,7 @@ static void DEFDLG_RestoreFocus( HWND hwnd, BOOL justActivate )
SetFocus( infoPtr->hwndFocus );
else
DEFDLG_SetFocus( infoPtr->hwndFocus );
-
- /* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
- sometimes losing focus when receiving WM_SETFOCUS messages. */
+ infoPtr->hwndFocus = NULL;
}
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index ef72cfe..63e76f7 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -1357,6 +1357,24 @@ static void test_SaveRestoreFocus(void)
foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
ok (foundId == 1001, "Second edit box should have gained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);
+ /* set focus to the dialog */
+ SetFocus(hDlg);
+
+ foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
+ ok (foundId == 1000, "First edit box should have gained focus on dialog focus. Expected: %d, Found: %ld\n", 1000, foundId);
+
+ /* select second tabbable item */
+ SetFocus(GetNextDlgTabItem(hDlg, GetNextDlgTabItem(hDlg, NULL, FALSE), FALSE));
+
+ foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
+ ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
+
+ /* send WM_ACTIVATE message to already active dialog */
+ SendMessageA(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_ACTIVE, 0), 0);
+
+ foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
+ ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
+
/* disable the 2nd box */
EnableWindow(GetFocus(), FALSE);
More information about the wine-cvs
mailing list