Also ignore initial mouse position after refresh rate change

This commit is contained in:
sonninnos 2025-08-30 22:17:52 +03:00
parent ab898468be
commit 3ebc2f7db2
3 changed files with 15 additions and 1 deletions

View File

@ -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;

View File

@ -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

View File

@ -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)