Commit 4fcbbf8c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winex11: Use the user driver interface to create host desktops.

parent e0d3683d
...@@ -348,22 +348,22 @@ void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ) ...@@ -348,22 +348,22 @@ void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height )
desktop_handler.free_monitors = X11DRV_desktop_free_monitors; desktop_handler.free_monitors = X11DRV_desktop_free_monitors;
desktop_handler.register_event_handlers = NULL; desktop_handler.register_event_handlers = NULL;
TRACE("Display device functions are now handled by: Virtual Desktop\n"); TRACE("Display device functions are now handled by: Virtual Desktop\n");
X11DRV_DisplayDevices_Init( TRUE );
} }
/*********************************************************************** /***********************************************************************
* x11drv_create_desktop * X11DRV_CreateDesktop
* *
* Create the X11 desktop window for the desktop mode. * Create the X11 desktop window for the desktop mode.
*/ */
NTSTATUS x11drv_create_desktop( void *arg ) BOOL X11DRV_CreateDesktop( const WCHAR *name, UINT width, UINT height )
{ {
const struct create_desktop_params *params = arg;
XSetWindowAttributes win_attr; XSetWindowAttributes win_attr;
Window win; Window win;
Display *display = thread_init_display(); Display *display = thread_init_display();
TRACE( "%s %ux%u\n", debugstr_w(name), width, height );
/* Create window */ /* Create window */
win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask | win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask |
PointerMotionMask | ButtonPressMask | ButtonReleaseMask | FocusChangeMask; PointerMotionMask | ButtonPressMask | ButtonReleaseMask | FocusChangeMask;
...@@ -376,20 +376,12 @@ NTSTATUS x11drv_create_desktop( void *arg ) ...@@ -376,20 +376,12 @@ NTSTATUS x11drv_create_desktop( void *arg )
win_attr.colormap = None; win_attr.colormap = None;
win = XCreateWindow( display, DefaultRootWindow(display), win = XCreateWindow( display, DefaultRootWindow(display),
0, 0, params->width, params->height, 0, default_visual.depth, InputOutput, 0, 0, width, height, 0, default_visual.depth, InputOutput,
default_visual.visual, CWEventMask | CWCursor | CWColormap, &win_attr ); default_visual.visual, CWEventMask | CWCursor | CWColormap, &win_attr );
if (!win) return FALSE; if (!win) return FALSE;
if (!create_desktop_win_data( win )) return FALSE;
X11DRV_init_desktop( win, params->width, params->height );
if (is_desktop_fullscreen())
{
TRACE("setting desktop to fullscreen\n");
XChangeProperty( display, win, x11drv_atom(_NET_WM_STATE), XA_ATOM, 32,
PropModeReplace, (unsigned char*)&x11drv_atom(_NET_WM_STATE_FULLSCREEN),
1);
}
XFlush( display ); XFlush( display );
X11DRV_init_desktop( win, width, height );
return TRUE; return TRUE;
} }
......
...@@ -74,16 +74,6 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved ) ...@@ -74,16 +74,6 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
return TRUE; return TRUE;
} }
/***********************************************************************
* wine_create_desktop (winex11.@)
*/
BOOL CDECL wine_create_desktop( UINT width, UINT height )
{
struct create_desktop_params params = { .width = width, .height = height };
return X11DRV_CALL( create_desktop, &params );
}
/*********************************************************************** /***********************************************************************
* AttachEventQueueToTablet (winex11.@) * AttachEventQueueToTablet (winex11.@)
*/ */
......
...@@ -409,6 +409,7 @@ static const struct user_driver_funcs x11drv_funcs = ...@@ -409,6 +409,7 @@ static const struct user_driver_funcs x11drv_funcs =
.pGetCurrentDisplaySettings = X11DRV_GetCurrentDisplaySettings, .pGetCurrentDisplaySettings = X11DRV_GetCurrentDisplaySettings,
.pGetDisplayDepth = X11DRV_GetDisplayDepth, .pGetDisplayDepth = X11DRV_GetDisplayDepth,
.pUpdateDisplayDevices = X11DRV_UpdateDisplayDevices, .pUpdateDisplayDevices = X11DRV_UpdateDisplayDevices,
.pCreateDesktop = X11DRV_CreateDesktop,
.pCreateWindow = X11DRV_CreateWindow, .pCreateWindow = X11DRV_CreateWindow,
.pDesktopWindowProc = X11DRV_DesktopWindowProc, .pDesktopWindowProc = X11DRV_DesktopWindowProc,
.pDestroyWindow = X11DRV_DestroyWindow, .pDestroyWindow = X11DRV_DestroyWindow,
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
enum x11drv_funcs enum x11drv_funcs
{ {
unix_create_desktop,
unix_init, unix_init,
unix_systray_clear, unix_systray_clear,
unix_systray_dock, unix_systray_dock,
...@@ -36,13 +35,6 @@ enum x11drv_funcs ...@@ -36,13 +35,6 @@ enum x11drv_funcs
#define X11DRV_CALL(func, params) WINE_UNIX_CALL( unix_ ## func, params ) #define X11DRV_CALL(func, params) WINE_UNIX_CALL( unix_ ## func, params )
/* x11drv_create_desktop params */
struct create_desktop_params
{
UINT width;
UINT height;
};
/* x11drv_init params */ /* x11drv_init params */
struct init_params struct init_params
{ {
......
...@@ -1847,13 +1847,13 @@ BOOL X11DRV_DestroyNotify( HWND hwnd, XEvent *event ) ...@@ -1847,13 +1847,13 @@ BOOL X11DRV_DestroyNotify( HWND hwnd, XEvent *event )
/* initialize the desktop window id in the desktop manager process */ /* initialize the desktop window id in the desktop manager process */
BOOL create_desktop_win_data( Window win ) static BOOL create_desktop_win_data( Window win, HWND hwnd )
{ {
struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_thread_data *thread_data = x11drv_thread_data();
Display *display = thread_data->display; Display *display = thread_data->display;
struct x11drv_win_data *data; struct x11drv_win_data *data;
if (!(data = alloc_win_data( display, NtUserGetDesktopWindow() ))) return FALSE; if (!(data = alloc_win_data( display, hwnd ))) return FALSE;
data->whole_window = win; data->whole_window = win;
data->managed = TRUE; data->managed = TRUE;
NtUserSetProp( data->hwnd, whole_window_prop, (HANDLE)win ); NtUserSetProp( data->hwnd, whole_window_prop, (HANDLE)win );
...@@ -1883,7 +1883,10 @@ void X11DRV_SetDesktopWindow( HWND hwnd ) ...@@ -1883,7 +1883,10 @@ void X11DRV_SetDesktopWindow( HWND hwnd )
if (!width && !height) /* not initialized yet */ if (!width && !height) /* not initialized yet */
{ {
RECT rect = NtUserGetVirtualScreenRect(); RECT rect;
X11DRV_DisplayDevices_Init( TRUE );
rect = NtUserGetVirtualScreenRect();
SERVER_START_REQ( set_window_pos ) SERVER_START_REQ( set_window_pos )
{ {
...@@ -1898,11 +1901,29 @@ void X11DRV_SetDesktopWindow( HWND hwnd ) ...@@ -1898,11 +1901,29 @@ void X11DRV_SetDesktopWindow( HWND hwnd )
wine_server_call( req ); wine_server_call( req );
} }
SERVER_END_REQ; SERVER_END_REQ;
if (!is_virtual_desktop()) return;
if (!create_desktop_win_data( root_window, hwnd ))
{
ERR( "Failed to create virtual desktop window data\n" );
root_window = DefaultRootWindow( gdi_display );
}
else if (is_desktop_fullscreen())
{
Display *display = x11drv_thread_data()->display;
TRACE("setting desktop to fullscreen\n");
XChangeProperty( display, root_window, x11drv_atom(_NET_WM_STATE), XA_ATOM, 32, PropModeReplace,
(unsigned char*)&x11drv_atom(_NET_WM_STATE_FULLSCREEN), 1 );
}
} }
else else
{ {
Window win = (Window)NtUserGetProp( hwnd, whole_window_prop ); Window win = (Window)NtUserGetProp( hwnd, whole_window_prop );
if (win && win != root_window) X11DRV_init_desktop( win, width, height ); if (win && win != root_window)
{
X11DRV_init_desktop( win, width, height );
X11DRV_DisplayDevices_Init( TRUE );
}
} }
} }
......
...@@ -4,8 +4,5 @@ ...@@ -4,8 +4,5 @@
@ cdecl LoadTabletInfo(long) X11DRV_LoadTabletInfo @ cdecl LoadTabletInfo(long) X11DRV_LoadTabletInfo
@ cdecl WTInfoW(long long ptr) X11DRV_WTInfoW @ cdecl WTInfoW(long long ptr) X11DRV_WTInfoW
# Desktop
@ cdecl wine_create_desktop(long long)
# System tray # System tray
@ cdecl wine_notify_icon(long ptr) @ cdecl wine_notify_icon(long ptr)
...@@ -222,6 +222,7 @@ extern BOOL X11DRV_GetCurrentDisplaySettings( LPCWSTR name, BOOL is_primary, LPD ...@@ -222,6 +222,7 @@ extern BOOL X11DRV_GetCurrentDisplaySettings( LPCWSTR name, BOOL is_primary, LPD
extern INT X11DRV_GetDisplayDepth( LPCWSTR name, BOOL is_primary ) DECLSPEC_HIDDEN; extern INT X11DRV_GetDisplayDepth( LPCWSTR name, BOOL is_primary ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, extern BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager,
BOOL force, void *param ) DECLSPEC_HIDDEN; BOOL force, void *param ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_CreateDesktop( const WCHAR *name, UINT width, UINT height ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_CreateWindow( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL X11DRV_CreateWindow( HWND hwnd ) DECLSPEC_HIDDEN;
extern LRESULT X11DRV_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) DECLSPEC_HIDDEN; extern LRESULT X11DRV_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) DECLSPEC_HIDDEN;
extern void X11DRV_DestroyWindow( HWND hwnd ) DECLSPEC_HIDDEN; extern void X11DRV_DestroyWindow( HWND hwnd ) DECLSPEC_HIDDEN;
...@@ -765,7 +766,6 @@ extern void X11DRV_resize_desktop(void) DECLSPEC_HIDDEN; ...@@ -765,7 +766,6 @@ extern void X11DRV_resize_desktop(void) DECLSPEC_HIDDEN;
extern BOOL is_virtual_desktop(void) DECLSPEC_HIDDEN; extern BOOL is_virtual_desktop(void) DECLSPEC_HIDDEN;
extern BOOL is_desktop_fullscreen(void) DECLSPEC_HIDDEN; extern BOOL is_desktop_fullscreen(void) DECLSPEC_HIDDEN;
extern BOOL is_detached_mode(const DEVMODEW *) DECLSPEC_HIDDEN; extern BOOL is_detached_mode(const DEVMODEW *) DECLSPEC_HIDDEN;
extern BOOL create_desktop_win_data( Window win ) DECLSPEC_HIDDEN;
void X11DRV_Settings_Init(void) DECLSPEC_HIDDEN; void X11DRV_Settings_Init(void) DECLSPEC_HIDDEN;
void X11DRV_XF86VM_Init(void) DECLSPEC_HIDDEN; void X11DRV_XF86VM_Init(void) DECLSPEC_HIDDEN;
...@@ -843,7 +843,6 @@ static inline BOOL is_window_rect_mapped( const RECT *rect ) ...@@ -843,7 +843,6 @@ static inline BOOL is_window_rect_mapped( const RECT *rect )
/* unixlib interface */ /* unixlib interface */
extern NTSTATUS x11drv_create_desktop( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS x11drv_systray_clear( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_systray_clear( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS x11drv_systray_dock( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_systray_dock( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS x11drv_systray_hide( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_systray_hide( void *arg ) DECLSPEC_HIDDEN;
......
...@@ -1320,7 +1320,6 @@ NTSTATUS x11drv_client_call( enum client_callback func, UINT arg ) ...@@ -1320,7 +1320,6 @@ NTSTATUS x11drv_client_call( enum client_callback func, UINT arg )
const unixlib_entry_t __wine_unix_call_funcs[] = const unixlib_entry_t __wine_unix_call_funcs[] =
{ {
x11drv_create_desktop,
x11drv_init, x11drv_init,
x11drv_systray_clear, x11drv_systray_clear,
x11drv_systray_dock, x11drv_systray_dock,
...@@ -1408,7 +1407,6 @@ static NTSTATUS x11drv_wow64_tablet_info( void *arg ) ...@@ -1408,7 +1407,6 @@ static NTSTATUS x11drv_wow64_tablet_info( void *arg )
const unixlib_entry_t __wine_unix_call_wow64_funcs[] = const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
{ {
x11drv_create_desktop,
x11drv_wow64_init, x11drv_wow64_init,
x11drv_wow64_systray_clear, x11drv_wow64_systray_clear,
x11drv_wow64_systray_dock, x11drv_wow64_systray_dock,
......
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