diff --git a/menu/menu_driver.c b/menu/menu_driver.c index b2d8e1eb15..697bd33772 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -1863,6 +1863,7 @@ static void menu_input_get_mouse_hw_state( bool overlay_active, menu_input_pointer_hw_state_t *hw_state) { + struct menu_state *menu_st = &menu_driver_state; rarch_joypad_info_t joypad_info; static int16_t last_x = -0x7fff; static int16_t last_y = -0x7fff; @@ -1883,6 +1884,13 @@ static void menu_input_get_mouse_hw_state( menu_mouse_enable = false; #endif + /* Ignore initial mouse position also after reinit */ + if (menu_st->input_pointer_hw_state.flags & MENU_INP_PTR_FLG_RESET) + { + menu_st->input_pointer_hw_state.flags &= ~MENU_INP_PTR_FLG_RESET; + last_x = last_y = -0x7fff; + } + /* Easiest to set inactive by default, and toggle * when input is detected */ hw_state->x = 0; diff --git a/menu/menu_input.h b/menu/menu_input.h index 0878c9e782..a02f73b865 100644 --- a/menu/menu_input.h +++ b/menu/menu_input.h @@ -192,7 +192,8 @@ enum menu_inp_ptr_hwst_flags MENU_INP_PTR_FLG_PRESS_LEFT = (1 << 5), MENU_INP_PTR_FLG_PRESS_RIGHT = (1 << 6), MENU_INP_PTR_FLG_PRESSED = (1 << 7), - MENU_INP_PTR_FLG_DRAGGED = (1 << 8) + MENU_INP_PTR_FLG_DRAGGED = (1 << 8), + MENU_INP_PTR_FLG_RESET = (1 << 9) }; /* Defines set of (abstracted) inputs/states diff --git a/retroarch.c b/retroarch.c index d5b6246312..cdad61558f 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1682,6 +1682,11 @@ void drivers_init( location_st->active = false; } +#ifdef HAVE_MENU + if (flags & DRIVER_INPUT_MASK) + menu_st->input_pointer_hw_state.flags |= MENU_INP_PTR_FLG_RESET; +#endif + core_info_init_current_core(); #if defined(HAVE_GFX_WIDGETS)