Skip to content

Commit b574c31

Browse files
committed
FIX: GDI a little less broken
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11860 8aca7d54-2c30-db11-9de9-000461428c89
1 parent 5d0cceb commit b574c31

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

src/simutrans/sys/simsys_w.cc

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -539,17 +539,13 @@ static inline unsigned long vkey_to_simkey(WPARAM wParam, LPARAM lParam)
539539
case VK_RETURN: return 13; break;
540540
}
541541

542-
if (wParam < 0x20 || wParam >= 0xA0) {
543-
// ignore dead keys like shift or vendor specific
544-
return 0;
545-
}
546-
547542
// check for F-Keys!
548-
if (code == 0 && wParam >= VK_F1 && wParam <= VK_F15) {
549-
code = wParam - VK_F1 + SIM_KEYCODE_F1;
543+
if (wParam >= VK_F1 && wParam <= VK_F15) {
544+
return wParam - VK_F1 + SIM_KEYCODE_F1;
550545
}
551546

552-
return code;
547+
// ignore dead keys like shift or vendor specific
548+
return 0;
553549
}
554550

555551

@@ -725,14 +721,11 @@ LRESULT WINAPI WindowProc(HWND this_hwnd, UINT msg, WPARAM wParam, LPARAM lParam
725721

726722
case WM_CHAR: /* originally KeyPress */
727723
{
728-
sint16 code = lParam >> 16;
729-
if( code >= 0x47 && code <= 0x52 && code != 0x4A && code != 0x4e ) {
730-
if( (GetKeyState( VK_NUMLOCK ) & 1) == 0 || (env_t::numpad_always_moves_map && !win_is_textinput()) ) { // numlock off?
731-
// we handled this numpad keys already above ...
732-
sys_event.type = SIM_NOEVENT;
733-
sys_event.code = 0;
734-
break;
735-
}
724+
if (vkey_to_simkey(wParam, lParam)) {
725+
// we handled this numpad keys already above ...
726+
sys_event.type = SIM_NOEVENT;
727+
sys_event.code = 0;
728+
break;
736729
}
737730
sys_event.type = SIM_KEYDOWN;
738731
sys_event.code = wParam;

0 commit comments

Comments
 (0)