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:
authorJean-Luc Peurière <jlp@nerim.net>2007-08-03 00:37:30 +0400
committerJean-Luc Peurière <jlp@nerim.net>2007-08-03 00:37:30 +0400
commit7965e64e98091fafe733336a0ced252f2503f184 (patch)
treeb1c648319b87c3987b2783b144ba8c3200ca79ea /intern/ghost
parenta0c98b95d52c0f627e59edfb32705827b3c96070 (diff)
linux plugin support for ndof
by Ettore Pasquini
Diffstat (limited to 'intern/ghost')
-rwxr-xr-xintern/ghost/intern/GHOST_SystemX11.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index f3891995f54..9d4717b00ef 100755
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -71,9 +71,13 @@ typedef struct NDOFPlatformInfo {
Display *display;
Window window;
volatile GHOST_TEventNDOFData *currValues;
+ Atom cmdAtom;
+ Atom motionAtom;
+ Atom btnPressAtom;
+ Atom btnRelAtom;
} NDOFPlatformInfo;
-static NDOFPlatformInfo sNdofInfo = {NULL, 0, NULL};
+static NDOFPlatformInfo sNdofInfo = {NULL, 0, NULL, 0, 0, 0, 0};
using namespace std;
@@ -462,21 +466,30 @@ GHOST_SystemX11::processEvent(XEvent *xe)
} else
#endif
if (sNdofInfo.currValues) {
- 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);
-
+ static GHOST_TEventNDOFData data = {0,0,0,0,0,0,0,0,0,0,0};
+ if (xcme.message_type == sNdofInfo.motionAtom)
+ {
+ data.changed = 1;
+ data.delta = xcme.data.s[8] - data.time;
+ data.time = xcme.data.s[8];
+ data.tx = xcme.data.s[2];
+ data.ty = xcme.data.s[3];
+ data.tz = xcme.data.s[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);
+ } else if (xcme.message_type == sNdofInfo.btnPressAtom) {
+ data.changed = 2;
+ data.delta = xcme.data.s[8] - data.time;
+ data.time = xcme.data.s[8];
+ data.buttons = xcme.data.s[2];
+ g_event = new GHOST_EventNDOF(getMilliSeconds(),
+ GHOST_kEventNDOFButton,
+ window, data);
+ }
} else {
/* Unknown client message, ignore */
}