allow mouse input while mouse overlay is active (#17615)

This commit is contained in:
Eric Warmenhoven 2025-02-21 15:33:27 -05:00 committed by GitHub
parent 273eb7bd7b
commit e26b3bca4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 27 deletions

View File

@ -401,31 +401,11 @@ static void cocoa_input_poll(void *data)
if (!apple)
return;
#ifdef IOS
#ifdef HAVE_IOS_TOUCHMOUSE
if (apple->window_pos_x > 0 || apple->mouse_grabbed)
{
apple->mouse_rel_x = apple->window_pos_x - apple->mouse_x_last;
apple->mouse_x_last = apple->window_pos_x;
}
#endif
#else
apple->mouse_rel_x = apple->window_pos_x - apple->mouse_x_last;
apple->mouse_x_last = apple->window_pos_x;
#endif
#ifdef IOS
#ifdef HAVE_IOS_TOUCHMOUSE
if (apple->window_pos_y > 0 || apple->mouse_grabbed)
{
apple->mouse_rel_y = apple->window_pos_y - apple->mouse_y_last;
apple->mouse_y_last = apple->window_pos_y;
}
#endif
#else
apple->mouse_rel_y = apple->window_pos_y - apple->mouse_y_last;
apple->mouse_y_last = apple->window_pos_y;
#endif
for (i = 0; i < apple->touch_count || i == 0; i++)
{

View File

@ -1791,9 +1791,6 @@ static int16_t input_state_device(
input_st->overlay_ptr, port, device, idx, id);
#endif
if (input_st->flags & INP_FLAG_BLOCK_POINTER_INPUT)
break;
if (id < RARCH_FIRST_META_KEY)
{
bool bind_valid = input_st->libretro_input_binds[port]
@ -1807,7 +1804,7 @@ static int16_t input_state_device(
res |= (1 << id);
}
else
res = ret;
res += ret;
}
}

View File

@ -772,13 +772,31 @@ enum
mouse.mouseInput.mouseMovedHandler = ^(GCMouseInput * _Nonnull mouse, float delta_x, float delta_y)
{
cocoa_input_data_t *apple = (cocoa_input_data_t*) input_state_get_ptr()->current_data;
if (!apple || !apple->mouse_grabbed)
if (!apple)
return;
apple->mouse_rel_x += (int16_t)delta_x;
apple->mouse_rel_y -= (int16_t)delta_y;
apple->window_pos_x += (int16_t)delta_x;
apple->window_pos_y -= (int16_t)delta_y;
};
mouse.mouseInput.leftButton.pressedChangedHandler = ^(GCControllerButtonInput * _Nonnull button, float value, BOOL pressed)
{
cocoa_input_data_t *apple = (cocoa_input_data_t*) input_state_get_ptr()->current_data;
if (!apple)
return;
if (pressed)
apple->mouse_buttons |= (1 << 0);
else
apple->mouse_buttons &= ~(1 << 0);
};
mouse.mouseInput.rightButton.pressedChangedHandler = ^(GCControllerButtonInput * _Nonnull button, float value, BOOL pressed)
{
cocoa_input_data_t *apple = (cocoa_input_data_t*) input_state_get_ptr()->current_data;
if (!apple)
return;
if (pressed)
apple->mouse_buttons |= (1 << 1);
else
apple->mouse_buttons &= ~(1 << 1);
};
}];
}
#endif