mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +00:00
(X11 input) Cleanups
This commit is contained in:
parent
9970768dd2
commit
509e2e2851
@ -76,9 +76,10 @@ static bool x_key_pressed(x11_input_t *x11, int key)
|
|||||||
if (key >= RETROK_LAST)
|
if (key >= RETROK_LAST)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
sym = input_keymaps_translate_rk_to_keysym((enum retro_key)key);
|
sym = input_keymaps_translate_rk_to_keysym((enum retro_key)key);
|
||||||
keycode = XKeysymToKeycode(x11->display, sym);
|
keycode = XKeysymToKeycode(x11->display, sym);
|
||||||
ret = x11->state[keycode >> 3] & (1 << (keycode & 7));
|
ret = x11->state[keycode >> 3] & (1 << (keycode & 7));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,6 +91,7 @@ static bool x_is_pressed(x11_input_t *x11,
|
|||||||
const struct retro_keybind *bind = &binds[id];
|
const struct retro_keybind *bind = &binds[id];
|
||||||
return bind->valid && x_key_pressed(x11, binds[id].key);
|
return bind->valid && x_key_pressed(x11, binds[id].key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,9 +147,9 @@ static int16_t x_mouse_state(x11_input_t *x11, unsigned id)
|
|||||||
}
|
}
|
||||||
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
||||||
return x11->mouse_m;
|
return x11->mouse_m;
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int16_t x_pointer_state(x11_input_t *x11,
|
static int16_t x_pointer_state(x11_input_t *x11,
|
||||||
@ -184,9 +186,9 @@ static int16_t x_pointer_state(x11_input_t *x11,
|
|||||||
return res_y;
|
return res_y;
|
||||||
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
||||||
return x11->mouse_l;
|
return x11->mouse_l;
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int16_t x_lightgun_state(x11_input_t *x11, unsigned id)
|
static int16_t x_lightgun_state(x11_input_t *x11, unsigned id)
|
||||||
@ -245,10 +247,9 @@ static int16_t x_input_state(void *data,
|
|||||||
|
|
||||||
case RETRO_DEVICE_LIGHTGUN:
|
case RETRO_DEVICE_LIGHTGUN:
|
||||||
return x_lightgun_state(x11, id);
|
return x_lightgun_state(x11, id);
|
||||||
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void x_input_free(void *data)
|
static void x_input_free(void *data)
|
||||||
@ -359,6 +360,9 @@ static bool x_set_rumble(void *data, unsigned port,
|
|||||||
static const rarch_joypad_driver_t *x_get_joypad_driver(void *data)
|
static const rarch_joypad_driver_t *x_get_joypad_driver(void *data)
|
||||||
{
|
{
|
||||||
x11_input_t *x11 = (x11_input_t*)data;
|
x11_input_t *x11 = (x11_input_t*)data;
|
||||||
|
|
||||||
|
if (!x11)
|
||||||
|
return NULL;
|
||||||
return x11->joypad;
|
return x11->joypad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user