The Xdrvlib.c Library - Logitech Magellan/SPACE MOUSE Classic Programmer's Manual

Logicad3d
Table of Contents

Advertisement

xclient.data
s[0]
Magellan Window High 16 bit
s[1]
Magellan Window Low 16 bit
s[2]
s[3]...s[9]
Event of a Released Key
Whenever a key on the Magellan/SPACE
MOUSE is released, the X-Window driver sends
the number of the released key to the
application. The numbered keys (1-8) are
represented by the corresponding numbers.
The star key (*) is represented by 9. The
following program excerpt reads the number of
the released key from the event.
int ButtonNumber;
Window MagellanWindow;
MagellanWindow = (Event.xclient.data.s[0]
<<16) | Event.xclient.data.s[1];
ButonNumber = Event.xclient.data.s[2];
int ButtonNumber;
Window MagellanWindow;
MagellanWindow = (Event.xclient.data.s[0]
<<16) | Event.xclient.data.s[1];
ButonNumber = Event.xclient.data.s[2];
ButtonReleaseEvent data has the same
structure as ButtonPressEvent (see description
the table above).

The xdrvlib.c Library

A simpler way to use the Magellan/SPACE
MOUSE interface is to use the existing calls in
the xdrvlib.c library, which is found on the
LogiCad3D CD-ROM under the directory
/unix/xdev . Using the library makes the
construction of the interface easier, since the
application only needs to read data out of the
predefined structures. This section explains the
functions, a global variable and a defined data
structure.
MagellanInit
This function initializes the software interface
to the X-Window driver. It combines the four
events ( CommandEvent , MotionEvent ,
ButtonPressEvent and ButtonReleaseEvent )
with the X-Window system. Furthermore, it
tests to see if the X-Window driver is active
and places the received window <window>
into the driver. All subsequent Magellan/SPACE
MOUSE events are sent to this window.
16-bit Word
Keyboard Number
reserved
Syntax:
int MagellanInit (<display>, <window>)
Display *<display>;
Window <window>;
<display>
Makes the connection to the X-server firm
(see XOpenDisplay in
Manual).
<window>
The number of an opened window or the
constant InputFocus , i.e. PointerWindow
Result:
If the function succeeds, it returns the
value TRUE. If not, it returns the value
FALSE.
File:
xdrvlib.h
MagellanSetWindow
This function places the received window
<window> into the driver. All subsequent
events of the Magellan/SPACE MOUSE are sent
to the newly activated window.
Syntax:
int MagellanSetWindow (<display>,
<window>)
Display *<display>;
Window <window>;
<display>
Makes the connection to the X-server firm
(see XOpenDisplay in
Manual).
<window>
The number of an opened window or the
constant InputFocus , i.e. PointerWindow
Result:
If the function succeeds, it returns the
value TRUE. If not, it returns the value
FALSE.
File:
xdrvlib.h
MagellanTranslateEvent
This function translates the information from
the ClientMessageEvent into the data structure
of the Magellan/SPACE MOUSE. Reading data
from this structure is easy because the
MagellanTranslateEvent modifies only those
values that are valid to the served event.
However, using MagellanMotionEvent means
that the 3D data is multiplied by the scaling
factors <MagellanTraScale> and
<MagellanRotScale> . The returned value
shows which event has been translated.
int MagellanTranslateEvent
Syntax:
(<display>,<Event>,<MagellanEvent>,
<MagellanTraScale>,<MagellanRotScal
e>)
Display *<display>;
XEvent *<Event>;
MagellanFloatEvent *<MagellanEvent>;
double <MagellanTraScale>;
double <MagellanRotScale>;
<display>
Makes the connection to the X-server firm
(see XOpenDisplay in
Manual).
<Event>
Contains a ClientMessageEvent , which is
sent from the X-Window driver. It is
received with the function XNextEvent or
a similar function (e.g. XPeekEvent ,
XWindowEvent ).
13
Xlib Programming
Xlib Programming
Xlib Programming

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Magellan/space mouse plusMagellan/space mouse plus xt

Table of Contents