Skip to content

Commit 3ebc2f7

Browse files
committed
Also ignore initial mouse position after refresh rate change
1 parent ab89846 commit 3ebc2f7

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

menu/menu_driver.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,7 @@ static void menu_input_get_mouse_hw_state(
18631863
bool overlay_active,
18641864
menu_input_pointer_hw_state_t *hw_state)
18651865
{
1866+
struct menu_state *menu_st = &menu_driver_state;
18661867
rarch_joypad_info_t joypad_info;
18671868
static int16_t last_x = -0x7fff;
18681869
static int16_t last_y = -0x7fff;
@@ -1883,6 +1884,13 @@ static void menu_input_get_mouse_hw_state(
18831884
menu_mouse_enable = false;
18841885
#endif
18851886

1887+
/* Ignore initial mouse position also after reinit */
1888+
if (menu_st->input_pointer_hw_state.flags & MENU_INP_PTR_FLG_RESET)
1889+
{
1890+
menu_st->input_pointer_hw_state.flags &= ~MENU_INP_PTR_FLG_RESET;
1891+
last_x = last_y = -0x7fff;
1892+
}
1893+
18861894
/* Easiest to set inactive by default, and toggle
18871895
* when input is detected */
18881896
hw_state->x = 0;

menu/menu_input.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ enum menu_inp_ptr_hwst_flags
192192
MENU_INP_PTR_FLG_PRESS_LEFT = (1 << 5),
193193
MENU_INP_PTR_FLG_PRESS_RIGHT = (1 << 6),
194194
MENU_INP_PTR_FLG_PRESSED = (1 << 7),
195-
MENU_INP_PTR_FLG_DRAGGED = (1 << 8)
195+
MENU_INP_PTR_FLG_DRAGGED = (1 << 8),
196+
MENU_INP_PTR_FLG_RESET = (1 << 9)
196197
};
197198

198199
/* Defines set of (abstracted) inputs/states

retroarch.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,6 +1682,11 @@ void drivers_init(
16821682
location_st->active = false;
16831683
}
16841684

1685+
#ifdef HAVE_MENU
1686+
if (flags & DRIVER_INPUT_MASK)
1687+
menu_st->input_pointer_hw_state.flags |= MENU_INP_PTR_FLG_RESET;
1688+
#endif
1689+
16851690
core_info_init_current_core();
16861691

16871692
#if defined(HAVE_GFX_WIDGETS)

0 commit comments

Comments
 (0)