ddraw: Don't include window border in default surface size

Samuel Lidén Borell samuellb at bredband.net
Sun Mar 4 13:08:04 CST 2007


If no width or height is passed to CreateSurface, use GetClientRect
instead of GetWindowRect to calculate a default size.

-------------- next part --------------
>From aa542d2694792e4d519755445fcc666e718dd775 Mon Sep 17 00:00:00 2001
From: Samuel Liden Borell <samuellb at bredband.net>
Date: Sun, 4 Mar 2007 20:00:22 +0100
Subject: [PATCH] ddraw: Don't include window border in default surface size

If no width or height is passed to CreateSurface, use GetClientRect
instead of GetWindowRect to calculate a default size.
---
 dlls/ddraw/ddraw.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 3270e41..c2d3a94 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -2131,7 +2131,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
         if( (hr == D3D_OK) && (window != 0) )
         {
             RECT rect;
-            if(GetWindowRect(window, &rect) )
+            if(GetClientRect(window, &rect) )
             {
                 /* This is a hack until I find a better solution */
                 if( (rect.right - rect.left) <= 1 ||
@@ -2143,9 +2143,8 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
                 }
                 else
                 {
-                    /* Not sure if this is correct */
-                    desc2.dwWidth = rect.right - rect.left;
-                    desc2.dwHeight = rect.bottom - rect.top;
+                    desc2.dwWidth = rect.right;
+                    desc2.dwHeight = rect.bottom;
                     TRACE("Using window %p's dimensions: %dx%d\n", window, desc2.dwWidth, desc2.dwHeight);
                 }
             }
-- 
1.4.4.3



More information about the wine-patches mailing list