Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2011-07-06 22:50:59 +0400
committerMike Erwin <significant.bit@gmail.com>2011-07-06 22:50:59 +0400
commit50ef78cdb8d9d746785bb03a296666dd15123e90 (patch)
treed80d17345daef89dca1180d9079164a4ccb33b03 /intern/ghost
parente3c89a127de7cabb32d89ff696d6d840ff23b123 (diff)
various fixes to enable MSVC build, removed crusty old Win32 ndof code
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_DropTargetWin32.cpp1
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.h2
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp129
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h106
4 files changed, 24 insertions, 214 deletions
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
index 2e77da42b31..99990a46c2a 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
@@ -33,6 +33,7 @@
#include "GHOST_Debug.h"
#include "GHOST_DropTargetWin32.h"
+#include <ShellApi.h>
#ifdef GHOST_DEBUG
// utility
diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h
index ab1ad49dea1..155510d6d7f 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.h
+++ b/intern/ghost/intern/GHOST_NDOFManager.h
@@ -29,7 +29,7 @@
// --- the following type definitions will find a home somewhere else once finished ---
-#define DEBUG_NDOF_MOTION
+//#define DEBUG_NDOF_MOTION
#define DEBUG_NDOF_BUTTONS
typedef enum { NDOF_UnknownDevice, NDOF_SpaceNavigator, NDOF_SpaceExplorer, NDOF_SpacePilotPro } NDOF_DeviceT;
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index b9e50e43000..8f7f56eb7ff 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -59,46 +59,12 @@
#endif
#endif
-#if 0 // shouldn't be needed...
-/*
- * 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
- * wheel detent value are undefined.
- */
-#ifndef WM_MOUSEWHEEL
-#define WM_MOUSEWHEEL 0x020A
-#endif // WM_MOUSEWHEEL
-#ifndef WHEEL_DELTA
-#define WHEEL_DELTA 120 /* Value for rolling one detent, (old convention! MS changed it) */
-#endif // WHEEL_DELTA
-
-/*
- * Defines for mouse buttons 4 and 5 aka xbutton1 and xbutton2.
- * MSDN: Declared in Winuser.h, include Windows.h
- * This does not seem to work with MinGW so we define our own here.
- */
-#ifndef XBUTTON1
-#define XBUTTON1 0x0001
-#endif // XBUTTON1
-#ifndef XBUTTON2
-#define XBUTTON2 0x0002
-#endif // XBUTTON2
-#ifndef WM_XBUTTONUP
-#define WM_XBUTTONUP 524
-#endif // WM_XBUTTONUP
-#ifndef WM_XBUTTONDOWN
-#define WM_XBUTTONDOWN 523
-#endif // WM_XBUTTONDOWN
-
-#endif // ^^^ removed code
-
#include "GHOST_Debug.h"
#include "GHOST_DisplayManagerWin32.h"
#include "GHOST_EventButton.h"
#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"
@@ -156,27 +122,12 @@
#define VK_MEDIA_PLAY_PAUSE 0xB3
#endif // VK_MEDIA_PLAY_PAUSE
-#if 0
-/*
- Initiates WM_INPUT messages from keyboard
- That way GHOST can retrieve true keys
-*/
-GHOST_TInt32 GHOST_SystemWin32::initKeyboardRawInput(void)
-{
- RAWINPUTDEVICE device = {0};
- device.usUsagePage = 0x01; /* usUsagePage & usUsage for keyboard*/
- device.usUsage = 0x06; /* http://msdn.microsoft.com/en-us/windows/hardware/gg487473.aspx */
-
- return RegisterRawInputDevices(&device, 1, sizeof(device));
-};
-#endif
-
static void initRawInput()
{
RAWINPUTDEVICE devices[2];
memset(devices, 0, 2 * sizeof(RAWINPUTDEVICE));
- // multi-axis mouse (SpaceNavigator)
+ // multi-axis mouse (SpaceNavigator, etc.)
devices[0].usUsagePage = 0x01;
devices[0].usUsage = 0x08;
@@ -414,15 +365,7 @@ GHOST_TSuccess GHOST_SystemWin32::init()
(LPFNSETPROCESSDPIAWARE)GetProcAddress(user32, "SetProcessDPIAware");
if (SetProcessDPIAware)
SetProcessDPIAware();
-// #ifdef NEED_RAW_PROC
-// pRegisterRawInputDevices = (LPFNDLLRRID)GetProcAddress(user32, "RegisterRawInputDevices");
-// pGetRawInputData = (LPFNDLLGRID)GetProcAddress(user32, "GetRawInputData");
-// #else
- FreeLibrary(user32);
-// #endif
-
- /* Initiates WM_INPUT messages from keyboard */
-// initKeyboardRawInput();
+ FreeLibrary(user32);
initRawInput();
// Determine whether this system has a high frequency performance counter. */
@@ -464,17 +407,11 @@ GHOST_TSuccess GHOST_SystemWin32::init()
GHOST_TSuccess GHOST_SystemWin32::exit()
{
-// #ifdef NEED_RAW_PROC
-// FreeLibrary(user32);
-// #endif
-
return GHOST_System::exit();
}
GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const& raw, int * keyDown, char * vk)
{
-// unsigned int size = 0;
-// char * data;
GHOST_TKey key = GHOST_kKeyUnknown;
@@ -757,7 +694,6 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP
char vk;
GHOST_SystemWin32 * system = (GHOST_SystemWin32 *)getSystem();
GHOST_TKey key = system->hardKey(window, raw, &keyDown, &vk);
-// GHOST_TKey key = system->hardKey(window, wParam, lParam, &keyDown, &vk);
GHOST_EventKey* event;
if (key != GHOST_kKeyUnknown) {
char ascii = '\0';
@@ -832,11 +768,9 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
GetRawInputDeviceInfo(raw.header.hDevice, RIDI_DEVICEINFO, &info, &infoSize);
if (info.dwType == RIM_TYPEHID)
- {
- // printf("hardware ID = %04X:%04X\n", info.hid.dwVendorId, info.hid.dwProductId);
m_ndofManager->setDevice(info.hid.dwVendorId, info.hid.dwProductId);
- }
- else puts("<!> not a HID device... mouse/kb perhaps?");
+ else
+ puts("<!> not a HID device... mouse/kb perhaps?");
firstEvent = false;
}
@@ -845,13 +779,25 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
// send motion. Mark as 'sent' so motion will always get dispatched.
eventSent = true;
+#ifdef _MSC_VER
+ // using Microsoft compiler & header files
+ // they invented the RawInput API, so this version is (probably) correct
+ BYTE const* data = raw.data.hid.bRawData;
+ // struct RAWHID {
+ // DWORD dwSizeHid;
+ // DWORD dwCount;
+ // BYTE bRawData[1];
+ // };
+#else
+ // MinGW's definition (below) doesn't agree, so we need a slight
+ // workaround until it's fixed
BYTE const* data = &raw.data.hid.bRawData;
- // MinGW's definition (below) doesn't agree with MSDN reference for bRawData:
- // typedef struct tagRAWHID {
- // DWORD dwSizeHid;
- // DWORD dwCount;
- // BYTE bRawData; // <== isn't this s'posed to be a BYTE*?
- // } RAWHID,*PRAWHID,*LPRAWHID;
+ // struct RAWHID {
+ // DWORD dwSizeHid;
+ // DWORD dwCount;
+ // BYTE bRawData; // <== isn't this s'posed to be a BYTE*?
+ // };
+#endif
BYTE packetType = data[0];
switch (packetType)
@@ -1241,30 +1187,6 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
* In GHOST, we let DefWindowProc call the timer callback.
*/
break;
-#if 0 // old NDOF code
- 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;
-#endif // old NDOF code
}
}
else {
@@ -1284,13 +1206,6 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
GHOST_PRINT("GHOST_SystemWin32::wndProc: event without window\n")
}
-// if (event) {
-// system->pushEvent(event);
-// }
-// else {
-// lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
-// }
-
if (event) {
system->pushEvent(event);
eventHandled = true;
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index dae8bf9a31a..c5dff27dace 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -38,7 +38,6 @@
#error WIN32 only!
#endif // WIN32
-//#undef _WIN32_WINNT
#define _WIN32_WINNT 0x501 // require Windows XP or newer
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -50,96 +49,6 @@
# define __int64 long long
#endif
-/* RawInput definitions should not be needed, due to WinXP requirement
-
-#ifndef WM_INPUT
-#define WM_INPUT 0x00FF
-#endif
-#ifndef RID_INPUT
-#define RID_INPUT 0x10000003
-#endif
-#ifndef RIM_INPUTSINK
-#define RIM_INPUTSINK 0x1
-#endif
-#ifndef RI_KEY_BREAK
-#define RI_KEY_BREAK 0x1
-#endif
-#ifndef RI_KEY_E0
-#define RI_KEY_E0 0x2
-#endif
-#ifndef RI_KEY_E1
-#define RI_KEY_E1 0x4
-#endif
-#ifndef RIM_TYPEMOUSE
-#define RIM_TYPEMOUSE 0x0
-#define RIM_TYPEKEYBOARD 0x1
-#define RIM_TYPEHID 0x2
-
-typedef struct tagRAWINPUTDEVICE {
- USHORT usUsagePage;
- USHORT usUsage;
- DWORD dwFlags;
- HWND hwndTarget;
-} RAWINPUTDEVICE;
-
-typedef struct tagRAWINPUTHEADER {
- DWORD dwType;
- DWORD dwSize;
- HANDLE hDevice;
- WPARAM wParam;
-} RAWINPUTHEADER;
-
-typedef struct tagRAWMOUSE {
- USHORT usFlags;
- union {
- ULONG ulButtons;
- struct {
- USHORT usButtonFlags;
- USHORT usButtonData;
- };
- };
- ULONG ulRawButtons;
- LONG lLastX;
- LONG lLastY;
- ULONG ulExtraInformation;
-} RAWMOUSE;
-
-typedef struct tagRAWKEYBOARD {
- USHORT MakeCode;
- USHORT Flags;
- USHORT Reserved;
- USHORT VKey;
- UINT Message;
- ULONG ExtraInformation;
-} RAWKEYBOARD;
-
-typedef struct tagRAWHID {
- DWORD dwSizeHid;
- DWORD dwCount;
- BYTE bRawData[1];
-} RAWHID;
-
-typedef struct tagRAWINPUT {
- RAWINPUTHEADER header;
- union {
- RAWMOUSE mouse;
- RAWKEYBOARD keyboard;
- RAWHID hid;
- } data;
-} RAWINPUT;
-
-DECLARE_HANDLE(HRAWINPUT);
-#endif
-
-#ifdef FREE_WINDOWS
-#define NEED_RAW_PROC
-typedef BOOL (WINAPI * LPFNDLLRRID)(RAWINPUTDEVICE*,UINT, UINT);
-
-typedef UINT (WINAPI * LPFNDLLGRID)(HRAWINPUT, UINT, LPVOID, PUINT, UINT);
-#define GetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader) ((pGetRawInputData)?pGetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader):(UINT)-1)
-#endif
-*/
-
class GHOST_EventButton;
class GHOST_EventCursor;
class GHOST_EventKey;
@@ -426,11 +335,6 @@ protected:
static LRESULT WINAPI s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
/**
- * Initiates WM_INPUT messages from keyboard
- */
-// GHOST_TInt32 initKeyboardRawInput(void);
-
- /**
* Toggles console
* @action 0 - Hides
* 1 - Shows
@@ -458,15 +362,6 @@ protected:
/** Console status */
int m_consoleStatus;
-
- /** handle for user32.dll*/
-// HMODULE user32;
-// #ifdef NEED_RAW_PROC
-// /* pointer to RegisterRawInputDevices function */
-// LPFNDLLRRID pRegisterRawInputDevices;
-// /* pointer to GetRawInputData function */
-// LPFNDLLGRID pGetRawInputData;
-// #endif
};
inline void GHOST_SystemWin32::retrieveModifierKeys(GHOST_ModifierKeys& keys) const
@@ -500,4 +395,3 @@ inline void GHOST_SystemWin32::handleKeyboardChange(void)
}
}
#endif // _GHOST_SYSTEM_WIN32_H_
-