changeset 4955:fc56181afdd6

RT-23660: WinApi User32.sendMessage HWND_BROADCAST Reviewed-by: Steve Northover, Kevin Rushforth, Chien Yang
author vadim
date Wed, 04 Sep 2013 12:14:42 +0400
parents 57a0f2653086
children bb696d27c662
files modules/graphics/src/main/native-prism-d3d/D3DContext.cc modules/graphics/src/main/native-prism-d3d/D3DContext.h modules/graphics/src/main/native-prism-d3d/D3DContextInit.cc modules/graphics/src/main/native-prism-d3d/D3DPipelineManager.cc modules/graphics/src/main/native-prism-d3d/D3DPipelineManager.h
diffstat 5 files changed, 3 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/native-prism-d3d/D3DContext.cc	Tue Sep 03 16:18:42 2013 -0700
+++ b/modules/graphics/src/main/native-prism-d3d/D3DContext.cc	Wed Sep 04 12:14:42 2013 +0400
@@ -88,7 +88,6 @@
     pd3dObjectEx = pd3dEx;
     pd3dDevice = NULL;
     pd3dDeviceEx = NULL;
-    deviceWindow = 0;
     adapterOrdinal = adapter;
     defaulResourcePool = D3DPOOL_SYSTEMMEM;
 
@@ -161,10 +160,6 @@
     SAFE_RELEASE(pd3dDevice);
     SAFE_RELEASE(pd3dDeviceEx);
 
-    if (deviceWindow) {
-        DestroyWindow(deviceWindow);
-    }
-
     if (phongShader) {
         delete phongShader;
         phongShader = NULL;
--- a/modules/graphics/src/main/native-prism-d3d/D3DContext.h	Tue Sep 03 16:18:42 2013 -0700
+++ b/modules/graphics/src/main/native-prism-d3d/D3DContext.h	Wed Sep 04 12:14:42 2013 +0400
@@ -268,7 +268,6 @@
     IDirect3DDevice9        *pd3dDevice;
     IDirect3DDevice9Ex      *pd3dDeviceEx;
     IDirect3DSurface9       *currentSurface;
-    HWND                     deviceWindow;
     IDirect3D9              *pd3dObject;
     IDirect3D9Ex            *pd3dObjectEx;
 
--- a/modules/graphics/src/main/native-prism-d3d/D3DContextInit.cc	Tue Sep 03 16:18:42 2013 -0700
+++ b/modules/graphics/src/main/native-prism-d3d/D3DContextInit.cc	Wed Sep 04 12:14:42 2013 +0400
@@ -38,6 +38,7 @@
 
     params.Windowed = TRUE;
     params.SwapEffect = D3DSWAPEFFECT_DISCARD;
+    params.hDeviceWindow = GetDesktopWindow();
 
     D3DCAPS9 d3dCaps;
 
@@ -54,16 +55,14 @@
 
     RlsTraceLn(NWT_TRACE_VERBOSE, (hwVertexProcessing ? "\tHARDWARE_VERTEXPROCESSING": "\tSOFTWARE_VERTEXPROCESSING"));
 
-    deviceWindow = D3DPipelineManager::GetInstance()->CreateDeviceFocusWindow(adapterOrdinal);
-
     if (pd3dObjectEx) {
-        hr = pd3dObjectEx->CreateDeviceEx(adapterOrdinal, devType, deviceWindow,
+        hr = pd3dObjectEx->CreateDeviceEx(adapterOrdinal, devType, 0,
             dwBehaviorFlags, &params, 0, &pd3dDeviceEx);
         if (SUCCEEDED(hr)) {
             pd3dDevice = addRef<IDirect3DDevice9>(pd3dDeviceEx);
         }
     } else {
-        hr = pd3dObject->CreateDevice(adapterOrdinal, devType, deviceWindow,
+        hr = pd3dObject->CreateDevice(adapterOrdinal, devType, 0,
             dwBehaviorFlags, &params, &pd3dDevice);
     }
 
--- a/modules/graphics/src/main/native-prism-d3d/D3DPipelineManager.cc	Tue Sep 03 16:18:42 2013 -0700
+++ b/modules/graphics/src/main/native-prism-d3d/D3DPipelineManager.cc	Wed Sep 04 12:14:42 2013 +0400
@@ -48,8 +48,6 @@
         maj == LOBYTE(LOWORD(winVer)) && min <= HIBYTE(LOWORD(winVer));
 }
 
-static LPCTSTR D3DFocusWindowClassName = L"D3DPrismFocusWindow";
-
 inline bool isForcedGPU(IConfig &cfg) { return cfg.getBool("forceGPU"); }
 
 D3DPipelineManager * D3DPipelineManager::CreateInstance(IConfig &cfg) {
@@ -74,7 +72,6 @@
     pd3d9Ex = NULL;
     pAdapters = NULL;
     adapterCount = 0;
-    classAtom = 0;
 
     devType = SelectDeviceType();
 
@@ -170,10 +167,6 @@
         delete[] pAdapters;
         pAdapters = NULL;
     }
-    if (classAtom != 0) {
-        UnregisterClass(D3DFocusWindowClassName, GetModuleHandle(NULL));
-        classAtom = 0;
-    }
     return S_OK;
 }
 
@@ -592,42 +585,6 @@
     return newFormat;
 }
 
