From 382c0b685b0808cb81143cf733aefad42412f0c8 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Fri, 6 Mar 2015 01:04:49 +0100 Subject: [PATCH] Calling postExitEvent() for Meta+Q as in other entries. --- examples/common/entry/entry_osx.mm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/common/entry/entry_osx.mm b/examples/common/entry/entry_osx.mm index c1fa7b7b..b95293ee 100644 --- a/examples/common/entry/entry_osx.mm +++ b/examples/common/entry/entry_osx.mm @@ -313,17 +313,20 @@ namespace entry uint8_t pressedChar[4]; Key::Enum key = handleKeyEvent(event, &modifiers, &pressedChar[0]); - // If KeyCode is none we don't don't handle the key and special case for cmd+q (quit) - // Note that return false here means that we take care of the key (instead of the default behavior) + // Returning false means that we take care of the key (instead of the default behavior) if (key != Key::None) { - if ( (Key::Key0 <= key && key <= Key::KeyZ) - || (Key::Esc <= key && key <= Key::Minus) ) + if (key == Key::KeyQ && (modifiers & Modifier::RightMeta) ) + { + m_eventQueue.postExitEvent(); + } + else if ( (Key::Key0 <= key && key <= Key::KeyZ) + || (Key::Esc <= key && key <= Key::Minus) ) { m_eventQueue.postCharEvent(s_defaultWindow, 1, pressedChar); + return false; } - else if (key != Key::KeyQ - && !(modifiers & Modifier::RightMeta) ) + else { m_eventQueue.postKeyEvent(s_defaultWindow, key, modifiers, true); return false; @@ -446,7 +449,6 @@ namespace entry } } - m_eventQueue.postExitEvent(); while (bgfx::RenderFrame::NoContext != bgfx::renderFrame() ) {};