added showing overlay touch buttons only if touch screen is really used
authorHolger Schemel <info@artsoft.org>
Wed, 2 Oct 2019 19:43:19 +0000 (21:43 +0200)
committerHolger Schemel <info@artsoft.org>
Wed, 2 Oct 2019 21:21:39 +0000 (23:21 +0200)
src/events.c
src/libgame/gadgets.c

index 32f7177964af22b746b8c6727cd23d207f96a5da..21836c9dd6c67355bff8ec57d09084569c719640 100644 (file)
@@ -1449,6 +1449,9 @@ void HandleKeyEvent(KeyEvent *event)
   {
     // for any other "real" key event, disable virtual buttons
     SetOverlayEnabled(FALSE);
+
+    // for any other "real" key event, disable overlay touch buttons
+    runtime.uses_touch_device = FALSE;
   }
 #endif
 
index 1004199f40d45bdd9cf405ca4398a71f1e75d045..c50fb32e5f0f1e3b9b8493957470499b1ed8c86a 100644 (file)
@@ -808,7 +808,8 @@ static void DrawGadget_OverlayTouchButton(struct GadgetInfo *gi)
   int alpha_max = SDL_ALPHA_OPAQUE;
   int alpha_step = ALPHA_FADING_STEPSIZE(alpha_max);
 
-  if (gi->mapped)
+  // only show mapped overlay touch buttons if touch screen is really used
+  if (gi->mapped && runtime.uses_touch_device)
   {
     if (alpha < alpha_max)
       alpha = MIN(alpha + alpha_step, alpha_max);