mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
(Wayland) Mouse grab cleanup (#15114)
This commit is contained in:
parent
90694a3cf1
commit
d2c40b48ab
@ -84,12 +84,6 @@ static void input_wl_poll(void *data)
|
||||
|
||||
if (wl->gfx->locked_pointer)
|
||||
{
|
||||
/* Get effective 'absolute' pointer location
|
||||
* (last position + delta, bounded by current
|
||||
* application window dimensions) */
|
||||
wl->mouse.x += wl->mouse.delta_x;
|
||||
wl->mouse.y += wl->mouse.delta_y;
|
||||
|
||||
/* Clamp X */
|
||||
if (wl->mouse.x < 0)
|
||||
wl->mouse.x = 0;
|
||||
@ -311,6 +305,7 @@ static int16_t input_wl_state(
|
||||
struct video_viewport vp;
|
||||
bool screen =
|
||||
(device == RARCH_DEVICE_POINTER_SCREEN);
|
||||
bool inside = false;
|
||||
int16_t res_x = 0;
|
||||
int16_t res_y = 0;
|
||||
int16_t res_screen_x = 0;
|
||||
@ -327,26 +322,22 @@ static int16_t input_wl_state(
|
||||
wl->mouse.x, wl->mouse.y,
|
||||
&res_x, &res_y, &res_screen_x, &res_screen_y))
|
||||
{
|
||||
if (screen)
|
||||
{
|
||||
res_x = res_screen_x;
|
||||
res_y = res_screen_y;
|
||||
}
|
||||
|
||||
inside = (res_x >= -0x7fff) && (res_y >= -0x7fff);
|
||||
if (!inside)
|
||||
return 0;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_POINTER_X:
|
||||
if (screen)
|
||||
{
|
||||
res_x = res_screen_x;
|
||||
res_y = res_screen_y;
|
||||
}
|
||||
if ((res_x >= -0x7fff) && (res_y >= -0x7fff)) /* Inside? */
|
||||
return res_x;
|
||||
break;
|
||||
case RETRO_DEVICE_ID_POINTER_Y:
|
||||
if (screen)
|
||||
{
|
||||
res_x = res_screen_x;
|
||||
res_y = res_screen_y;
|
||||
}
|
||||
if ((res_x >= -0x7fff) && (res_y >= -0x7fff)) /* Inside? */
|
||||
return res_y;
|
||||
break;
|
||||
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
||||
return wl->mouse.left;
|
||||
case RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN:
|
||||
@ -431,7 +422,6 @@ static uint64_t input_wl_get_capabilities(void *data)
|
||||
static void input_wl_grab_mouse(void *data, bool state)
|
||||
{
|
||||
input_ctx_wayland_data_t *wl = (input_ctx_wayland_data_t*)data;
|
||||
|
||||
gfx_ctx_wayland_data_t *gfx = (gfx_ctx_wayland_data_t*)wl->gfx;
|
||||
|
||||
if (gfx->pointer_constraints)
|
||||
|
Loading…
x
Reference in New Issue
Block a user