From fe4fad790ed187bf1d8c5bf61066fe00823fbe7e Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 22 Mar 2016 15:50:44 +0100 Subject: winrt: Fix QKeyEvent::isAutoRepeat When keeping a key pressed CorePhysicalKeyStatus' RepeatCount stays 1 while WasKeyDown changes from false to true. Thus WasKeyDown should be used to determine the auto repeat status of the key event. Task-number: QTBUG-52055 Change-Id: I7cde6b92473bd5335e85418c2b92cfe8f338975c Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 47e68ae0af..e4f7709146 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -885,7 +885,7 @@ HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Wind virtualKey, 0, QString(), - status.RepeatCount > 1, + status.WasKeyDown, !status.RepeatCount ? 1 : status.RepeatCount, false); return S_OK; @@ -912,7 +912,7 @@ HRESULT QWinRTScreen::onKeyUp(ABI::Windows::UI::Core::ICoreWindow *, ABI::Window virtualKey, 0, info.text, - status.RepeatCount > 1, + status.WasKeyDown, !status.RepeatCount ? 1 : status.RepeatCount, false); return S_OK; @@ -945,7 +945,7 @@ HRESULT QWinRTScreen::onCharacterReceived(ICoreWindow *, ICharacterReceivedEvent virtualKey, 0, text, - status.RepeatCount > 1, + status.WasKeyDown, !status.RepeatCount ? 1 : status.RepeatCount, false); d->activeKeys.insert(key, KeyInfo(text, virtualKey)); -- cgit v1.2.3 From a064bcf883f4552af3c81756dceda7c53cb8b061 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 23 Mar 2016 10:25:17 +0100 Subject: winrt: mimic desktop Window's "QKeyEvent::isAutoRepeat" behavior We should mimic desktop Qt's behavior as close as possible. That means, that a key release event is triggered between auto generated press events for most keys. For some keys like modifiers, caps lock, scroll lock etc. there are no auto repeated events if the key is held down. The "last" release event after having held the key and several events are triggered does not have the isAutoRepeat flag set so we should not have that flag in this case either. Task-number: QTBUG-52055 Change-Id: I001a73416c4b2072d307ee5d87c7cb8406c9575f Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 46 +++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index e4f7709146..fbf6393d90 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -416,6 +416,23 @@ static inline Qt::Key qKeyFromVirtual(VirtualKey key) } } +// Some keys like modifiers, caps lock etc. should not be automatically repeated if the key is held down +static inline bool shouldAutoRepeat(Qt::Key key) +{ + switch (key) { + case Qt::Key_Shift: + case Qt::Key_Control: + case Qt::Key_Alt: + case Qt::Key_Meta: + case Qt::Key_CapsLock: + case Qt::Key_NumLock: + case Qt::Key_ScrollLock: + return false; + default: + return true; + } +} + static inline Qt::Key qKeyFromCode(quint32 code, int mods) { if (code >= 'a' && code <= 'z') @@ -870,12 +887,33 @@ HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Wind Q_ASSERT_SUCCEEDED(hr); Qt::Key key = qKeyFromVirtual(virtualKey); - // Defer character key presses to onCharacterReceived - if (key == Qt::Key_unknown || (key >= Qt::Key_Space && key <= Qt::Key_ydiaeresis)) { + + const bool wasPressed = d->activeKeys.contains(key); + if (wasPressed) { + if (!shouldAutoRepeat(key)) + return S_OK; + + // If the key was pressed before trigger a key release before the next key press + QWindowSystemInterface::handleExtendedKeyEvent( + topWindow(), + QEvent::KeyRelease, + key, + keyboardModifiers(), + !status.ScanCode ? -1 : status.ScanCode, + virtualKey, + 0, + QString(), + status.WasKeyDown, + !status.RepeatCount ? 1 : status.RepeatCount, + false); + } else { d->activeKeys.insert(key, KeyInfo(virtualKey)); - return S_OK; } + // Defer character key presses to onCharacterReceived + if (key == Qt::Key_unknown || (key >= Qt::Key_Space && key <= Qt::Key_ydiaeresis)) + return S_OK; + QWindowSystemInterface::handleExtendedKeyEvent( topWindow(), QEvent::KeyPress, @@ -912,7 +950,7 @@ HRESULT QWinRTScreen::onKeyUp(ABI::Windows::UI::Core::ICoreWindow *, ABI::Window virtualKey, 0, info.text, - status.WasKeyDown, + false, // The final key release does not have autoRepeat set on Windows !status.RepeatCount ? 1 : status.RepeatCount, false); return S_OK; -- cgit v1.2.3 From b2c0e5af186201979f47a306e017eb8979248f00 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 28 Mar 2016 13:37:22 +0300 Subject: By default use native menu bar Task-number: QTBUG-52010 Change-Id: I8f5feacc41719b1c084ec5a8763e597c1dab716c Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidplatformtheme.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp index d53d678bcf..9350a15721 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp @@ -362,6 +362,9 @@ QAndroidPlatformTheme::QAndroidPlatformTheme(QAndroidPlatformNativeInterface *an // default in case the style has not set a font m_systemFont = QFont(QLatin1String("Roboto"), 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi + + // by default use native menu bar + QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, false); } QPlatformMenuBar *QAndroidPlatformTheme::createPlatformMenuBar() const -- cgit v1.2.3 From 3f73ecd59aea46d6ddd8d5dc1e7d4ace6307bafa Mon Sep 17 00:00:00 2001 From: Elena Zaretskaya Date: Sat, 9 Apr 2016 00:36:34 +0400 Subject: Fix 2 cursors under EGLFS_KMS Don't create hwcursor if it is disabled in QT_QPA_EGLFS_KMS_CONFIG. Task-number: QTBUG-52403 Change-Id: I4e6f45d5b773dc2d50cd012179cd23452d910537 Reviewed-by: Laszlo Agocs --- .../platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp index c29d64c06d..8ba0a5cdd0 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp @@ -417,7 +417,7 @@ void QEglFSKmsDevice::createScreens() Q_FOREACH (QPlatformScreen *screen, siblings) static_cast(screen)->setVirtualSiblings(siblings); - if (primaryScreen) + if (primaryScreen && m_integration->hwCursor()) m_globalCursor = new QEglFSKmsCursor(primaryScreen); } } -- cgit v1.2.3 From 5f41d344e9d66434be13a9644b4da08dd01974a9 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 6 Apr 2016 16:09:25 -0700 Subject: QNSView: Disable focus ring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not only we don't need Cocoa to display it for us, but it also seems to take a lot of time after the call to -[NSView setNeedsDisplayInRect:]. While resizing a large and busy widgets window, we can decrease the relative time spent in -[QNSView flushBackingStore:region: offset:] from over 15% down to around 3%. Change-Id: I2a8d51be28b77c4c3da2588d9a14e461e7910167 Reviewed-by: Timur Pocheptsov Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 90a7004938..7e9b9aa839 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -164,6 +164,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; } m_isMenuView = false; + self.focusRingType = NSFocusRingTypeNone; } return self; } -- cgit v1.2.3