[PATCH v2 1/2] winex11.drv: Remove frame when non-client area is empty.

Rémi Bernon rbernon at codeweavers.com
Wed Mar 18 08:46:07 CDT 2020


Several applications -Steam, Battle.net for instance- handle the
WM_NCCALCSIZE message to override the non-client areas size and make
the client area cover the whole window, instead of changing the styles.

In winex11.drv, in decorated mode, we adjust the window rect according
to the window style to hide the unwanted decorations behind the frame,
but when client and window rects are equals, there's nothing to hide
and the actual window styles are irrelevant and can safely be ignored.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40930
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

v2: Use the new window and client rectangles from within the
X11DRV_WindowPosChanging callback.

 dlls/winex11.drv/window.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 99e4094ebd9..4676b099358 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -280,13 +280,16 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl
  *              get_mwm_decorations
  */
 static unsigned long get_mwm_decorations( struct x11drv_win_data *data,
-                                          DWORD style, DWORD ex_style )
+                                          DWORD style, DWORD ex_style,
+                                          const RECT *window_rect,
+                                          const RECT *client_rect )
 {
     unsigned long ret = 0;
 
     if (!decorated_mode) return 0;
 
-    if (IsRectEmpty( &data->window_rect )) return 0;
+    if (EqualRect( window_rect, client_rect )) return 0;
+    if (IsRectEmpty( window_rect )) return 0;
     if (data->shaped) return 0;
 
     if (ex_style & WS_EX_TOOLWINDOW) return 0;
@@ -712,7 +715,7 @@ static void set_mwm_hints( struct x11drv_win_data *data, DWORD style, DWORD ex_s
     }
     else
     {
-        mwm_hints.decorations = get_mwm_decorations( data, style, ex_style );
+        mwm_hints.decorations = get_mwm_decorations( data, style, ex_style, &data->window_rect, &data->client_rect );
         mwm_hints.functions = MWM_FUNC_MOVE;
         if (is_window_resizable( data, style )) mwm_hints.functions |= MWM_FUNC_RESIZE;
         if (!(style & WS_DISABLED))
@@ -1157,7 +1160,8 @@ void make_window_embedded( struct x11drv_win_data *data )
  *
  * Convert a rect from client to X window coordinates
  */
-static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect )
+static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect,
+                                     const RECT *window_rect, const RECT *client_rect )
 {
     DWORD style, ex_style, style_mask = 0, ex_style_mask = 0;
     unsigned long decor;
@@ -1168,7 +1172,7 @@ static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect )
 
     style = GetWindowLongW( data->hwnd, GWL_STYLE );
     ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE );
-    decor = get_mwm_decorations( data, style, ex_style );
+    decor = get_mwm_decorations( data, style, ex_style, window_rect, client_rect );
 
     if (decor & MWM_DECOR_TITLE) style_mask |= WS_CAPTION;
     if (decor & MWM_DECOR_BORDER)
@@ -2274,7 +2278,7 @@ void CDECL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flag
     }
 
     *visible_rect = *window_rect;
-    X11DRV_window_to_X_rect( data, visible_rect );
+    X11DRV_window_to_X_rect( data, visible_rect, window_rect, client_rect );
 
     /* create the window surface if necessary */
 
-- 
2.26.0.rc2




More information about the wine-devel mailing list