David Adam : ddraw: SETFOCUSWINDOW lives independently of other flags.

Alexandre Julliard julliard at winehq.org
Fri Oct 22 12:30:47 CDT 2010


Module: wine
Branch: master
Commit: 0a90271d6984d047893b6d93d2baa5d20dadfac7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0a90271d6984d047893b6d93d2baa5d20dadfac7

Author: David Adam <david.adam.cnrs at gmail.com>
Date:   Fri Oct 22 08:32:39 2010 +0200

ddraw: SETFOCUSWINDOW lives independently of other flags.

---

 dlls/ddraw/ddraw.c            |   24 ++++++++++++++----------
 dlls/ddraw/tests/ddrawmodes.c |    7 +++++++
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 346c7c5..1f88fa5 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -586,21 +586,23 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
     if(cooplevel & DDSCL_SETFOCUSWINDOW)
     {
         /* This isn't compatible with a lot of flags */
-        if(cooplevel & ( DDSCL_MULTITHREADED   |
-                         DDSCL_FPUSETUP        |
-                         DDSCL_FPUPRESERVE     |
-                         DDSCL_ALLOWREBOOT     |
-                         DDSCL_ALLOWMODEX      |
-                         DDSCL_SETDEVICEWINDOW |
-                         DDSCL_NORMAL          |
-                         DDSCL_EXCLUSIVE       |
-                         DDSCL_FULLSCREEN      ) )
+        if(cooplevel & ( DDSCL_MULTITHREADED      |
+                         DDSCL_CREATEDEVICEWINDOW |
+                         DDSCL_FPUSETUP           |
+                         DDSCL_FPUPRESERVE        |
+                         DDSCL_ALLOWREBOOT        |
+                         DDSCL_ALLOWMODEX         |
+                         DDSCL_SETDEVICEWINDOW    |
+                         DDSCL_NORMAL             |
+                         DDSCL_EXCLUSIVE          |
+                         DDSCL_FULLSCREEN         ) )
         {
             TRACE("Called with incompatible flags, returning DDERR_INVALIDPARAMS\n");
             LeaveCriticalSection(&ddraw_cs);
             return DDERR_INVALIDPARAMS;
         }
-        else if( (This->cooperative_level & DDSCL_FULLSCREEN) && window)
+
+        if( (This->cooperative_level & DDSCL_FULLSCREEN) && window )
         {
             TRACE("Setting DDSCL_SETFOCUSWINDOW with an already set window, returning DDERR_HWNDALREADYSET\n");
             LeaveCriticalSection(&ddraw_cs);
@@ -620,6 +622,8 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
             DestroyWindow(This->devicewindow);
             This->devicewindow = NULL;
         }
+
+        return DD_OK;
     }
     /* DDSCL_NORMAL or DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE */
     if(cooplevel & DDSCL_NORMAL)
diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c
index 709ea5d..b6491f3 100644
--- a/dlls/ddraw/tests/ddrawmodes.c
+++ b/dlls/ddraw/tests/ddrawmodes.c
@@ -557,6 +557,9 @@ static void testcooperativelevels_normal(void)
     surfacedesc.dwBackBufferCount = 1;
     surfacedesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
 
+    rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW);
+    ok(rc==DDERR_INVALIDPARAMS,"SetCooperativeLevel(DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW) returned: %x\n",rc);
+
     /* Do some tests with DDSCL_NORMAL mode */
     /* Fullscreen mode + normal mode + exclusive mode */
     rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_NORMAL);
@@ -604,6 +607,10 @@ static void testcooperativelevels_normal(void)
     if(surface && surface != (IDirectDrawSurface *)0xdeadbeef) IDirectDrawSurface_Release(surface);
 
     /* Set the focus window */
+
+    rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW);
+    ok(rc==DDERR_INVALIDPARAMS,"SetCooperativeLevel(DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW) returned: %x\n",rc);
+
     rc = IDirectDraw_SetCooperativeLevel(lpDD,
         hwnd, DDSCL_SETFOCUSWINDOW);
 




More information about the wine-cvs mailing list