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
path: root/intern
diff options
context:
space:
mode:
authorJean-Luc Peurière <jlp@nerim.net>2007-06-13 00:01:28 +0400
committerJean-Luc Peurière <jlp@nerim.net>2007-06-13 00:01:28 +0400
commitedc6512ba6528fce4442f9b20875d1a301a0ceef (patch)
tree929c8cd8e32cc3aa44d41fdde1c55a86b93ba78c /intern
parent6cc1269d976641e6fdac59d1c1afbc96ae3aab8b (diff)
first workable version on Os X
work only in non camera mode in 3D view need the external plug-in to be compiled separately line 894 of ghostwinlay.c must be replaced with values adapted at your system see mailing list for features planned and how to use
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/GHOST_C-api.h7
-rw-r--r--intern/ghost/GHOST_ISystem.h6
-rw-r--r--intern/ghost/GHOST_Types.h35
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp9
-rw-r--r--intern/ghost/intern/GHOST_EventNDOF.h22
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.cpp103
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.h34
-rw-r--r--intern/ghost/intern/GHOST_System.cpp9
-rw-r--r--intern/ghost/intern/GHOST_System.h6
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp51
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h4
11 files changed, 207 insertions, 79 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index d5fc87c16f6..568437b4231 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -276,8 +276,11 @@ extern void GHOST_OpenNDOF(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
- GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
- GHOST_NDOFEventHandler_fp setNdofEventHandler);
+ GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen
+ );
+
+ // original patch only
+ // GHOST_NDOFEventHandler_fp setNdofEventHandler);
/***************************************************************************************
** Cursor management functionality
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 9c0cef2b4f0..541a78cbaa9 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -305,8 +305,10 @@ public:
virtual void openNDOF(GHOST_IWindow*,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
- GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
- GHOST_NDOFEventHandler_fp setNdofEventHandler) = 0;
+ GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen
+ // original patch only
+ // GHOST_NDOFEventHandler_fp setNdofEventHandler
+ ) = 0;
/***************************************************************************************
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index f8f9a8d4735..9b8a402a195 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -338,19 +338,38 @@ typedef struct {
GHOST_TInt32 z;
} GHOST_TEventWheelData;
-typedef int (*GHOST_NDOFLibraryInit_fp)();
-typedef void (*GHOST_NDOFLibraryShutdown_fp)(void* deviceHandle);
-typedef void* (*GHOST_NDOFDeviceOpen_fp)(void* platformData);
-typedef int (*GHOST_NDOFEventHandler_fp)(float* result7, void* deviceHandle, unsigned int message, unsigned int* wParam, unsigned long* lParam);
/* original patch used floats, but the driver return ints and uns. We will calibrate in view, no sense on doing conversions twice */
+/* as all USB device controls are likely to use ints, this is also more future proof */
+//typedef struct {
+// /** N-degree of freedom device data */
+// float tx, ty, tz; /** -x left, +y up, +z forward */
+// float rx, ry, rz;
+// float dt;
+//} GHOST_TEventNDOFData;
+
typedef struct {
- /** N-degree of freedom device data */
- float tx, ty, tz; /** -x left, +y up, +z forward */
- float rx, ry, rz;
- float dt;
+ /** N-degree of freedom device data v2*/
+ int changed;
+ GHOST_TUns64 client;
+ GHOST_TUns64 address;
+ GHOST_TInt16 tx, ty, tz; /** -x left, +y up, +z forward */
+ GHOST_TInt16 rx, ry, rz;
+ GHOST_TInt16 buttons;
+ GHOST_TUns64 time;
+ GHOST_TUns64 delta;
} GHOST_TEventNDOFData;
+typedef int (*GHOST_NDOFLibraryInit_fp)();
+typedef void (*GHOST_NDOFLibraryShutdown_fp)(void* deviceHandle);
+typedef void* (*GHOST_NDOFDeviceOpen_fp)(void* platformData);
+
+// original patch windows callback. In mac os X version the callback is internal to the plug-in and post an event to main thead.
+// not necessary faster, but better integration with other events.
+
+//typedef int (*GHOST_NDOFEventHandler_fp)(float* result7, void* deviceHandle, unsigned int message, unsigned int* wParam, unsigned long* lParam);
+//typedef void (*GHOST_NDOFCallBack_fp)(GHOST_TEventNDOFDataV2 *VolDatas);
+
typedef struct {
/** The key code. */
GHOST_TKey key;
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index cbecb49c80b..8fa79261483 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -262,13 +262,16 @@ GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_Eve
void GHOST_OpenNDOF(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
- GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
- GHOST_NDOFEventHandler_fp setNdofEventHandler)
+ GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
+ //original patch only
+ /* GHOST_NDOFEventHandler_fp setNdofEventHandler)*/
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
system->openNDOF((GHOST_IWindow*) windowhandle,
- setNdofLibraryInit, setNdofLibraryShutdown, setNdofDeviceOpen, setNdofEventHandler);
+ setNdofLibraryInit, setNdofLibraryShutdown, setNdofDeviceOpen);
+// original patch
+// setNdofLibraryInit, setNdofLibraryShutdown, setNdofDeviceOpen, setNdofEventHandler);
}
diff --git a/intern/ghost/intern/GHOST_EventNDOF.h b/intern/ghost/intern/GHOST_EventNDOF.h
index 1eadebd92ac..76f5a9e0894 100644
--- a/intern/ghost/intern/GHOST_EventNDOF.h
+++ b/intern/ghost/intern/GHOST_EventNDOF.h
@@ -1,14 +1,10 @@
-/**
- * $Id: GHOST_EventNdof.h,v 1.6 2002/12/28 22:26:45 maarten Exp $
- * ***** 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
@@ -19,19 +15,11 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Contributor(s): none yet.
*
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-/**
- * @file GHOST_EventNdof.h
- * Declaration of GHOST_EventNdof class.
+ * ***** END GPL LICENSE BLOCK *****
*/
+
#ifndef _GHOST_EVENT_NDOF_H_
#define _GHOST_EVENT_NDOF_H_
diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp
index 3ac3d483d18..1bfaf390544 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManager.cpp
@@ -1,21 +1,23 @@
-
-// Insert Blender compatible license here :-)
-
-// note: an implementation is currently only provided for Windows, but designed to be easy to move to Linux, etc.
-
-/**
-
- To use this implemenation, you must specify the #define WITH_SPACEBALL for the ghost library.
- Only this cpp file is affected by the macro, the header file and everything else are independent
- of the spaceball libraries.
-
- The 3dXWare SDK is available from the tab on the left side of -
- http://www.3dconnexion.com/support/4a.php
-
- The SDK is necessary to build this file with WITH_SPACEBALL defined.
-
- For this stuff to work, siappdll.dll and spwini.dll must be in the executable path of blender
-
+/*
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
*/
@@ -23,15 +25,17 @@
//#include "GHOST_WindowWin32.h"
-
-
+// the variable is outside the class because it must be accessed from plugin
+static volatile GHOST_TEventNDOFData currentNdofValues = {0,0,0,0,0,0,0,0,0,0,0};
namespace
{
GHOST_NDOFLibraryInit_fp ndofLibraryInit = 0;
GHOST_NDOFLibraryShutdown_fp ndofLibraryShutdown = 0;
GHOST_NDOFDeviceOpen_fp ndofDeviceOpen = 0;
- GHOST_NDOFEventHandler_fp ndofEventHandler = 0;
+// GHOST_NDOFEventHandler_fp ndofEventHandler = 0;
+
+
}
@@ -45,8 +49,7 @@ GHOST_NDOFManager::GHOST_NDOFManager()
ndofLibraryInit = 0;
ndofLibraryShutdown = 0;
ndofDeviceOpen = 0;
- ndofEventHandler = 0;
- // available = 0;
+ // ndofEventHandler = 0;
}
GHOST_NDOFManager::~GHOST_NDOFManager()
@@ -62,18 +65,22 @@ void
GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
- GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
- GHOST_NDOFEventHandler_fp setNdofEventHandler)
+ GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
+// GHOST_NDOFEventHandler_fp setNdofEventHandler)
{
ndofLibraryInit = setNdofLibraryInit;
ndofLibraryShutdown = setNdofLibraryShutdown;
ndofDeviceOpen = setNdofDeviceOpen;
- ndofEventHandler = setNdofEventHandler;
+// original patch
+// ndofEventHandler = setNdofEventHandler;
if (ndofLibraryInit && ndofDeviceOpen)
{
printf("%i client \n", ndofLibraryInit());
- }
+ m_DeviceHandle = ndofDeviceOpen((void *)&currentNdofValues);
+ }
+
+
/*
if (ndofDeviceOpen)
{
@@ -87,7 +94,8 @@ GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window,
}
-
+/** original patch only */
+/*
GHOST_TEventNDOFData*
GHOST_NDOFManager::handle(unsigned int message, unsigned int* wParam, unsigned long* lParam)
{
@@ -100,7 +108,7 @@ GHOST_NDOFManager::handle(unsigned int message, unsigned int* wParam, unsigned l
printf("handled %i\n", handled);
return handled ? &sbdata : 0;
}
-
+*/
bool
GHOST_NDOFManager::available()
@@ -108,3 +116,40 @@ GHOST_NDOFManager::available()
return m_DeviceHandle != 0;
}
+bool
+GHOST_NDOFManager::event_present()
+{
+ if( currentNdofValues.changed >0) {
+ printf("time %llu but%u x%i y%i z%i rx%i ry%i rz%i \n" ,
+ currentNdofValues.time, currentNdofValues.buttons,
+ currentNdofValues.tx,currentNdofValues.ty,currentNdofValues.tz,
+ currentNdofValues.rx,currentNdofValues.ry,currentNdofValues.rz);
+ return true;
+ }else
+ return false;
+
+}
+
+void GHOST_NDOFManager::GHOST_NDOFGetDatas(GHOST_TEventNDOFData &datas)
+{
+ datas.tx = currentNdofValues.tx;
+ datas.ty = currentNdofValues.ty;
+ datas.tz = currentNdofValues.tz;
+ datas.rx = currentNdofValues.rx;
+ datas.ry = currentNdofValues.ry;
+ datas.rz = currentNdofValues.rz;
+ datas.buttons = currentNdofValues.buttons;
+ datas.client = currentNdofValues.client;
+ datas.address = currentNdofValues.address;
+ datas.time = currentNdofValues.time;
+ datas.delta = currentNdofValues.delta;
+
+}
+
+/*
+//#ifdef
+OSStatus GHOST_SystemCarbon::blendEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData)
+{
+}
+
+*/
diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h
index 69e7f8e25f0..2e905ed53d2 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.h
+++ b/intern/ghost/intern/GHOST_NDOFManager.h
@@ -1,4 +1,25 @@
-
+/*
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
#ifndef _GHOST_NDOFMANAGER_H_
#define _GHOST_NDOFMANAGER_H_
@@ -23,13 +44,18 @@ public:
void deviceOpen(GHOST_IWindow* window,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
- GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
- GHOST_NDOFEventHandler_fp setNdofEventHandler);
+ GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen);
+
+ void GHOST_NDOFGetDatas(GHOST_TEventNDOFData &datas);
+
+// GHOST_NDOFEventHandler_fp setNdofEventHandler);
bool available();
+ bool event_present();
+/* original patch. unused now */
/* to do: abstract for Linux, MacOS, etc. */
- GHOST_TEventNDOFData* handle(unsigned int message, unsigned int* wparam, unsigned long* lparam);
+// GHOST_TEventNDOFData* handle(unsigned int message, unsigned int* wparam, unsigned long* lparam);
protected:
void* m_DeviceHandle;
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index 7daeca9566b..674b1f67d55 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -243,14 +243,15 @@ GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent* event)
void GHOST_System::openNDOF(GHOST_IWindow* w,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
- GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
- GHOST_NDOFEventHandler_fp setNdofEventHandler)
+ GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen)
+// original patch only
+// GHOST_NDOFEventHandler_fp setNdofEventHandler)
{
m_ndofManager->deviceOpen(w,
setNdofLibraryInit,
setNdofLibraryShutdown,
- setNdofDeviceOpen,
- setNdofEventHandler);
+ setNdofDeviceOpen);
+ // setNdofEventHandler);
}
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index e7014b14f51..a45196ee3da 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -197,8 +197,10 @@ public:
virtual void openNDOF(GHOST_IWindow* w,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
- GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen,
- GHOST_NDOFEventHandler_fp setNdofEventHandler);
+ GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen);
+
+// original patch only
+// GHOST_NDOFEventHandler_fp setNdofEventHandler);
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index e1e3853e8a8..056addddeb1 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -48,22 +48,33 @@
#include "GHOST_EventButton.h"
#include "GHOST_EventCursor.h"
#include "GHOST_EventWheel.h"
+#include "GHOST_EventNDOF.h"
+
#include "GHOST_TimerManager.h"
#include "GHOST_TimerTask.h"
#include "GHOST_WindowManager.h"
#include "GHOST_WindowCarbon.h"
+#include "GHOST_NDOFManager.h"
#define GHOST_KEY_SWITCH(mac, ghost) { case (mac): ghostKey = (ghost); break; }
+/* blender class and types events */
+enum {
+ kEventClassBlender = 'blnd'
+};
+
+enum {
+ kEventBlenderNdofAxis = 1,
+ kEventBlenderNdofButtons = 2
+};
+
const EventTypeSpec kEvents[] =
{
{ kEventClassAppleEvent, kEventAppleEvent },
-
/*
{ kEventClassApplication, kEventAppActivated },
{ kEventClassApplication, kEventAppDeactivated },
*/
-
{ kEventClassKeyboard, kEventRawKeyDown },
{ kEventClassKeyboard, kEventRawKeyRepeat },
{ kEventClassKeyboard, kEventRawKeyUp },
@@ -84,7 +95,12 @@ const EventTypeSpec kEvents[] =
{ kEventClassWindow, kEventWindowActivated },
{ kEventClassWindow, kEventWindowDeactivated },
{ kEventClassWindow, kEventWindowUpdate },
- { kEventClassWindow, kEventWindowBoundsChanged }
+ { kEventClassWindow, kEventWindowBoundsChanged },
+
+ { kEventClassBlender, kEventBlenderNdofAxis },
+ { kEventClassBlender, kEventBlenderNdofButtons }
+
+
};
@@ -416,7 +432,9 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow(
return window;
}
-
+/* this is an old style low level event queue.
+ As we want to handle our own timers, this is ok.
+ the full screen hack should be removed */
bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
{
bool anyProcessed = false;
@@ -424,7 +442,7 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
do {
GHOST_TimerManager* timerMgr = getTimerManager();
-
+
if (waitForEvent) {
GHOST_TUns64 curtime = getMilliSeconds();
GHOST_TUns64 next = timerMgr->nextFireTime();
@@ -455,6 +473,8 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
}
}
+
+ /* end loop when no more events available */
while (::ReceiveNextEvent(0, NULL, 0, true, &event)==noErr) {
OSStatus status= ::SendEventToEventTarget(event, ::GetEventDispatcherTarget());
if (status==noErr) {
@@ -466,7 +486,7 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
* are, but we get a lot of them
*/
if (i!='cgs ') {
- //printf("Missed - Class: '%.4s', Kind: %d\n", &i, ::GetEventKind(event));
+ printf("Missed - Class: '%.4s', Kind: %d\n", &i, ::GetEventKind(event));
}
}
::ReleaseEvent(event);
@@ -610,6 +630,7 @@ OSErr GHOST_SystemCarbon::sAEHandlerQuit(const AppleEvent *event, AppleEvent *re
GHOST_TSuccess GHOST_SystemCarbon::init()
{
+
GHOST_TSuccess success = GHOST_System::init();
if (success) {
/*
@@ -629,6 +650,7 @@ GHOST_TSuccess GHOST_SystemCarbon::init()
::AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, sAEHandlerOpenDocs, (SInt32) this, false);
::AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, sAEHandlerPrintDocs, (SInt32) this, false);
::AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, sAEHandlerQuit, (SInt32) this, false);
+
}
return success;
}
@@ -765,6 +787,7 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
}
err = noErr;
}
+
}
OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
@@ -1039,11 +1062,14 @@ bool GHOST_SystemCarbon::handleMenuCommand(GHOST_TInt32 menuResult)
return handled;
}
+
OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData)
{
GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) userData;
OSStatus err = eventNotHandledErr;
-
+ GHOST_IWindow* window;
+ GHOST_TEventNDOFData data;
+
switch (::GetEventClass(event))
{
case kEventClassAppleEvent:
@@ -1061,7 +1087,16 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
case kEventClassKeyboard:
err = sys->handleKeyEvent(event);
break;
- }
+ case kEventClassBlender :
+ window = sys->m_windowManager->getActiveWindow();
+ sys->m_ndofManager->GHOST_NDOFGetDatas(data);
+ sys->m_eventManager->pushEvent(new GHOST_EventNDOF(sys->getMilliSeconds(), GHOST_kEventNDOFMotion, window, data));
+ err = noErr;
+ break;
+ default :
+ ;
+ break;
+ }
return err;
}
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index 93022aa78ff..f2e3a775701 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -224,6 +224,10 @@ protected:
*/
bool handleMenuCommand(GHOST_TInt32 menuResult);
+ /* callback for blender generated events */
+// static OSStatus blendEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData);
+
+
/**
* Callback for Carbon when it has events.
*/