Skip to content

Commit

Permalink
Fixed|UI: Command line widgets must check for disabled state
Browse files Browse the repository at this point in the history
If disabled, command line widgets must not handle events. The base
class (LineEditWidget) does already respect the disabled flag,
however derived classes did not.
  • Loading branch information
skyjake committed Dec 29, 2013
1 parent 8d162c9 commit 89afd46
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doomsday/client/src/ui/widgets/commandwidget.cpp
Expand Up @@ -86,6 +86,8 @@ void CommandWidget::focusLost()

bool CommandWidget::handleEvent(Event const &event)
{
if(isDisabled()) return false;

if(hasFocus() && event.isKeyDown())
{
KeyEvent const &key = event.as<KeyEvent>();
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/src/ui/widgets/consolecommandwidget.cpp
Expand Up @@ -66,6 +66,8 @@ ConsoleCommandWidget::ConsoleCommandWidget(String const &name)

bool ConsoleCommandWidget::handleEvent(Event const &event)
{
if(isDisabled()) return false;

if(hasFocus())
{
// Console bindings override normal event handling.
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/src/ui/widgets/scriptcommandwidget.cpp
Expand Up @@ -50,6 +50,8 @@ ScriptCommandWidget::ScriptCommandWidget(String const &name)

bool ScriptCommandWidget::handleEvent(Event const &event)
{
if(isDisabled()) return false;

bool wasCompl = autocompletionPopup().isOpen();
bool eaten = CommandWidget::handleEvent(event);
if(eaten && wasCompl && event.isKeyDown())
Expand Down

0 comments on commit 89afd46

Please sign in to comment.