From: Holger Schemel Date: Wed, 2 Oct 2019 19:43:19 +0000 (+0200) Subject: added showing overlay touch buttons only if touch screen is really used X-Git-Tag: 4.1.4.0~7 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=7c435b7727b2d835e00b79365dd46102e0de08b4 added showing overlay touch buttons only if touch screen is really used --- 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);