Gabriel Ivăncescu : winex11.drv: Fix X11DRV_X_to_window_rect to handle windows smaller than the decoration.

Alexandre Julliard julliard at winehq.org
Wed May 20 15:35:39 CDT 2020


Module: wine
Branch: master
Commit: fff364274774fe51bdc8a0aee22369aac161dcb7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=fff364274774fe51bdc8a0aee22369aac161dcb7

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Tue May 19 15:18:48 2020 +0300

winex11.drv: Fix X11DRV_X_to_window_rect to handle windows smaller than the decoration.

A window can be resized to a smaller size than the decoration (title +
borders), such as when it is minimized. In such cases it is necessary
to recompute the minimum bounds, as it is done in the opposite function
X11DRV_window_to_X_rect, since the real information was lost.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48490
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Alexandre Julliard <julliard 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 595c54a7c0..a16b835424 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1209,12 +1209,16 @@ static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect,
  */
 void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect, int x, int y, int cx, int cy )
 {
-    x += data->window_rect.left - data->whole_rect.left;
-    y += data->window_rect.top - data->whole_rect.top;
-    cx += (data->window_rect.right - data->window_rect.left) -
-          (data->whole_rect.right - data->whole_rect.left);
-    cy += (data->window_rect.bottom - data->window_rect.top) -
-          (data->whole_rect.bottom - data->whole_rect.top);
+    RECT rc;
+
+    get_decoration_rect( data, &rc, &data->window_rect, &data->client_rect );
+
+    x += min( data->window_rect.left - data->whole_rect.left, rc.left );
+    y += min( data->window_rect.top - data->whole_rect.top, rc.top );
+    cx += max( (data->window_rect.right - data->window_rect.left) -
+               (data->whole_rect.right - data->whole_rect.left), rc.right - rc.left );
+    cy += max( (data->window_rect.bottom - data->window_rect.top) -
+               (data->whole_rect.bottom - data->whole_rect.top), rc.bottom - rc.top );
     SetRect( rect, x, y, x + cx, y + cy );
 }
 




More information about the wine-cvs mailing list