server: Make shell, taskman, and progman windows per-desktop.

This commit is contained in:
Tim Clem 2024-09-26 11:55:51 -07:00 committed by Alexandre Julliard
parent ce22a8e81d
commit a7b69cb692
Notes: Alexandre Julliard 2024-10-02 23:22:29 +02:00
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6600
8 changed files with 85 additions and 75 deletions

View file

@ -5993,7 +5993,7 @@ HWND get_shell_window(void)
{
HWND hwnd = 0;
SERVER_START_REQ(set_global_windows)
SERVER_START_REQ(set_desktop_shell_windows)
{
req->flags = 0;
if (!wine_server_call_err(req))
@ -6035,9 +6035,9 @@ BOOL WINAPI NtUserSetShellWindowEx( HWND shell, HWND list_view )
NtUserSetWindowPos( shell, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE );
SERVER_START_REQ(set_global_windows)
SERVER_START_REQ(set_desktop_shell_windows)
{
req->flags = SET_GLOBAL_SHELL_WINDOWS;
req->flags = SET_DESKTOP_SHELL_WINDOWS;
req->shell_window = wine_server_user_handle( shell );
req->shell_listview = wine_server_user_handle( list_view );
ret = !wine_server_call_err(req);
@ -6050,7 +6050,7 @@ HWND get_progman_window(void)
{
HWND ret = 0;
SERVER_START_REQ(set_global_windows)
SERVER_START_REQ(set_desktop_shell_windows)
{
req->flags = 0;
if (!wine_server_call_err(req))
@ -6062,9 +6062,9 @@ HWND get_progman_window(void)
HWND set_progman_window( HWND hwnd )
{
SERVER_START_REQ(set_global_windows)
SERVER_START_REQ(set_desktop_shell_windows)
{
req->flags = SET_GLOBAL_PROGMAN_WINDOW;
req->flags = SET_DESKTOP_PROGMAN_WINDOW;
req->progman_window = wine_server_user_handle( hwnd );
if (wine_server_call_err( req )) hwnd = 0;
}
@ -6076,7 +6076,7 @@ HWND get_taskman_window(void)
{
HWND ret = 0;
SERVER_START_REQ(set_global_windows)
SERVER_START_REQ(set_desktop_shell_windows)
{
req->flags = 0;
if (!wine_server_call_err(req))
@ -6091,9 +6091,9 @@ HWND set_taskman_window( HWND hwnd )
/* hwnd = MSTaskSwWClass
* |-> SysTabControl32
*/
SERVER_START_REQ(set_global_windows)
SERVER_START_REQ(set_desktop_shell_windows)
{
req->flags = SET_GLOBAL_TASKMAN_WINDOW;
req->flags = SET_DESKTOP_TASKMAN_WINDOW;
req->taskman_window = wine_server_user_handle( hwnd );
if (wine_server_call_err( req )) hwnd = 0;
}

View file

@ -4615,7 +4615,7 @@ struct open_token_reply
struct set_global_windows_request
struct set_desktop_shell_windows_request
{
struct request_header __header;
unsigned int flags;
@ -4624,7 +4624,7 @@ struct set_global_windows_request
user_handle_t progman_window;
user_handle_t taskman_window;
};
struct set_global_windows_reply
struct set_desktop_shell_windows_reply
{
struct reply_header __header;
user_handle_t old_shell_window;
@ -4632,9 +4632,9 @@ struct set_global_windows_reply
user_handle_t old_progman_window;
user_handle_t old_taskman_window;
};
#define SET_GLOBAL_SHELL_WINDOWS 0x01
#define SET_GLOBAL_PROGMAN_WINDOW 0x02
#define SET_GLOBAL_TASKMAN_WINDOW 0x04
#define SET_DESKTOP_SHELL_WINDOWS 0x01
#define SET_DESKTOP_PROGMAN_WINDOW 0x02
#define SET_DESKTOP_TASKMAN_WINDOW 0x04
struct adjust_token_privileges_request
@ -6029,7 +6029,7 @@ enum request
REQ_remove_clipboard_listener,
REQ_create_token,
REQ_open_token,
REQ_set_global_windows,
REQ_set_desktop_shell_windows,
REQ_adjust_token_privileges,
REQ_get_token_privileges,
REQ_check_token_privileges,
@ -6324,7 +6324,7 @@ union generic_request
struct remove_clipboard_listener_request remove_clipboard_listener_request;
struct create_token_request create_token_request;
struct open_token_request open_token_request;
struct set_global_windows_request set_global_windows_request;
struct set_desktop_shell_windows_request set_desktop_shell_windows_request;
struct adjust_token_privileges_request adjust_token_privileges_request;
struct get_token_privileges_request get_token_privileges_request;
struct check_token_privileges_request check_token_privileges_request;
@ -6617,7 +6617,7 @@ union generic_reply
struct remove_clipboard_listener_reply remove_clipboard_listener_reply;
struct create_token_reply create_token_reply;
struct open_token_reply open_token_reply;
struct set_global_windows_reply set_global_windows_reply;
struct set_desktop_shell_windows_reply set_desktop_shell_windows_reply;
struct adjust_token_privileges_reply adjust_token_privileges_reply;
struct get_token_privileges_reply get_token_privileges_reply;
struct check_token_privileges_reply check_token_privileges_reply;
@ -6693,7 +6693,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 841
#define SERVER_PROTOCOL_VERSION 842
/* ### protocol_version end ### */

View file

@ -3292,8 +3292,8 @@ enum caret_state
#define OPEN_TOKEN_AS_SELF 2
/* Set/get the global windows */
@REQ(set_global_windows)
/* Set/get the desktop shell windows */
@REQ(set_desktop_shell_windows)
unsigned int flags; /* flags for fields to set (see below) */
user_handle_t shell_window; /* handle to the new shell window */
user_handle_t shell_listview; /* handle to the new shell listview window */
@ -3305,9 +3305,9 @@ enum caret_state
user_handle_t old_progman_window; /* handle to the new program manager window */
user_handle_t old_taskman_window; /* handle to the new task manager window */
@END
#define SET_GLOBAL_SHELL_WINDOWS 0x01 /* set both main shell and listview windows */
#define SET_GLOBAL_PROGMAN_WINDOW 0x02
#define SET_GLOBAL_TASKMAN_WINDOW 0x04
#define SET_DESKTOP_SHELL_WINDOWS 0x01 /* set both main shell and listview windows */
#define SET_DESKTOP_PROGMAN_WINDOW 0x02
#define SET_DESKTOP_TASKMAN_WINDOW 0x04
/* Adjust the privileges held by a token */
@REQ(adjust_token_privileges)

View file

@ -335,7 +335,7 @@ DECL_HANDLER(add_clipboard_listener);
DECL_HANDLER(remove_clipboard_listener);
DECL_HANDLER(create_token);
DECL_HANDLER(open_token);
DECL_HANDLER(set_global_windows);
DECL_HANDLER(set_desktop_shell_windows);
DECL_HANDLER(adjust_token_privileges);
DECL_HANDLER(get_token_privileges);
DECL_HANDLER(check_token_privileges);
@ -629,7 +629,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_remove_clipboard_listener,
(req_handler)req_create_token,
(req_handler)req_open_token,
(req_handler)req_set_global_windows,
(req_handler)req_set_desktop_shell_windows,
(req_handler)req_adjust_token_privileges,
(req_handler)req_get_token_privileges,
(req_handler)req_check_token_privileges,
@ -1999,17 +1999,17 @@ C_ASSERT( FIELD_OFFSET(struct open_token_request, flags) == 24 );
C_ASSERT( sizeof(struct open_token_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct open_token_reply, token) == 8 );
C_ASSERT( sizeof(struct open_token_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_global_windows_request, flags) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_global_windows_request, shell_window) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_global_windows_request, shell_listview) == 20 );
C_ASSERT( FIELD_OFFSET(struct set_global_windows_request, progman_window) == 24 );
C_ASSERT( FIELD_OFFSET(struct set_global_windows_request, taskman_window) == 28 );
C_ASSERT( sizeof(struct set_global_windows_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct set_global_windows_reply, old_shell_window) == 8 );
C_ASSERT( FIELD_OFFSET(struct set_global_windows_reply, old_shell_listview) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_global_windows_reply, old_progman_window) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_global_windows_reply, old_taskman_window) == 20 );
C_ASSERT( sizeof(struct set_global_windows_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct set_desktop_shell_windows_request, flags) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_desktop_shell_windows_request, shell_window) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_desktop_shell_windows_request, shell_listview) == 20 );
C_ASSERT( FIELD_OFFSET(struct set_desktop_shell_windows_request, progman_window) == 24 );
C_ASSERT( FIELD_OFFSET(struct set_desktop_shell_windows_request, taskman_window) == 28 );
C_ASSERT( sizeof(struct set_desktop_shell_windows_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct set_desktop_shell_windows_reply, old_shell_window) == 8 );
C_ASSERT( FIELD_OFFSET(struct set_desktop_shell_windows_reply, old_shell_listview) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_desktop_shell_windows_reply, old_progman_window) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_desktop_shell_windows_reply, old_taskman_window) == 20 );
C_ASSERT( sizeof(struct set_desktop_shell_windows_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct adjust_token_privileges_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct adjust_token_privileges_request, disable_all) == 16 );
C_ASSERT( FIELD_OFFSET(struct adjust_token_privileges_request, get_modified_state) == 20 );

