From 8eefdf174e01545d44fd16c7852f2c6e983cf7fe Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 10 Jun 2015 16:44:46 -0300 Subject: [PATCH] Fix problem mapping "Ctrl++ Pad" key --- src/ui/accelerator.cpp | 27 +++++++++------- src/ui/accelerator_ui_tests.cpp | 56 +++++++++++++++++++++++++++++++++ src/ui/manager.cpp | 18 +++++++++-- 3 files changed, 86 insertions(+), 15 deletions(-) create mode 100644 src/ui/accelerator_ui_tests.cpp diff --git a/src/ui/accelerator.cpp b/src/ui/accelerator.cpp index 90907700b..9f9e1fa07 100644 --- a/src/ui/accelerator.cpp +++ b/src/ui/accelerator.cpp @@ -10,9 +10,10 @@ #include "ui/accelerator.h" -#include "base/unique_ptr.h" +#include "base/replace_string.h" #include "base/split_string.h" #include "base/string.h" +#include "base/unique_ptr.h" #include #include @@ -54,10 +55,12 @@ Accelerator::Accelerator(const std::string& str) return; } - std::vector tokens; - base::split_string(str, tokens, "+"); - for (std::string tok : tokens) { - tok = base::string_to_lower(tok); + std::size_t i, j; + for (i=0; itype() == kKeyDownMessage || + msg->type() == kKeyUpMessage) { + int mods = (int)static_cast(msg)->keyModifiers(); + TRACE("Key%s scancode=%d unicode=%d mods=%s%s%s\n", + (msg->type() == kKeyDownMessage ? "Down": "Up"), + static_cast(msg)->scancode(), + static_cast(msg)->unicodeChar(), + mods & kKeyShiftModifier ? " Shift": "", + mods & kKeyCtrlModifier ? " Ctrl": "", + mods & kKeyAltModifier ? " Alt": ""); + } +#endif + // Check if this message must be filtered by some widget before - c = msg->type(); + int c = msg->type(); if (c >= kFirstRegisteredMessage) c = kFirstRegisteredMessage;