10.08.2013 Views

Bachelor Thesis - Computer Graphics Group

Bachelor Thesis - Computer Graphics Group

Bachelor Thesis - Computer Graphics Group

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Callbacks:<br />

• Callback GestureEvent - this function is being called to notify the<br />

main application about the gesture capture phases<br />

• Callback WindowIgnored - the application is asked every time a gesture<br />

should be activated whether the given window should be ignored<br />

Methods:<br />

• instance - return a reference to the GesturesHook singleton instance<br />

• initialize - set the mouse hook and start capturing gestures, the return<br />

value indicates success or failure<br />

• terminate - stop capturing gestures and release the mouse hook<br />

• setCallback GestureEvent - gesture-event callback setter<br />

• setCallback WindowIgnored - window-ignored callback setter<br />

Properties:<br />

• enabled - gesture capturing can be disabled temporarily<br />

• toggleButton - toggle button (left, right, middle, X-button 1 & 2)<br />

• activationDistance - activation distance in pixels<br />

• timeout - timeout interval in milliseconds<br />

4.4 Implementation<br />

Every application instance has its own virtual memory address space. Therefore,<br />

all instances of the gesture catcher library are separated from each other.<br />

The code segment, which is read only, is mapped to the same physical memory<br />

to save resources. The data segment is private to each instance. As we need<br />

to have a globally shared instance of the GesturesHook singleton class, a<br />

shared data segment has to be created using compiler directives. The instance<br />

is being instantiated into a pre-allocated buffer in this memory area using<br />

C++ placement new operator. Dynamic memory allocation from heap must<br />

be avoided completely, as pointers valid in the context of one application are<br />

no longer valid in other applications’ address spaces. As the result, STL data<br />

structures such as strings and containers cannot be used.<br />

24

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!