(WIN32) Restore zero key event characters (#14848)

This commit is contained in:
sonninnos 2023-01-15 10:00:47 +02:00 committed by GitHub
parent 46e6ac2093
commit b8bcce98c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 30 deletions

View File

@ -1002,7 +1002,7 @@ static LRESULT CALLBACK wnd_proc_common_internal(HWND hwnd,
mod |= RETROKMOD_META; mod |= RETROKMOD_META;
input_keyboard_event(keydown, keycode, input_keyboard_event(keydown, keycode,
wparam, mod, RETRO_DEVICE_KEYBOARD); 0, mod, RETRO_DEVICE_KEYBOARD);
if (message != WM_SYSKEYDOWN) if (message != WM_SYSKEYDOWN)
return 0; return 0;
@ -1253,7 +1253,7 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
mod |= RETROKMOD_META; mod |= RETROKMOD_META;
input_keyboard_event(keydown, keycode, input_keyboard_event(keydown, keycode,
wparam, mod, RETRO_DEVICE_KEYBOARD); 0, mod, RETRO_DEVICE_KEYBOARD);
if (message != WM_SYSKEYDOWN) if (message != WM_SYSKEYDOWN)
return 0; return 0;

View File

@ -591,7 +591,7 @@ static LRESULT CALLBACK winraw_callback(
wr->keyboard.keys[mcode] = down; wr->keyboard.keys[mcode] = down;
input_keyboard_event(down, input_keyboard_event(down,
input_keymaps_translate_keysym_to_rk(mcode), input_keymaps_translate_keysym_to_rk(mcode),
ri->data.keyboard.VKey, mod, RETRO_DEVICE_KEYBOARD); 0, mod, RETRO_DEVICE_KEYBOARD);
break; break;
case RIM_TYPEMOUSE: case RIM_TYPEMOUSE:
for (i = 0; i < wr->mouse_cnt; ++i) for (i = 0; i < wr->mouse_cnt; ++i)

View File

@ -2659,21 +2659,21 @@ static unsigned get_kr_composition( char* pcur, char* padd)
if ((tmp2 = strstr(cc1, utf8))) if ((tmp2 = strstr(cc1, utf8)))
{ {
*((unsigned*)padd) = *((unsigned*)(tmp2+6)) & 0xffffff; *((unsigned*)padd) = *((unsigned*)(tmp2 + 6)) & 0xffffff;
return 0; return 0;
} }
else if ((tmp2 = strstr(cc2, utf8))) else if ((tmp2 = strstr(cc2, utf8)))
{ {
*((unsigned*)padd) = *((unsigned*)(tmp2+6)) & 0xffffff; *((unsigned*)padd) = *((unsigned*)(tmp2 + 6)) & 0xffffff;
return 0; return 0;
} }
if (tmp2 && tmp2 < cc2+sizeof(cc2)-10) if (tmp2 && tmp2 < cc2 + sizeof(cc2) - 10)
{ {
*((unsigned*)padd) = *((unsigned*)(tmp2+6)) & 0xffffff; *((unsigned*)padd) = *((unsigned*)(tmp2 + 6)) & 0xffffff;
return 0; return 0;
} }
if (c1 >=19) if (c1 >= 19)
return ret; return ret;
if (c1 == -1) if (c1 == -1)
@ -2713,7 +2713,7 @@ static unsigned get_kr_composition( char* pcur, char* padd)
strlcpy(utf8, s1 + (19 + c2) * 3, 4); strlcpy(utf8, s1 + (19 + c2) * 3, 4);
utf8[3] = 0; utf8[3] = 0;
strlcat(utf8, padd, sizeof(utf8)); strlcat(utf8, padd, sizeof(utf8));
if (!(tmp2 = strstr(cc2,utf8)) || tmp2 >= cc2 + sizeof(cc2) - 10) if (!(tmp2 = strstr(cc2, utf8)) || tmp2 >= cc2 + sizeof(cc2) - 10)
return ret; return ret;
strlcpy(utf8, tmp2 + 6, 4); strlcpy(utf8, tmp2 + 6, 4);
utf8[3] = 0; utf8[3] = 0;
@ -2745,7 +2745,7 @@ static unsigned get_kr_composition( char* pcur, char* padd)
int tv = 0; int tv = 0;
if ((tmp2 = strstr(cc3, utf8))) if ((tmp2 = strstr(cc3, utf8)))
tv = (tmp2 - cc3) % 10; tv = (tmp2 - cc3) % 10;
if (tv==6) if (tv == 6)
{ {
/* complex 3rd element -> disassemble */ /* complex 3rd element -> disassemble */
strlcpy(utf8, tmp2 - 3, 4); strlcpy(utf8, tmp2 - 3, 4);
@ -2801,22 +2801,22 @@ static bool input_keyboard_line_event(
/* reset composition, when 1 byte(=english) input */ /* reset composition, when 1 byte(=english) input */
if (character && character < 0xff) if (character && character < 0xff)
composition = 0; composition = 0;
if (IS_COMPOSITION(character) || IS_END_COMPOSITION(character) ) if (IS_COMPOSITION(character) || IS_END_COMPOSITION(character))
{ {
size_t len = strlen((char*)&composition); size_t len = strlen((char*)&composition);
if (composition && state->buffer && state->size>=len && state->ptr>= len) if (composition && state->buffer && state->size >= len && state->ptr >= len)
{ {
memmove(state->buffer + state->ptr-len, state->buffer+state->ptr, len + 1); memmove(state->buffer + state->ptr-len, state->buffer + state->ptr, len + 1);
state->ptr -=len; state->ptr -= len;
state->size-=len; state->size -= len;
} }
if ( IS_COMPOSITION_KR(character) && composition) if (IS_COMPOSITION_KR(character) && composition)
{ {
unsigned new_comp; unsigned new_comp;
character = character & 0xffffff; character = character & 0xffffff;
new_comp = get_kr_composition((char*)&composition, (char*)&character); new_comp = get_kr_composition((char*)&composition, (char*)&character);
if (new_comp) if (new_comp)
input_keyboard_line_append( state, (char*)&new_comp, 3); input_keyboard_line_append(state, (char*)&new_comp, 3);
composition = character; composition = character;
} }
else else
@ -2824,13 +2824,13 @@ static bool input_keyboard_line_event(
if (IS_END_COMPOSITION(character)) if (IS_END_COMPOSITION(character))
composition = 0; composition = 0;
else else
composition = character &0xffffff; composition = character & 0xffffff;
character &= 0xffffff; character &= 0xffffff;
} }
if (len && composition == 0) if (len && composition == 0)
word = state->buffer; word = state->buffer;
if (character) if (character)
input_keyboard_line_append( state, (char*)&character, strlen((char*)&character)); input_keyboard_line_append(state, (char*)&character, strlen((char*)&character));
word = state->buffer; word = state->buffer;
} }
else else