From 2443718b9fa92bd249d496d7b03647cfc228fa90 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Sun, 8 Mar 2015 01:17:49 +0100 Subject: [PATCH] Fixup for previous commit. --- examples/common/entry/entry_osx.mm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/examples/common/entry/entry_osx.mm b/examples/common/entry/entry_osx.mm index 17650e17..a9f94d96 100644 --- a/examples/common/entry/entry_osx.mm +++ b/examples/common/entry/entry_osx.mm @@ -308,16 +308,22 @@ namespace entry { m_eventQueue.postExitEvent(); } - else if (0 != (modifiers & (Modifier::LeftShift|Modifier::RightShift) ) - && ( (Key::Key0 <= key && key <= Key::KeyZ) || (Key::Esc <= key && key <= Key::Minus) ) ) - { - m_eventQueue.postCharEvent(s_defaultWindow, 1, pressedChar); - return false; - } else { - m_eventQueue.postKeyEvent(s_defaultWindow, key, modifiers, true); - return false; + enum { ShiftMask = Modifier::LeftShift|Modifier::RightShift }; + const bool nonShiftModifiers = (0 != (modifiers&(~ShiftMask) ) ); + const bool isCharPressed = (Key::Key0 <= key && key <= Key::KeyZ) || (Key::Esc <= key && key <= Key::Minus) ; + const bool isText = isCharPressed && !nonShiftModifiers; + if (isText) + { + m_eventQueue.postCharEvent(s_defaultWindow, 1, pressedChar); + return false; + } + else + { + m_eventQueue.postKeyEvent(s_defaultWindow, key, modifiers, true); + return false; + } } }