Commit ca97cb87 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

server: Inherit internal desktop flags when creating desktops.

Based on Rémi's idea. CEF applications create their own desktops and so is_virtual_desktop() could incorrectly report that virtual desktop is off if DF_WINE_VIRTUAL_DESKTOP is not inherited. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55810
parent 2990a4f8
......@@ -256,7 +256,8 @@ HDESK WINAPI CreateDesktopW( LPCWSTR name, LPCWSTR device, LPDEVMODEW devmode,
OBJECT_ATTRIBUTES attr;
UNICODE_STRING str;
if (device || (devmode && !(flags & DF_WINE_VIRTUAL_DESKTOP)))
if (device || (devmode && !(flags & DF_WINE_VIRTUAL_DESKTOP))
|| (flags & DF_WINE_ROOT_DESKTOP && flags & DF_WINE_VIRTUAL_DESKTOP))
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
......
......@@ -297,6 +297,7 @@ struct unpack_dde_message_result
#define SPY_RESULT_DEFWND 0x0002
/* CreateDesktop wine specific flag */
#define DF_WINE_ROOT_DESKTOP 0x40000000
#define DF_WINE_VIRTUAL_DESKTOP 0x80000000
/* NtUserMessageCall codes */
......
......@@ -1094,7 +1094,7 @@ void manage_desktop( WCHAR *arg )
{
DEVMODEW devmode = {.dmPelsWidth = width, .dmPelsHeight = height};
/* magic: desktop "root" means use the root window */
if ((using_root = !wcsicmp( name, L"root" ))) desktop = CreateDesktopW( name, NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
if ((using_root = !wcsicmp( name, L"root" ))) desktop = CreateDesktopW( name, NULL, NULL, DF_WINE_ROOT_DESKTOP, DESKTOP_ALL_ACCESS, NULL );
else desktop = CreateDesktopW( name, NULL, &devmode, DF_WINE_VIRTUAL_DESKTOP, DESKTOP_ALL_ACCESS, NULL );
if (!desktop)
{
......
......@@ -221,14 +221,24 @@ struct desktop *get_desktop_obj( struct process *process, obj_handle_t handle, u
static struct desktop *create_desktop( const struct unicode_str *name, unsigned int attr,
unsigned int flags, struct winstation *winstation )
{
struct desktop *desktop;
struct desktop *desktop, *current_desktop;
if ((desktop = create_named_object( &winstation->obj, &desktop_ops, name, attr, NULL )))
{
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
{
/* initialize it if it didn't already exist */
desktop->flags = flags;
/* inherit DF_WINE_*_DESKTOP flags if none of them are specified */
if (!(flags & (DF_WINE_ROOT_DESKTOP | DF_WINE_VIRTUAL_DESKTOP))
&& (current_desktop = get_thread_desktop( current, 0 )))
{
desktop->flags |= current_desktop->flags & (DF_WINE_VIRTUAL_DESKTOP | DF_WINE_ROOT_DESKTOP);
release_object( current_desktop );
}
desktop->winstation = (struct winstation *)grab_object( winstation );
desktop->top_window = NULL;
desktop->msg_window = NULL;
......@@ -243,7 +253,7 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned
}
else
{
desktop->flags |= (flags & DF_WINE_VIRTUAL_DESKTOP);
desktop->flags |= flags & (DF_WINE_VIRTUAL_DESKTOP | DF_WINE_ROOT_DESKTOP);
clear_error();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment