[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30621] branches/soc-2010-merwin/intern/ ghost/intern: more preliminary NDOF handling stuff (untested)
Mike Erwin
significant.bit at gmail.com
Thu Jul 22 11:30:01 CEST 2010
Revision: 30621
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30621
Author: merwin
Date: 2010-07-22 11:30:01 +0200 (Thu, 22 Jul 2010)
Log Message:
-----------
more preliminary NDOF handling stuff (untested)
Modified Paths:
--------------
branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerCocoa.cpp
branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemCocoa.mm
branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemWin32.cpp
branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemX11.cpp
branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemX11.h
Added Paths:
-----------
branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerWin32.h
branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerX11.h
Modified: branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerCocoa.cpp
===================================================================
--- branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerCocoa.cpp 2010-07-22 08:57:23 UTC (rev 30620)
+++ branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerCocoa.cpp 2010-07-22 09:30:01 UTC (rev 30621)
@@ -80,10 +80,8 @@
return;
}
-// char* name = "\pBlender";
-// name[0] = 7; // convert to Pascal string
-
- m_clientID = RegisterConnexionClient('blnd', (UInt8*) "\pBlender"/*name*/,
+ // Pascal string *and* a four-letter constant. How old-skool.
+ m_clientID = RegisterConnexionClient('blnd', (UInt8*) "\pBlender",
kConnexionClientModeTakeOver, kConnexionMaskAll);
printf("client id = %d\n", m_clientID);
@@ -104,8 +102,5 @@
bool GHOST_NDOFManagerCocoa::available()
{
extern OSErr InstallConnexionHandlers() __attribute__((weak_import));
-// [mce] C likes the above line, but Obj-C++ does not. Make sure it works for
-// machines without the driver installed! Try it on the QuickSilver.
-
return InstallConnexionHandlers != NULL;
}
Modified: branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
===================================================================
--- branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerCocoa.h 2010-07-22 08:57:23 UTC (rev 30620)
+++ branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerCocoa.h 2010-07-22 09:30:01 UTC (rev 30621)
@@ -25,6 +25,8 @@
#include "GHOST_NDOFManager.h"
+// Event capture is handled within the NDOFManager on Macintosh,
+// so there's no need for SystemCocoa to look for them.
class GHOST_NDOFManagerCocoa : public GHOST_NDOFManager
{
Added: branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerWin32.h
===================================================================
--- branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerWin32.h (rev 0)
+++ branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerWin32.h 2010-07-22 09:30:01 UTC (rev 30621)
@@ -0,0 +1,46 @@
+/*
+ * ***** 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef _GHOST_NDOFMANAGERWIN32_H_
+#define _GHOST_NDOFMANAGERWIN32_H_
+
+#include "GHOST_NDOFManager.h"
+
+
+class GHOST_NDOFManagerWin32 : public GHOST_NDOFManager
+{
+public:
+ GHOST_NDOFManagerWin32(GHOST_System& sys)
+ : GHOST_NDOFManager(sys)
+ {}
+
+ // whether multi-axis functionality is available (via the OS or driver)
+ // does not imply that a device is plugged in or being used
+ bool available()
+ {
+ // always available since RawInput is built into Windows
+ return true;
+ }
+};
+
+
+#endif
Property changes on: branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerWin32.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerX11.h
===================================================================
--- branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerX11.h (rev 0)
+++ branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerX11.h 2010-07-22 09:30:01 UTC (rev 30621)
@@ -0,0 +1,46 @@
+/*
+ * ***** 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef _GHOST_NDOFMANAGERX11_H_
+#define _GHOST_NDOFMANAGERX11_H_
+
+#include "GHOST_NDOFManager.h"
+
+
+class GHOST_NDOFManagerX11 : public GHOST_NDOFManager
+{
+public:
+ GHOST_NDOFManagerX11(GHOST_System& sys)
+ : GHOST_NDOFManager(sys)
+ {}
+
+ // whether multi-axis functionality is available (via the OS or driver)
+ // does not imply that a device is plugged in or being used
+ bool available()
+ {
+ // never available since I've not yet written it!
+ return false;
+ }
+};
+
+
+#endif
Property changes on: branches/soc-2010-merwin/intern/ghost/intern/GHOST_NDOFManagerX11.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemCocoa.mm
===================================================================
--- branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemCocoa.mm 2010-07-22 08:57:23 UTC (rev 30620)
+++ branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemCocoa.mm 2010-07-22 09:30:01 UTC (rev 30621)
@@ -54,7 +54,7 @@
#include "GHOST_TimerTask.h"
#include "GHOST_WindowManager.h"
#include "GHOST_WindowCocoa.h"
-#include "GHOST_NDOFManager.h"
+#include "GHOST_NDOFManagerCocoa.h"
#include "AssertMacros.h"
#pragma mark KeyMap, mouse converters
@@ -601,14 +601,9 @@
{
GHOST_TSuccess success = GHOST_System::init();
if (success) {
- //ProcessSerialNumber psn;
+
+ m_ndofManager = new GHOST_NDOFManagerCocoa(*this);
- //Carbon stuff to move window & menu to foreground
- /*if (!GetCurrentProcess(&psn)) {
- TransformProcessType(&psn, kProcessTransformToForegroundApplication);
- SetFrontProcess(&psn);
- }*/
-
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (NSApp == nil) {
[NSApplication sharedApplication];
Modified: branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemWin32.cpp 2010-07-22 08:57:23 UTC (rev 30620)
+++ branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemWin32.cpp 2010-07-22 09:30:01 UTC (rev 30621)
@@ -73,7 +73,7 @@
#include "GHOST_TimerManager.h"
#include "GHOST_WindowManager.h"
#include "GHOST_WindowWin32.h"
-#include "GHOST_NDOFManager.h"
+#include "GHOST_NDOFManagerWin32.h"
// Key code values not found in winuser.h
#ifndef VK_MINUS
@@ -347,6 +347,8 @@
{
GHOST_TSuccess success = GHOST_System::init();
+ m_ndofManager = new GHOST_NDOFManagerWin32(*this);
+
/* Disable scaling on high DPI displays on Vista */
HMODULE user32 = ::LoadLibraryA("user32.dll");
typedef BOOL (WINAPI * LPFNSETPROCESSDPIAWARE)();
@@ -736,9 +738,6 @@
No other registered devices use the c62_ space, so a simple mask will work!
*/
- short t[3], r[3]; // defined here just for quick testing,
- unsigned short buttons; // will maintain shared copy for all NDOF events
-
// multiple events per RAWHID? MSDN hints at this.
printf("%d events\n", raw.data.hid.dwCount);
@@ -754,14 +753,24 @@
switch (packetType)
{
case 1: // translation
+ {
+ short t[3];
memcpy(t, data + 1, sizeof(t));
printf("T: %+5d %+5d %+5d\n", t[0], t[1], t[2]);
+ m_ndofManager->updateTranslation(t, getMilliseconds());
break;
+ }
case 2: // rotation
+ {
+ short r[3];
memcpy(r, data + 1, sizeof(r));
printf("R: %+5d %+5d %+5d\n", r[0], r[1], r[2]);
+ m_ndofManager->updateRotation(r, getMilliseconds());
break;
+ }
case 3: // buttons
+ {
+ unsigned short buttons;
memcpy(&buttons, data + 1, sizeof(buttons));
printf("buttons:");
if (buttons)
@@ -774,7 +783,9 @@
}
else
printf(" none\n");
+ m_ndofManager->updateButtons(buttons, getMilliseconds());
break;
+ }
}
}
Modified: branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemX11.cpp 2010-07-22 08:57:23 UTC (rev 30620)
+++ branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemX11.cpp 2010-07-22 09:30:01 UTC (rev 30621)
@@ -38,14 +38,14 @@
#include "GHOST_EventButton.h"
#include "GHOST_EventWheel.h"
#include "GHOST_EventNDOF.h"
-#include "GHOST_NDOFManager.h"
+#include "GHOST_NDOFManagerX11.h"
#include "GHOST_DisplayManagerX11.h"
#include "GHOST_Debug.h"
#include <X11/Xatom.h>
#include <X11/keysym.h>
-#include <X11/XKBlib.h> /* allow detectable autorepeate */
+#include <X11/XKBlib.h> /* allow detectable autorepeat */
#ifdef __sgi
@@ -67,10 +67,11 @@
#include <stdio.h> // for fprintf only
#include <cstdlib> // for exit
+// [mce] these are for communication with the plugin
typedef struct NDOFPlatformInfo {
Display *display;
Window window;
- volatile GHOST_TEventNDOFData *currValues;
+// volatile GHOST_TEventNDOFData *currValues;
Atom cmdAtom;
Atom motionAtom;
Atom btnPressAtom;
@@ -79,7 +80,6 @@
static NDOFPlatformInfo sNdofInfo = {NULL, 0, NULL, 0, 0, 0, 0};
-
//these are for copy and select copy
static char *txt_cut_buffer= NULL;
static char *txt_select_buffer= NULL;
@@ -142,7 +142,7 @@
m_start_time = GHOST_TUns64(tv.tv_sec*1000 + tv.tv_usec/1000);
- /* use detectable autorepeate, mac and windows also do this */
+ /* use detectable autorepeat, mac and windows also do this */
int use_xkb;
int xkb_opcode, xkb_event, xkb_error;
int xkb_major = XkbMajorVersion, xkb_minor = XkbMinorVersion;
@@ -168,6 +168,9 @@
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list