summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-05-18 16:33:18 +0200
committerGitHub <noreply@github.com>2020-05-18 16:33:18 +0200
commit9844cd45e35b122de3dc0bf7eea76a3034fb5cf2 (patch)
tree22979f6581b8696c2e22c5254a2036327130713f /platform/windows
parentd3d118baaac67b7fe97251647fea28c195f505fd (diff)
parente460456e60b5129f89b4647d8bbb9c71a294c1ca (diff)
Merge pull request #38820 from ericrybick/master
Fix certain characters being recognized as special keys on Windows when using the us international layout
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/display_server_windows.cpp3
-rw-r--r--platform/windows/key_mapping_windows.cpp13
-rw-r--r--platform/windows/key_mapping_windows.h1
3 files changed, 16 insertions, 1 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 14116d6f23..9e117dba29 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -2658,7 +2658,8 @@ void DisplayServerWindows::_process_key_events() {
KeyEvent &ke = key_event_buffer[i];
switch (ke.uMsg) {
case WM_CHAR: {
- if ((i == 0 && ke.uMsg == WM_CHAR) || (i > 0 && key_event_buffer[i - 1].uMsg == WM_CHAR)) {
+ // extended keys should only be processed as WM_KEYDOWN message.
+ if (!KeyMappingWindows::is_extended_key(ke.wParam) && ((i == 0 && ke.uMsg == WM_CHAR) || (i > 0 && key_event_buffer[i - 1].uMsg == WM_CHAR))) {
Ref<InputEventKey> k;
k.instance();
diff --git a/platform/windows/key_mapping_windows.cpp b/platform/windows/key_mapping_windows.cpp
index 1fe7551445..d8d0b13068 100644
--- a/platform/windows/key_mapping_windows.cpp
+++ b/platform/windows/key_mapping_windows.cpp
@@ -411,3 +411,16 @@ unsigned int KeyMappingWindows::get_scansym(unsigned int p_code, bool p_extended
return keycode;
}
+
+bool KeyMappingWindows::is_extended_key(unsigned int p_code) {
+ return p_code == VK_INSERT ||
+ p_code == VK_DELETE ||
+ p_code == VK_HOME ||
+ p_code == VK_END ||
+ p_code == VK_PRIOR ||
+ p_code == VK_NEXT ||
+ p_code == VK_LEFT ||
+ p_code == VK_UP ||
+ p_code == VK_RIGHT ||
+ p_code == VK_DOWN;
+}
diff --git a/platform/windows/key_mapping_windows.h b/platform/windows/key_mapping_windows.h
index 4d0c12c16e..f64f1feb9f 100644
--- a/platform/windows/key_mapping_windows.h
+++ b/platform/windows/key_mapping_windows.h
@@ -43,6 +43,7 @@ class KeyMappingWindows {
public:
static unsigned int get_keysym(unsigned int p_code);
static unsigned int get_scansym(unsigned int p_code, bool p_extended);
+ static bool is_extended_key(unsigned int p_code);
};
#endif // KEY_MAPPING_WINDOWS_H