From 167cc17d22237ef7dbe72cd291558d24d3d48950 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 9 Dec 2015 15:55:54 +0300 Subject: [PATCH] fix problem with inputing of { and } in German locale, windows --- src/dlangui/platforms/windows/winapp.d | 10 ++++++---- src/dlangui/widgets/editors.d | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dlangui/platforms/windows/winapp.d b/src/dlangui/platforms/windows/winapp.d index 3476d044..6c40880c 100644 --- a/src/dlangui/platforms/windows/winapp.d +++ b/src/dlangui/platforms/windows/winapp.d @@ -700,14 +700,16 @@ class Win32Window : Window { updateKeyFlags((GetKeyState(VK_MENU) & 0x8000) != 0 ? KeyAction.KeyDown : KeyAction.KeyUp, KeyFlag.Alt); break; } + //updateKeyFlags((GetKeyState(VK_CONTROL) & 0x8000) != 0 ? KeyAction.KeyDown : KeyAction.KeyUp, KeyFlag.Control); + //updateKeyFlags((GetKeyState(VK_SHIFT) & 0x8000) != 0 ? KeyAction.KeyDown : KeyAction.KeyUp, KeyFlag.Shift); + //updateKeyFlags((GetKeyState(VK_MENU) & 0x8000) != 0 ? KeyAction.KeyDown : KeyAction.KeyUp, KeyFlag.Alt); if (keyCode == 0xBF) keyCode = KeyCode.KEY_DIVIDE; event = new KeyEvent(action, keyCode, _keyFlags); } else if (action == KeyAction.Text && character != 0) { - if (_keyFlags & (KeyFlag.Control | KeyFlag.Alt)) { - if (character >= 1 && character <= 26) { - event = new KeyEvent(action, KeyCode.KEY_A + character - 1, _keyFlags); - } + bool ctrlAZKeyCode = (character >= 1 && character <= 26); + if ((_keyFlags & (KeyFlag.Control | KeyFlag.Alt)) && ctrlAZKeyCode) { + event = new KeyEvent(action, KeyCode.KEY_A + character - 1, _keyFlags); } else { dchar[] text; text ~= character; diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d index cebc82ac..e75eaba2 100644 --- a/src/dlangui/widgets/editors.d +++ b/src/dlangui/widgets/editors.d @@ -1410,7 +1410,8 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction /// handle keys override bool onKeyEvent(KeyEvent event) { if (focused) startCaretBlinking(); - if (event.action == KeyAction.Text && event.text.length && !(event.flags & (KeyFlag.Control | KeyFlag.Alt))) { + bool ctrlOrAltPressed = false; //(event.flags & (KeyFlag.Control /* | KeyFlag.Alt */)); + if (event.action == KeyAction.Text && event.text.length && !ctrlOrAltPressed) { Log.d("text entered: ", event.text); if (readOnly) return true;