View file

@ -4000,7 +4000,7 @@ static void dump_open_token_reply( const struct open_token_reply *req )
fprintf( stderr, " token=%04x", req->token );
}
static void dump_set_global_windows_request( const struct set_global_windows_request *req )
static void dump_set_desktop_shell_windows_request( const struct set_desktop_shell_windows_request *req )
{
fprintf( stderr, " flags=%08x", req->flags );
fprintf( stderr, ", shell_window=%08x", req->shell_window );
@ -4009,7 +4009,7 @@ static void dump_set_global_windows_request( const struct set_global_windows_req
fprintf( stderr, ", taskman_window=%08x", req->taskman_window );
}
static void dump_set_global_windows_reply( const struct set_global_windows_reply *req )
static void dump_set_desktop_shell_windows_reply( const struct set_desktop_shell_windows_reply *req )
{
fprintf( stderr, " old_shell_window=%08x", req->old_shell_window );
fprintf( stderr, ", old_shell_listview=%08x", req->old_shell_listview );
@ -4977,7 +4977,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_remove_clipboard_listener_request,
(dump_func)dump_create_token_request,
(dump_func)dump_open_token_request,
(dump_func)dump_set_global_windows_request,
(dump_func)dump_set_desktop_shell_windows_request,
(dump_func)dump_adjust_token_privileges_request,
(dump_func)dump_get_token_privileges_request,
(dump_func)dump_check_token_privileges_request,
@ -5268,7 +5268,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
NULL,
(dump_func)dump_create_token_reply,
(dump_func)dump_open_token_reply,
(dump_func)dump_set_global_windows_reply,
(dump_func)dump_set_desktop_shell_windows_reply,
(dump_func)dump_adjust_token_privileges_reply,
(dump_func)dump_get_token_privileges_reply,
(dump_func)dump_check_token_privileges_reply,
@ -5559,7 +5559,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"remove_clipboard_listener",
"create_token",
"open_token",
"set_global_windows",
"set_desktop_shell_windows",
"adjust_token_privileges",
"get_token_privileges",
"check_token_privileges",

View file

@ -73,6 +73,10 @@ struct desktop
struct list threads; /* list of threads connected to this desktop */
struct window *top_window; /* desktop window for this desktop */
struct window *msg_window; /* HWND_MESSAGE top window */
struct window *shell_window; /* shell window for this desktop */
struct window *shell_listview; /* shell list view window for this desktop */
struct window *progman_window; /* progman window for this desktop */
struct window *taskman_window; /* taskman window for this desktop */
struct hook_table *global_hooks; /* table of global hooks on this desktop */
struct list hotkeys; /* list of registered hotkeys */
struct list pointers; /* list of active pointers */

View file

@ -145,12 +145,6 @@ struct user_handle_array
static const rectangle_t empty_rect;
/* global window pointers */
static struct window *shell_window;
static struct window *shell_listview;
static struct window *progman_window;
static struct window *taskman_window;
/* magic HWND_TOP etc. pointers */
#define WINPTR_TOP ((struct window *)1L)
#define WINPTR_BOTTOM ((struct window *)2L)
@ -2022,10 +2016,10 @@ void free_window_handle( struct window *win )
}
/* reset global window pointers, if the corresponding window is destroyed */
if (win == shell_window) shell_window = NULL;
if (win == shell_listview) shell_listview = NULL;
if (win == progman_window) progman_window = NULL;
if (win == taskman_window) taskman_window = NULL;
if (win == win->desktop->shell_window) win->desktop->shell_window = NULL;
if (win == win->desktop->shell_listview) win->desktop->shell_listview = NULL;
if (win == win->desktop->progman_window) win->desktop->progman_window = NULL;
if (win == win->desktop->taskman_window) win->desktop->taskman_window = NULL;
free_hotkeys( win->desktop, win->handle );
cleanup_clipboard_window( win->desktop, win->handle );
destroy_properties( win );
@ -2918,9 +2912,9 @@ DECL_HANDLER(get_window_properties)
}
/* get the new window pointer for a global window, checking permissions */
/* helper for set_global_windows request */
static int get_new_global_window( struct window **win, user_handle_t handle )
/* get the new window pointer for a desktop shell window, checking permissions */
/* helper for set_desktop_shell_windows request */
static int get_new_shell_window( struct window **win, user_handle_t handle )
{
if (!handle)
{
@ -2936,36 +2930,44 @@ static int get_new_global_window( struct window **win, user_handle_t handle )
return (*win != NULL);
}
/* Set/get the global windows */
DECL_HANDLER(set_global_windows)
/* Set/get the desktop shell windows */
DECL_HANDLER(set_desktop_shell_windows)
{
struct window *new_shell_window = shell_window;
struct window *new_shell_listview = shell_listview;
struct window *new_progman_window = progman_window;
struct window *new_taskman_window = taskman_window;
struct desktop *desktop;
struct window *new_shell_window, *new_shell_listview, *new_progman_window, *new_taskman_window;
reply->old_shell_window = shell_window ? shell_window->handle : 0;
reply->old_shell_listview = shell_listview ? shell_listview->handle : 0;
reply->old_progman_window = progman_window ? progman_window->handle : 0;
reply->old_taskman_window = taskman_window ? taskman_window->handle : 0;
if (!(desktop = get_desktop_obj( current->process, current->desktop, 0 ))) return;
if (req->flags & SET_GLOBAL_SHELL_WINDOWS)
new_shell_window = desktop->shell_window;
new_shell_listview = desktop->shell_listview;
new_progman_window = desktop->progman_window;
new_taskman_window = desktop->taskman_window;
reply->old_shell_window = new_shell_window ? new_shell_window->handle : 0;
reply->old_shell_listview = new_shell_listview ? new_shell_listview->handle : 0;
reply->old_progman_window = new_progman_window ? new_progman_window->handle : 0;
reply->old_taskman_window = new_taskman_window ? new_taskman_window->handle : 0;
if (req->flags & SET_DESKTOP_SHELL_WINDOWS)
{
if (!get_new_global_window( &new_shell_window, req->shell_window )) return;
if (!get_new_global_window( &new_shell_listview, req->shell_listview )) return;
if (!get_new_shell_window( &new_shell_window, req->shell_window )) goto done;
if (!get_new_shell_window( &new_shell_listview, req->shell_listview )) goto done;
}
if (req->flags & SET_GLOBAL_PROGMAN_WINDOW)
if (req->flags & SET_DESKTOP_PROGMAN_WINDOW)
{
if (!get_new_global_window( &new_progman_window, req->progman_window )) return;
if (!get_new_shell_window( &new_progman_window, req->progman_window )) goto done;
}
if (req->flags & SET_GLOBAL_TASKMAN_WINDOW)
if (req->flags & SET_DESKTOP_TASKMAN_WINDOW)
{
if (!get_new_global_window( &new_taskman_window, req->taskman_window )) return;
if (!get_new_shell_window( &new_taskman_window, req->taskman_window )) goto done;
}
shell_window = new_shell_window;
shell_listview = new_shell_listview;
progman_window = new_progman_window;
taskman_window = new_taskman_window;
desktop->shell_window = new_shell_window;
desktop->shell_listview = new_shell_listview;
desktop->progman_window = new_progman_window;
desktop->taskman_window = new_taskman_window;
done:
release_object( desktop );
}
/* retrieve layered info for a window */

View file

@ -285,6 +285,10 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned
desktop->winstation = (struct winstation *)grab_object( winstation );
desktop->top_window = NULL;
desktop->msg_window = NULL;
desktop->shell_window = NULL;
desktop->shell_listview = NULL;
desktop->progman_window = NULL;
desktop->taskman_window = NULL;
desktop->global_hooks = NULL;
desktop->close_timeout = NULL;
desktop->foreground_input = NULL;