mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 16:39:43 +00:00
(X11/udev) Input fixes
This commit is contained in:
parent
45f90ad89a
commit
321ede2256
@ -790,10 +790,10 @@ static bool udev_pointer_is_off_window(const udev_input_t *udev)
|
||||
bool r = video_driver_get_viewport_info(&view);
|
||||
|
||||
if (r)
|
||||
r = udev->pointer_x < view.x ||
|
||||
udev->pointer_x >= view.x + view.width ||
|
||||
udev->pointer_y < view.y ||
|
||||
udev->pointer_y >= view.y + view.height;
|
||||
r = udev->pointer_x < 0 ||
|
||||
udev->pointer_x >= view.full_width ||
|
||||
udev->pointer_y < 0 ||
|
||||
udev->pointer_y >= view.full_height;
|
||||
return r;
|
||||
#else
|
||||
return false;
|
||||
@ -1028,14 +1028,19 @@ static int16_t udev_input_state(void *data,
|
||||
{
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
{
|
||||
if ( (binds[port][i].key < RETROK_LAST) &&
|
||||
udev_keyboard_pressed(udev, binds[port][i].key) )
|
||||
return 1;
|
||||
bool keyboard_pressed = false;
|
||||
bool joypad_pressed = false;
|
||||
|
||||
if (binds[port][i].valid)
|
||||
if (udev_is_pressed(
|
||||
udev, udev->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
{
|
||||
keyboard_pressed = (binds[port][i].key < RETROK_LAST) ?
|
||||
udev_keyboard_pressed(udev, binds[port][i].key) : false;
|
||||
joypad_pressed = udev_is_pressed(udev, udev->joypad,
|
||||
joypad_info, binds[port], port, i);
|
||||
}
|
||||
|
||||
if (keyboard_pressed || joypad_pressed)
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,14 +329,19 @@ static int16_t x_input_state(void *data,
|
||||
{
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
{
|
||||
if ((binds[port][i].key < RETROK_LAST) &&
|
||||
x_keyboard_pressed(x11, binds[port][i].key) )
|
||||
return 1;
|
||||
bool keyboard_pressed = false;
|
||||
bool joypad_pressed = false;
|
||||
|
||||
if (binds[port][i].valid)
|
||||
if (x_is_pressed(
|
||||
x11, x11->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
{
|
||||
keyboard_pressed = (binds[port][i].key < RETROK_LAST) ?
|
||||
x_keyboard_pressed(x11, binds[port][i].key) : false;
|
||||
joypad_pressed = x_is_pressed(x11, x11->joypad,
|
||||
joypad_info, binds[port], port, i);
|
||||
}
|
||||
|
||||
if (keyboard_pressed || joypad_pressed)
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,8 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
|
||||
#define BIT16_GET(a, bit) (((a) >> ((bit) & 15)) & 1)
|
||||
#define BIT16_CLEAR_ALL(a) ((a) = 0)
|
||||
|
||||
#define BIT32_SET(a, bit) ((a) |= (1 << ((bit) & 31)))
|
||||
#define BIT32_CLEAR(a, bit) ((a) &= ~(1 << ((bit) & 31)))
|
||||
#define BIT32_SET(a, bit) ((a) |= (UINT32_C(1) << ((bit) & 31)))
|
||||
#define BIT32_CLEAR(a, bit) ((a) &= ~(UINT32_C(1) << ((bit) & 31)))
|
||||
#define BIT32_GET(a, bit) (((a) >> ((bit) & 31)) & 1)
|
||||
#define BIT32_CLEAR_ALL(a) ((a) = 0)
|
||||
|
||||
@ -116,8 +116,8 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
|
||||
#define BIT64_GET(a, bit) (((a) >> ((bit) & 63)) & 1)
|
||||
#define BIT64_CLEAR_ALL(a) ((a) = 0)
|
||||
|
||||
#define BIT128_SET(a, bit) ((a).data[(bit) >> 5] |= (1 << ((bit) & 31)))
|
||||
#define BIT128_CLEAR(a, bit) ((a).data[(bit) >> 5] &= ~(1 << ((bit) & 31)))
|
||||
#define BIT128_SET(a, bit) ((a).data[(bit) >> 5] |= (UINT32_C(1) << ((bit) & 31)))
|
||||
#define BIT128_CLEAR(a, bit) ((a).data[(bit) >> 5] &= ~(UINT32_C(1) << ((bit) & 31)))
|
||||
#define BIT128_GET(a, bit) (((a).data[(bit) >> 5] >> ((bit) & 31)) & 1)
|
||||
#define BIT128_CLEAR_ALL(a) memset(&(a), 0, sizeof(a))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user