Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow mouse input while mouse overlay is active #17615

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions input/drivers/cocoa_input.m
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down
5 changes: 1 addition & 4 deletions input/input_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -1807,7 +1804,7 @@ static int16_t input_state_device(
res |= (1 << id);
}
else
res = ret;
res += ret;
}
}

Expand Down
24 changes: 21 additions & 3 deletions ui/drivers/ui_cocoatouch.m
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,31 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application
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
Expand Down
Loading