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
d2029908
Commit
d2029908
authored
Nov 15, 2011
by
Erich Hoover
Committed by
Alexandre Julliard
Nov 18, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Prioritize focus for dialog owner on EndDialog.
parent
66e98122
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
2 deletions
+59
-2
dialog.c
dlls/user32/dialog.c
+12
-2
msg.c
dlls/user32/tests/msg.c
+47
-0
No files found.
dlls/user32/dialog.c
View file @
d2029908
...
...
@@ -928,7 +928,8 @@ BOOL WINAPI EndDialog( HWND hwnd, INT_PTR retval )
dlgInfo
->
flags
|=
DF_END
;
wasEnabled
=
(
dlgInfo
->
flags
&
DF_OWNERENABLED
);
if
(
wasEnabled
&&
(
owner
=
GetWindow
(
hwnd
,
GW_OWNER
)))
owner
=
GetWindow
(
hwnd
,
GW_OWNER
);
if
(
wasEnabled
&&
owner
)
DIALOG_EnableOwner
(
owner
);
/* Windows sets the focus to the dialog itself in EndDialog */
...
...
@@ -942,7 +943,16 @@ BOOL WINAPI EndDialog( HWND hwnd, INT_PTR retval )
SetWindowPos
(
hwnd
,
NULL
,
0
,
0
,
0
,
0
,
SWP_NOMOVE
|
SWP_NOSIZE
|
SWP_NOZORDER
|
SWP_NOACTIVATE
|
SWP_HIDEWINDOW
);
if
(
hwnd
==
GetActiveWindow
())
WINPOS_ActivateOtherWindow
(
hwnd
);
if
(
hwnd
==
GetActiveWindow
())
{
/* If this dialog was given an owner then set the focus to that owner
even when the owner is disabled (normally when a window closes any
disabled windows cannot receive the focus). */
if
(
owner
)
SetForegroundWindow
(
owner
);
else
WINPOS_ActivateOtherWindow
(
hwnd
);
}
/* unblock dialog loop */
PostMessageA
(
hwnd
,
WM_NULL
,
0
,
0
);
...
...
dlls/user32/tests/msg.c
View file @
d2029908
...
...
@@ -11256,6 +11256,52 @@ static void test_dialog_messages(void)
UnregisterClass
(
cls
.
lpszClassName
,
cls
.
hInstance
);
}
static
void
test_EndDialog
(
void
)
{
HWND
hparent
,
hother
,
hactive
,
hdlg
;
WNDCLASS
cls
;
hparent
=
CreateWindowExA
(
0
,
"TestParentClass"
,
"Test parent"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
|
WS_DISABLED
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
ok
(
hparent
!=
0
,
"Failed to create parent window
\n
"
);
hother
=
CreateWindowExA
(
0
,
"TestParentClass"
,
"Test parent 2"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
ok
(
hother
!=
0
,
"Failed to create parent window
\n
"
);
ok
(
GetClassInfo
(
0
,
"#32770"
,
&
cls
),
"GetClassInfo failed
\n
"
);
cls
.
lpszClassName
=
"MyDialogClass"
;
cls
.
hInstance
=
GetModuleHandle
(
0
);
/* need a cast since a dlgproc is used as a wndproc */
cls
.
lpfnWndProc
=
(
WNDPROC
)
test_dlg_proc
;
if
(
!
RegisterClass
(
&
cls
))
assert
(
0
);
flush_sequence
();
SetForegroundWindow
(
hother
);
hactive
=
GetForegroundWindow
();
ok
(
hother
==
hactive
,
"Wrong window has focus (%p != %p)
\n
"
,
hother
,
hactive
);
/* create a dialog where the parent is disabled, this parent should still
receive the focus when the dialog exits (even though "normally" a
disabled window should not receive the focus) */
hdlg
=
CreateDialogParam
(
0
,
"CLASS_TEST_DIALOG_2"
,
hparent
,
test_dlg_proc
,
0
);
ok
(
IsWindow
(
hdlg
),
"CreateDialogParam failed
\n
"
);
SetForegroundWindow
(
hdlg
);
hactive
=
GetForegroundWindow
();
ok
(
hdlg
==
hactive
,
"Wrong window has focus (%p != %p)
\n
"
,
hdlg
,
hactive
);
EndDialog
(
hdlg
,
0
);
hactive
=
GetForegroundWindow
();
ok
(
hparent
==
hactive
,
"Wrong window has focus (parent != active) (active: %p, parent: %p, dlg: %p, other: %p)
\n
"
,
hactive
,
hparent
,
hdlg
,
hother
);
DestroyWindow
(
hdlg
);
flush_sequence
();
DestroyWindow
(
hother
);
DestroyWindow
(
hparent
);
UnregisterClass
(
cls
.
lpszClassName
,
cls
.
hInstance
);
}
static
void
test_nullCallback
(
void
)
{
HWND
hwnd
;
...
...
@@ -13573,6 +13619,7 @@ START_TEST(msg)
test_SetWindowRgn
();
test_sys_menu
();
test_dialog_messages
();
test_EndDialog
();
test_nullCallback
();
test_dbcs_wm_char
();
test_menu_messages
();
...
...
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