[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11472] branches/ndof/intern/ghost/intern/ GHOST_SystemX11.cpp: linux plugin support for ndof
JLuc Peuriere
jlp at nerim.net
Thu Aug 2 22:37:30 CEST 2007
Revision: 11472
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11472
Author: lukep
Date: 2007-08-02 22:37:30 +0200 (Thu, 02 Aug 2007)
Log Message:
-----------
linux plugin support for ndof
by Ettore Pasquini
Modified Paths:
--------------
branches/ndof/intern/ghost/intern/GHOST_SystemX11.cpp
Modified: branches/ndof/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- branches/ndof/intern/ghost/intern/GHOST_SystemX11.cpp 2007-08-02 20:36:57 UTC (rev 11471)
+++ branches/ndof/intern/ghost/intern/GHOST_SystemX11.cpp 2007-08-02 20:37:30 UTC (rev 11472)
@@ -71,9 +71,13 @@
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 @@
} 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 */
}
More information about the Bf-blender-cvs
mailing list