summaryrefslogtreecommitdiff
path: root/win32.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-30 16:54:39 +0000
committerdarkvater <darkvater@openttd.org>2005-01-30 16:54:39 +0000
commit1527ef3db001a1bb609f8c331313a52c9ac69888 (patch)
tree49b3e495609d4e23cf7be92ce87f031d35282063 /win32.c
parent8580e73b65c94f978319b2b4e7f4dc1833bfa149 (diff)
downloadopenttd-1527ef3db001a1bb609f8c331313a52c9ac69888.tar.xz
(svn r1734) - Fix: [ 1112253 ] hijacking of arrow keys, game also scrolled when it was out of focus (dominik)
Diffstat (limited to 'win32.c')
-rw-r--r--win32.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/win32.c b/win32.c
index 1b6661abe..022472766 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;