From: Roberto Pungartnik Subject: [PATCH] winex11.drv: Virtual desktop window properties Message-Id: Date: Fri, 18 Oct 2019 20:24:00 -0300

winex11.drv: Virtual desktop window properties Virtual desktop depends on max_width and max_height to determine if the window is in full screen or not, and then set window properties(decoration, size). Corrected treatment when launch a new explorer instance before wine server fully shuts down(referenced on commit efbbe66669a060dd01b3ae399f5a9e7328312f03) Signed-off-by: Roberto Pungartnik --- dlls/winex11.drv/desktop.c | 30 +++++++++++++++++++++++------- dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/xinerama.c | 1 + 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index fed8dd32e9..a2312ff1f6 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -140,6 +140,21 @@ static LONG X11DRV_desktop_SetCurrentMode(int mode) return DISP_CHANGE_SUCCESSFUL; } +/*********************************************************************** + * set_max_rect + * + * Update max_width and max_height(used to determine if a virtual + * desktop is in full screen. + */ +void set_max_rect( RECT max_rect ) +{ + if( max_rect.right - max_rect.left > max_width ) + max_width = max_rect.right - max_rect.left; + + if( max_rect.bottom - max_rect.top > max_height ) + max_height = max_rect.bottom - max_rect.top; +} + /*********************************************************************** * X11DRV_init_desktop * @@ -147,18 +162,12 @@ static LONG X11DRV_desktop_SetCurrentMode(int mode) */ void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ) { - RECT primary_rect; - root_window = win; managed_mode = FALSE; /* no managed windows in desktop mode */ xinerama_init( width, height ); X11DRV_DisplayDevices_Init( TRUE ); - primary_rect = get_primary_monitor_rect(); - max_width = primary_rect.right - primary_rect.left; - max_height = primary_rect.bottom - primary_rect.top; - /* initialize the available resolutions */ dd_modes = X11DRV_Settings_SetHandlers("desktop", X11DRV_desktop_GetCurrentMode, @@ -210,7 +219,7 @@ BOOL CDECL X11DRV_create_desktop( UINT width, UINT height ) if (!win) return FALSE; SetRect( &rect, 0, 0, width, height ); - if (is_window_rect_fullscreen( &rect )) + if (is_desktop_rect_fullscreen( &rect )) { TRACE("setting desktop to fullscreen\n"); XChangeProperty( display, win, x11drv_atom(_NET_WM_STATE), XA_ATOM, 32, @@ -263,6 +272,13 @@ BOOL is_desktop_fullscreen(void) primary_rect.bottom - primary_rect.top == max_height); } +/* Check if the desktop is in full screen against monitor max size*/ +BOOL is_desktop_rect_fullscreen( const RECT rect ) +{ + return (rect.right - rect.left == max_width && + rect.bottom - rect.top == max_height); +} + static void update_desktop_fullscreen( unsigned int width, unsigned int height) { Display *display = thread_display(); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 135faa8989..15f37e1866 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -227,6 +227,8 @@ extern const struct gdi_dc_funcs *X11DRV_XRender_Init(void) DECLSPEC_HIDDEN; extern struct opengl_funcs *get_glx_driver(UINT) DECLSPEC_HIDDEN; extern const struct vulkan_funcs *get_vulkan_driver(UINT) DECLSPEC_HIDDEN; +extern void set_max_rect( RECT max_rect ) DECLSPEC_HIDDEN; + /* IME support */ extern void IME_SetOpenStatus(BOOL fOpen) DECLSPEC_HIDDEN; extern void IME_SetCompositionStatus(BOOL fOpen) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c index 61c422e835..891c4b416d 100644 --- a/dlls/winex11.drv/xinerama.c +++ b/dlls/winex11.drv/xinerama.c @@ -334,6 +334,7 @@ void xinerama_init( unsigned int width, unsigned int height ) i, wine_dbgstr_rect(&monitors[i].rcMonitor), wine_dbgstr_rect(&monitors[i].rcWork), (monitors[i].dwFlags & MONITORINFOF_PRIMARY) ? " (primary)" : "" ); + set_max_rect( monitors[i].rcMonitor ); } handler.name = desktop_mode ? "Desktop" : "Xinerama"; -- 2.17.1