From 7c435b7727b2d835e00b79365dd46102e0de08b4 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 2 Oct 2019 21:43:19 +0200 Subject: [PATCH] added showing overlay touch buttons only if touch screen is really used --- src/events.c | 3 +++ src/libgame/gadgets.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/events.c b/src/events.c index 32f71779..21836c9d 100644 --- a/src/events.c +++ b/src/events.c @@ -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 diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 1004199f..c50fb32e 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -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); -- 2.34.1