From 3a16ae6f46ca6fd06a87c44e240f920493fe7616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 19 Feb 2017 20:31:51 +0100 Subject: [PATCH] Platform: use Flag::TextInputActive instead of a boolean in Sdl2Application. --- src/Magnum/Platform/Sdl2Application.cpp | 6 +++--- src/Magnum/Platform/Sdl2Application.h | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 30b6ec26f..b7f731e78 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -495,21 +495,21 @@ bool Sdl2Application::isTextInputActive() { #ifndef CORRADE_TARGET_EMSCRIPTEN return SDL_IsTextInputActive(); #else - return _isTextInputActive; + return !!(_flags & Flag::TextInputActive); #endif } void Sdl2Application::startTextInput() { SDL_StartTextInput(); #ifdef CORRADE_TARGET_EMSCRIPTEN - _isTextInputActive = true; + _flags |= Flag::TextInputActive; #endif } void Sdl2Application::stopTextInput() { SDL_StopTextInput(); #ifdef CORRADE_TARGET_EMSCRIPTEN - _isTextInputActive = false; + _flags &= ~Flag::TextInputActive; #endif } diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index ef7e9924f..e2591e302 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -680,6 +680,9 @@ class Sdl2Application { #ifndef CORRADE_TARGET_EMSCRIPTEN Exit = 1 << 3 #endif + #ifdef CORRADE_TARGET_EMSCRIPTEN + TextInputActive = 1 << 4 + #endif }; typedef Containers::EnumSet Flags; @@ -698,7 +701,6 @@ class Sdl2Application { UnsignedInt _minimalLoopPeriod; #else SDL_Surface* _glContext; - bool _isTextInputActive = false; #endif std::unique_ptr _context;