From 42b475968018949ac6b324b3421643b7f2eded1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Thu, 12 Apr 2018 13:42:54 +0200 Subject: [PATCH] Sdk/Application: Give/clear console focus when enabling/disabling it --- SDK/src/NDK/Application.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/SDK/src/NDK/Application.cpp b/SDK/src/NDK/Application.cpp index 784df724b..b190250ff 100644 --- a/SDK/src/NDK/Application.cpp +++ b/SDK/src/NDK/Application.cpp @@ -209,7 +209,19 @@ namespace Ndk overlay->keyPressedSlot.Connect(eventHandler.OnKeyPressed, [&consoleRef] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& event) { if (event.code == Nz::Keyboard::F9) - consoleRef.Show(!consoleRef.IsVisible()); + { + // Toggle console visibility and focus + if (consoleRef.IsVisible()) + { + consoleRef.ClearFocus(); + consoleRef.Show(false); + } + else + { + consoleRef.Show(true); + consoleRef.SetFocus(); + } + } }); overlay->resizedSlot.Connect(info.renderTarget->OnRenderTargetSizeChange, [&consoleRef] (const Nz::RenderTarget* renderTarget)