OpenTracker

An Open Architecture for Reconfigurable Tracking based on XML | Contact

ot::QtMouseEventModule Class Reference
[OTQt Classes]

Module (MEM) employed in the operation mode More...

#include <QtMouseEventModule.h>

Inheritance diagram for ot::QtMouseEventModule:

Inheritance graph
[legend]
Collaboration diagram for ot::QtMouseEventModule:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 QtMouseEventModule ()
 ~QtMouseEventModule ()
virtual void init (StringTable &attributes, ConfigNode *localTree)
virtual void start ()
virtual void close ()
virtual void pullEvent ()

Private Types

typedef std::list< ButtonEventButtonEventList
typedef std::list< QMouseEvent * > QMouseEventList
typedef std::list< QWheelEvent * > QWheelEventList

Private Member Functions

 QtMouseEventModule (QtMouseEventModule const &ref)
QtMouseEventModule operator= (QtMouseEventModule const &ref)

Private Attributes

QtAppScreenas_
ButtonEventHistory button_event_history_ [QtMouseButtonSink::BUTTON_COUNT]

Classes

class  ButtonEvent
 Describes a mouse button event. More...
class  ButtonEventHistory
 Records a collection of special button events from the past. More...

Detailed Description

Module (MEM) employed in the operation mode

The operation mode is executed within the target application context where the module actually generates mouse events from tracking data.

The operation mode describes the actual mouse event generating procedure of OTQt. It assumes, that the OTQt configuraton steps have been successfully performed. A final XML configuration file was produced and a OTQt hook was implemented in the target Qt application. With the start of the Qt application the OTQt module is initalized and started.

The initialization startup takes place in member methods of the OTQt class: the OpenTracker context is initalized, the OTQt modules objects are created and added to context factories, the provided XML configuration file is parsed, the MEM is initialized which generates the appropriate sink objects. Finally a timer thread using the Qt class QTimer is initialized with a default timeout of 20 milliseconds calling the OTQt::driveOT() method at the end of each timeout performing one OpenTracker cycle.

The design principle concerning sinks and modules is the following: The sinks are kept rather "stupid" as they basically store copies of incoming events. Some sinks provide simple but useful methods which indicate changes in tracking event data. Most of the work is done in the module (MEM) itself: the application screen 3D location management, the mouse cursor placement and the generation of button and wheel events. There main reason for that design decision is simple: only in the module all information is available to decide wheater certain Qt mouse events should be generated or not.

The OTQt sinks store incoming events only if the pending events differ from the last event which was processed in the MEM. Each sink employs a two element event queue internally where current and previous events are stored. If the pending event differs from the current event, the event is copied and stored as new current event while the old current event becomes the previous event. The original event is passed unchanged to parent nodes of the sink. The intention of this early event filtering is the reduction of computational load. Only relevant events are processed afterwards in the module. Each sink indicates the arrival of a new event by setting the pending event dirty bit.

The pending event dirty bit is the signal for the module that a sink provides a new, unseen tracking event. The main processing method of the MEM is the pullState() method which is triggered from within the OpenTracker cycle method OTQt::driveOT() after all sinks received their events and could set their dirty bit flag.

Definition at line 146 of file QtMouseEventModule.h.


Member Typedef Documentation

type defintion of a button event list

Definition at line 180 of file QtMouseEventModule.h.

typedef std::list<QMouseEvent *> ot::QtMouseEventModule::QMouseEventList [private]

type defintion of a native Qt MouseEvent list

Definition at line 182 of file QtMouseEventModule.h.

typedef std::list<QWheelEvent *> ot::QtMouseEventModule::QWheelEventList [private]

type defintion of a native Qt WheelEvent list

Definition at line 184 of file QtMouseEventModule.h.


Constructor & Destructor Documentation

ot::QtMouseEventModule::QtMouseEventModule (  ) 

Calls base class default constructor.

Definition at line 56 of file QtMouseEventModule.cxx.

ot::QtMouseEventModule::~QtMouseEventModule (  ) 

Definition at line 63 of file QtMouseEventModule.cxx.

References as_.

ot::QtMouseEventModule::QtMouseEventModule ( QtMouseEventModule const &  ref  )  [private]


Member Function Documentation

void ot::QtMouseEventModule::close (  )  [virtual]

Does nothing.

Reimplemented from ot::QtMouseEventModuleBase.

Definition at line 150 of file QtMouseEventModule.cxx.

References OTQT_INFO().

void ot::QtMouseEventModule::init ( StringTable attributes,
ConfigNode localTree 
) [virtual]

Calls base class method.

Iterates through the child nodes of the given config node tree. Encountering a QtAppScreen XML element, creates such an object. Passing the local XML attributes to the class QtAppScreen constructor. Enables the CONFIGURED state.

Parameters:
attributes XML attribute key/value map
localTree module configuration XML element inclusive nested elements
See also:
QtMouseEventModuleBase::init()

Reimplemented from ot::QtMouseEventModuleBase.

Definition at line 70 of file QtMouseEventModule.cxx.

References as_, ot::QtMouseEventModuleBase::CONFIGURED, ot::ConfigNode::countChildren(), ot::StringTable::get(), ot::ConfigNode::getChild(), ot::KeyIterator::hasMoreKeys(), ot::QtMouseEventModuleBase::init(), ot::KeyIterator::nextElement(), OTQT_DEBUG(), OTQT_WARNING(), ot::StringTable::put(), ot::QtMouseEventModuleBase::state_, and ot::QtMouseEventModuleBase::xml_attrib_table_.

