(X11/udev) When fetching RETRO_DEVICE_ID_JOYPAD_MASK, only query keyboard if corresponding gamepad button is not pressed

This commit is contained in:
jdgleaver 2020-06-12 16:06:32 +01:00
parent 321ede2256
commit 2c956fbe85
2 changed files with 20 additions and 20 deletions

View File

@ -1028,19 +1028,19 @@ static int16_t udev_input_state(void *data,
{
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
bool keyboard_pressed = false;
bool joypad_pressed = false;
if (binds[port][i].valid)
{
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 (udev_is_pressed(udev, udev->joypad,
joypad_info, binds[port], port, i))
{
ret |= (1 << i);
continue;
}
if (keyboard_pressed || joypad_pressed)
ret |= (1 << i);
if ((binds[port][i].key < RETROK_LAST) &&
udev_keyboard_pressed(udev, binds[port][i].key))
ret |= (1 << i);
}
}
}

View File

@ -329,19 +329,19 @@ static int16_t x_input_state(void *data,
{
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
bool keyboard_pressed = false;
bool joypad_pressed = false;
if (binds[port][i].valid)
{
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 (x_is_pressed(x11, x11->joypad,
joypad_info, binds[port], port, i))
{
ret |= (1 << i);
continue;
}
if (keyboard_pressed || joypad_pressed)
ret |= (1 << i);
if ((binds[port][i].key < RETROK_LAST) &&
x_keyboard_pressed(x11, binds[port][i].key))
ret |= (1 << i);
}
}
}