Merge pull request #10845 from jdgleaver/x11-udev-input-fixes

(X11/udev) Input fixes
This commit is contained in:
Autechre 2020-06-12 17:22:44 +02:00 committed by GitHub
commit 6e621a98d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 20 deletions

View File

@ -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;
if (binds[port][i].valid)
if (udev_is_pressed(
udev, udev->joypad,
joypad_info, binds[port], port, i))
{
if (udev_is_pressed(udev, udev->joypad,
joypad_info, binds[port], port, i))
{
ret |= (1 << i);
continue;
}
if ((binds[port][i].key < RETROK_LAST) &&
udev_keyboard_pressed(udev, binds[port][i].key))
ret |= (1 << i);
}
}
}

View File

@ -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;
if (binds[port][i].valid)
if (x_is_pressed(
x11, x11->joypad,
joypad_info, binds[port], port, i))
{
if (x_is_pressed(x11, x11->joypad,
joypad_info, binds[port], port, i))
{
ret |= (1 << i);
continue;
}
if ((binds[port][i].key < RETROK_LAST) &&
x_keyboard_pressed(x11, binds[port][i].key))
ret |= (1 << i);
}
}
}

View File

@ -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))