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-08-07 20:44:10 +0400
committerMike Erwin <significant.bit@gmail.com>2011-08-07 20:44:10 +0400
commit479c203dad2868da012bff884dade573d6254993 (patch)
tree0307f20b2210b094b750164547fd3bdff9f29ebe
parent6a0bbfd0e47e81fcb66cc91291adbcf1e6e87284 (diff)
stricter WITH_INPUT_NDOF guards, general cleanup
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.cpp20
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerCocoa.h7
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerCocoa.mm6
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerX11.cpp25
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerX11.h7
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm9
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp20
7 files changed, 44 insertions, 50 deletions
diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp
index 855e27b9964..a24ccc3ff6c 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManager.cpp
@@ -375,7 +375,7 @@ void GHOST_NDOFManager::setDeadZone(float dz)
static bool atHomePosition(GHOST_TEventNDOFMotionData* ndof)
{
-#define HOME(foo) (ndof->foo == 0)
+#define HOME(foo) (ndof->foo == 0.f)
return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz);
#undef HOME
}
@@ -386,9 +386,9 @@ static bool nearHomePosition(GHOST_TEventNDOFMotionData* ndof, float threshold)
return atHomePosition(ndof);
}
else {
-#define HOME1(foo) (fabsf(ndof->foo) < threshold)
- return HOME1(tx) && HOME1(ty) && HOME1(tz) && HOME1(rx) && HOME1(ry) && HOME1(rz);
-#undef HOME1
+#define HOME(foo) (fabsf(ndof->foo) < threshold)
+ return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz);
+#undef HOME
}
}
@@ -423,17 +423,17 @@ bool GHOST_NDOFManager::sendMotionEvent()
data->dt = 0.001f * (m_motionTime - m_prevMotionTime); // in seconds
- bool handMotion = !nearHomePosition(data, m_deadZone);
+ bool weHaveMotion = !nearHomePosition(data, m_deadZone);
// determine what kind of motion event to send (Starting, InProgress, Finishing)
// and where that leaves this NDOF manager (NotStarted, InProgress, Finished)
switch (m_motionState) {
case GHOST_kNotStarted:
case GHOST_kFinished:
- if (handMotion) {
+ if (weHaveMotion) {
data->progress = GHOST_kStarting;
m_motionState = GHOST_kInProgress;
- // prev motion time will be ancient, so just make up something reasonable
+ // prev motion time will be ancient, so just make up a reasonable time delta
data->dt = 0.0125f;
}
else {
@@ -443,9 +443,9 @@ bool GHOST_NDOFManager::sendMotionEvent()
}
break;
case GHOST_kInProgress:
- if (handMotion) {
+ if (weHaveMotion) {
data->progress = GHOST_kInProgress;
- // keep InProgress state
+ // remain 'InProgress'
}
else {
data->progress = GHOST_kFinishing;
@@ -453,7 +453,7 @@ bool GHOST_NDOFManager::sendMotionEvent()
}
break;
default:
- break;
+ ; // will always be one of the above
}
#ifdef DEBUG_NDOF_MOTION
diff --git a/intern/ghost/intern/GHOST_NDOFManagerCocoa.h b/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
index 27397b711b7..e9897f30104 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
+++ b/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
@@ -22,10 +22,12 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-
+
#ifndef _GHOST_NDOFMANAGERCOCOA_H_
#define _GHOST_NDOFMANAGERCOCOA_H_
+#ifdef WITH_INPUT_NDOF
+
#include "GHOST_NDOFManager.h"
// Event capture is handled within the NDOF manager on Macintosh,
@@ -47,4 +49,5 @@ private:
};
-#endif
+#endif // WITH_INPUT_NDOF
+#endif // #include guard
diff --git a/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm b/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
index 53a991a7396..1d90b6daa68 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
+++ b/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
@@ -22,7 +22,9 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-
+
+#ifdef WITH_INPUT_NDOF
+
#include "GHOST_NDOFManagerCocoa.h"
#include "GHOST_SystemCocoa.h"
@@ -170,3 +172,5 @@ bool GHOST_NDOFManagerCocoa::available()
return InstallConnexionHandlers != NULL;
// this means that the driver is installed and dynamically linked to blender
}
+
+#endif // WITH_INPUT_NDOF
diff --git a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
index 099fa15d179..4dd53319039 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
@@ -22,7 +22,9 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-
+
+#ifdef WITH_INPUT_NDOF
+
#include "GHOST_NDOFManagerX11.h"
#include "GHOST_SystemX11.h"
#include <spnav.h>
@@ -34,14 +36,14 @@ GHOST_NDOFManagerX11::GHOST_NDOFManagerX11(GHOST_System& sys)
GHOST_NDOFManager(sys),
m_available(false)
{
- setDeadZone(0.1f); // how to calibrate on Linux? throw away slight motion!
+ setDeadZone(0.1f); /* how to calibrate on Linux? throw away slight motion! */
if (spnav_open() != -1) {
- // determine exactly which device (if any) is plugged in
+ /* determine exactly which device (if any) is plugged in */
#define MAX_LINE_LENGTH 100
- // look for USB devices with Logitech's vendor ID
+ /* look for USB devices with Logitech's vendor ID */
FILE* command_output = popen("lsusb -d 046d:","r");
if (command_output) {
char line[MAX_LINE_LENGTH] = {0};
@@ -50,15 +52,15 @@ GHOST_NDOFManagerX11::GHOST_NDOFManagerX11(GHOST_System& sys)
if (sscanf(line, "Bus %*d Device %*d: ID %hx:%hx", &vendor_id, &product_id) == 2)
if (setDevice(vendor_id, product_id)) {
m_available = true;
- break; // stop looking once the first 3D mouse is found
+ break; /* stop looking once the first 3D mouse is found */
}
}
pclose(command_output);
}
}
else {
- printf("ndof: spacenavd not found\n");
- // This isn't a hard error, just means the user doesn't have a 3D mouse.
+ puts("ndof: spacenavd not found");
+ /* This isn't a hard error, just means the user doesn't have a 3D mouse. */
}
}
@@ -73,11 +75,6 @@ bool GHOST_NDOFManagerX11::available()
return m_available;
}
-//bool GHOST_NDOFManagerX11::identifyDevice()
-//{
-//
-//}
-
bool GHOST_NDOFManagerX11::processEvents()
{
GHOST_TUns64 now = m_system.getMilliSeconds();
@@ -88,7 +85,7 @@ bool GHOST_NDOFManagerX11::processEvents()
switch (e.type) {
case SPNAV_EVENT_MOTION:
{
- // convert to blender view coords
+ /* convert to blender view coords */
short t[3] = {e.motion.x, e.motion.y, -e.motion.z};
short r[3] = {-e.motion.rx, -e.motion.ry, e.motion.rz};
@@ -104,3 +101,5 @@ bool GHOST_NDOFManagerX11::processEvents()
}
return anyProcessed;
}
+
+#endif /* WITH_INPUT_NDOF */
diff --git a/intern/ghost/intern/GHOST_NDOFManagerX11.h b/intern/ghost/intern/GHOST_NDOFManagerX11.h
index 82bd256c707..0a549753756 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerX11.h
+++ b/intern/ghost/intern/GHOST_NDOFManagerX11.h
@@ -26,6 +26,8 @@
#ifndef _GHOST_NDOFMANAGERX11_H_
#define _GHOST_NDOFMANAGERX11_H_
+#ifdef WITH_INPUT_NDOF
+
#include "GHOST_NDOFManager.h"
/* Event capture is handled within the NDOF manager on Linux,
@@ -40,10 +42,9 @@ public:
bool processEvents();
private:
- // bool identifyDevice();
-
bool m_available;
};
-#endif
+#endif /* WITH_INPUT_NDOF */
+#endif /* #include guard */
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 17f0f2d6ecd..303c2b24497 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -21,8 +21,8 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): Maarten Gribnau 05/2001
- * Damien Plisson 09/2009
+ * Contributors: Maarten Gribnau 05/2001
+ * Damien Plisson 09/2009
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -43,16 +43,17 @@
#include "GHOST_EventButton.h"
#include "GHOST_EventCursor.h"
#include "GHOST_EventWheel.h"
-#include "GHOST_EventNDOF.h"
#include "GHOST_EventTrackpad.h"
#include "GHOST_EventDragnDrop.h"
#include "GHOST_EventString.h"
-
#include "GHOST_TimerManager.h"
#include "GHOST_TimerTask.h"
#include "GHOST_WindowManager.h"
#include "GHOST_WindowCocoa.h"
+#ifdef WITH_INPUT_NDOF
#include "GHOST_NDOFManagerCocoa.h"
+#endif
+
#include "AssertMacros.h"
#pragma mark KeyMap, mouse converters
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 105f71b514f..d5100e589f2 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -42,8 +42,10 @@
#include "GHOST_EventKey.h"
#include "GHOST_EventButton.h"
#include "GHOST_EventWheel.h"
-#include "GHOST_NDOFManagerX11.h"
#include "GHOST_DisplayManagerX11.h"
+#ifdef WITH_INPUT_NDOF
+#include "GHOST_NDOFManagerX11.h"
+#endif
#include "GHOST_Debug.h"
@@ -815,22 +817,6 @@ GHOST_SystemX11::processEvent(XEvent *xe)
}
}
-#if 0 // obsolete SpaceNav code
-
- void *
-GHOST_SystemX11::
-prepareNdofInfo(volatile GHOST_TEventNDOFData *currentNdofValues)
-{
- const vector<GHOST_IWindow*>& v(m_windowManager->getWindows());
- if (v.size() > 0)
- sNdofInfo.window = static_cast<GHOST_WindowX11*>(v[0])->getXWindow();
- sNdofInfo.display = m_display;
- sNdofInfo.currValues = currentNdofValues;
- return (void*)&sNdofInfo;
-}
-
-#endif
-
GHOST_TSuccess
GHOST_SystemX11::
getModifierKeys(