From 5dfe7b64ae979ab8b382711cb7f23755047a1470 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 21 Aug 2015 14:53:31 -0300 Subject: [PATCH] Enter key closes Cel or Layer properties if children have the focus --- src/app/commands/cmd_cel_properties.cpp | 10 ++++++++++ src/app/commands/cmd_layer_properties.cpp | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/app/commands/cmd_cel_properties.cpp b/src/app/commands/cmd_cel_properties.cpp index 86d895120..00e7fb13a 100644 --- a/src/app/commands/cmd_cel_properties.cpp +++ b/src/app/commands/cmd_cel_properties.cpp @@ -117,6 +117,16 @@ private: bool onProcessMessage(ui::Message* msg) override { switch (msg->type()) { + case kKeyDownMessage: + if (opacity()->hasFocus()) { + if (static_cast(msg)->scancode() == kKeyEnter) { + onCommitChange(); + closeWindow(this); + return true; + } + } + break; + case kCloseMessage: // Save changes before we close the window setCel(nullptr, nullptr); diff --git a/src/app/commands/cmd_layer_properties.cpp b/src/app/commands/cmd_layer_properties.cpp index 4f0890f97..919bf79f2 100644 --- a/src/app/commands/cmd_layer_properties.cpp +++ b/src/app/commands/cmd_layer_properties.cpp @@ -132,6 +132,18 @@ private: bool onProcessMessage(ui::Message* msg) override { switch (msg->type()) { + case kKeyDownMessage: + if (name()->hasFocus() || + opacity()->hasFocus() || + mode()->hasFocus()) { + if (static_cast(msg)->scancode() == kKeyEnter) { + onCommitChange(); + closeWindow(this); + return true; + } + } + break; + case kCloseMessage: // Save changes before we close the window setLayer(nullptr);