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
a1d63d10
Commit
a1d63d10
authored
Jan 27, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Feb 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Keep track of the winstation input desktop.
parent
c77261dd
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
92 additions
and
6 deletions
+92
-6
msg.c
dlls/user32/tests/msg.c
+0
-1
winstation.c
dlls/user32/tests/winstation.c
+0
-2
winstation.c
dlls/win32u/winstation.c
+9
-1
server_protocol.h
include/wine/server_protocol.h
+16
-1
protocol.def
server/protocol.def
+6
-0
request.h
server/request.h
+4
-0
trace.c
server/trace.c
+8
-0
user.h
server/user.h
+2
-0
winstation.c
server/winstation.c
+47
-1
No files found.
dlls/user32/tests/msg.c
View file @
a1d63d10
...
...
@@ -9806,7 +9806,6 @@ static DWORD WINAPI run_in_temp_desktop_thread_func(LPVOID param)
curr_desktop_name
,
sizeof
(
curr_desktop_name
),
&
length
);
ok_
(
file
,
line
)(
result
,
"GetUserObjectInformationA(post_inp_desktop=%p) error %lu [rl = %lu]
\n
"
,
post_inp_desktop
,
GetLastError
(),
length
);
todo_wine
ok_
(
file
,
line
)(
strcmp
(
curr_desktop_name
,
temp_desktop_name
)
==
0
,
"different desktop name: %s != %s (no switch or concurrent WineTest run?)
\n
"
,
debugstr_a
(
curr_desktop_name
),
debugstr_a
(
temp_desktop_name
)
);
...
...
dlls/user32/tests/winstation.c
View file @
a1d63d10
...
...
@@ -693,7 +693,6 @@ static void test_inputdesktop(void)
memset
(
name
,
0
,
sizeof
(
name
));
ret
=
GetUserObjectInformationA
(
input_desk
,
UOI_NAME
,
name
,
1024
,
NULL
);
ok
(
ret
,
"GetUserObjectInformation failed!
\n
"
);
todo_wine
ok
(
!
strcmp
(
name
,
"new_desk"
),
"unexpected desktop %s
\n
"
,
name
);
ret
=
CloseDesktop
(
input_desk
);
ok
(
ret
,
"CloseDesktop failed!
\n
"
);
...
...
@@ -798,7 +797,6 @@ static void test_inputdesktop2(void)
ok
(
hdesk
!=
NULL
,
"OpenDesktop failed!
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
SwitchDesktop
(
hdesk
);
todo_wine
ok
(
!
ret
,
"Switch to desktop belong to non default winstation should fail!
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"last error %08lx
\n
"
,
GetLastError
());
...
...
dlls/win32u/winstation.c
View file @
a1d63d10
...
...
@@ -295,7 +295,15 @@ HDESK WINAPI NtUserOpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK acce
BOOL
WINAPI
NtUserSwitchDesktop
(
HDESK
desktop
)
{
FIXME
(
"desktop %p stub!
\n
"
,
desktop
);
TRACE
(
"desktop %p
\n
"
,
desktop
);
SERVER_START_REQ
(
set_input_desktop
)
{
req
->
handle
=
wine_server_obj_handle
(
desktop
);
if
(
wine_server_call_err
(
req
))
return
FALSE
;
}
SERVER_END_REQ
;
return
TRUE
;
}
...
...
include/wine/server_protocol.h
View file @
a1d63d10
...
...
@@ -3835,6 +3835,18 @@ struct open_input_desktop_reply
struct
set_input_desktop_request
{
struct
request_header
__header
;
obj_handle_t
handle
;
};
struct
set_input_desktop_reply
{
struct
reply_header
__header
;
};
struct
close_desktop_request
{
struct
request_header
__header
;
...
...
@@ -5799,6 +5811,7 @@ enum request
REQ_create_desktop
,
REQ_open_desktop
,
REQ_open_input_desktop
,
REQ_set_input_desktop
,
REQ_close_desktop
,
REQ_get_thread_desktop
,
REQ_set_thread_desktop
,
...
...
@@ -6090,6 +6103,7 @@ union generic_request
struct
create_desktop_request
create_desktop_request
;
struct
open_desktop_request
open_desktop_request
;
struct
open_input_desktop_request
open_input_desktop_request
;
struct
set_input_desktop_request
set_input_desktop_request
;
struct
close_desktop_request
close_desktop_request
;
struct
get_thread_desktop_request
get_thread_desktop_request
;
struct
set_thread_desktop_request
set_thread_desktop_request
;
...
...
@@ -6379,6 +6393,7 @@ union generic_reply
struct
create_desktop_reply
create_desktop_reply
;
struct
open_desktop_reply
open_desktop_reply
;
struct
open_input_desktop_reply
open_input_desktop_reply
;
struct
set_input_desktop_reply
set_input_desktop_reply
;
struct
close_desktop_reply
close_desktop_reply
;
struct
get_thread_desktop_reply
get_thread_desktop_reply
;
struct
set_thread_desktop_reply
set_thread_desktop_reply
;
...
...
@@ -6492,7 +6507,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 79
3
#define SERVER_PROTOCOL_VERSION 79
4
/* ### protocol_version end ### */
...
...
server/protocol.def
View file @
a1d63d10
...
...
@@ -2769,6 +2769,12 @@ enum coords_relative
@END
/* Changes the current input desktop */
@REQ(set_input_desktop)
obj_handle_t handle; /* handle to the desktop */
@END
/* Close a desktop */
@REQ(close_desktop)
obj_handle_t handle; /* handle to the desktop */
...
...
server/request.h
View file @
a1d63d10
...
...
@@ -294,6 +294,7 @@ DECL_HANDLER(enum_winstation);
DECL_HANDLER
(
create_desktop
);
DECL_HANDLER
(
open_desktop
);
DECL_HANDLER
(
open_input_desktop
);
DECL_HANDLER
(
set_input_desktop
);
DECL_HANDLER
(
close_desktop
);
DECL_HANDLER
(
get_thread_desktop
);
DECL_HANDLER
(
set_thread_desktop
);
...
...
@@ -584,6 +585,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(
req_handler
)
req_create_desktop
,
(
req_handler
)
req_open_desktop
,
(
req_handler
)
req_open_input_desktop
,
(
req_handler
)
req_set_input_desktop
,
(
req_handler
)
req_close_desktop
,
(
req_handler
)
req_get_thread_desktop
,
(
req_handler
)
req_set_thread_desktop
,
...
...
@@ -1740,6 +1742,8 @@ C_ASSERT( FIELD_OFFSET(struct open_input_desktop_request, attributes) == 20 );
C_ASSERT
(
sizeof
(
struct
open_input_desktop_request
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
open_input_desktop_reply
,
handle
)
==
8
);
C_ASSERT
(
sizeof
(
struct
open_input_desktop_reply
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
set_input_desktop_request
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
set_input_desktop_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
close_desktop_request
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
close_desktop_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_thread_desktop_request
,
tid
)
==
12
);
...
...
server/trace.c
View file @
a1d63d10
...
...
@@ -3381,6 +3381,11 @@ static void dump_open_input_desktop_reply( const struct open_input_desktop_reply
fprintf
(
stderr
,
" handle=%04x"
,
req
->
handle
);
}
static
void
dump_set_input_desktop_request
(
const
struct
set_input_desktop_request
*
req
)
{
fprintf
(
stderr
,
" handle=%04x"
,
req
->
handle
);
}
static
void
dump_close_desktop_request
(
const
struct
close_desktop_request
*
req
)
{
fprintf
(
stderr
,
" handle=%04x"
,
req
->
handle
);
...
...
@@ -4765,6 +4770,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(
dump_func
)
dump_create_desktop_request
,
(
dump_func
)
dump_open_desktop_request
,
(
dump_func
)
dump_open_input_desktop_request
,
(
dump_func
)
dump_set_input_desktop_request
,
(
dump_func
)
dump_close_desktop_request
,
(
dump_func
)
dump_get_thread_desktop_request
,
(
dump_func
)
dump_set_thread_desktop_request
,
...
...
@@ -5053,6 +5059,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(
dump_func
)
dump_open_desktop_reply
,
(
dump_func
)
dump_open_input_desktop_reply
,
NULL
,
NULL
,
(
dump_func
)
dump_get_thread_desktop_reply
,
NULL
,
(
dump_func
)
dump_enum_desktop_reply
,
...
...
@@ -5339,6 +5346,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"create_desktop"
,
"open_desktop"
,
"open_input_desktop"
,
"set_input_desktop"
,
"close_desktop"
,
"get_thread_desktop"
,
"set_thread_desktop"
,
...
...
server/user.h
View file @
a1d63d10
...
...
@@ -48,6 +48,7 @@ struct winstation
unsigned
int
flags
;
/* winstation flags */
struct
list
entry
;
/* entry in global winstation list */
struct
list
desktops
;
/* list of desktops of this winstation */
struct
desktop
*
input_desktop
;
/* desktop receiving user input */
struct
clipboard
*
clipboard
;
/* clipboard information */
struct
atom_table
*
atom_table
;
/* global atom table */
struct
namespace
*
desktop_names
;
/* namespace for desktops of this winstation */
...
...
@@ -67,6 +68,7 @@ struct desktop
struct
object
obj
;
/* object header */
unsigned
int
flags
;
/* desktop flags */
struct
winstation
*
winstation
;
/* winstation this desktop belongs to */
timeout_t
input_time
;
/* last time this desktop had the input */
struct
list
entry
;
/* entry in winstation list of desktops */
struct
window
*
top_window
;
/* desktop window for this desktop */
struct
window
*
msg_window
;
/* HWND_MESSAGE top window */
...
...
server/winstation.c
View file @
a1d63d10
...
...
@@ -144,6 +144,7 @@ static struct winstation *create_winstation( struct object *root, const struct u
{
/* initialize it if it didn't already exist */
winstation
->
flags
=
flags
;
winstation
->
input_desktop
=
NULL
;
winstation
->
clipboard
=
NULL
;
winstation
->
atom_table
=
NULL
;
list_add_tail
(
&
winstation_list
,
&
winstation
->
entry
);
...
...
@@ -211,6 +212,23 @@ struct winstation *get_process_winstation( struct process *process, unsigned int
access
,
&
winstation_ops
);
}
/* retrieve the winstation current input desktop */
static
struct
desktop
*
get_input_desktop
(
struct
winstation
*
winstation
)
{
struct
desktop
*
desktop
;
if
(
!
(
desktop
=
winstation
->
input_desktop
))
return
NULL
;
return
(
struct
desktop
*
)
grab_object
(
desktop
);
}
/* changes the winstation current input desktop and update its input time */
static
int
set_input_desktop
(
struct
winstation
*
winstation
,
struct
desktop
*
new_desktop
)
{
if
(
!
(
winstation
->
flags
&
WSF_VISIBLE
))
return
0
;
if
(
new_desktop
)
new_desktop
->
input_time
=
current_time
;
winstation
->
input_desktop
=
new_desktop
;
return
1
;
}
/* retrieve a pointer to a desktop object */
struct
desktop
*
get_desktop_obj
(
struct
process
*
process
,
obj_handle_t
handle
,
unsigned
int
access
)
{
...
...
@@ -300,6 +318,15 @@ static int desktop_close_handle( struct object *obj, struct process *process, ob
static
void
desktop_destroy
(
struct
object
*
obj
)
{
struct
desktop
*
desktop
=
(
struct
desktop
*
)
obj
;
struct
winstation
*
winstation
=
desktop
->
winstation
;
if
(
desktop
==
winstation
->
input_desktop
)
{
struct
desktop
*
other
,
*
found
=
NULL
;
LIST_FOR_EACH_ENTRY
(
other
,
&
winstation
->
desktops
,
struct
desktop
,
entry
)
if
(
!
found
||
other
->
input_time
>
found
->
input_time
)
found
=
other
;
set_input_desktop
(
winstation
,
found
);
}
free_hotkeys
(
desktop
,
0
);
if
(
desktop
->
top_window
)
free_window_handle
(
desktop
->
top_window
);
...
...
@@ -561,6 +588,7 @@ DECL_HANDLER(create_desktop)
{
if
((
desktop
=
create_desktop
(
&
name
,
req
->
attributes
,
req
->
flags
,
winstation
)))
{
if
(
!
winstation
->
input_desktop
)
set_input_desktop
(
winstation
,
desktop
);
reply
->
handle
=
alloc_handle
(
current
->
process
,
desktop
,
req
->
access
,
req
->
attributes
);
release_object
(
desktop
);
}
...
...
@@ -608,7 +636,7 @@ DECL_HANDLER(open_input_desktop)
return
;
}
if
((
desktop
=
get_
desktop_obj
(
current
->
process
,
current
->
process
->
desktop
,
0
)))
if
((
desktop
=
get_
input_desktop
(
winstation
)))
{
reply
->
handle
=
alloc_handle
(
current
->
process
,
desktop
,
req
->
access
,
req
->
attributes
);
release_object
(
desktop
);
...
...
@@ -616,6 +644,24 @@ DECL_HANDLER(open_input_desktop)
release_object
(
winstation
);
}
/* changes the current input desktop */
DECL_HANDLER
(
set_input_desktop
)
{
/* FIXME: check access rights */
struct
winstation
*
winstation
;
struct
desktop
*
desktop
;
if
(
!
(
winstation
=
get_process_winstation
(
current
->
process
,
0
)))
return
;
if
((
desktop
=
(
struct
desktop
*
)
get_handle_obj
(
current
->
process
,
req
->
handle
,
0
,
&
desktop_ops
)))
{
if
(
!
set_input_desktop
(
winstation
,
desktop
))
set_error
(
STATUS_ILLEGAL_FUNCTION
);
release_object
(
desktop
);
}
release_object
(
winstation
);
}
/* close a desktop */
DECL_HANDLER
(
close_desktop
)
{
...
...
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