Skip to content

Commit b8bcce9

Browse files
authored
(WIN32) Restore zero key event characters (libretro#14848)
1 parent 46e6ac2 commit b8bcce9

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

gfx/common/win32_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ static LRESULT CALLBACK wnd_proc_common_internal(HWND hwnd,
10021002
mod |= RETROKMOD_META;
10031003

10041004
input_keyboard_event(keydown, keycode,
1005-
wparam, mod, RETRO_DEVICE_KEYBOARD);
1005+
0, mod, RETRO_DEVICE_KEYBOARD);
10061006

10071007
if (message != WM_SYSKEYDOWN)
10081008
return 0;
@@ -1253,7 +1253,7 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
12531253
mod |= RETROKMOD_META;
12541254

12551255
input_keyboard_event(keydown, keycode,
1256-
wparam, mod, RETRO_DEVICE_KEYBOARD);
1256+
0, mod, RETRO_DEVICE_KEYBOARD);
12571257

12581258
if (message != WM_SYSKEYDOWN)
12591259
return 0;

input/drivers/winraw_input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static LRESULT CALLBACK winraw_callback(
591591
wr->keyboard.keys[mcode] = down;
592592
input_keyboard_event(down,
593593
input_keymaps_translate_keysym_to_rk(mcode),
594-
ri->data.keyboard.VKey, mod, RETRO_DEVICE_KEYBOARD);
594+
0, mod, RETRO_DEVICE_KEYBOARD);
595595
break;
596596
case RIM_TYPEMOUSE:
597597
for (i = 0; i < wr->mouse_cnt; ++i)

input/input_driver.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ static bool inside_hitbox(const struct overlay_desc *desc, float x, float y)
14401440
(fabs(x - desc->x_hitbox) <= desc->range_x_mod) &&
14411441
(fabs(y - desc->y_hitbox) <= desc->range_y_mod);
14421442
case OVERLAY_HITBOX_NONE:
1443-
break;
1443+
break;
14441444
}
14451445
return false;
14461446
}
@@ -2638,7 +2638,7 @@ static unsigned get_kr_composition( char* pcur, char* padd)
26382638
int c2 = -1;
26392639
int c3 = 0;
26402640
int nv = -1;
2641-
char utf8[8] = {0, 0, 0, 0, 0, 0, 0, 0};
2641+
char utf8[8] = {0, 0, 0, 0, 0, 0, 0, 0};
26422642
unsigned ret = *((unsigned*)pcur);
26432643

26442644
/* check korean */
@@ -2659,21 +2659,21 @@ static unsigned get_kr_composition( char* pcur, char* padd)
26592659

26602660
if ((tmp2 = strstr(cc1, utf8)))
26612661
{
2662-
*((unsigned*)padd) = *((unsigned*)(tmp2+6)) & 0xffffff;
2662+
*((unsigned*)padd) = *((unsigned*)(tmp2 + 6)) & 0xffffff;
26632663
return 0;
26642664
}
26652665
else if ((tmp2 = strstr(cc2, utf8)))
26662666
{
2667-
*((unsigned*)padd) = *((unsigned*)(tmp2+6)) & 0xffffff;
2667+
*((unsigned*)padd) = *((unsigned*)(tmp2 + 6)) & 0xffffff;
26682668
return 0;
26692669
}
2670-
if (tmp2 && tmp2 < cc2+sizeof(cc2)-10)
2670+
if (tmp2 && tmp2 < cc2 + sizeof(cc2) - 10)
26712671
{
2672-
*((unsigned*)padd) = *((unsigned*)(tmp2+6)) & 0xffffff;
2672+
*((unsigned*)padd) = *((unsigned*)(tmp2 + 6)) & 0xffffff;
26732673
return 0;
26742674
}
26752675

2676-
if (c1 >=19)
2676+
if (c1 >= 19)
26772677
return ret;
26782678

