@@ -64,16 +64,29 @@ typedef union spnav_event {
6464extern "C" {
6565#endif
6666
67+ /* Open connection to the daemon via AF_UNIX socket.
68+ * The unix domain socket interface is an alternative to the original magellan
69+ * protocol, and it is *NOT* compatible with the 3D connexion driver. If you wish
70+ * to remain compatible, use the X11 protocol (spnav_x11_open, see below).
71+ * Returns -1 on failure.
72+ */
6773int spnav_open (void );
74+
75+ /* Close connection to the daemon. Use it for X11 or AF_UNIX connections.
76+ * Returns -1 on failure
77+ */
6878int spnav_close (void );
6979
7080/* Retrieves the file descriptor used for communication with the daemon, for
7181 * use with select() by the application, if so required.
7282 * If the X11 mode is used, the socket used to communicate with the X server is
7383 * returned, so the result of this function is always reliable.
84+ * If AF_UNIX mode is used, the fd of the socket is returned or -1 if
85+ * no connection is open / failure occured.
7486 */
7587int spnav_fd (void );
7688
89+ /* TODO: document */
7790int spnav_sensitivity (double sens );
7891
7992/* blocks waiting for space-nav events. returns 0 if an error occurs */
@@ -94,9 +107,26 @@ int spnav_remove_events(int type);
94107
95108
96109#ifdef USE_X11
110+ /* Opens a connection to the daemon, using the original magellan X11 protocol.
111+ * Any application using this protocol should be compatible with the proprietary
112+ * 3D connexion driver too.
113+ */
97114int spnav_x11_open (Display * dpy , Window win );
115+
116+ /* Sets the application window, that is to receive events by the driver.
117+ *
118+ * NOTE: Any number of windows can be registered for events, when using the
119+ * free spnavd daemon. I suspect that the proprietary 3D connexion daemon only
120+ * sends events to one window at a time, thus this function replaces the window
121+ * that receives events. If compatibility with 3dxsrv is required, do not
122+ * assume that you can register multiple windows.
123+ */
98124int spnav_x11_window (Window win );
99125
126+ /* Examines an arbitrary X11 event. If it's a spnav event, it returns the event
127+ * type (SPNAV_EVENT_MOTION or SPNAV_EVENT_BUTTON) and fills in the spnav_event
128+ * structure passed through "event" accordingly. Otherwise, it returns 0.
129+ */
100130int spnav_x11_event (const XEvent * xev , spnav_event * event );
101131#endif
102132
0 commit comments