diff options
author | egladil <egladil@openttd.org> | 2008-01-01 18:55:15 +0000 |
---|---|---|
committer | egladil <egladil@openttd.org> | 2008-01-01 18:55:15 +0000 |
commit | 9a2547b5a7123210f1c320629466a1562c06fe2f (patch) | |
tree | a9c09047d516ce56fc2ea8c3b1d4f5580c47a077 /src | |
parent | c94a6b8c78a4b8dc2498c487b482ef85a0208bc2 (diff) | |
download | openttd-9a2547b5a7123210f1c320629466a1562c06fe2f.tar.xz |
(svn r11740) -Fix [FS#1610]: Modify and possibly discard key events for code points in the unicode private use area.
Diffstat (limited to 'src')
-rw-r--r-- | src/window.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp index 077fb0f33..c85faa5a6 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1643,6 +1643,20 @@ void HandleKeypress(uint32 key) e.we.keypress.keycode = GB(key, 16, 16); e.we.keypress.cont = true; + /* + * The Unicode standard defines an area called the private use area. Code points in this + * area are reserved for private use and thus not portable between systems. For instance, + * Apple defines code points for the arrow keys in this area, but these are only printable + * on a system running OS X. We don't want these keys to show up in text fields and such, + * and thus we have to clear the unicode character when we encounter such a key. + */ + if (e.we.keypress.key >= 0xE000 && e.we.keypress.key <= 0xF8FF) e.we.keypress.key = 0; + + /* + * If both key and keycode is zero, we don't bother to process the event. + */ + if (e.we.keypress.key == 0 && e.we.keypress.keycode == 0) return; + /* check if we have a query string window open before allowing hotkeys */ if (FindWindowById(WC_QUERY_STRING, 0) != NULL || FindWindowById(WC_SEND_NETWORK_MSG, 0) != NULL || |