There was a problem with the last merge :S
[blender.git] / intern / ghost / intern / GHOST_SystemWin32.cpp
index c423fbd29ad106b8c9145104992fbbb216b8ab38..f5c7c08ebfe1d71ec5e68647413009b7485b65a5 100644 (file)
@@ -1,14 +1,11 @@
 /**
  * $Id$
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License.  See http://www.blender.org/BL/ for information
- * about this.
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +23,7 @@
  *
  * Contributor(s): none yet.
  *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * ***** END GPL LICENSE BLOCK *****
  */
 
 /**
 
 #include "GHOST_SystemWin32.h"
 
+// win64 doesn't define GWL_USERDATA
+#ifdef WIN32
+#ifndef GWL_USERDATA
+#define GWL_USERDATA GWLP_USERDATA
+#define GWL_WNDPROC GWLP_WNDPROC
+#endif
+#endif
+
 /*
  * According to the docs the mouse wheel message is supported from windows 98 
  * upwards. Leaving WINVER at default value, the WM_MOUSEWHEEL message and the 
 #include "GHOST_EventCursor.h"
 #include "GHOST_EventKey.h"
 #include "GHOST_EventWheel.h"
+#include "GHOST_EventNDOF.h"
 #include "GHOST_TimerTask.h"
 #include "GHOST_TimerManager.h"
 #include "GHOST_WindowManager.h"
 #include "GHOST_WindowWin32.h"
+#include "GHOST_NDOFManager.h"
 
 // Key code values not found in winuser.h
 #ifndef VK_MINUS
@@ -303,6 +310,15 @@ GHOST_TSuccess GHOST_SystemWin32::init()
 {
        GHOST_TSuccess success = GHOST_System::init();
 
+       /* Disable scaling on high DPI displays on Vista */
+       HMODULE user32 = ::LoadLibraryA("user32.dll");
+       typedef BOOL (WINAPI * LPFNSETPROCESSDPIAWARE)();
+       LPFNSETPROCESSDPIAWARE SetProcessDPIAware =
+               (LPFNSETPROCESSDPIAWARE)GetProcAddress(user32, "SetProcessDPIAware");
+       if (SetProcessDPIAware)
+               SetProcessDPIAware();
+       FreeLibrary(user32);
+
        // Determine whether this system has a high frequency performance counter. */
        m_hasPerformanceCounter = ::QueryPerformanceFrequency((LARGE_INTEGER*)&m_freq) == TRUE;
        if (m_hasPerformanceCounter) {
@@ -845,6 +861,28 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
                                         * In GHOST, we let DefWindowProc call the timer callback.
                                         */
                                        break;
+                               case WM_BLND_NDOF_AXIS:
+                                       {
+                                               GHOST_TEventNDOFData ndofdata;
+                                               system->m_ndofManager->GHOST_NDOFGetDatas(ndofdata);
+                                               system->m_eventManager->
+                                                       pushEvent(new GHOST_EventNDOF(
+                                                               system->getMilliSeconds(), 
+                                                               GHOST_kEventNDOFMotion, 
+                                                               window, ndofdata));
+                                       }
+                                       break;
+                               case WM_BLND_NDOF_BTN:
+                                       {
+                                               GHOST_TEventNDOFData ndofdata;
+                                               system->m_ndofManager->GHOST_NDOFGetDatas(ndofdata);
+                                               system->m_eventManager->
+                                                       pushEvent(new GHOST_EventNDOF(
+                                                               system->getMilliSeconds(), 
+                                                               GHOST_kEventNDOFButton, 
+                                                               window, ndofdata));
+                                       }
+                                       break;
                        }
                }
                else {