Browse Source

Platform: use Flag::TextInputActive instead of a boolean in Sdl2Application.

pull/193/head
Vladimír Vondruš 9 years ago
parent
commit
3a16ae6f46
  1. 6
      src/Magnum/Platform/Sdl2Application.cpp
  2. 4
      src/Magnum/Platform/Sdl2Application.h

6
src/Magnum/Platform/Sdl2Application.cpp

@ -495,21 +495,21 @@ bool Sdl2Application::isTextInputActive() {
#ifndef CORRADE_TARGET_EMSCRIPTEN #ifndef CORRADE_TARGET_EMSCRIPTEN
return SDL_IsTextInputActive(); return SDL_IsTextInputActive();
#else #else
return _isTextInputActive; return !!(_flags & Flag::TextInputActive);
#endif #endif
} }
void Sdl2Application::startTextInput() { void Sdl2Application::startTextInput() {
SDL_StartTextInput(); SDL_StartTextInput();
#ifdef CORRADE_TARGET_EMSCRIPTEN #ifdef CORRADE_TARGET_EMSCRIPTEN
_isTextInputActive = true; _flags |= Flag::TextInputActive;
#endif #endif
} }
void Sdl2Application::stopTextInput() { void Sdl2Application::stopTextInput() {
SDL_StopTextInput(); SDL_StopTextInput();
#ifdef CORRADE_TARGET_EMSCRIPTEN #ifdef CORRADE_TARGET_EMSCRIPTEN
_isTextInputActive = false; _flags &= ~Flag::TextInputActive;
#endif #endif
} }

4
src/Magnum/Platform/Sdl2Application.h

@ -680,6 +680,9 @@ class Sdl2Application {
#ifndef CORRADE_TARGET_EMSCRIPTEN #ifndef CORRADE_TARGET_EMSCRIPTEN
Exit = 1 << 3 Exit = 1 << 3
#endif #endif
#ifdef CORRADE_TARGET_EMSCRIPTEN
TextInputActive = 1 << 4
#endif
}; };
typedef Containers::EnumSet<Flag> Flags; typedef Containers::EnumSet<Flag> Flags;
@ -698,7 +701,6 @@ class Sdl2Application {
UnsignedInt _minimalLoopPeriod; UnsignedInt _minimalLoopPeriod;
#else #else
SDL_Surface* _glContext; SDL_Surface* _glContext;
bool _isTextInputActive = false;
#endif #endif
std::unique_ptr<Platform::Context> _context; std::unique_ptr<Platform::Context> _context;

Loading…
Cancel
Save