Remove hwnd and hdc, so it being store to right struct.
authorMagnus Olsen <magnus@greatlord.com>
Sat, 5 Nov 2005 15:05:31 +0000 (15:05 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Sat, 5 Nov 2005 15:05:31 +0000 (15:05 +0000)
svn path=/trunk/; revision=19015

reactos/lib/ddraw/hal/ddraw_hal.c
reactos/lib/ddraw/main/ddraw_main.c
reactos/lib/ddraw/rosdraw.h

index 6997c15..dc4caab 100644 (file)
@@ -19,12 +19,9 @@ HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface)
     This->DirectDrawGlobal.lp16DD = &This->DirectDrawGlobal;
 
     /* get the object */
     This->DirectDrawGlobal.lp16DD = &This->DirectDrawGlobal;
 
     /* get the object */
-    if(!DdCreateDirectDrawObject (&This->DirectDrawGlobal, This->hdc))
+    if(!DdCreateDirectDrawObject (&This->DirectDrawGlobal, (HDC)This->DirectDrawGlobal.lpExclusiveOwner->hDC ))
         return DDERR_INVALIDPARAMS;
         return DDERR_INVALIDPARAMS;
-
-       BOOL dummy;
-       DdReenableDirectDrawObject(&This->DirectDrawGlobal, &dummy);
-            
+       
     /* alloc all the space */
     This->DirectDrawGlobal.lpDDCBtmp = (LPDDHAL_CALLBACKS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
                                                                     sizeof(DDHAL_CALLBACKS));        
     /* alloc all the space */
     This->DirectDrawGlobal.lpDDCBtmp = (LPDDHAL_CALLBACKS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
                                                                     sizeof(DDHAL_CALLBACKS));        
@@ -267,12 +264,14 @@ HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface)
     This->HalInfo.GetDriverInfo(&DriverInfo);
     
     /* Get the ZPixelFormats */
     This->HalInfo.GetDriverInfo(&DriverInfo);
     
     /* Get the ZPixelFormats */
+       /* take off this it until we figout how lpexluisev should be fild in 
     This->DirectDrawGlobal.lpZPixelFormats = (LPDDPIXELFORMAT) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
                                                sizeof(DDPIXELFORMAT) * This->DirectDrawGlobal.dwNumZPixelFormats);
     DriverInfo.guidInfo = GUID_ZPixelFormats;
     DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpZPixelFormats;
     DriverInfo.dwExpectedSize = sizeof(DDPIXELFORMAT);
     This->HalInfo.GetDriverInfo(&DriverInfo);
     This->DirectDrawGlobal.lpZPixelFormats = (LPDDPIXELFORMAT) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
                                                sizeof(DDPIXELFORMAT) * This->DirectDrawGlobal.dwNumZPixelFormats);
     DriverInfo.guidInfo = GUID_ZPixelFormats;
     DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpZPixelFormats;
     DriverInfo.dwExpectedSize = sizeof(DDPIXELFORMAT);
     This->HalInfo.GetDriverInfo(&DriverInfo);
+       */
     
     /* Setup some info from the callbacks we got  */    
     DDHAL_GETAVAILDRIVERMEMORYDATA  mem;
     
     /* Setup some info from the callbacks we got  */    
     DDHAL_GETAVAILDRIVERMEMORYDATA  mem;
index e9bb331..16a0f6d 100644 (file)
@@ -21,14 +21,23 @@ HRESULT WINAPI Main_DirectDraw_Initialize (LPDIRECTDRAW7 iface, LPGUID lpGUID)
 
     This->InitializeDraw = TRUE;
 
 
     This->InitializeDraw = TRUE;
 
