Skip to content

Commit

Permalink
Client|Console: Log background blur can be disabled, eat mouse clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jun 15, 2013
1 parent 5b5670e commit a75d53e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
9 changes: 9 additions & 0 deletions doomsday/client/include/ui/widgets/consolewidget.h
Expand Up @@ -49,6 +49,15 @@ class ConsoleWidget : public GuiWidget

bool isLogOpen() const;

/**
* Enables or disables the console log background blur.
*
* @todo Blurring is presently forcibly disabled when a game is loaded.
*
* @param yes @c true to enable blur, otherwise @c false.
*/
void enableBlur(bool yes = true);

// Events.
void viewResized();
void update();
Expand Down
24 changes: 21 additions & 3 deletions doomsday/client/src/ui/widgets/consolewidget.cpp
Expand Up @@ -140,9 +140,7 @@ ConsoleWidget::ConsoleWidget() : GuiWidget("console"), d(new Instance(this))
add(d->log);

// Blur the log background.
Background logBg = d->log->background();
logBg.type = Background::Blurred;
d->log->set(logBg);
enableBlur();

connect(d->log, SIGNAL(contentHeightIncreased(int)), this, SLOT(logContentHeightIncreased(int)));

Expand Down Expand Up @@ -184,6 +182,20 @@ bool ConsoleWidget::isLogOpen() const
return d->opened;
}

void ConsoleWidget::enableBlur(bool yes)
{
Background logBg = d->log->background();
if(yes)
{
logBg.type = Background::Blurred;
}
else
{
logBg.type = Background::None;
}
d->log->set(logBg);
}

void ConsoleWidget::viewResized()
{
if(!d->opened)
Expand Down Expand Up @@ -265,6 +277,12 @@ bool ConsoleWidget::handleEvent(Event const &event)
}
}

if(event.type() == Event::MouseButton && hitTest(event))
{
// Prevent clicks from leaking through.
return true;
}

if(event.type() == Event::KeyPress)
{
KeyEvent const &key = event.as<KeyEvent>();
Expand Down

0 comments on commit a75d53e

Please sign in to comment.