Skip to content

Commit

Permalink
Client: Offer all mouse events first to WindowSystem
Browse files Browse the repository at this point in the history
The events will be given to the legacy input mechanism if the new one
doesn't want them.
  • Loading branch information
skyjake committed May 31, 2013
1 parent e916091 commit 9d837ee
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions doomsday/client/src/ui/clientwindow.cpp
Expand Up @@ -85,9 +85,11 @@ DENG2_OBSERVES(Canvas, FocusChange)
.setInput(Rule::Width, root.viewWidth());
root.add(taskBar);

Rule const &unit = ClientApp::windowSystem().style().rules().rule("unit");

ConsoleWidget *console = new ConsoleWidget;
console->rule()
.setInput(Rule::Bottom, taskBar->rule().top())
.setInput(Rule::Bottom, taskBar->rule().top() - unit)
.setInput(Rule::Left, root.viewLeft());
root.add(console);

Expand Down Expand Up @@ -214,6 +216,13 @@ DENG2_OBSERVES(Canvas, FocusChange)
#ifndef WIN32
void mouseEvent(MouseEvent const &event)
{
if(ClientApp::windowSystem().processEvent(event))
{
// Eaten by the window system.
return;
}

// Fall back to legacy handling.
switch(event.type())
{
case Event::MouseButton:
Expand All @@ -226,11 +235,6 @@ DENG2_OBSERVES(Canvas, FocusChange)
event.state() == MouseEvent::Pressed);
break;

case Event::MousePosition:
// Pass onto the window system.
ClientApp::windowSystem().processEvent(event);
break;

case Event::MouseMotion:
Mouse_Qt_SubmitMotion(IMA_POINTER, event.pos().x, event.pos().y);
break;
Expand Down

0 comments on commit 9d837ee

Please sign in to comment.