26792679
if (c1 == -1)
@@ -2698,7 +2698,7 @@ static unsigned get_kr_composition( char* pcur, char* padd)
26982698
c2 = nv - 19;
26992699
}
27002700
else
2701-
if (c2 >= 0 && c3 == 0)
2701+
if (c2 >= 0 && c3 == 0)
27022702
{
27032703
if (nv < 19)
27042704
{
@@ -2708,19 +2708,19 @@ static unsigned get_kr_composition( char* pcur, char* padd)
27082708
c3 = (int)((tmp1 - s1) / 3 - 19 - 21);
27092709
}
27102710
else
2711-
{
2711+
{
27122712
/* 2nd element transform */
27132713
strlcpy(utf8, s1 + (19 + c2) * 3, 4);
27142714
utf8[3] = 0;
27152715
strlcat(utf8, padd, sizeof(utf8));
2716-
if (!(tmp2 = strstr(cc2,utf8)) || tmp2 >= cc2 + sizeof(cc2) - 10)
2716+
if (!(tmp2 = strstr(cc2, utf8)) || tmp2 >= cc2 + sizeof(cc2) - 10)
27172717
return ret;
27182718
strlcpy(utf8, tmp2 + 6, 4);
27192719
utf8[3] = 0;
27202720
if (!(tmp1 = strstr(s1 + (19) * 3, utf8)))
27212721
return ret;
27222722
c2 = (int)((tmp1 - s1) / 3 - 19);
2723-
}
2723+
}
27242724
}
27252725
else
27262726
if (c3 > 0)
@@ -2740,12 +2740,12 @@ static unsigned get_kr_composition( char* pcur, char* padd)
27402740
return ret;
27412741
c3 = (int)((tmp1 - s1) / 3 - 19 - 21);
27422742
}
2743-
else
2743+
else
27442744
{
27452745
int tv = 0;
27462746
if ((tmp2 = strstr(cc3, utf8)))
27472747
tv = (tmp2 - cc3) % 10;
2748-
if (tv==6)
2748+
if (tv == 6)
27492749
{
27502750
/* complex 3rd element -> disassemble */
27512751
strlcpy(utf8, tmp2 - 3, 4);
@@ -2766,7 +2766,7 @@ static unsigned get_kr_composition( char* pcur, char* padd)
27662766
}
27672767
*((unsigned*)padd) = get_kr_utf8(tv, nv - 19, 0);
27682768
return get_kr_utf8(c1, c2, c3);
2769-
}
2769+
}
27702770
}
27712771
else
27722772
return ret;
@@ -2794,43 +2794,43 @@ static bool input_keyboard_line_event(
27942794
char c = (character >= 128) ? '?' : character;
27952795

27962796
#ifdef HAVE_LANGEXTRA
2797-
static uint32_t composition = 0;
2798-
/* reset composition, when edit box is opened. */
2797+
static uint32_t composition = 0;
2798+
/* reset composition, when edit box is opened. */
27992799
if (state->size == 0)
28002800
composition = 0;
28012801
/* reset composition, when 1 byte(=english) input */
28022802
if (character && character < 0xff)
28032803
composition = 0;
2804-
if (IS_COMPOSITION(character) || IS_END_COMPOSITION(character) )
2804+
if (IS_COMPOSITION(character) || IS_END_COMPOSITION(character))
28052805
{
28062806
size_t len = strlen((char*)&composition);
2807-
if (composition && state->buffer && state->size>=len && state->ptr>= len)
2807+
if (composition && state->buffer && state->size >= len && state->ptr >= len)
28082808
{
2809-
memmove(state->buffer + state->ptr-len, state->buffer+state->ptr, len + 1);
2810-
state->ptr -=len;
2811-
state->size-=len;
2809+
memmove(state->buffer + state->ptr-len, state->buffer + state->ptr, len + 1);
2810+
state->ptr -= len;
2811+
state->size -= len;
28122812
}
2813-
if ( IS_COMPOSITION_KR(character) && composition)
2813+
if (IS_COMPOSITION_KR(character) && composition)
28142814
{
28152815
unsigned new_comp;
28162816
character = character & 0xffffff;
28172817
new_comp = get_kr_composition((char*)&composition, (char*)&character);
28182818
if (new_comp)
2819-
input_keyboard_line_append( state, (char*)&new_comp, 3);
2819+
input_keyboard_line_append(state, (char*)&new_comp, 3);
28202820
composition = character;
28212821
}
28222822
else
28232823
{
28242824
if (IS_END_COMPOSITION(character))
28252825
composition = 0;
28262826
else
2827-
composition = character &0xffffff;
2827+
composition = character & 0xffffff;
28282828
character &= 0xffffff;
28292829
}
28302830
if (len && composition == 0)
28312831
word = state->buffer;
28322832
if (character)
2833-
input_keyboard_line_append( state, (char*)&character, strlen((char*)&character));
2833+
input_keyboard_line_append(state, (char*)&character, strlen((char*)&character));
28342834
word = state->buffer;
28352835
}
28362836
else
@@ -2932,7 +2932,7 @@ void input_event_osk_append(
29322932
prv_osk = *osk_idx;
29332933
*osk_idx = OSK_KOREAN_PAGE1;
29342934
}
2935-
else
2935+
else
29362936
*osk_idx = (enum osk_type)prv_osk;
29372937
}
29382938
else
@@ -6459,7 +6459,7 @@ void input_keyboard_event(bool down, unsigned code,
64596459
/* fall-through */
64606460
default:
64616461
if (!input_keyboard_line_event(input_st,
6462-
&input_st->keyboard_line, character))
6462+
&input_st->keyboard_line, character))
64636463
return;
64646464
break;
64656465
}

0 commit comments

Comments
 (0)