diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/GHOST_Types.h | 3 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCarbon.cpp | 17 | ||||
-rwxr-xr-x | intern/ghost/intern/GHOST_SystemX11.cpp | 32 |
3 files changed, 31 insertions, 21 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index 0de4c162ab8..379b3323f53 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -137,7 +137,8 @@ typedef enum { GHOST_kEventButtonUp, /// Mouse button event GHOST_kEventWheel, /// Mouse wheel event - GHOST_kEventNDOFMotion, /// N degree of freedom device motion event + GHOST_kEventNDOFMotion, /// N degree of freedom device motion event + GHOST_kEventNDOFButton, /// N degree of freedom device button event GHOST_kEventKeyDown, GHOST_kEventKeyUp, diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index 056addddeb1..756de42f227 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -984,7 +984,7 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event) GHOST_ASSERT(ghostWindow, "GHOST_SystemCarbon::handleMouseEvent: ghostWindow==0"); if (::TrackGoAway(window, mousePos)) { - // todo: add option-close, because itØs in the HIG + // todo: add option-close, because itÿs in the HIG // if (event.modifiers & optionKey) { // Close the clean documents, others will be confirmed one by one. //} @@ -1069,6 +1069,7 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even OSStatus err = eventNotHandledErr; GHOST_IWindow* window; GHOST_TEventNDOFData data; + UInt32 kind; switch (::GetEventClass(event)) { @@ -1090,7 +1091,19 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even 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)); + kind = ::GetEventKind(event); + + switch (kind) + { + case 1: + sys->m_eventManager->pushEvent(new GHOST_EventNDOF(sys->getMilliSeconds(), GHOST_kEventNDOFMotion, window, data)); + // printf("motion\n"); + break; + case 2: + sys->m_eventManager->pushEvent(new GHOST_EventNDOF(sys->getMilliSeconds(), GHOST_kEventNDOFButton, window, data)); +// printf("button\n"); + break; + } err = noErr; break; default : diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index e3d4ee405e8..f3891995f54 100755 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -462,25 +462,21 @@ GHOST_SystemX11::processEvent(XEvent *xe) } else #endif if (sNdofInfo.currValues) { - sNdofInfo.currValues->changed = 1; - sNdofInfo.currValues->delta = xcme.data.s[8] - sNdofInfo.currValues->time; - sNdofInfo.currValues->time = xcme.data.s[8]; - sNdofInfo.currValues->tx = xcme.data.s[2] >> 4; - sNdofInfo.currValues->ty = xcme.data.s[3] >> 4; - sNdofInfo.currValues->tz = xcme.data.s[4] >> 4; - sNdofInfo.currValues->rx = xcme.data.s[5]; - sNdofInfo.currValues->ry = xcme.data.s[6]; - sNdofInfo.currValues->rz = xcme.data.s[7]; - - /*fprintf(stderr, "ClientMessage: [%d %d %d][%d %d %d] t=%llu\n", - sNdofInfo.currValues->tx, sNdofInfo.currValues->ty, - sNdofInfo.currValues->tz, sNdofInfo.currValues->rx, - sNdofInfo.currValues->ry, sNdofInfo.currValues->rz, - sNdofInfo.currValues->time); */ + GHOST_TEventNDOFData data; + data.changed = 1; + data.delta = xcme.data.s[8] - data.time; + data.time = xcme.data.s[8]; + data.tx = xcme.data.s[2] >> 4; + data.ty = xcme.data.s[3] >> 4; + data.tz = xcme.data.s[4] >> 4; + data.rx = xcme.data.s[5]; + data.ry = xcme.data.s[6]; + data.rz = xcme.data.s[7]; + + g_event = new GHOST_EventNDOF(getMilliSeconds(), + GHOST_kEventNDOFMotion, + window, data); - g_event = new GHOST_EventNDOF(getMilliSeconds(), - GHOST_kEventNDOFMotion, - window, *sNdofInfo.currValues); } else { /* Unknown client message, ignore */ } |