summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/winrt/qwinrtscreen.cpp
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2017-04-18 12:47:21 +0200
committerOliver Wolff <oliver.wolff@qt.io>2017-04-19 10:27:32 +0000
commitad0249cc793772a342bf6ced40fb44cd52b2b0e6 (patch)
tree493b137d2b17f2839f1b341b89e5f8321cf44966 /src/plugins/platforms/winrt/qwinrtscreen.cpp
parentee3ac3a3bfb4c4a0802f6530f61995297c573646 (diff)
winrt: Fix QKeyEvent::isAutoRepeat
CorePhysicalKeyStatus::KeyStatus does not give the information we are after so we have to keep track of "auto repeat" state of the keys ourself. Task-number: QTBUG-59232 Change-Id: I22aa185780e5fa1f7f3c23c2deb2a0dde0c4a582 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'src/plugins/platforms/winrt/qwinrtscreen.cpp')
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index edfcf038d7..3a4c3b871c 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -101,22 +101,26 @@ QT_BEGIN_NAMESPACE
struct KeyInfo {
KeyInfo()
: virtualKey(0)
+ , isAutoRepeat(false)
{
}
KeyInfo(const QString &text, quint32 virtualKey)
: text(text)
, virtualKey(virtualKey)
+ , isAutoRepeat(false)
{
}
KeyInfo(quint32 virtualKey)
: virtualKey(virtualKey)
+ , isAutoRepeat(false)
{
}
QString text;
quint32 virtualKey;
+ bool isAutoRepeat;
};
static inline Qt::ScreenOrientations qtOrientationsFromNative(DisplayOrientations native)
@@ -971,6 +975,7 @@ HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Wind
if (!shouldAutoRepeat(key))
return S_OK;
+ d->activeKeys[key].isAutoRepeat = true;
// If the key was pressed before trigger a key release before the next key press
QWindowSystemInterface::handleExtendedKeyEvent(
topWindow(),
@@ -981,7 +986,7 @@ HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Wind
virtualKey,
0,
QString(),
- status.WasKeyDown,
+ d->activeKeys.value(key).isAutoRepeat,
!status.RepeatCount ? 1 : status.RepeatCount,
false);
} else {
@@ -1001,7 +1006,7 @@ HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Wind
virtualKey,
0,
QString(),
- status.WasKeyDown,
+ d->activeKeys.value(key).isAutoRepeat,
!status.RepeatCount ? 1 : status.RepeatCount,
false);
return S_OK;
@@ -1051,20 +1056,19 @@ HRESULT QWinRTScreen::onCharacterReceived(ICoreWindow *, ICharacterReceivedEvent
const Qt::KeyboardModifiers modifiers = keyboardModifiers();
const Qt::Key key = qKeyFromCode(keyCode, modifiers);
const QString text = QChar(keyCode);
- const quint32 virtualKey = d->activeKeys.value(key).virtualKey;
+ const KeyInfo info = d->activeKeys.value(key);
QWindowSystemInterface::handleExtendedKeyEvent(
topWindow(),
QEvent::KeyPress,
key,
modifiers,
!status.ScanCode ? -1 : status.ScanCode,
- virtualKey,
+ info.virtualKey,
0,
text,
- status.WasKeyDown,
+ info.isAutoRepeat,
!status.RepeatCount ? 1 : status.RepeatCount,
false);
- d->activeKeys.insert(key, KeyInfo(text, virtualKey));
return S_OK;
}