From 6bc101fa7e9a51bdcd27a0bcf6d7d26fbe733c5b Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Tue, 2 Aug 2011 10:26:20 +0000 Subject: [PATCH] Indentation changes --- intern/ghost/intern/GHOST_SystemWin32.cpp | 39 +++++++++++------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 4af5643eb75..c985c6dd0a6 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -766,8 +766,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw) GHOST_TUns64 now = getMilliSeconds(); static bool firstEvent = true; - if (firstEvent) - { // determine exactly which device is plugged in + if (firstEvent) { // determine exactly which device is plugged in RID_DEVICE_INFO info; unsigned infoSize = sizeof(RID_DEVICE_INFO); info.cbSize = infoSize; @@ -776,23 +775,23 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw) if (info.dwType == RIM_TYPEHID) m_ndofManager->setDevice(info.hid.dwVendorId, info.hid.dwProductId); else - puts(" not a HID device... mouse/kb perhaps?"); + puts(" not a HID device... mouse/kb perhaps?"); firstEvent = false; - } + } // The NDOF manager sends button changes immediately, and *pretends* to // 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 + // 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]; + // DWORD dwSizeHid; + // DWORD dwCount; + // BYTE bRawData[1]; // }; #else // MinGW's definition (below) doesn't agree, so we need a slight @@ -807,46 +806,46 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw) BYTE packetType = data[0]; switch (packetType) - { + { case 1: // translation - { + { short* axis = (short*)(data + 1); short t[3] = {axis[0], -axis[2], axis[1]}; m_ndofManager->updateTranslation(t, now); if (raw.data.hid.dwSizeHid == 13) - { // this report also includes rotation + { // this report also includes rotation short r[3] = {-axis[3], axis[5], -axis[4]}; m_ndofManager->updateRotation(r, now); // I've never gotten one of these, has anyone else? puts("ndof: combined T + R"); - } - break; } + break; + } case 2: // rotation - { + { short* axis = (short*)(data + 1); short r[3] = {-axis[0], axis[2], -axis[1]}; m_ndofManager->updateRotation(r, now); break; - } + } case 3: // buttons - { - #if 0 + { +#if 0 // I'm getting garbage bits -- examine whole report: printf("ndof: HID report for buttons ["); for (int i = 0; i < raw.data.hid.dwSizeHid; ++i) printf(" %02X", data[i]); printf(" ]\n"); - #endif +#endif int button_bits; memcpy(&button_bits, data + 1, sizeof(button_bits)); m_ndofManager->updateButtons(button_bits, now); break; - } } + } return eventSent; } #endif // WITH_INPUT_NDOF