-HWND D3DPipelineManager::CreateDeviceFocusWindow(int adapterOrdinal) {
-
-    if (classAtom == 0) {
-        WNDCLASS wc = {};
-        wc.hInstance = GetModuleHandle(NULL);
-        wc.lpfnWndProc = DefWindowProc;
-        wc.lpszClassName = D3DFocusWindowClassName;
-
-        classAtom = RegisterClass(&wc);
-        if (classAtom == 0) {
-            DWORD lastError = GetLastError();
-            RlsTraceLn1(NWT_TRACE_ERROR,
-                "CreateFocusWindow: error registering window class, lastError=%d", lastError);
-            return 0;
-        }
-    }
-
-    MONITORINFO mi = { sizeof(MONITORINFO) };
-    HMONITOR hMon = pd3d9->GetAdapterMonitor(adapterOrdinal);
-    if (hMon == 0 || !GetMonitorInfo(hMon, (LPMONITORINFO)&mi)) {
-        RlsTraceLn1(NWT_TRACE_ERROR,
-            "CreateFocusWindow: error getting monitor info for adapter=%d", adapterOrdinal);
-        return 0;
-    }
-
-    HWND hWnd = CreateWindow(D3DFocusWindowClassName, D3DFocusWindowClassName, WS_POPUP,
-        mi.rcMonitor.left, mi.rcMonitor.top, 1, 1,
-        NULL, NULL, GetModuleHandle(NULL), NULL);
-
-    if (hWnd == 0) {
-        RlsTraceLn(NWT_TRACE_ERROR, "CreateFocusWindow: CreateWindow failed");
-    }
-
-    return hWnd;
-}
-
 HRESULT D3DPipelineManager::GetD3DContext(UINT adapterOrdinal,
                                           D3DContext **ppd3dContext)
 {
--- a/modules/graphics/src/main/native-prism-d3d/D3DPipelineManager.h	Tue Sep 03 16:18:42 2013 -0700
+++ b/modules/graphics/src/main/native-prism-d3d/D3DPipelineManager.h	Wed Sep 04 12:14:42 2013 +0400
@@ -95,8 +95,6 @@
     static void SetErrorMessage(char const *msg);
     static void SetErrorMessageV(char const *msg, ...);
 
-    HWND CreateDeviceFocusWindow(int adapterOrdinal);
-
 private:
     D3DPipelineManager(IConfig &);
 
@@ -149,7 +147,6 @@
     static D3DPipelineManager* pMgr;
 
     D3DMULTISAMPLE_TYPE userMultiSampleType;
-    ATOM classAtom;
 };
 
 #define OS_UNDEFINED    (0 << 0)