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
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
}

4
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<Flag> Flags;
@ -698,7 +701,6 @@ class Sdl2Application {
UnsignedInt _minimalLoopPeriod;
#else
SDL_Surface* _glContext;
bool _isTextInputActive = false;
#endif
std::unique_ptr<Platform::Context> _context;

Loading…
Cancel
Save