Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
9358f3e9
Commit
9358f3e9
authored
Sep 10, 2004
by
Zach Gorman
Committed by
Alexandre Julliard
Sep 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The initial dialog focus should be established by the default handler
for SetFocus(), not in the dialog creation code.
parent
5c8ceb49
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
30 deletions
+15
-30
dialog.c
dlls/user/tests/dialog.c
+5
-5
defdlg.c
windows/defdlg.c
+8
-5
dialog.c
windows/dialog.c
+2
-20
No files found.
dlls/user/tests/dialog.c
View file @
9358f3e9
...
...
@@ -769,11 +769,11 @@ static void InitialFocusTest (void)
"Expected NULL focus, got %s (%p).
\n
"
,
GetHwndString
(
g_hwndInitialFocusT1
),
g_hwndInitialFocusT1
);
todo_wine
ok
((
g_hwndInitialFocusT2
==
g_hwndButton2
),
"Error after first SetFocus() when WM_INITDIALOG returned FALSE: "
"Expected the second button (%p), got %s (%p).
\n
"
,
g_hwndButton2
,
GetHwndString
(
g_hwndInitialFocusT2
),
g_hwndInitialFocusT2
);
ok
((
g_hwndInitialFocusT2
==
g_hwndButton2
),
"Error after first SetFocus() when WM_INITDIALOG returned FALSE: "
"Expected the second button (%p), got %s (%p).
\n
"
,
g_hwndButton2
,
GetHwndString
(
g_hwndInitialFocusT2
),
g_hwndInitialFocusT2
);
/* Test 2:
* This is the same as above, except WM_INITDIALOG is made to return TRUE.
...
...
windows/defdlg.c
View file @
9358f3e9
...
...
@@ -96,13 +96,16 @@ static void DEFDLG_RestoreFocus( HWND hwnd )
if
(
IsIconic
(
hwnd
))
return
;
if
(
!
(
infoPtr
=
DIALOG_get_info
(
hwnd
,
FALSE
)))
return
;
if
(
!
IsWindow
(
infoPtr
->
hwndFocus
))
return
;
/* Don't set the focus back to controls if EndDialog is already called.*/
if
(
!
(
infoPtr
->
flags
&
DF_END
))
{
DEFDLG_SetFocus
(
hwnd
,
infoPtr
->
hwndFocus
);
return
;
if
(
infoPtr
->
flags
&
DF_END
)
return
;
if
(
!
IsWindow
(
infoPtr
->
hwndFocus
)
||
infoPtr
->
hwndFocus
==
hwnd
)
{
/* If no saved focus control exists, set focus to the first visible,
non-disabled, WS_TABSTOP control in the dialog */
infoPtr
->
hwndFocus
=
GetNextDlgTabItem
(
hwnd
,
0
,
FALSE
);
if
(
!
IsWindow
(
infoPtr
->
hwndFocus
))
return
;
}
DEFDLG_SetFocus
(
hwnd
,
infoPtr
->
hwndFocus
);
/* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
sometimes losing focus when receiving WM_SETFOCUS messages. */
}
...
...
windows/dialog.c
View file @
9358f3e9
...
...
@@ -657,33 +657,15 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
if
(
DIALOG_CreateControls32
(
hwnd
,
dlgTemplate
,
&
template
,
hInst
,
unicode
))
{
HWND
hwndPreInitFocus
;
/* Send initialisation messages and set focus */
dlgInfo
->
hwndFocus
=
GetNextDlgTabItem
(
hwnd
,
0
,
FALSE
);
hwndPreInitFocus
=
GetFocus
();
if
(
SendMessageA
(
hwnd
,
WM_INITDIALOG
,
(
WPARAM
)
dlgInfo
->
hwndFocus
,
param
))
if
(
SendMessageA
(
hwnd
,
WM_INITDIALOG
,
(
WPARAM
)
dlgInfo
->
hwndFocus
,
param
))
{
/* check where the focus is again,
* some controls status might have changed in WM_INITDIALOG */
/* By returning TRUE, app has requested a default focus assignment */
dlgInfo
->
hwndFocus
=
GetNextDlgTabItem
(
hwnd
,
0
,
FALSE
);
if
(
dlgInfo
->
hwndFocus
)
SetFocus
(
dlgInfo
->
hwndFocus
);
}
else
{
/* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
but the focus has not changed, set the focus where we expect it. */
if
((
GetFocus
()
==
hwndPreInitFocus
)
&&
(
GetWindowLongW
(
hwnd
,
GWL_STYLE
)
&
WS_VISIBLE
))
{
dlgInfo
->
hwndFocus
=
GetNextDlgTabItem
(
hwnd
,
0
,
FALSE
);
if
(
dlgInfo
->
hwndFocus
)
SetFocus
(
dlgInfo
->
hwndFocus
);
}
}
if
(
template
.
style
&
WS_VISIBLE
&&
!
(
GetWindowLongW
(
hwnd
,
GWL_STYLE
)
&
WS_VISIBLE
))
{
...
...
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