ddraw: Don't include window border in default surface size (ignore the other patch)

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


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


-------------- next part --------------
>From 07cc77860b1c19d6e0f789bc526d9a0bd6b2c11e Mon Sep 17 00:00:00 2001
From: Samuel Liden Borell <samuellb at bredband.net>
Date: Sun, 4 Mar 2007 20:34:52 +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 |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 3270e41..f087281 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -2131,21 +2131,20 @@ 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 ||
-                    (rect.bottom - rect.top) <= 1 )
+                if((rect.right  <= 1) ||
+                   (rect.bottom <= 1))
                 {
                     FIXME("Wanted to get surface dimensions from window %p, but it has only "
                            "a size of %dx%d. Using full screen dimensions\n",
-                           window, rect.right - rect.left, rect.bottom - rect.top);
+                           window, rect.right, rect.bottom);
                 }
                 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