From a75d53ee68357100956eb0af95675944ab2e132e Mon Sep 17 00:00:00 2001 From: skyjake Date: Sat, 15 Jun 2013 14:11:21 +0300 Subject: [PATCH] Client|Console: Log background blur can be disabled, eat mouse clicks --- .../client/include/ui/widgets/consolewidget.h | 9 +++++++ .../client/src/ui/widgets/consolewidget.cpp | 24 ++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/doomsday/client/include/ui/widgets/consolewidget.h b/doomsday/client/include/ui/widgets/consolewidget.h index 2d43e70814..171ab8f508 100644 --- a/doomsday/client/include/ui/widgets/consolewidget.h +++ b/doomsday/client/include/ui/widgets/consolewidget.h @@ -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(); diff --git a/doomsday/client/src/ui/widgets/consolewidget.cpp b/doomsday/client/src/ui/widgets/consolewidget.cpp index 927a82fcef..a15a1b1646 100644 --- a/doomsday/client/src/ui/widgets/consolewidget.cpp +++ b/doomsday/client/src/ui/widgets/consolewidget.cpp @@ -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))); @@ -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) @@ -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();