Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
54156869
Commit
54156869
authored
Dec 21, 2004
by
Ulrich Czekalla
Committed by
Alexandre Julliard
Dec 21, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If a dialog with the DS_CONTROL style is not visible then ignore
default focus assignment.
parent
827154e4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
1 deletion
+57
-1
dialog.c
dlls/user/tests/dialog.c
+47
-0
resource.rc
dlls/user/tests/resource.rc
+8
-0
dialog.c
windows/dialog.c
+2
-1
No files found.
dlls/user/tests/dialog.c
View file @
54156869
...
...
@@ -716,6 +716,31 @@ static LRESULT CALLBACK delayFocusDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wPar
return
FALSE
;
}
static
LRESULT
CALLBACK
focusDlgWinProc
(
HWND
hDlg
,
UINT
uiMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
switch
(
uiMsg
)
{
case
WM_INITDIALOG
:
return
TRUE
;
case
WM_COMMAND
:
if
(
LOWORD
(
wParam
)
==
IDCANCEL
)
{
EndDialog
(
hDlg
,
LOWORD
(
wParam
));
return
TRUE
;
}
else
if
(
LOWORD
(
wParam
)
==
200
)
{
if
(
HIWORD
(
wParam
)
==
EN_SETFOCUS
)
g_hwndInitialFocusT1
=
(
HWND
)
lParam
;
}
return
FALSE
;
}
return
FALSE
;
}
/* Helper for InitialFocusTest */
static
const
char
*
GetHwndString
(
HWND
hw
)
{
...
...
@@ -800,6 +825,28 @@ static void InitialFocusTest (void)
"Expected the second button (%p), got %s (%p).
\n
"
,
g_hwndButton2
,
GetHwndString
(
g_hwndInitialFocusT2
),
g_hwndInitialFocusT2
);
/* Test 3:
* If the dialog has DS_CONTROL and it's not visible then we shouldn't change focus */
{
HWND
hDlg
;
HRSRC
hResource
;
HANDLE
hTemplate
;
DLGTEMPLATE
*
pTemplate
;
hResource
=
FindResourceA
(
g_hinst
,
"FOCUS_TEST_DIALOG"
,
(
LPSTR
)
RT_DIALOG
);
hTemplate
=
LoadResource
(
g_hinst
,
hResource
);
pTemplate
=
(
LPDLGTEMPLATEA
)
LockResource
(
hTemplate
);
g_hwndInitialFocusT1
=
0
;
hDlg
=
CreateDialogIndirectParamW
(
g_hinst
,
pTemplate
,
NULL
,
(
DLGPROC
)
focusDlgWinProc
,
0
);
ok
(
hDlg
!=
0
,
"Failed to create test dialog.
\n
"
);
ok
((
g_hwndInitialFocusT1
==
0
),
"Focus should not be set for an invisible DS_CONTROL dialog %p.
\n
"
,
g_hwndInitialFocusT1
);
DestroyWindow
(
hDlg
);
}
}
...
...
dlls/user/tests/resource.rc
View file @
54156869
...
...
@@ -67,3 +67,11 @@ CLASS "TestDialog"
FONT 8, "System"
{
}
FOCUS_TEST_DIALOG DIALOG DISCARDABLE 0, 0, 60, 30
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CONTROL
CAPTION "Test dialog"
FONT 8, "MS Shell Dlg"
{
EDITTEXT 200,4,4,50,14
}
windows/dialog.c
View file @
54156869
...
...
@@ -664,7 +664,8 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
{
/* Send initialisation messages and set focus */
if
(
SendMessageW
(
hwnd
,
WM_INITDIALOG
,
(
WPARAM
)
dlgInfo
->
hwndFocus
,
param
))
if
(
SendMessageW
(
hwnd
,
WM_INITDIALOG
,
(
WPARAM
)
dlgInfo
->
hwndFocus
,
param
)
&&
((
~
template
.
style
&
DS_CONTROL
)
||
(
template
.
style
&
WS_VISIBLE
)))
{
/* By returning TRUE, app has requested a default focus assignment */
dlgInfo
->
hwndFocus
=
GetNextDlgTabItem
(
hwnd
,
0
,
FALSE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment