From 34644308f7f6acb2981af1ff2c2892e672f73258 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Sun, 4 Dec 2011 21:15:35 +0000 Subject: [PATCH] - added 'nokeyrepeat' option for the win32 gui --- bochs/gui/win32.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bochs/gui/win32.cc b/bochs/gui/win32.cc index 77f20c9be..27f0353cb 100644 --- a/bochs/gui/win32.cc +++ b/bochs/gui/win32.cc @@ -100,6 +100,7 @@ static BOOL mouseCaptureMode, mouseCaptureNew, mouseToggleReq; static UINT_PTR workerThread = 0; static DWORD workerThreadID = 0; static int mouse_buttons = 3; +static bx_bool win32_nokeyrepeat = 0; // Graphics screen stuff static unsigned x_tilesize = 0, y_tilesize = 0; @@ -629,7 +630,10 @@ void bx_win32_gui_c::specific_init(int argc, char **argv, unsigned if (argc > 1) { for (i = 1; i < argc; i++) { BX_INFO(("option %d: %s", i, argv[i])); - if (!strcmp(argv[i], "legacyF12")) { + if (!strcmp(argv[i], "nokeyrepeat")) { + BX_INFO(("disabled host keyboard repeat")); + win32_nokeyrepeat = 1; + } else if (!strcmp(argv[i], "legacyF12")) { BX_PANIC(("The option 'legacyF12' is now deprecated - use 'mouse: toggle=f12' instead")); #if BX_DEBUGGER && BX_DEBUGGER_GUI } else if (!strcmp(argv[i], "gui_debug")) { @@ -1236,7 +1240,9 @@ LRESULT CALLBACK simWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) return 0; } EnterCriticalSection(&stInfo.keyCS); - enq_key_event(HIWORD (lParam) & 0x01FF, BX_KEY_PRESSED); + if (((lParam & 0x40000000) == 0) || !win32_nokeyrepeat) { + enq_key_event(HIWORD (lParam) & 0x01FF, BX_KEY_PRESSED); + } LeaveCriticalSection(&stInfo.keyCS); return 0;