When a mouse button is pressed, information on this button is displayed in the terminal
This is achieved by the pointer "button" from the line:
dtkInButton* button = (dtkInButton*) DGL::getApp()->get("buttons", DTKINBUTTON_TYPE);
We would like that mouse control is no more done this way but rather through Qt. We are currently writing a small application in Qt and when a mouse button is pressed on the Qt Window, mouse information is displayed on the terminal. We'll then try to implement this on the "CCallbackHelix" example.
We expect to have the following if we succeed:
- A window created with Qt in which we will display the Helix
- Mouse and keyboard events will be controlled in Qt
Questions
- Is the Producer API used to control the mouse in the "CCallbackHelix" example or is it through DTK?
------------------------------------------------------------------------------------------------------------------------------------
John replied:
When DIVERSE was first written, it ran only on X11 based systems such as
Linux and IRIX. DTK created some classes which use X11 to read the
keyboard, mouse and mouse buttons. When DGL was written by Andrew, he
decided to use Producer to handle the keyboard, mouse and buttons (and also
windows). He felt this would be the easiest way to support non-X11
platforms.
Except for bug fixes, DTK is basically a "frozen" project. The original DTK
developer is no longer around, so we pretty much use DTK as is. New
functionality is written in DGL.
Andrew came up with a way in DGL to feed data to DTK using Producer, so the
old X11 DTK code would still work. For example, the DTK trackballNav DSO
works with DGL's Producer code stuffing the mouse and buttons, but is
unchanged since it was originally written to use DTK's X11 code.
This is done in the DMKCallback class in the files
diverse/dgl/libs/dgl/DProducer
diverse/dgl/include/dgl
Other little DGL-only utility classes exist too: DGLKeyboard, DGLMouse,
DGLMouseButton. DTK doesn't use them, but they do use Producer.
Take a look in the DGLWindow class, and look for "DMKCallback". You'll see
it get set up in the postRealize() callback, and called every frame in the
updateKM() callback.
No comments:
Post a Comment