(x11_input.c) get rid of this inline function

This commit is contained in:
twinaphex 2017-06-06 23:50:51 +02:00
parent c7b45aaf80
commit deb804ab2f

View File

@ -49,7 +49,6 @@ typedef struct x11_input
bool grab_mouse;
} x11_input_t;
static void *x_input_init(const char *joypad_driver)
{
x11_input_t *x11;
@ -74,31 +73,35 @@ static void *x_input_init(const char *joypad_driver)
return x11;
}
static INLINE bool x_key_pressed(x11_input_t *x11, int key)
{
unsigned sym = rarch_keysym_lut[(enum retro_key)key];
int keycode = XKeysymToKeycode(x11->display, sym);
return x11->state[keycode >> 3] & (1 << (keycode & 7));
}
static int16_t x_pressed_analog(x11_input_t *x11,
const struct retro_keybind *binds, unsigned idx, unsigned id)
{
int16_t pressed_minus = 0, pressed_plus = 0;
int16_t pressed_minus = 0;
int16_t pressed_plus = 0;
unsigned id_minus = 0;
unsigned id_plus = 0;
int id_minus_key = 0;
int id_plus_key = 0;
unsigned sym = 0;
int keycode = 0;
input_conv_analog_id_to_bind_id(idx, id, &id_minus, &id_plus);
id_minus_key = binds[id_minus].key;
id_plus_key = binds[id_plus].key;
if (binds && binds[id_minus].valid && (id_minus_key < RETROK_LAST) && x_key_pressed(x11, id_minus_key))
sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
keycode = XKeysymToKeycode(x11->display, sym);
if (binds && binds[id_minus].valid
&& (id_minus_key < RETROK_LAST)
&& (x11->state[keycode >> 3] & (1 << (keycode & 7))))
pressed_minus = -0x7fff;
if (binds && binds[id_plus].valid && (id_plus_key < RETROK_LAST) && x_key_pressed(x11, id_plus_key))
sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
keycode = XKeysymToKeycode(x11->display, sym);
if (binds && binds[id_plus].valid
&& (id_plus_key < RETROK_LAST)
&& (x11->state[keycode >> 3] & (1 << (keycode & 7))))
pressed_plus = 0x7fff;
return pressed_plus + pressed_minus;
@ -220,23 +223,34 @@ static int16_t x_input_state(void *data,
unsigned device, unsigned idx, unsigned id)
{
int16_t ret = 0;
int key = 0;
x11_input_t *x11 = (x11_input_t*)data;
switch (device)
{
case RETRO_DEVICE_JOYPAD:
key = binds[port][id].key;
return ((key < RETROK_LAST) && x_key_pressed(x11, key)) ||
input_joypad_pressed(x11->joypad, joypad_info, port, binds[port], id);
break;
{
int key = binds[port][id].key;
int keycode = XKeysymToKeycode(x11->display,
rarch_keysym_lut[(enum retro_key)key]);
ret = x11->state[keycode >> 3] & (1 << (keycode & 7));
}
if (!ret)
return input_joypad_pressed(x11->joypad,
joypad_info, port, binds[port], id);
return ret;
case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && x_key_pressed(x11, id);
if (id < RETROK_LAST)
{
int keycode = XKeysymToKeycode(x11->display,
rarch_keysym_lut[(enum retro_key)id]);
return x11->state[keycode >> 3] & (1 << (keycode & 7));
}
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
ret = x_pressed_analog(x11, binds[port], idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(x11->joypad, joypad_info,
return input_joypad_analog(x11->joypad, joypad_info,
port, idx,
id, binds[port]);
return ret;