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
9687ceaf
Commit
9687ceaf
authored
Nov 22, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Don't allow activating a WS_CHILD top-level window through SetFocus.
parent
63e6dbc1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
focus.c
dlls/user32/focus.c
+5
-1
win.c
dlls/user32/tests/win.c
+25
-2
No files found.
dlls/user32/focus.c
View file @
9687ceaf
...
...
@@ -266,7 +266,11 @@ HWND WINAPI SetFocus( HWND hwnd )
LONG
style
=
GetWindowLongW
(
hwndTop
,
GWL_STYLE
);
if
(
style
&
(
WS_MINIMIZE
|
WS_DISABLED
))
return
0
;
parent
=
GetAncestor
(
hwndTop
,
GA_PARENT
);
if
(
!
parent
||
parent
==
GetDesktopWindow
())
break
;
if
(
!
parent
||
parent
==
GetDesktopWindow
())
{
if
((
style
&
(
WS_POPUP
|
WS_CHILD
))
==
WS_CHILD
)
return
0
;
break
;
}
if
(
parent
==
get_hwnd_message_parent
())
return
0
;
hwndTop
=
parent
;
}
...
...
dlls/user32/tests/win.c
View file @
9687ceaf
...
...
@@ -2513,7 +2513,7 @@ static LRESULT WINAPI set_focus_on_activate_proc(HWND hwnd, UINT msg, WPARAM wp,
static
void
test_SetFocus
(
HWND
hwnd
)
{
HWND
child
,
child2
;
HWND
child
,
child2
,
ret
;
WNDPROC
old_wnd_proc
;
/* check if we can set focus to non-visible windows */
...
...
@@ -2588,9 +2588,32 @@ todo_wine
ok
(
GetActiveWindow
()
==
hwnd
,
"parent window %p should be active
\n
"
,
hwnd
);
todo_wine
ok
(
GetFocus
()
==
child
,
"Focus should be on child %p, not %p
\n
"
,
child
,
GetFocus
()
);
SetWindowLongPtr
(
hwnd
,
GWLP_WNDPROC
,
(
LONG_PTR
)
old_wnd_proc
);
SetFocus
(
hwnd
);
SetParent
(
child
,
GetDesktopWindow
());
SetParent
(
child2
,
child
);
ok
(
GetActiveWindow
()
==
hwnd
,
"parent window %p should be active
\n
"
,
hwnd
);
ok
(
GetFocus
()
==
hwnd
,
"Focus should be on parent %p
\n
"
,
hwnd
);
ret
=
SetFocus
(
child2
);
ok
(
ret
==
0
,
"SetFocus %p should fail
\n
"
,
child2
);
ok
(
GetActiveWindow
()
==
hwnd
,
"parent window %p should be active
\n
"
,
hwnd
);
ok
(
GetFocus
()
==
hwnd
,
"Focus should be on parent %p
\n
"
,
hwnd
);
ret
=
SetFocus
(
child
);
ok
(
ret
==
0
,
"SetFocus %p should fail
\n
"
,
child
);
ok
(
GetActiveWindow
()
==
hwnd
,
"parent window %p should be active
\n
"
,
hwnd
);
ok
(
GetFocus
()
==
hwnd
,
"Focus should be on parent %p
\n
"
,
hwnd
);
SetWindowLongW
(
child
,
GWL_STYLE
,
WS_POPUP
|
WS_CHILD
);
SetFocus
(
child2
);
ok
(
GetActiveWindow
()
==
child
,
"child window %p should be active
\n
"
,
child
);
ok
(
GetFocus
()
==
child2
,
"Focus should be on child2 %p
\n
"
,
child2
);
SetFocus
(
hwnd
);
ok
(
GetActiveWindow
()
==
hwnd
,
"parent window %p should be active
\n
"
,
hwnd
);
ok
(
GetFocus
()
==
hwnd
,
"Focus should be on parent %p
\n
"
,
hwnd
);
SetFocus
(
child
);
ok
(
GetActiveWindow
()
==
child
,
"child window %p should be active
\n
"
,
child
);
ok
(
GetFocus
()
==
child
,
"Focus should be on child %p
\n
"
,
child
);
DestroyWindow
(
child2
);
DestroyWindow
(
child
);
}
...
...
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