X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fevents.c;h=6def0cb60992c285be6837ad94a877c4a6a0a303;hb=739004ae2f6fa8b334b040760486b9689d8f59da;hp=eaa87c00989d9ed5379db662e3276071df20998d;hpb=71664f429ff6b802e1826ce51688ce81914ada0d;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index eaa87c00..6def0cb6 100644 --- a/src/events.c +++ b/src/events.c @@ -653,6 +653,7 @@ void HandleWindowEvent(WindowEvent *event) video.display_height = new_display_height; SDLSetScreenProperties(); + SetGadgetsPosition_OverlayTouchButtons(); // check if screen orientation has changed (should always be true here) if (nr != GRID_ACTIVE_NR()) @@ -1274,7 +1275,7 @@ static void HandleButtonOrFinger_FollowFinger(int mx, int my, int button) int last_move_dir = (ABS(dx) > ABS(dy) ? MV_VERTICAL : MV_HORIZONTAL); if (level.game_engine_type == GAME_ENGINE_TYPE_EM) - level.native_em_level->ply[0]->last_move_dir = last_move_dir; + game_em.ply[0]->last_move_dir = last_move_dir; else local_player->last_move_dir = last_move_dir; @@ -1448,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 @@ -1680,6 +1684,14 @@ void HandleButton(int mx, int my, int button, int button_nr) strEqual(setup.touch.control_type, TOUCH_CONTROL_FOLLOW_FINGER) || (strEqual(setup.touch.control_type, TOUCH_CONTROL_VIRTUAL_BUTTONS) && !CheckVirtualButtonPressed(mx, my, button))); + + // always recognize potentially releasing already pressed gadgets + if (button == MB_RELEASED) + handle_gadgets = TRUE; + + // always recognize pressing or releasing overlay touch buttons + if (CheckPosition_OverlayTouchButtons(mx, my, button) && !motion_status) + handle_gadgets = TRUE; #endif if (HandleGlobalAnimClicks(mx, my, button, FALSE))