QtMouseEventModule ot::QtMouseEventModule::operator= ( QtMouseEventModule const &  ref  )  [private]

void ot::QtMouseEventModule::pullEvent (  )  [virtual]

The processing of pending events starts with the ASPS.

The MEM employs a separate class QtAppScreen which provides methods to update the geometric information about the location of the desktop screen in case the ASPD changed its position and/or orientation. Without accurate information about the location and extent of the desktop screen, the second step, the computation of the mouse cursor coordinates would be impossible. OTQt defines a certain 3D volume located in front of the target desktop screen as mouse event sensible region. This region is called screen cuboid (SC).

The consequent flow of the procedure mainly depends on whether the MPD resides inside or outside the SC. If it is outside, the module instructs the sinks to refuse tracking events for the duration of the MPD residing outside the SC and quits. At the time the MPD reenters the SC this blockade is annulated. If the MPD resides inside the SC, the MPD position is used to update the desktop cursor coordinate. On a desktop coordinate change a MouseMove Qt event is created.

Next, regarding the MBS, the current and previous event of each mouse button (typically left, right and middle button) are compared, searching for bit transitions which indicate either MouseButtonPress or MouseButtonRelease events. To detect the special case of a MouseDoubleClick event, which is generated if the event triple press, release, press occurs within a certain time frame, the MEM records the latest mouse press and release event together with their timestamps in a dedicated data structure.

The generation of mouse wheel events also bases on the comparion of current and previous event within the MWS. Certain bit transitions indicate either a Wheel Forward Move or Wheel Backward Move expressed by a positive or negative delta value in the Qt mouse wheel event.

At the end of the pullState() method the generated events collected in lists are posted to the target Qt application using the non-blocking postEvent() method which takes Qt event object pointers as argument. The deallocation of the heap objects is done by Qt.// At any point the pullState() method exits, the pending event flags of all sinks are reseted.//

Reimplemented from ot::QtMouseEventModuleBase.

Definition at line 165 of file QtMouseEventModule.cxx.

References ot::QtMouseEventSinkBase::acquireEvent(), QTime::addMSecs(), as_, ot::QtMouseEventModuleBase::asp_sink_, ot::QtMouseButtonSink::BUTTON_COUNT, button_event_history_, ot::QtMouseEventModule::ButtonEvent::button_id, ot::QtMouseButtonSink::buttonOn(), ot::QtMouseButtonSink::buttonPressed(), ot::QtMouseButtonSink::buttonReleased(), QTime::currentTime(), ot::QtMouseEventModuleBase::DISPATCH_QT_EVENTS, QApplication::doubleClickInterval(), ot::QtMouseEventSinkBase::enableState(), ot::QtMouseEventSinkBase::EVENT_ACQUIRE_LOCK, ot::QtMouseEventSinkBase::getCurrentEvent(), ot::QtAppScreen::getMPD2DCoords(), ot::QtMouseButtonSink::getQButtonId(), ot::QtMouseEventModule::ButtonEvent::global_pos, ot::QtMouseEventModuleBase::INITIALIZED, ot::QtMouseEventSinkBase::isEventPending(), ot::QtAppScreen::isMPDInsideScreenCuboid(), ot::QtMouseEventModule::ButtonEventHistory::last_dblclick, ot::QtMouseEventModule::ButtonEventHistory::last_init_press, ot::QtMouseEventModule::ButtonEventHistory::last_release, ot::QtMouseEventModuleBase::mb_sink_, ot::QtMouseEventModuleBase::mp_sink_, ot::QtMouseEventModuleBase::mw_sink_, ot::Event::null, OTQT_DEBUG(), QCursor::pos(), QApplication::postEvent(), QCursor::setPos(), ot::QtMouseEventModuleBase::state_, ot::QtMouseEventModule::ButtonEvent::target_widget, ot::QtMouseEventModule::ButtonEvent::timestamp, ot::QtMouseEventModule::ButtonEvent::type, ot::QtMouseEventModule::ButtonEvent::type_changed, ot::QtAppScreen::updateASPD(), ot::QtAppScreen::updateMPD(), ot::QtMouseWheelSink::wheelBackwardMove(), ot::QtMouseWheelSink::wheelForwardMove(), QApplication::wheelScrollLines(), QApplication::widgetAt(), QPoint::x(), and QPoint::y().

void ot::QtMouseEventModule::start (  )  [virtual]

Calls the base class method.

Verifies whether all class members have been initialized correctly during the XML configuration file parsing procedure, especially the QtAppScreen object (see init() method). If verified positively, enables the CONFIGURED state flag. Otherwise disables the CONFIGURED and enables the STOP state flag. Prints error messages to stderr stream for each non-successful check.

See also:
QtMouseEventModuleBase::start()

Reimplemented from ot::QtMouseEventModuleBase.

Definition at line 121 of file QtMouseEventModule.cxx.

References as_, ot::QtMouseEventModuleBase::CONFIGURED, ot::QtMouseEventModuleBase::INITIALIZED, ot::QtMouseEventModuleBase::MEM_STOP, OTQT_DEBUG(), OTQT_ERROR(), ot::QtMouseEventModuleBase::start(), and ot::QtMouseEventModuleBase::state_.


Member Data Documentation

collection of target application desktop screen information

Definition at line 272 of file QtMouseEventModule.h.

Referenced by init(), pullEvent(), start(), and ~QtMouseEventModule().

event history for each mouse button

Definition at line 274 of file QtMouseEventModule.h.

Referenced by pullEvent().


The documentation for this class was generated from the following files:

copyright (c) 2006 Graz University of Technology