server: Allow to specify the class name instead of the atom to find a window.
diff --git a/server/protocol.def b/server/protocol.def
index 5cb951d..90e943b 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2131,6 +2131,7 @@
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 */
diff --git a/server/trace.c b/server/trace.c
index 2460cde..7275e65 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -2635,7 +2635,9 @@
{
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 )
diff --git a/server/window.c b/server/window.c
index 3e8219b..8cf8001 100644
--- a/server/window.c
+++ b/server/window.c
@@ -1757,12 +1757,19 @@
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 @@
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);