diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index 60378041c3..7c0d4b21f9 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -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); } } diff --git a/input/drivers/x11_input.c b/input/drivers/x11_input.c index cbeeed131d..6d35eb875c 100644 --- a/input/drivers/x11_input.c +++ b/input/drivers/x11_input.c @@ -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); } } diff --git a/libretro-common/include/retro_miscellaneous.h b/libretro-common/include/retro_miscellaneous.h index 45ef20d0ce..83378d8d0d 100644 --- a/libretro-common/include/retro_miscellaneous.h +++ b/libretro-common/include/retro_miscellaneous.h @@ -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))