-   
-
-           
-    // get the HDC
-    This->hdc = GetWindowDC(GetDesktopWindow());
-    This->Height = GetDeviceCaps(This->hdc, VERTRES);
-    This->Width = GetDeviceCaps(This->hdc, HORZRES);
-    This->Bpp = GetDeviceCaps(This->hdc, BITSPIXEL);
+    /* Setup the lpExclusiveOwner struct in msdn this struct member is undoc 
+          I am using there name to figout which info it should be fild with 
+          My hardware drv does not support call to SetExusive so I can not 
+          debug it see how it should be fild 
+       */
+       
+       This->DirectDrawGlobal.lpExclusiveOwner = &This->ExclusiveOwner;
+       memset(&This->ExclusiveOwner, 0, sizeof(DDRAWI_DIRECTDRAW_LCL));
+
+       This->DirectDrawGlobal.lpExclusiveOwner->dwProcessId = GetCurrentProcessId();   
+       This->DirectDrawGlobal.lpExclusiveOwner->hDC = ((ULONG_PTR)GetWindowDC(GetDesktopWindow())); 
+       This->DirectDrawGlobal.lpExclusiveOwner->hWnd = ((ULONG_PTR)GetDesktopWindow());
+       This->DirectDrawGlobal.lpExclusiveOwner->lpGbl = &This->DirectDrawGlobal;
+                
+    This->Height = GetDeviceCaps((HDC)This->DirectDrawGlobal.lpExclusiveOwner->hDC , VERTRES);
+    This->Width = GetDeviceCaps((HDC)This->DirectDrawGlobal.lpExclusiveOwner->hDC , HORZRES);
+    This->Bpp = GetDeviceCaps((HDC)This->DirectDrawGlobal.lpExclusiveOwner->hDC , BITSPIXEL);
 
     // call software first
     if((ret = Hal_DirectDraw_Initialize (iface)) != DD_OK)
 
     // call software first
     if((ret = Hal_DirectDraw_Initialize (iface)) != DD_OK)
@@ -51,12 +60,9 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw
     IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
 
     // check the parameters
     IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
 
     // check the parameters
-    if (This->cooperative_level == cooplevel && This->window == hwnd)
+    if ((This->cooperative_level == cooplevel) && ((HWND)This->DirectDrawGlobal.lpExclusiveOwner->hWnd  == hwnd))
         return DD_OK;
         return DD_OK;
-
-    if (This->window)
-        return DDERR_HWNDALREADYSET;
-
+    
     if (This->cooperative_level)
         return DDERR_EXCLUSIVEMODEALREADYSET;
 
     if (This->cooperative_level)
         return DDERR_EXCLUSIVEMODEALREADYSET;
 
@@ -67,8 +73,8 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw
         return DDERR_INVALIDPARAMS;
 
     // set the data
         return DDERR_INVALIDPARAMS;
 
     // set the data
-    This->window = hwnd;
-    This->hdc = GetDC(hwnd);
+    This->DirectDrawGlobal.lpExclusiveOwner->hWnd = (ULONG_PTR) hwnd;
+    This->DirectDrawGlobal.lpExclusiveOwner->hDC  = (ULONG_PTR)GetDC(hwnd);
     This->cooperative_level = cooplevel;
 
     if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE) 
     This->cooperative_level = cooplevel;
 
     if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE) 
index 6fa7f37..e7ab653 100644 (file)
 
 typedef struct 
 {
 
 typedef struct 
 {
+       /* Setup the Vtbl COM table */
        IDirectDraw7Vtbl* lpVtbl;
        IDirectDraw4Vtbl* lpVtbl_v4;
        IDirectDraw2Vtbl* lpVtbl_v2;
        IDirectDrawVtbl*  lpVtbl_v1;
 
        IDirectDraw7Vtbl* lpVtbl;
        IDirectDraw4Vtbl* lpVtbl_v4;
        IDirectDraw2Vtbl* lpVtbl_v2;
        IDirectDrawVtbl*  lpVtbl_v1;
 
+       /* The main struct that contain all info from the HAL and HEL */
        DDRAWI_DIRECTDRAW_GBL DirectDrawGlobal;
        DDRAWI_DIRECTDRAW_GBL DirectDrawGlobal;
+
+       /* ExclusiveOwner */
+       DDRAWI_DIRECTDRAW_LCL ExclusiveOwner;
+                               
+       /* MISC info that will be remove in futuer */   
        DDHAL_DDMISCELLANEOUSCALLBACKS Misc2Callback;
        DDHALINFO HalInfo;      
        DDHAL_DDMISCELLANEOUSCALLBACKS Misc2Callback;
        DDHALINFO HalInfo;      
-
-    HWND window;
-    DWORD cooperative_level;
-       HDC hdc;
+    
+    DWORD cooperative_level;   
        int Height, Width, Bpp;
 
        int Height, Width, Bpp;
 
-       GUID InGUID;
        BOOL InitializeDraw;
 
        BOOL InitializeDraw;
 
+
 } IDirectDrawImpl; 
 
 /******** Surface Object ********/
 } IDirectDrawImpl; 
 
 /******** Surface Object ********/