This commit is contained in:
twinaphex 2015-01-29 23:59:46 +01:00
parent bae3650d44
commit 0912f05d39
11 changed files with 33 additions and 23 deletions

View File

@ -78,11 +78,11 @@ void apple_rarch_exited(void)
for (i = 1; i < ch.length; i ++)
apple_input_keyboard_event(event_type == NSKeyDown,
0, [ch characterAtIndex:i], mod);
0, [ch characterAtIndex:i], mod, RETRO_DEVICE_KEYBOARD);
}
apple_input_keyboard_event(event_type == NSKeyDown,
event.keyCode, character, mod);
event.keyCode, character, mod, RETRO_DEVICE_KEYBOARD);
}
break;
case NSFlagsChanged:
@ -93,7 +93,7 @@ void apple_rarch_exited(void)
old_flags = new_flags;
apple_input_keyboard_event(down, event.keyCode,
0, event.modifierFlags);
0, event.modifierFlags, RETRO_DEVICE_KEYBOARD);
}
break;
case NSMouseMoved:

View File

@ -177,15 +177,18 @@ enum
{
character = [ch characterAtIndex:0];
apple_input_keyboard_event(event._isKeyDown,
(uint32_t)event._keyCode, 0, mod);
(uint32_t)event._keyCode, 0, mod,
RETRO_DEVICE_KEYBOARD);
for (i = 1; i < ch.length; i++)
apple_input_keyboard_event(event._isKeyDown,
0, [ch characterAtIndex:i], mod);
0, [ch characterAtIndex:i], mod,
RETRO_DEVICE_KEYBOARD);
}
apple_input_keyboard_event(event._isKeyDown,
(uint32_t)event._keyCode, character, mod);
(uint32_t)event._keyCode, character, mod,
RETRO_DEVICE_KEYBOARD);
}
return [super _keyCommandForEvent:event];
@ -209,7 +212,7 @@ enum
if (eventType == GSEVENT_TYPE_KEYDOWN || eventType == GSEVENT_TYPE_KEYUP)
apple_input_keyboard_event(eventType == GSEVENT_TYPE_KEYDOWN,
*(uint16_t*)&eventMem[0x3C], 0, 0);
*(uint16_t*)&eventMem[0x3C], 0, 0, RETRO_DEVICE_KEYBOARD);
}
}

View File

@ -173,7 +173,8 @@ static void rwebinput_input_poll(void *data)
{
if (diff & 1)
input_keyboard_event((state->keys[i] & (1 << k)) != 0,
input_keymaps_translate_keysym_to_rk(i * 8 + k), 0, 0);
input_keymaps_translate_keysym_to_rk(i * 8 + k), 0, 0,
RETRO_DEVICE_KEYBOARD);
}
}

View File

@ -345,7 +345,8 @@ static void sdl_input_poll(void *data)
if (event.key.keysym.mod & KMOD_CAPS)
mod |= RETROKMOD_CAPSLOCK;
input_keyboard_event(event.type == SDL_KEYDOWN, code, code, mod);
input_keyboard_event(event.type == SDL_KEYDOWN, code, code, mod,
RETRO_DEVICE_KEYBOARD);
}
#ifdef HAVE_SDL2
else if (event.type == SDL_MOUSEWHEEL)

View File

@ -133,7 +133,7 @@ static void handle_icade_event(unsigned keycode)
}
void apple_input_keyboard_event(bool down,
unsigned code, uint32_t character, uint32_t mod)
unsigned code, uint32_t character, uint32_t mod, unsigned device)
{
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;

View File

@ -46,25 +46,30 @@ LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message,
* WM_CHAR and WM_KEYDOWN properly.
*/
case WM_CHAR:
input_keyboard_event(true, RETROK_UNKNOWN, wparam, mod);
input_keyboard_event(true, RETROK_UNKNOWN, wparam, mod,
RETRO_DEVICE_KEYBOARD);
return TRUE;
case WM_KEYDOWN:
/* DirectInput uses scancodes directly. */
input_keyboard_event(true, keycode, 0, mod);
input_keyboard_event(true, keycode, 0, mod,
RETRO_DEVICE_KEYBOARD);
return 0;
case WM_KEYUP:
/* DirectInput uses scancodes directly. */
input_keyboard_event(false, keycode, 0, mod);
input_keyboard_event(false, keycode, 0, mod,
RETRO_DEVICE_KEYBOARD);
return 0;
case WM_SYSKEYUP:
input_keyboard_event(false, keycode, 0, mod);
input_keyboard_event(false, keycode, 0, mod,
RETRO_DEVICE_KEYBOARD);
return 0;
case WM_SYSKEYDOWN:
input_keyboard_event(true, keycode, 0, mod);
input_keyboard_event(true, keycode, 0, mod,
RETRO_DEVICE_KEYBOARD);
switch (wparam)
{

View File

@ -122,9 +122,9 @@ void x11_handle_key_event(XEvent *event, XIC ic, bool filter)
if (state & Mod4Mask)
mod |= RETROKMOD_META;
input_keyboard_event(down, key, chars[0], mod);
input_keyboard_event(down, key, chars[0], mod, RETRO_DEVICE_KEYBOARD);
for (i = 1; i < num; i++)
input_keyboard_event(down, RETROK_UNKNOWN,
chars[i], mod);
chars[i], mod, RETRO_DEVICE_KEYBOARD);
}

View File

@ -61,9 +61,9 @@ void handle_xkb(
}
input_keyboard_event(value, input_keymaps_translate_keysym_to_rk(code),
num_syms ? xkb_keysym_to_utf32(syms[0]) : 0, mod);
num_syms ? xkb_keysym_to_utf32(syms[0]) : 0, mod, RETRO_DEVICE_KEYBOARD);
for (i = 1; i < num_syms; i++)
input_keyboard_event(value, RETROK_UNKNOWN,
xkb_keysym_to_utf32(syms[i]), mod);
xkb_keysym_to_utf32(syms[i]), mod, RETRO_DEVICE_KEYBOARD);
}

View File

@ -232,7 +232,7 @@ void input_keyboard_wait_keys_cancel(void)
* This interfaces with the global driver struct and libretro callbacks.
**/
void input_keyboard_event(bool down, unsigned code,
uint32_t character, uint16_t mod)
uint32_t character, uint16_t mod, unsigned device)
{
static bool deferred_wait_keys;
@ -259,7 +259,7 @@ void input_keyboard_event(bool down, unsigned code,
if (!down)
return;
if (driver.osk_active && code != 0x12d)
if (device == RETRO_DEVICE_POINTER && code != 0x12d)
{
if (!input_keyboard_line_event(g_keyboard_line, (char)code))
return;

View File

@ -97,7 +97,7 @@ void input_keyboard_line_free(input_keyboard_line_t *state);
* This interfaces with the global driver struct and libretro callbacks.
**/
void input_keyboard_event(bool down, unsigned code, uint32_t character,
uint16_t mod);
uint16_t mod, unsigned device);
/**
* input_keyboard_start_line:

View File

@ -537,7 +537,7 @@ static inline void input_poll_overlay(input_overlay_t *overlay_device, float opa
for (j = 0; j < 32; j++)
if ((orig_bits & (1 << j)) != (new_bits & (1 << j)))
input_keyboard_event(new_bits & (1 << j),
i * 32 + j, 0, key_mod);
i * 32 + j, 0, key_mod, RETRO_DEVICE_POINTER);
}
}