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
a54a990b
Commit
a54a990b
authored
Nov 02, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Allow to specify the class name instead of the atom to find a window.
parent
1fc461f9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
52 deletions
+39
-52
win.c
dlls/user32/win.c
+24
-48
server_protocol.h
include/wine/server_protocol.h
+2
-1
protocol.def
server/protocol.def
+1
-0
trace.c
server/trace.c
+3
-1
window.c
server/window.c
+9
-2
No files found.
dlls/user32/win.c
View file @
a54a990b
...
...
@@ -211,7 +211,7 @@ static WND *free_window_handle( HWND hwnd )
* Build an array of the children of a given window. The array must be
* freed with HeapFree. Returns NULL when no windows are found.
*/
static
HWND
*
list_window_children
(
HWND
hwnd
,
ATOM
atom
,
DWORD
tid
)
static
HWND
*
list_window_children
(
HWND
hwnd
,
LPCWSTR
class
,
DWORD
tid
)
{
HWND
*
list
;
int
size
=
32
;
...
...
@@ -225,8 +225,9 @@ static HWND *list_window_children( HWND hwnd, ATOM atom, DWORD tid )
SERVER_START_REQ
(
get_window_children
)
{
req
->
parent
=
hwnd
;
req
->
atom
=
atom
;
req
->
tid
=
tid
;
if
(
!
(
req
->
atom
=
get_int_atom_value
(
class
))
&&
class
)
wine_server_add_data
(
req
,
class
,
strlenW
(
class
)
*
sizeof
(
WCHAR
)
);
wine_server_set_reply
(
req
,
list
,
(
size
-
1
)
*
sizeof
(
HWND
)
);
if
(
!
wine_server_call
(
req
))
count
=
reply
->
count
;
}
...
...
@@ -1398,11 +1399,9 @@ BOOL WINAPI OpenIcon( HWND hwnd )
/***********************************************************************
* WIN_FindWindow
*
* Implementation of FindWindow() and FindWindowEx().
* FindWindowExW (USER32.@)
*/
static
HWND
WIN_FindWindow
(
HWND
parent
,
HWND
child
,
ATOM
className
,
LPCWSTR
title
)
HWND
WINAPI
FindWindowExW
(
HWND
parent
,
HWND
child
,
LPCWSTR
className
,
LPCWSTR
title
)
{
HWND
*
list
=
NULL
;
HWND
retvalue
=
0
;
...
...
@@ -1458,54 +1457,31 @@ HWND WINAPI FindWindowA( LPCSTR className, LPCSTR title )
/***********************************************************************
* FindWindowExA (USER32.@)
*/
HWND
WINAPI
FindWindowExA
(
HWND
parent
,
HWND
child
,
LPCSTR
className
,
LPCSTR
title
)
HWND
WINAPI
FindWindowExA
(
HWND
parent
,
HWND
child
,
LPCSTR
className
,
LPCSTR
title
)
{
ATOM
atom
=
0
;
LPWSTR
buffer
;
HWND
hwnd
;
INT
len
;
LPWSTR
titleW
=
NULL
;
HWND
hwnd
=
0
;
if
(
className
)
{
/* If the atom doesn't exist, then no class */
/* with this name exists either. */
if
(
!
(
atom
=
GlobalFindAtomA
(
className
)))
if
(
title
)
{
SetLastError
(
ERROR_CANNOT_FIND_WND_CLASS
);
return
0
;
}
DWORD
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
title
,
-
1
,
NULL
,
0
);
if
(
!
(
titleW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
0
;
MultiByteToWideChar
(
CP_ACP
,
0
,
title
,
-
1
,
titleW
,
len
);
}
if
(
!
title
)
return
WIN_FindWindow
(
parent
,
child
,
atom
,
NULL
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
title
,
-
1
,
NULL
,
0
);
if
(
!
(
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
0
;
MultiByteToWideChar
(
CP_ACP
,
0
,
title
,
-
1
,
buffer
,
len
);
hwnd
=
WIN_FindWindow
(
parent
,
child
,
atom
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
hwnd
;
}
/***********************************************************************
* FindWindowExW (USER32.@)
*/
HWND
WINAPI
FindWindowExW
(
HWND
parent
,
HWND
child
,
LPCWSTR
className
,
LPCWSTR
title
)
{
ATOM
atom
=
0
;
if
(
className
)
{
/* If the atom doesn't exist, then no class */
/* with this name exists either. */
if
(
!
(
atom
=
GlobalFindAtomW
(
className
)))
if
(
!
IS_INTRESOURCE
(
className
))
{
SetLastError
(
ERROR_CANNOT_FIND_WND_CLASS
);
return
0
;
WCHAR
classW
[
256
];
if
(
MultiByteToWideChar
(
CP_ACP
,
0
,
className
,
-
1
,
classW
,
sizeof
(
classW
)
/
sizeof
(
WCHAR
)
))
hwnd
=
FindWindowExW
(
parent
,
child
,
classW
,
titleW
);
}
else
{
hwnd
=
FindWindowExW
(
parent
,
child
,
(
LPCWSTR
)
className
,
titleW
);
}
return
WIN_FindWindow
(
parent
,
child
,
atom
,
title
);
HeapFree
(
GetProcessHeap
(),
0
,
titleW
);
return
hwnd
;
}
...
...
@@ -2774,7 +2750,7 @@ HWND WINAPI GetLastActivePopup( HWND hwnd )
*/
HWND
*
WIN_ListChildren
(
HWND
hwnd
)
{
return
list_window_children
(
hwnd
,
0
,
0
);
return
list_window_children
(
hwnd
,
NULL
,
0
);
}
...
...
@@ -2818,7 +2794,7 @@ BOOL WINAPI EnumThreadWindows( DWORD id, WNDENUMPROC func, LPARAM lParam )
USER_CheckNotLock
();
if
(
!
(
list
=
list_window_children
(
GetDesktopWindow
(),
0
,
id
)))
return
TRUE
;
if
(
!
(
list
=
list_window_children
(
GetDesktopWindow
(),
NULL
,
id
)))
return
TRUE
;
/* Now call the callback function for every window */
...
...
include/wine/server_protocol.h
View file @
a54a990b
...
...
@@ -2888,6 +2888,7 @@ struct get_window_children_request
user_handle_t
parent
;
atom_t
atom
;
thread_id_t
tid
;
/* VARARG(class,unicode_str); */
};
struct
get_window_children_reply
{
...
...
@@ -4884,6 +4885,6 @@ union generic_reply
struct
set_completion_info_reply
set_completion_info_reply
;
};
#define SERVER_PROTOCOL_VERSION 32
7
#define SERVER_PROTOCOL_VERSION 32
8
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
server/protocol.def
View file @
a54a990b
...
...
@@ -2131,6 +2131,7 @@ enum message_type
user_handle_t parent; /* parent window */
atom_t atom; /* class atom for the listed children */
thread_id_t tid; /* thread owning the listed children */
VARARG(class,unicode_str); /* class name */
@REPLY
int count; /* total count of children */
VARARG(children,user_handles); /* children handles */
...
...
server/trace.c
View file @
a54a990b
...
...
@@ -2635,7 +2635,9 @@ static void dump_get_window_children_request( const struct get_window_children_r
{
fprintf
(
stderr
,
" parent=%p,"
,
req
->
parent
);
fprintf
(
stderr
,
" atom=%04x,"
,
req
->
atom
);
fprintf
(
stderr
,
" tid=%04x"
,
req
->
tid
);
fprintf
(
stderr
,
" tid=%04x,"
,
req
->
tid
);
fprintf
(
stderr
,
" class="
);
dump_varargs_unicode_str
(
cur_size
);
}
static
void
dump_get_window_children_reply
(
const
struct
get_window_children_reply
*
req
)
...
...
server/window.c
View file @
a54a990b
...
...
@@ -1757,12 +1757,19 @@ DECL_HANDLER(get_window_children)
int
total
=
0
;
user_handle_t
*
data
;
data_size_t
len
;
atom_t
atom
=
req
->
atom
;
if
(
get_req_data_size
())
{
atom
=
find_global_atom
(
NULL
,
get_req_data
(),
get_req_data_size
()
/
sizeof
(
WCHAR
)
);
if
(
!
atom
)
return
;
}
if
(
parent
)
{
LIST_FOR_EACH_ENTRY
(
ptr
,
&
parent
->
children
,
struct
window
,
entry
)
{
if
(
req
->
atom
&&
get_class_atom
(
ptr
->
class
)
!=
req
->
atom
)
continue
;
if
(
atom
&&
get_class_atom
(
ptr
->
class
)
!=
atom
)
continue
;
if
(
req
->
tid
&&
get_thread_id
(
ptr
->
thread
)
!=
req
->
tid
)
continue
;
total
++
;
}
...
...
@@ -1774,7 +1781,7 @@ DECL_HANDLER(get_window_children)
LIST_FOR_EACH_ENTRY
(
ptr
,
&
parent
->
children
,
struct
window
,
entry
)
{
if
(
len
<
sizeof
(
*
data
))
break
;
if
(
req
->
atom
&&
get_class_atom
(
ptr
->
class
)
!=
req
->
atom
)
continue
;
if
(
atom
&&
get_class_atom
(
ptr
->
class
)
!=
atom
)
continue
;
if
(
req
->
tid
&&
get_thread_id
(
ptr
->
thread
)
!=
req
->
tid
)
continue
;
*
data
++
=
ptr
->
handle
;
len
-=
sizeof
(
*
data
);
...
...
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