summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2013-08-25 11:23:10 +0000
committermichi_cc <michi_cc@openttd.org>2013-08-25 11:23:10 +0000
commit6bbca9307d5da114e6b1210f6fa0b4fd42cbaaec (patch)
treef88f8824e30ed74df7e5be7b9ff0acb442a82d9a /src/video
parent2d44c98670fe13d20fb5af6ec262e8144a84f43c (diff)
downloadopenttd-6bbca9307d5da114e6b1210f6fa0b4fd42cbaaec.tar.xz
(svn r25743) -Fix [FS#5705]: [OSX] Text input into an edit box would trigger hotkeys.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/cocoa/event.mm6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm
index 81b9db1d2..f5474800f 100644
--- a/src/video/cocoa/event.mm
+++ b/src/video/cocoa/event.mm
@@ -34,6 +34,7 @@
#include "../../gfx_func.h"
#include "../../network/network.h"
#include "../../core/random_func.hpp"
+#include "../../core/math_func.hpp"
#include "../../texteff.hpp"
#include "../../window_func.h"
@@ -291,7 +292,10 @@ static void QZ_KeyEvent(unsigned short keycode, unsigned short unicode, BOOL dow
if (down) {
uint32 pressed_key = QZ_MapKey(keycode);
- HandleKeypress(pressed_key, unicode);
+ /* Don't handle normal characters if an edit box has the focus. */
+ if (!EditBoxInGlobalFocus() || (!IsInsideMM(pressed_key, 'A', 'Z' + 1) && !IsInsideMM(pressed_key, '0', '9' + 1))) {
+ HandleKeypress(pressed_key, unicode);
+ }
DEBUG(driver, 2, "cocoa_v: QZ_KeyEvent: %x (%x), down, mapping: %x", keycode, unicode, pressed_key);
} else {
DEBUG(driver, 2, "cocoa_v: QZ_KeyEvent: %x (%x), up", keycode, unicode);