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
bed7e69a
Commit
bed7e69a
authored
Apr 20, 2015
by
Aric Stewart
Committed by
Alexandre Julliard
Apr 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Do not replace focus and active windows with NULL on thread_attach_input.
parent
3f7c4711
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
2 deletions
+140
-2
input.c
dlls/user32/tests/input.c
+133
-0
msg.c
dlls/user32/tests/msg.c
+1
-2
queue.c
server/queue.c
+6
-0
No files found.
dlls/user32/tests/input.c
View file @
bed7e69a
...
...
@@ -2025,6 +2025,138 @@ static void test_Input_mouse(void)
DestroyWindow
(
button_win
);
}
static
LRESULT
WINAPI
MsgCheckProcA
(
HWND
hwnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
return
DefWindowProcA
(
hwnd
,
message
,
wParam
,
lParam
);
}
struct
wnd_event
{
HWND
hwnd
;
HANDLE
start_event
;
BOOL
setWindows
;
};
static
DWORD
WINAPI
thread_proc
(
void
*
param
)
{
MSG
msg
;
struct
wnd_event
*
wnd_event
=
param
;
wnd_event
->
hwnd
=
CreateWindowExA
(
0
,
"TestWindowClass"
,
"window caption text"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
ok
(
wnd_event
->
hwnd
!=
0
,
"Failed to create overlapped window
\n
"
);
if
(
wnd_event
->
setWindows
)
{
SetFocus
(
wnd_event
->
hwnd
);
SetActiveWindow
(
wnd_event
->
hwnd
);
}
SetEvent
(
wnd_event
->
start_event
);
while
(
GetMessageA
(
&
msg
,
0
,
0
,
0
))
{
TranslateMessage
(
&
msg
);
DispatchMessageA
(
&
msg
);
}
return
0
;
}
static
void
test_attach_input
(
void
)
{
HANDLE
hThread
;
HWND
ourWnd
;
DWORD
ret
,
tid
;
struct
wnd_event
wnd_event
;
WNDCLASSA
cls
;
cls
.
style
=
0
;
cls
.
lpfnWndProc
=
MsgCheckProcA
;
cls
.
cbClsExtra
=
0
;
cls
.
cbWndExtra
=
0
;
cls
.
hInstance
=
GetModuleHandleA
(
0
);
cls
.
hIcon
=
0
;
cls
.
hCursor
=
LoadCursorW
(
NULL
,
(
LPCWSTR
)
IDC_ARROW
);
cls
.
hbrBackground
=
(
HBRUSH
)(
COLOR_WINDOW
+
1
);
cls
.
lpszMenuName
=
NULL
;
cls
.
lpszClassName
=
"TestWindowClass"
;
if
(
!
RegisterClassA
(
&
cls
))
return
;
wnd_event
.
start_event
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
wnd_event
.
setWindows
=
FALSE
;
if
(
!
wnd_event
.
start_event
)
{
win_skip
(
"skipping interthread message test under win9x
\n
"
);
return
;
}
hThread
=
CreateThread
(
NULL
,
0
,
thread_proc
,
&
wnd_event
,
0
,
&
tid
);
ok
(
hThread
!=
NULL
,
"CreateThread failed, error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
wnd_event
.
start_event
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
wnd_event
.
start_event
);
ourWnd
=
CreateWindowExA
(
0
,
"TestWindowClass"
,
NULL
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
NULL
);
ok
(
ourWnd
!=
0
,
"failed to create ourWnd window
\n
"
);
SetFocus
(
ourWnd
);
SetActiveWindow
(
ourWnd
);
ret
=
AttachThreadInput
(
GetCurrentThreadId
(),
tid
,
TRUE
);
ok
(
ret
,
"AttachThreadInput error %d
\n
"
,
GetLastError
());
ok
(
GetActiveWindow
()
==
ourWnd
,
"expected active %p, got %p
\n
"
,
ourWnd
,
GetActiveWindow
());
ok
(
GetFocus
()
==
ourWnd
,
"expected focus %p, got %p
\n
"
,
ourWnd
,
GetFocus
());
ret
=
AttachThreadInput
(
GetCurrentThreadId
(),
tid
,
FALSE
);
ok
(
ret
,
"AttachThreadInput error %d
\n
"
,
GetLastError
());
ret
=
PostMessageA
(
wnd_event
.
hwnd
,
WM_QUIT
,
0
,
0
);
ok
(
ret
,
"PostMessageA(WM_QUIT) error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
hThread
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
hThread
);
wnd_event
.
start_event
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
wnd_event
.
setWindows
=
TRUE
;
if
(
!
wnd_event
.
start_event
)
{
win_skip
(
"skipping interthread message test under win9x
\n
"
);
return
;
}
hThread
=
CreateThread
(
NULL
,
0
,
thread_proc
,
&
wnd_event
,
0
,
&
tid
);
ok
(
hThread
!=
NULL
,
"CreateThread failed, error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
wnd_event
.
start_event
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
wnd_event
.
start_event
);
ourWnd
=
CreateWindowExA
(
0
,
"TestWindowClass"
,
"window caption text"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
ok
(
ourWnd
!=
0
,
"failed to create ourWnd window
\n
"
);
SetFocus
(
ourWnd
);
SetActiveWindow
(
ourWnd
);
ret
=
AttachThreadInput
(
GetCurrentThreadId
(),
tid
,
TRUE
);
ok
(
ret
,
"AttachThreadInput error %d
\n
"
,
GetLastError
());
ok
(
GetActiveWindow
()
==
wnd_event
.
hwnd
,
"expected active %p, got %p
\n
"
,
wnd_event
.
hwnd
,
GetActiveWindow
());
ok
(
GetFocus
()
==
wnd_event
.
hwnd
,
"expected focus %p, got %p
\n
"
,
wnd_event
.
hwnd
,
GetFocus
());
ret
=
AttachThreadInput
(
GetCurrentThreadId
(),
tid
,
FALSE
);
ok
(
ret
,
"AttachThreadInput error %d
\n
"
,
GetLastError
());
ret
=
PostMessageA
(
wnd_event
.
hwnd
,
WM_QUIT
,
0
,
0
);
ok
(
ret
,
"PostMessageA(WM_QUIT) error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
hThread
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
hThread
);
}
START_TEST
(
input
)
{
init_function_pointers
();
...
...
@@ -2046,6 +2178,7 @@ START_TEST(input)
test_get_async_key_state
();
test_keyboard_layout_name
();
test_key_names
();
test_attach_input
();
if
(
pGetMouseMovePointsEx
)
test_GetMouseMovePointsEx
();
...
...
dlls/user32/tests/msg.c
View file @
bed7e69a
...
...
@@ -14238,10 +14238,9 @@ todo_wine
ret
=
AttachThreadInput
(
GetCurrentThreadId
(),
tid
,
TRUE
);
ok
(
ret
,
"AttachThreadInput error %d
\n
"
,
GetLastError
());
todo_wine
{
ok
(
GetActiveWindow
()
==
parent
,
"expected active %p, got %p
\n
"
,
parent
,
GetActiveWindow
());
ok
(
GetFocus
()
==
parent
,
"expected focus %p, got %p
\n
"
,
parent
,
GetFocus
());
}
flush_events
();
flush_sequence
();
...
...
server/queue.c
View file @
bed7e69a
...
...
@@ -1063,6 +1063,12 @@ int attach_thread_input( struct thread *thread_from, struct thread *thread_to )
}
release_object
(
desktop
);
if
(
thread_from
->
queue
)
{
if
(
!
input
->
focus
)
input
->
focus
=
thread_from
->
queue
->
input
->
focus
;
if
(
!
input
->
active
)
input
->
active
=
thread_from
->
queue
->
input
->
active
;
}
ret
=
assign_thread_input
(
thread_from
,
input
);
if
(
ret
)
memset
(
input
->
keystate
,
0
,
sizeof
(
input
->
keystate
)
);
release_object
(
input
);
...
...
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