added shifting up video display when activating screen keyboard (Android)
[rocksndiamonds.git] / src / libgame / system.c
index d8c79937451ab0b05fa4b517a54c225c54c5fb21..df401b5a57a6ebea20d8f539f6eedff4be5076b9 100644 (file)
@@ -386,6 +386,8 @@ void InitVideoBuffer(int width, int height, int depth, boolean fullscreen)
   video.frame_delay = 0;
   video.frame_delay_value = GAME_FRAME_DELAY;
 
+  video.shifted_up = FALSE;
+
   SDLInitVideoBuffer(fullscreen);
 
   video.initialized = TRUE;
@@ -1511,6 +1513,29 @@ KeyMod GetKeyModStateFromEvents()
   return HandleKeyModState(KSYM_UNDEFINED, 0);
 }
 
+void StartTextInput(int x, int y)
+{
+#if defined(TARGET_SDL2)
+  SDL_StartTextInput();
+
+#if defined(HAS_SCREEN_KEYBOARD)
+  if (y > video.height / 2)
+    video.shifted_up = TRUE;
+#endif
+#endif
+}
+
+void StopTextInput()
+{
+#if defined(TARGET_SDL2)
+  SDL_StopTextInput();
+
+#if defined(HAS_SCREEN_KEYBOARD)
+  video.shifted_up = FALSE;
+#endif
+#endif
+}
+
 boolean CheckCloseWindowEvent(ClientMessageEvent *event)
 {
   if (event->type != EVENT_CLIENTMESSAGE)