diff --git a/console.c b/console.c index e82cf23c06..e97d5cf6c3 100644 --- a/console.c +++ b/console.c @@ -32,7 +32,6 @@ static char* _iconsole_buffer[ICON_BUFFER + 1]; static uint16 _iconsole_cbuffer[ICON_BUFFER + 1]; static char _iconsole_cmdline[ICON_CMDLN_SIZE]; static byte _iconsole_cmdpos; -static Window* _iconsole_win = NULL; static byte _iconsole_scroll; // ** console cursor ** // diff --git a/console.h b/console.h index fd4c45ea15..55c1340467 100644 --- a/console.h +++ b/console.h @@ -1,6 +1,9 @@ #ifndef CONSOLE_H #define CONSOLE_H +/* Pointer to console window */ +VARDEF Window *_iconsole_win; + // ** console parser ** // typedef enum _iconsole_var_types { diff --git a/main_gui.c b/main_gui.c index 6fac303a3a..3a754e69b3 100644 --- a/main_gui.c +++ b/main_gui.c @@ -2202,7 +2202,7 @@ static void StatusBarWndProc(Window *w, WindowEvent *e) } } -void ScrollMainViewport(int x, int y) +static void ScrollMainViewport(int x, int y) { if (_game_mode != GM_MENU) { Window *w = FindWindowById(WC_MAIN_WINDOW, 0); @@ -2250,7 +2250,7 @@ static const int8 scrollamt[16][2] = { void HandleKeyScrolling(void) { - if (_dirkeys) { + if (_dirkeys && _iconsole_win == NULL) { int factor = _shift_pressed ? 50 : 10; ScrollMainViewport(scrollamt[_dirkeys][0] * factor, scrollamt[_dirkeys][1] * factor); } diff --git a/win32.c b/win32.c index 1b6661abe6..022472766e 100644 --- a/win32.c +++ b/win32.c @@ -714,11 +714,14 @@ static int Win32GdiMainLoop(void) _dbg_screen_rect = _wnd.has_focus && GetAsyncKeyState(VK_CAPITAL)<0; // determine which directional keys are down - _dirkeys = - (GetAsyncKeyState(VK_LEFT) < 0 ? 1 : 0) + - (GetAsyncKeyState(VK_UP) < 0 ? 2 : 0) + - (GetAsyncKeyState(VK_RIGHT) < 0 ? 4 : 0) + - (GetAsyncKeyState(VK_DOWN) < 0 ? 8 : 0); + if (_wnd.has_focus) { + _dirkeys = + (GetAsyncKeyState(VK_LEFT) < 0 ? 1 : 0) + + (GetAsyncKeyState(VK_UP) < 0 ? 2 : 0) + + (GetAsyncKeyState(VK_RIGHT) < 0 ? 4 : 0) + + (GetAsyncKeyState(VK_DOWN) < 0 ? 8 : 0); + } else + _dirkeys = 0; GameLoop(); _cursor.delta.x = _cursor.delta.y = 0;