mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
user32-dialog_focus: Update patch.
This commit is contained in:
parent
088524a29e
commit
2b2bf8ac06
@ -52,7 +52,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "f760079a717042d436a693df59fa1d4416a0e352"
|
||||
echo "4397d9497608a3df45a5c519a37f5dcde5cc2301"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -6431,12 +6431,12 @@ fi
|
||||
# | * [#46215] File Open Dialog fails to set focus to Filename text box
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/user32/dialog.c
|
||||
# | * dlls/user32/dialog.c, dlls/user32/tests/dialog.c
|
||||
# |
|
||||
if test "$enable_user32_dialog_focus" -eq 1; then
|
||||
patch_apply user32-dialog_focus/0001-user32-Dont-reset-focus-if-current-control-is-a-chil.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Alistair Leslie-Hughes", "user32: Dont reset focus if current control is a child of our parent.", 1 },';
|
||||
printf '%s\n' '+ { "Alistair Leslie-Hughes", "user32: Dont reset focus if current dialog is a child.", 2 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
@ -1,35 +1,127 @@
|
||||
From 1e118030e5b1da7bbfa4c03548b15beb137497f5 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Thu, 6 Dec 2018 15:01:54 +1100
|
||||
Subject: [PATCH] user32: Dont reset focus if current control is a child of our
|
||||
parent
|
||||
Subject: [PATCH v2] user32: Dont reset focus if current dialog is a child.
|
||||
Message-Id: <PS2P216MB0066A5295ACFD65599E9D23E93A10@PS2P216MB0066.KORP216.PROD.OUTLOOK.COM>
|
||||
Date: Fri, 14 Dec 2018 04:00:43 +0000
|
||||
|
||||
Regression of 44f89322ba8825a8e4851aaaf7de89910701ca75
|
||||
|
||||
The standard File Open Dialog, creates an empty WS_EX_CONTROLPARENT
|
||||
child dialog which shouldn't receive focus.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46215
|
||||
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
---
|
||||
dlls/user32/dialog.c | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
dlls/user32/dialog.c | 5 +++-
|
||||
dlls/user32/tests/dialog.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 76 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
|
||||
index 0b33a57..0d98d0a 100644
|
||||
index 0b33a57..72e6eee 100644
|
||||
--- a/dlls/user32/dialog.c
|
||||
+++ b/dlls/user32/dialog.c
|
||||
@@ -692,7 +692,16 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
|
||||
@@ -692,7 +692,10 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
|
||||
SetFocus( focus );
|
||||
}
|
||||
else
|
||||
- SetFocus( hwnd );
|
||||
+ {
|
||||
+ if (template.style & WS_CHILD)
|
||||
+ {
|
||||
+ HWND hParent = GetParent(hwnd);
|
||||
+ if (!IsChild(hParent, GetFocus()))
|
||||
+ SetFocus( hwnd );
|
||||
+ }
|
||||
+ else
|
||||
+ if (!(template.style & WS_CHILD))
|
||||
+ SetFocus( hwnd );
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
|
||||
index 631f3d3..ff6052f 100644
|
||||
--- a/dlls/user32/tests/dialog.c
|
||||
+++ b/dlls/user32/tests/dialog.c
|
||||
@@ -907,6 +907,55 @@ static INT_PTR CALLBACK focusDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+static INT_PTR CALLBACK EmptyProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
+{
|
||||
+ switch(uMsg) {
|
||||
+ case WM_INITDIALOG:
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+HWND hChildDlg = NULL;
|
||||
+static INT_PTR CALLBACK focusChildDlgWinProc (HWND hwnd, UINT uiMsg, WPARAM wParam,
|
||||
+ LPARAM lParam)
|
||||
+{
|
||||
+ switch (uiMsg)
|
||||
+ {
|
||||
+ case WM_INITDIALOG:
|
||||
+ {
|
||||
+ RECT rectHwnd;
|
||||
+ struct {
|
||||
+ DLGTEMPLATE tmplate;
|
||||
+ WORD menu,class,title;
|
||||
+ } temp;
|
||||
+
|
||||
+ SetFocus( GetDlgItem(hwnd, 200) );
|
||||
+
|
||||
+ GetClientRect(hwnd,&rectHwnd);
|
||||
+ temp.tmplate.style = WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | DS_CONTROL | DS_3DLOOK;
|
||||
+ temp.tmplate.dwExtendedStyle = 0;
|
||||
+ temp.tmplate.cdit = 0;
|
||||
+ temp.tmplate.x = 0;
|
||||
+ temp.tmplate.y = 0;
|
||||
+ temp.tmplate.cx = 0;
|
||||
+ temp.tmplate.cy = 0;
|
||||
+ temp.menu = temp.class = temp.title = 0;
|
||||
+
|
||||
+ hChildDlg = CreateDialogIndirectParamA(g_hinst, &temp.tmplate,
|
||||
+ hwnd, (DLGPROC)EmptyProcUserTemplate, 0);
|
||||
+ ok(hChildDlg != 0, "Failed to create test dialog.\n");
|
||||
+
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ case WM_CLOSE:
|
||||
+ DestroyWindow(hChildDlg);
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
/* Helper for InitialFocusTest */
|
||||
static const char * GetHwndString(HWND hw)
|
||||
{
|
||||
@@ -1093,6 +1142,29 @@ static void test_focus(void)
|
||||
|
||||
DestroyWindow(hDlg);
|
||||
}
|
||||
+
|
||||
+ /* Test 6:
|
||||
+ * Select textbox's text on creation when WM_INITDIALOG creates a child dialog. */
|
||||
+ {
|
||||
+ HWND hDlg;
|
||||
+ HRSRC hResource;
|
||||
+ HANDLE hTemplate;
|
||||
+ DLGTEMPLATE* pTemplate;
|
||||
+ HWND edit;
|
||||
+
|
||||
+ hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_3", (LPCSTR)RT_DIALOG);
|
||||
+ hTemplate = LoadResource(g_hinst, hResource);
|
||||
+ pTemplate = LockResource(hTemplate);
|
||||
+
|
||||
+ hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, focusChildDlgWinProc, 0);
|
||||
+ ok(hDlg != 0, "Failed to create test dialog.\n");
|
||||
+ edit = GetDlgItem(hDlg, 200);
|
||||
+
|
||||
+ ok(GetFocus() == edit, "Focus not set to edit, focus=%p, dialog=%p, edit=%p\n",
|
||||
+ GetFocus(), hDlg, edit);
|
||||
+
|
||||
+ DestroyWindow(hDlg);
|
||||
+ }
|
||||
}
|
||||
|
||||
static void test_GetDlgItemText(void)
|
||||
|
||||
--
|
||||
1.9.1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user