Module: wine Branch: master Commit: 4fcbbf8c9a15c9f18259d5c57b61fa8974121964 URL: https://gitlab.winehq.org/wine/wine/-/commit/4fcbbf8c9a15c9f18259d5c57b61fa8...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon May 29 14:12:25 2023 +0200
winex11: Use the user driver interface to create host desktops.
---
dlls/winex11.drv/desktop.c | 22 +++++++--------------- dlls/winex11.drv/dllmain.c | 10 ---------- dlls/winex11.drv/init.c | 1 + dlls/winex11.drv/unixlib.h | 8 -------- dlls/winex11.drv/window.c | 29 +++++++++++++++++++++++++---- dlls/winex11.drv/winex11.drv.spec | 3 --- dlls/winex11.drv/x11drv.h | 3 +-- dlls/winex11.drv/x11drv_main.c | 2 -- 8 files changed, 34 insertions(+), 44 deletions(-)
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 17431f8215e..168029367d3 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -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.register_event_handlers = NULL; 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. */ -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; Window win; Display *display = thread_init_display();
+ TRACE( "%s %ux%u\n", debugstr_w(name), width, height ); + /* Create window */ win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | FocusChangeMask; @@ -376,20 +376,12 @@ NTSTATUS x11drv_create_desktop( void *arg ) win_attr.colormap = None;
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 ); 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 ); + + X11DRV_init_desktop( win, width, height ); return TRUE; }
diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c index 3aa0a9875d0..99e2d47c508 100644 --- a/dlls/winex11.drv/dllmain.c +++ b/dlls/winex11.drv/dllmain.c @@ -74,16 +74,6 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved ) 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, ¶ms ); -} - /*********************************************************************** * AttachEventQueueToTablet (winex11.@) */ diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 940239250fb..57e24c6aeba 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -409,6 +409,7 @@ static const struct user_driver_funcs x11drv_funcs = .pGetCurrentDisplaySettings = X11DRV_GetCurrentDisplaySettings, .pGetDisplayDepth = X11DRV_GetDisplayDepth, .pUpdateDisplayDevices = X11DRV_UpdateDisplayDevices, + .pCreateDesktop = X11DRV_CreateDesktop, .pCreateWindow = X11DRV_CreateWindow, .pDesktopWindowProc = X11DRV_DesktopWindowProc, .pDestroyWindow = X11DRV_DestroyWindow, diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 0c812896fbc..cc9f0184afd 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -21,7 +21,6 @@
enum x11drv_funcs { - unix_create_desktop, unix_init, unix_systray_clear, unix_systray_dock, @@ -36,13 +35,6 @@ enum x11drv_funcs
#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 */ struct init_params { diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index c7fad985f01..4fa4fb59c90 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1847,13 +1847,13 @@ BOOL X11DRV_DestroyNotify( HWND hwnd, XEvent *event )
/* 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(); Display *display = thread_data->display; 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->managed = TRUE; NtUserSetProp( data->hwnd, whole_window_prop, (HANDLE)win ); @@ -1883,7 +1883,10 @@ void X11DRV_SetDesktopWindow( HWND hwnd )
if (!width && !height) /* not initialized yet */ { - RECT rect = NtUserGetVirtualScreenRect(); + RECT rect; + + X11DRV_DisplayDevices_Init( TRUE ); + rect = NtUserGetVirtualScreenRect();
SERVER_START_REQ( set_window_pos ) { @@ -1898,11 +1901,29 @@ void X11DRV_SetDesktopWindow( HWND hwnd ) wine_server_call( 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 { 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 ); + } } }
diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index a7334eef3d9..6dedae550e8 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -4,8 +4,5 @@ @ cdecl LoadTabletInfo(long) X11DRV_LoadTabletInfo @ cdecl WTInfoW(long long ptr) X11DRV_WTInfoW
-# Desktop -@ cdecl wine_create_desktop(long long) - # System tray @ cdecl wine_notify_icon(long ptr) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 71e1cb60646..40729741aad 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -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 BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, 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 LRESULT X11DRV_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) DECLSPEC_HIDDEN; extern void X11DRV_DestroyWindow( HWND hwnd ) 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_desktop_fullscreen(void) 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_XF86VM_Init(void) DECLSPEC_HIDDEN; @@ -843,7 +843,6 @@ static inline BOOL is_window_rect_mapped( const RECT *rect )
/* unixlib interface */
-extern NTSTATUS x11drv_create_desktop( 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_hide( void *arg ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 3fd6dcab254..5b79e6ce7c7 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -1320,7 +1320,6 @@ NTSTATUS x11drv_client_call( enum client_callback func, UINT arg )
const unixlib_entry_t __wine_unix_call_funcs[] = { - x11drv_create_desktop, x11drv_init, x11drv_systray_clear, x11drv_systray_dock, @@ -1408,7 +1407,6 @@ static NTSTATUS x11drv_wow64_tablet_info( void *arg )
const unixlib_entry_t __wine_unix_call_wow64_funcs[] = { - x11drv_create_desktop, x11drv_wow64_init, x11drv_wow64_systray_clear, x11drv_wow64_systray_dock,