Rémi Bernon : winex11.drv: Remove frame when non-client area is empty.

Alexandre Julliard julliard at winehq.org
Fri Aug 7 10:42:29 CDT 2020


Module: wine
Branch: stable
Commit: 6681fb522e035edee5d2939c151c51d6ca6fe1a1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6681fb522e035edee5d2939c151c51d6ca6fe1a1

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed Mar 18 14:46:07 2020 +0100

winex11.drv: Remove frame when non-client area is empty.

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 47f69a22484a5b0c1286cb0f430976d97fa6d9a0)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 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 99e4094ebd..4676b09935 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 */
 




More information about the wine-cvs mailing list