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.

SendInput function had to be used to emulate the mouse click. The effect<br />

is the same as if a real mouse button was clicked. Windows sends a correct<br />

message to the underlying window for us.<br />

Uninitialized<br />

Idle<br />

Ignored<br />

GesturePending<br />

GestureActive<br />

GestureBroken<br />

Cancelled<br />

Terminated<br />

Figure 4.2: State transitions<br />

Without event filtering, inactive windows are normally activated when clicked<br />

on, immediately after the button has been pressed, not when it was released.<br />

Nevertheless, since the window does not receive the button down message, it<br />

is not activated automatically. It has to be done in code by calling SetForegroundWindow.<br />

Furthermore, SetCapture must be used in order to receive<br />

mouse movement events when the cursor moves over to another window. Theoretically,<br />

this should not be necessary. The hook callback function should be<br />

called for the other window. And the library state is globally shared. However,<br />

in reality, the gesture only worked in the original window, no mouse messages<br />

have been received from the outside.<br />

As already mentioned, all program instances have their own address space. In<br />

order to invoke a callback function in the main application, the code flow has to<br />

switch the address space of the main application, where the callback function<br />

resides. To achieve this, message passing is used. The initialize function<br />

spawns a new so-called message thread running in our process. This thread<br />

creates a hidden message-only window receiving standard window messages.<br />

26

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

Saved successfully!

Ooh no, something went wrong!