From 9e6d3a8c9adc185319e791a0bffd95601f8cb051 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 1 Mar 2015 13:11:40 -0800 Subject: Fix GCC 4.9 warning about repeated attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qxcbscreen.cpp:701:21: error: ‘QDebug operator<<(QDebug, const QXcbScreen*)’: visibility attribute ignored because it qxcbscreen.h:149:21: error: conflicts with previous declaration here [- Werror=attributes] Change-Id: Ia0aac2f09e9245339951ffff13c77c23cb9430c5 Reviewed-by: Uli Schlachter Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index c7f811491c..3dcd6a713a 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -760,7 +760,7 @@ static inline void formatSizeF(QDebug &debug, const QSizeF s) debug << s.width() << 'x' << s.height() << "mm"; } -Q_XCB_EXPORT QDebug operator<<(QDebug debug, const QXcbScreen *screen) +QDebug operator<<(QDebug debug, const QXcbScreen *screen) { const QDebugStateSaver saver(debug); debug.nospace(); -- cgit v1.2.3 From 4f15449bc2584ad299569c86f707994dca76d733 Mon Sep 17 00:00:00 2001 From: Jian Liang Date: Tue, 7 Jul 2015 22:23:33 +0800 Subject: Windows: register alias for application font Previously Qt didn't register an English name alias for application font files under Windows. Suppose we add an application font file using QFontDatabase::addApplicationFont(), the font family name returned by QFontDatabase::applicationFontFamilies() then was the English name of the font file, but the corresponding font family name returned by QFontDatabase::families() was the localized version. This prevented us from using the English font family to access the font since it was not registered as alias. Add an overload of populateFamily() which will register the English name of the application font file as alias. Task-number: QTBUG-47096 Change-Id: Idb89b7d8a419646c209426e826e7fd1ebee49662 Reviewed-by: Friedemann Kleint Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 15 ++++++++++----- src/plugins/platforms/windows/qwindowsfontdatabase.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 1c5b114efd..b1bb944fc6 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -933,7 +933,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, } static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM) + int type, LPARAM registerAlias) { const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName); const uchar charSet = f->elfLogFont.lfCharSet; @@ -943,13 +943,13 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is // identical to a TEXTMETRIC except for the last four members, which we don't use // anyway - addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type, false); + addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type, registerAlias); // keep on enumerating return 1; } -void QWindowsFontDatabase::populateFamily(const QString &familyName) +void QWindowsFontDatabase::populateFamily(const QString &familyName, bool registerAlias) { qCDebug(lcQpaFonts) << familyName; if (familyName.size() >= LF_FACESIZE) { @@ -962,10 +962,15 @@ void QWindowsFontDatabase::populateFamily(const QString &familyName) familyName.toWCharArray(lf.lfFaceName); lf.lfFaceName[familyName.size()] = 0; lf.lfPitchAndFamily = 0; - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, 0, 0); + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, (LPARAM)registerAlias, 0); ReleaseDC(0, dummy); } +void QWindowsFontDatabase::populateFamily(const QString &familyName) +{ + populateFamily(familyName, false); +} + namespace { // Context for enumerating system fonts, records whether the default font has been encountered, // which is normally not enumerated by EnumFontFamiliesEx(). @@ -1382,7 +1387,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData, // Fonts based on files are added via populate, as they will show up in font enumeration. for (int j = 0; j < families.count(); ++j) - populateFamily(families.at(j)); + populateFamily(families.at(j), true); } m_applicationFonts << font; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h index 3615612c78..efb5421996 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.h +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h @@ -100,6 +100,7 @@ public: static QString familyForStyleHint(QFont::StyleHint styleHint); private: + void populateFamily(const QString &familyName, bool registerAlias); void removeApplicationFonts(); struct WinApplicationFont { -- cgit v1.2.3 From f3e1dfb786c8c425562a29bd2ca18dbeb1d4ea84 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 20 Jul 2015 16:30:35 +0200 Subject: Windows: Fix handling of cursor flash time. Check for special return value INFINITE (unsigned -1) of GetCaretBlinkTime() (indicating cursor should not flash) and return 0 in that case. Change-Id: Iead41a20a68b79d04b03f77a3caf063d4e1d577e Task-number: QTBUG-47208 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 9b0f126241..79df6ce720 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -491,7 +491,7 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co switch (hint) { case QPlatformIntegration::CursorFlashTime: if (const unsigned timeMS = GetCaretBlinkTime()) - return QVariant(int(timeMS) * 2); + return QVariant(timeMS != INFINITE ? int(timeMS) * 2 : 0); break; #ifdef SPI_GETKEYBOARDSPEED case KeyboardAutoRepeatRate: -- cgit v1.2.3 From b0b08cc0e4e38504d6b833702f7477aee4e2a192 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 5 Jul 2015 12:15:29 +0200 Subject: When a screen comes back online, the windows need to be told about it On my system, this fixes the misbehavior of Qt applications when the (only) active screen is switched, e.g. from an external screen to the laptop. This behavior is caused by the screen() of widgets to be set to NULL when their screen goes away. When a new screen comes online, the widgets *should* be told about it, but they are not. The only place that "maybeSetScreen" is called is when an existing screen changes its geometry, but not when a screen gets enabled without its geometry being affected in any way (e.g. because it was just disabled via xrandr, but has been connected all along). This makes sure that "maybeSetScreen" is also called when a screen gets enabled. Task-number: QTBUG-47041 Change-Id: Ic72d6beaa544bf9a4efdbea0830b1bc0d6ce5362 Reviewed-by: Dmitry Shachnev Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 74f48b0136..08676152dc 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -252,6 +252,14 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event) otherScreen->addVirtualSibling(screen); m_screens << screen; QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary()); + + // Windows which had null screens have already had expose events by now. + // They need to be told the screen is back, it's OK to render. + foreach (QWindow *window, QGuiApplication::topLevelWindows()) { + QXcbWindow *xcbWin = static_cast(window->handle()); + if (xcbWin) + xcbWin->maybeSetScreen(screen); + } } // else ignore disabled screens } else if (screen) { -- cgit v1.2.3 From ae51e360f986698eaf41fdb38f8a878a50f69be1 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Fri, 19 Jun 2015 13:34:11 +0300 Subject: xcb: Ignore disabling of outputs in the middle of the mode switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X server may send RROutputChangeNotify event with null crtc and mode, when it switches an output mode. Request RROutputInfo to distinguish this case from the case when the output is explicitly disabled. Change-Id: I4c2356ec71dbcc8013009ea8a6f46dd11f19d6bb Task-number: QTBUG-44158 Task-number: QTBUG-46786 Task-number: QTBUG-46822 Reviewed-by: Daniel Vrátil Reviewed-by: Gatis Paeglis Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 08676152dc..29e1fd145d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -265,11 +265,19 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event) } else if (screen) { // Screen has been disabled -> remove if (output.crtc == XCB_NONE && output.mode == XCB_NONE) { - qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled"; - m_screens.removeOne(screen); - foreach (QXcbScreen *otherScreen, m_screens) - otherScreen->removeVirtualSibling((QPlatformScreen *) screen); - QXcbIntegration::instance()->destroyScreen(screen); + xcb_randr_get_output_info_cookie_t outputInfoCookie = + xcb_randr_get_output_info(xcb_connection(), output.output, output.config_timestamp); + QScopedPointer outputInfo( + xcb_randr_get_output_info_reply(xcb_connection(), outputInfoCookie, NULL)); + if (outputInfo->crtc == XCB_NONE) { + qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled"; + m_screens.removeOne(screen); + foreach (QXcbScreen *otherScreen, m_screens) + otherScreen->removeVirtualSibling((QPlatformScreen *) screen); + QXcbIntegration::instance()->destroyScreen(screen); + } else { + qCDebug(lcQpaScreen) << "output" << screen->name() << "has been temporarily disabled for the mode switch"; + } } else { // Just update existing screen screen->updateGeometry(output.config_timestamp); -- cgit v1.2.3 From a0e2e715f58134c7c913996e036b154df1f71d99 Mon Sep 17 00:00:00 2001 From: Ron Bessems Date: Wed, 8 Jul 2015 10:14:10 -0400 Subject: Fixed null pointer dereference Crash in qtwidgets.dll when Qt app is used with accessibility tools like Dragon. Crash due to null pointer dereference. Task-number: QTBUG-47093 Change-Id: I140196ba44b68dfaf229dd8a8e6031379ea1acac Reviewed-by: Frederik Gladhorn --- .../platforms/windows/accessible/qwindowsmsaaaccessible.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index 8b67f235bb..2189938248 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -689,7 +689,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildI return E_INVALIDARG; QAccessibleInterface *acc = childPointer(accessible, varChildID); - if (acc) { + if (acc && acc->isValid()) { *ppdispChild = QWindowsAccessibility::wrap(acc); return S_OK; } @@ -778,7 +778,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDescription(VARIANT var QString descr; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; descr = child->text(QAccessible::Description); } else { @@ -803,7 +803,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accHelp(VARIANT varID, BST QString help; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; help = child->text(QAccessible::Help); } else { @@ -862,7 +862,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BST QString name; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; name = child->text(QAccessible::Name); if (name.isEmpty()) { @@ -910,7 +910,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VAR QAccessible::Role role; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; role = child->role(); } else { @@ -947,7 +947,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accState(VARIANT varID, VA QAccessible::State state; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; state = child->state(); } else { -- cgit v1.2.3 From 50f064f788c6a570ab01909f06a7fe629aa4a621 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 21 Jul 2015 18:09:38 +0200 Subject: fix -no-opengl build Change-Id: Id3570cf10d86908ddff35be65103d16b353dad04 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsnativeinterface.cpp | 4 +++- src/plugins/platforms/windows/qwindowswindow.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index 6e58c55bbe..db8b2ec094 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -135,7 +135,9 @@ QVariantMap QWindowsNativeInterface::windowProperties(QPlatformWindow *window) c void *QWindowsNativeInterface::nativeResourceForIntegration(const QByteArray &resource) { -#ifndef QT_NO_OPENGL +#ifdef QT_NO_OPENGL + Q_UNUSED(resource) +#else if (resourceType(resource) == GlHandleType) return QWindowsIntegration::staticOpenGLContext()->moduleHandle(); #endif diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 543c08135f..853cf036a7 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2271,6 +2271,7 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins) void *QWindowsWindow::surface(void *nativeConfig, int *err) { #ifdef QT_NO_OPENGL + Q_UNUSED(err) Q_UNUSED(nativeConfig) return 0; #else -- cgit v1.2.3 From 3627d8b171379e4f0d3b52d33fcce4767282f1d9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Jul 2015 11:02:41 +0200 Subject: Windows/QClipboard: Fix crash in debug output of QMimeData. Rewrite QDebug operator<<(QDebug d, const QMimeData &mimeData) to take a pointer and handle 0 values. Change the formatting to the style commonly used in Qt. Make it static as it is not used anywhere else. Task-number: QTBUG-47393 Change-Id: I78174e10b75769bf4acd33a894acc0a51e525c39 Reviewed-by: Joerg Bornemann --- .../platforms/windows/qwindowsclipboard.cpp | 37 ++++++++++++---------- .../platforms/windows/qwindowsinternalmimedata.h | 2 -- 2 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index 4cea845c36..925427ac30 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -69,25 +69,28 @@ static const char formatTextHtmlC[] = "text/html"; \ingroup qt-lighthouse-win */ -QDebug operator<<(QDebug d, const QMimeData &m) +static QDebug operator<<(QDebug d, const QMimeData *mimeData) { QDebugStateSaver saver(d); d.nospace(); - const QStringList formats = m.formats(); - d << "QMimeData: " << formats.join(QStringLiteral(", ")) << '\n' - << " Text=" << m.hasText() << " HTML=" << m.hasHtml() - << " Color=" << m.hasColor() << " Image=" << m.hasImage() - << " URLs=" << m.hasUrls() << '\n'; - if (m.hasText()) - d << " Text: '" << m.text() << "'\n"; - if (m.hasHtml()) - d << " HTML: '" << m.html() << "'\n"; - if (m.hasColor()) - d << " Color: " << qvariant_cast(m.colorData()) << '\n'; - if (m.hasImage()) - d << " Image: " << qvariant_cast(m.imageData()).size() << '\n'; - if (m.hasUrls()) - d << " URLs: " << m.urls() << '\n'; + d << "QMimeData("; + if (mimeData) { + const QStringList formats = mimeData->formats(); + d << "formats=" << formats.join(QStringLiteral(", ")); + if (mimeData->hasText()) + d << ", text=" << mimeData->text(); + if (mimeData->hasHtml()) + d << ", html=" << mimeData->html(); + if (mimeData->hasColor()) + d << ", colorData=" << qvariant_cast(mimeData->colorData()); + if (mimeData->hasImage()) + d << ", imageData=" << qvariant_cast(mimeData->imageData()); + if (mimeData->hasUrls()) + d << ", urls=" << mimeData->urls(); + } else { + d << '0'; + } + d << ')'; return d; } @@ -297,7 +300,7 @@ QMimeData *QWindowsClipboard::mimeData(QClipboard::Mode mode) void QWindowsClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode) { - qCDebug(lcQpaMime) << __FUNCTION__ << mode << *mimeData; + qCDebug(lcQpaMime) << __FUNCTION__ << mode << mimeData; if (mode != QClipboard::Clipboard) return; diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.h b/src/plugins/platforms/windows/qwindowsinternalmimedata.h index 09ab417268..6a60a9676a 100644 --- a/src/plugins/platforms/windows/qwindowsinternalmimedata.h +++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.h @@ -55,8 +55,6 @@ protected: virtual void releaseDataObject(IDataObject *) const {} }; -QDebug operator<<(QDebug d, const QMimeData &m); - QT_END_NAMESPACE #endif // QWINDOWSINTERNALMIME_H -- cgit v1.2.3 From 150aa19042bbee893c5b4f16cb230f9266a1f4b7 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 22 Jul 2015 15:31:17 +0200 Subject: ios: Do not drop the user-provided default QSurfaceFormat Task-number: QTBUG-47195 Change-Id: I40bc7be816f5e23a63a2fe6d32842143b52f9d58 Reviewed-by: jian liang Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosintegration.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 837d0e9143..8395db81ff 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -81,7 +81,7 @@ QIOSIntegration::QIOSIntegration() // QPlatformBackingStore. qApp->setAttribute(Qt::AA_ShareOpenGLContexts, true); // And that context must match the format used for the backingstore's context. - QSurfaceFormat fmt; + QSurfaceFormat fmt = QSurfaceFormat::defaultFormat(); fmt.setDepthBufferSize(16); fmt.setStencilBufferSize(8); QSurfaceFormat::setDefaultFormat(fmt); -- cgit v1.2.3 From 404430dca5b85bb197c8d4659060c5e3b4ac67f3 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 27 Jul 2015 11:11:08 +0200 Subject: iOS: use UIKeyboardTypeNumbersAndPunctuation for Qt::ImhPreferNumbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using Qt::ImhPreferNumbers means that we should use a keyboard that has focus on typing numbers. But it's important that we don't restrict typing to numbers only, it also needs to support normal text input. And this seems to be exactly what UIKeyboardTypeNumbersAndPunctuation does. Task-number: QTBUG-47365 Change-Id: I5bb88cedcbe0e89ea884dc9c14d3ffd9fb368060 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostextresponder.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 52336a4e69..09839790fa 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -199,6 +199,8 @@ self.keyboardType = UIKeyboardTypePhonePad; else if (hints & Qt::ImhLatinOnly) self.keyboardType = UIKeyboardTypeASCIICapable; + else if (hints & Qt::ImhPreferNumbers) + self.keyboardType = UIKeyboardTypeNumbersAndPunctuation; else self.keyboardType = UIKeyboardTypeDefault; -- cgit v1.2.3 From 5f276d7a5ff961568d69c3d94232527342728027 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 24 Jul 2015 11:37:42 +0200 Subject: iOS: add missing Q_DECL_OVERRIDE Add missing Q_DECL_OVERRIDE to silence clang. Change-Id: I57261a39f0dcf4e0ffd8d9c079a95f2d3347d34a Reviewed-by: Jake Petroules --- src/plugins/platforms/ios/qioscontext.h | 12 +++++----- .../platforms/ios/qiosfileengineassetslibrary.mm | 2 +- src/plugins/platforms/ios/qiosintegration.h | 26 +++++++++++----------- src/plugins/platforms/ios/qiosmenu.h | 2 +- src/plugins/platforms/ios/qiosscreen.h | 20 ++++++++--------- src/plugins/platforms/ios/qiostheme.h | 4 ++-- src/plugins/platforms/ios/qioswindow.h | 24 ++++++++++---------- 7 files changed, 45 insertions(+), 45 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h index e550efe7c3..ec678fee44 100644 --- a/src/plugins/platforms/ios/qioscontext.h +++ b/src/plugins/platforms/ios/qioscontext.h @@ -50,15 +50,15 @@ public: QIOSContext(QOpenGLContext *context); ~QIOSContext(); - QSurfaceFormat format() const; + QSurfaceFormat format() const Q_DECL_OVERRIDE; - void swapBuffers(QPlatformSurface *surface); + void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE; - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); + bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE; + void doneCurrent() Q_DECL_OVERRIDE; - GLuint defaultFramebufferObject(QPlatformSurface *) const; - QFunctionPointer getProcAddress(const QByteArray &procName); + GLuint defaultFramebufferObject(QPlatformSurface *) const Q_DECL_OVERRIDE; + QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE; bool isSharing() const Q_DECL_OVERRIDE; bool isValid() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm index f0b6afce2d..761a89c989 100644 --- a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm +++ b/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm @@ -304,7 +304,7 @@ public: return g_iteratorCurrentUrl.localData(); } - QFileInfo currentFileInfo() const + QFileInfo currentFileInfo() const Q_DECL_OVERRIDE { return QFileInfo(currentFileName()); } diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index 0fe318dce7..7d23fe1d62 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -54,26 +54,26 @@ public: QIOSIntegration(); ~QIOSIntegration(); - bool hasCapability(Capability cap) const; + bool hasCapability(Capability cap) const Q_DECL_OVERRIDE; - QPlatformWindow *createPlatformWindow(QWindow *window) const; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; - QPlatformFontDatabase *fontDatabase() const; - QPlatformClipboard *clipboard() const; - QPlatformInputContext *inputContext() const; + QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; + QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; + QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; QPlatformServices *services() const Q_DECL_OVERRIDE; - QVariant styleHint(StyleHint hint) const; + QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; - QStringList themeNames() const; - QPlatformTheme *createPlatformTheme(const QString &name) const; + QStringList themeNames() const Q_DECL_OVERRIDE; + QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; - QAbstractEventDispatcher *createEventDispatcher() const; - QPlatformNativeInterface *nativeInterface() const; + QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; + QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; QTouchDevice *touchDevice(); QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; @@ -86,7 +86,7 @@ public: // -- QPlatformNativeInterface -- - void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); + void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE; void setDebugWindowManagement(bool); bool debugWindowManagement() const; diff --git a/src/plugins/platforms/ios/qiosmenu.h b/src/plugins/platforms/ios/qiosmenu.h index 15f200bb27..4fa0416df7 100644 --- a/src/plugins/platforms/ios/qiosmenu.h +++ b/src/plugins/platforms/ios/qiosmenu.h @@ -112,7 +112,7 @@ public: static id menuActionTarget() { return m_currentMenu ? m_currentMenu->m_menuController : 0; } protected: - bool eventFilter(QObject *obj, QEvent *event); + bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE; private: quintptr m_tag; diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h index a638210c00..a0aa922a31 100644 --- a/src/plugins/platforms/ios/qiosscreen.h +++ b/src/plugins/platforms/ios/qiosscreen.h @@ -50,17 +50,17 @@ public: QIOSScreen(UIScreen *screen); ~QIOSScreen(); - QRect geometry() const; - QRect availableGeometry() const; - int depth() const; - QImage::Format format() const; - QSizeF physicalSize() const; - QDpi logicalDpi() const; - qreal devicePixelRatio() const; + QRect geometry() const Q_DECL_OVERRIDE; + QRect availableGeometry() const Q_DECL_OVERRIDE; + int depth() const Q_DECL_OVERRIDE; + QImage::Format format() const Q_DECL_OVERRIDE; + QSizeF physicalSize() const Q_DECL_OVERRIDE; + QDpi logicalDpi() const Q_DECL_OVERRIDE; + qreal devicePixelRatio() const Q_DECL_OVERRIDE; - Qt::ScreenOrientation nativeOrientation() const; - Qt::ScreenOrientation orientation() const; - void setOrientationUpdateMask(Qt::ScreenOrientations mask); + Qt::ScreenOrientation nativeOrientation() const Q_DECL_OVERRIDE; + Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE; + void setOrientationUpdateMask(Qt::ScreenOrientations mask) Q_DECL_OVERRIDE; UIScreen *uiScreen() const; UIWindow *uiWindow() const; diff --git a/src/plugins/platforms/ios/qiostheme.h b/src/plugins/platforms/ios/qiostheme.h index 9ef179b4dc..58144cb239 100644 --- a/src/plugins/platforms/ios/qiostheme.h +++ b/src/plugins/platforms/ios/qiostheme.h @@ -47,7 +47,7 @@ public: ~QIOSTheme(); const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE; - QVariant themeHint(ThemeHint hint) const; + QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE; QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE; QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE; @@ -55,7 +55,7 @@ public: bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE; QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE; - const QFont *font(Font type = SystemFont) const; + const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE; static const char *name; diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index c53eee1afd..0c65cf8aa5 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -54,29 +54,29 @@ public: explicit QIOSWindow(QWindow *window); ~QIOSWindow(); - void setGeometry(const QRect &rect); + void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; - void setWindowState(Qt::WindowState state); - void setParent(const QPlatformWindow *window); - void handleContentOrientationChange(Qt::ScreenOrientation orientation); - void setVisible(bool visible); + void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE; + void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE; + void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE; + void setVisible(bool visible) Q_DECL_OVERRIDE; void setOpacity(qreal level) Q_DECL_OVERRIDE; bool isExposed() const Q_DECL_OVERRIDE; void propagateSizeHints() Q_DECL_OVERRIDE {} - void raise() { raiseOrLower(true); } - void lower() { raiseOrLower(false); } + void raise() Q_DECL_OVERRIDE{ raiseOrLower(true); } + void lower() Q_DECL_OVERRIDE { raiseOrLower(false); } bool shouldAutoActivateWindow() const; - void requestActivateWindow(); + void requestActivateWindow() Q_DECL_OVERRIDE; - qreal devicePixelRatio() const; + qreal devicePixelRatio() const Q_DECL_OVERRIDE; - bool setMouseGrabEnabled(bool grab) { return grab; } - bool setKeyboardGrabEnabled(bool grab) { return grab; } + bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; } + bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; } - WId winId() const { return WId(m_view); }; + WId winId() const Q_DECL_OVERRIDE { return WId(m_view); } void clearAccessibleCache(); -- cgit v1.2.3 From 4ef3d985dd959d8e878ea9b1080691fca861f8ea Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 20 Jul 2015 11:01:39 +0200 Subject: Windows: Split code paths for touch/native gesture events. Fix up 2b5df245d6cdbfb3150ee815debccf655af8f19f which routed WM_GESTURE through QWindowsMouseHandler::translateTouchEvent() causing asserts on missing touch devices. Task-number: QTBUG-47184 Change-Id: Ie843ebb343e34487bcac9c9dbea88de641d51e28 Reviewed-by: Oliver Wolff Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscontext.cpp | 6 +++++- .../platforms/windows/qwindowsmousehandler.cpp | 24 +++++++++++++++++----- .../platforms/windows/qwindowsmousehandler.h | 3 +++ 3 files changed, 27 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index a532e92397..3f355db607 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -919,7 +919,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::InputMethodRequest: return QWindowsInputContext::instance()->handleIME_Request(wParam, lParam, result); case QtWindows::GestureEvent: - return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); +#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) + return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); +#else + return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); +#endif case QtWindows::InputMethodOpenCandidateWindowEvent: case QtWindows::InputMethodCloseCandidateWindowEvent: // TODO: Release/regrab mouse if a popup has mouse grab. diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index db635b602b..e6b80f2b93 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -472,12 +472,11 @@ bool QWindowsMouseHandler::translateScrollEvent(QWindow *window, HWND, } // from bool QApplicationPrivate::translateTouchEvent() -bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, +bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, QtWindows::WindowsEventType, MSG msg, LRESULT *) { #ifndef Q_OS_WINCE - Q_UNUSED(hwnd); typedef QWindowSystemInterface::TouchPoint QTouchPoint; typedef QList QTouchPointList; @@ -545,8 +544,24 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, touchPoints); +#else // !Q_OS_WINCE + Q_UNUSED(window) + Q_UNUSED(msg) +#endif return true; -#else //Q_OS_WINCE + +} + +bool QWindowsMouseHandler::translateGestureEvent(QWindow *window, HWND hwnd, + QtWindows::WindowsEventType, + MSG msg, LRESULT *) +{ +#ifndef Q_OS_WINCE + Q_UNUSED(window) + Q_UNUSED(hwnd) + Q_UNUSED(msg) + return false; +#else // !Q_OS_WINCE GESTUREINFO gi; memset(&gi, 0, sizeof(GESTUREINFO)); gi.cbSize = sizeof(GESTUREINFO); @@ -625,9 +640,8 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, QWindowSystemInterface::handleEnterEvent(window); m_windowUnderMouse = window; } - return true; -#endif +#endif // Q_OS_WINCE } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h index ce3e6b6fc4..61aa8d6084 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.h +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -59,6 +59,9 @@ public: bool translateTouchEvent(QWindow *widget, HWND hwnd, QtWindows::WindowsEventType t, MSG msg, LRESULT *result); + bool translateGestureEvent(QWindow *window, HWND hwnd, + QtWindows::WindowsEventType, + MSG msg, LRESULT *); bool translateScrollEvent(QWindow *window, HWND hwnd, MSG msg, LRESULT *result); -- cgit v1.2.3 From 7e89c7b8552b670f090fefb4b40fce348ecc416c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 28 Jul 2015 07:53:43 +0200 Subject: xcb: fix tablet proximity again Patch 53d289ec4c0f512a3475da4bbf1f940cd6838ace caused it not to select property change events, which are needed separately for each tablet device. It's not enough to select them on the master device. Change-Id: Ibb6c7990d2edd865019eacfa7eed4bf818f7557e Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 2f46436ce2..150047fe12 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -306,14 +306,13 @@ void QXcbConnection::xi2Select(xcb_window_t window) const bool pointerSelected = isAtLeastXI22() && xi2MouseEvents(); QSet tabletDevices; #ifndef QT_NO_TABLETEVENT - if (!m_tabletData.isEmpty() && !pointerSelected) { + if (!m_tabletData.isEmpty()) { unsigned int tabletBitMask; unsigned char *xiTabletBitMask = reinterpret_cast(&tabletBitMask); QVector xiEventMask(m_tabletData.count()); - tabletBitMask = XI_ButtonPressMask; - tabletBitMask |= XI_ButtonReleaseMask; - tabletBitMask |= XI_MotionMask; - tabletBitMask |= XI_PropertyEventMask; + tabletBitMask = XI_PropertyEventMask; + if (!pointerSelected) + tabletBitMask |= XI_ButtonPressMask | XI_ButtonReleaseMask | XI_MotionMask; for (int i = 0; i < m_tabletData.count(); ++i) { int deviceId = m_tabletData.at(i).deviceId; tabletDevices.insert(deviceId); -- cgit v1.2.3 From 2bcb2ce8c976de7daea71cab7d2215fc1ce5a448 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Wed, 15 Jul 2015 23:01:31 +0300 Subject: xcb: Fix build with QT_NO_CURSOR Change-Id: I2391c2921274b7a178fbdde1d0f59f7fbaa3048e Reviewed-by: Friedemann Kleint --- src/plugins/platforms/xcb/qxcbcursor.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index e51ab85e30..bd880698e6 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -336,8 +336,10 @@ QXcbCursor::~QXcbCursor() if (!--cursorCount) xcb_close_font(conn, cursorFont); +#ifndef QT_NO_CURSOR foreach (xcb_cursor_t cursor, m_cursorHash) xcb_free_cursor(conn, cursor); +#endif } #ifndef QT_NO_CURSOR -- cgit v1.2.3 From 0d7af31e83ec2de324546558e5c787e1d489cf5c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2015 10:35:10 -0700 Subject: Make the function pointer to xcb_poll_for_queued_event not a member In the normal case, this change is a no-op. In case RTLD_DEFAULT isn't defined, this makes the job of the optimizer easier to detect that the static variable is never modified and that it can do a lot of dead code elimination. This also enables the optimization in the next commit. Change-Id: Ib306f8f647014b399b87ffff13f12f40a359233b Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbconnection.cpp | 33 +++++++++++++++++----------- src/plugins/platforms/xcb/qxcbconnection.h | 3 --- 2 files changed, 20 insertions(+), 16 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 29e1fd145d..2158300591 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -77,6 +77,21 @@ #include #endif +typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c); +static XcbPollForQueuedEventFunctionPointer local_xcb_poll_for_queued_event; + +static inline void checkXcbPollForQueuedEvent() +{ +#ifdef RTLD_DEFAULT + local_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event"); +#endif + +#ifdef Q_XCB_DEBUG + if (local_xcb_poll_for_queued_event) + qDebug("Using threaded event reader with xcb_poll_for_queued_event"); +#endif +} + QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input") @@ -1169,21 +1184,13 @@ void QXcbConnection::addPeekFunc(PeekFunc f) QXcbEventReader::QXcbEventReader(QXcbConnection *connection) : m_connection(connection) - , m_xcb_poll_for_queued_event(0) { -#ifdef RTLD_DEFAULT - m_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event"); -#endif - -#ifdef Q_XCB_DEBUG - if (m_xcb_poll_for_queued_event) - qDebug("Using threaded event reader with xcb_poll_for_queued_event"); -#endif + checkXcbPollForQueuedEvent(); } void QXcbEventReader::start() { - if (m_xcb_poll_for_queued_event) { + if (local_xcb_poll_for_queued_event) { connect(this, SIGNAL(eventPending()), m_connection, SLOT(processXcbEvents()), Qt::QueuedConnection); connect(this, SIGNAL(finished()), m_connection, SLOT(processXcbEvents())); QThread::start(); @@ -1209,7 +1216,7 @@ void QXcbEventReader::registerEventDispatcher(QAbstractEventDispatcher *dispatch // flush the xcb connection before the EventDispatcher is going to block // In the non-threaded case processXcbEvents is called before going to block, // which flushes the connection. - if (m_xcb_poll_for_queued_event) + if (local_xcb_poll_for_queued_event) connect(dispatcher, SIGNAL(aboutToBlock()), m_connection, SLOT(flush())); } @@ -1219,7 +1226,7 @@ void QXcbEventReader::run() while (m_connection && (event = xcb_wait_for_event(m_connection->xcb_connection()))) { m_mutex.lock(); addEvent(event); - while (m_connection && (event = m_xcb_poll_for_queued_event(m_connection->xcb_connection()))) + while (m_connection && (event = local_xcb_poll_for_queued_event(m_connection->xcb_connection()))) addEvent(event); m_mutex.unlock(); emit eventPending(); @@ -1243,7 +1250,7 @@ void QXcbEventReader::addEvent(xcb_generic_event_t *event) QXcbEventArray *QXcbEventReader::lock() { m_mutex.lock(); - if (!m_xcb_poll_for_queued_event) { + if (!local_xcb_poll_for_queued_event) { while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection->xcb_connection())) m_events << event; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index ee5ed8906a..a183a72353 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -324,9 +324,6 @@ private: QMutex m_mutex; QXcbEventArray m_events; QXcbConnection *m_connection; - - typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c); - XcbPollForQueuedEventFunctionPointer m_xcb_poll_for_queued_event; }; class QXcbWindowEventListener -- cgit v1.2.3 From 3a63bb0ea755bb15c03a82192773c481d5ae8574 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2015 10:40:29 -0700 Subject: Let the linker find xcb_poll_for_queued_event for us It's more efficient than we are. This also enables the code to work in the unlikely case of an ELF platform without RTLD_DEFAULT. Change-Id: Ib306f8f647014b399b87ffff13f12f8aeeb2589a Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbconnection.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 2158300591..d2e08aecee 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -55,7 +55,6 @@ #include -#include #include #include #include @@ -77,6 +76,14 @@ #include #endif +#if defined(Q_CC_GNU) && defined(Q_OF_ELF) +static xcb_generic_event_t *local_xcb_poll_for_queued_event(xcb_connection_t *c) + __attribute__((weakref("xcb_poll_for_queued_event"))); + +static inline void checkXcbPollForQueuedEvent() +{ } +#else +#include typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c); static XcbPollForQueuedEventFunctionPointer local_xcb_poll_for_queued_event; @@ -85,12 +92,8 @@ static inline void checkXcbPollForQueuedEvent() #ifdef RTLD_DEFAULT local_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event"); #endif - -#ifdef Q_XCB_DEBUG - if (local_xcb_poll_for_queued_event) - qDebug("Using threaded event reader with xcb_poll_for_queued_event"); -#endif } +#endif QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 0617834e0cfa00c8dadbac17877659196107be76 Mon Sep 17 00:00:00 2001 From: Martin Koller Date: Sat, 25 Jul 2015 16:33:01 +0200 Subject: xcb: Make it compile on systems with xinput2 < 2.2 Change-Id: I7e98d3540cd7717ac8af8d1993618d18320f811a Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 150047fe12..335236578b 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -457,17 +457,6 @@ static inline qreal fixed1616ToReal(FP1616 val) } #endif // defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) -#if defined(XCB_USE_XINPUT21) -static qreal valuatorNormalized(double value, XIValuatorClassInfo *vci) -{ - if (value > vci->max) - value = vci->max; - if (value < vci->min) - value = vci->min; - return (value - vci->min) / (vci->max - vci->min); -} -#endif // XCB_USE_XINPUT21 - void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) { if (xi2PrepareXIGenericDeviceEvent(event, m_xiOpCode)) { @@ -480,9 +469,11 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) case XI_ButtonPress: case XI_ButtonRelease: case XI_Motion: +#ifdef XCB_USE_XINPUT22 case XI_TouchBegin: case XI_TouchUpdate: case XI_TouchEnd: +#endif { xiDeviceEvent = reinterpret_cast(event); eventListener = windowEventListenerFromId(xiDeviceEvent->event); @@ -547,6 +538,15 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) } #ifdef XCB_USE_XINPUT22 +static qreal valuatorNormalized(double value, XIValuatorClassInfo *vci) +{ + if (value > vci->max) + value = vci->max; + if (value < vci->min) + value = vci->min; + return (value - vci->min) / (vci->max - vci->min); +} + void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindow) { xXIDeviceEvent *xiDeviceEvent = static_cast(xiDevEvent); @@ -976,6 +976,8 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData, Q // the pen on the XI 2.2+ path. if (xi2MouseEvents() && eventListener) eventListener->handleXIMouseEvent(reinterpret_cast(event)); +#else + Q_UNUSED(eventListener); #endif switch (xiEvent->evtype) { -- cgit v1.2.3 From 5e3e34731b7880ac775e8f1fa156ce016e6820f1 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 18 May 2015 09:27:10 +0400 Subject: Default implementation for QPlatformFontDatabase::fallbacksForFamily() ...mainly for platforms that do not provide a native/unified way to obtain system-defined font fallbacks list (ie !CoreText && !FontConfig). Change-Id: I23c5589d79ddecb6311ccc52ec8b29977f06d408 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../android/qandroidplatformfontdatabase.cpp | 24 ++++++++-------------- .../android/qandroidplatformfontdatabase.h | 3 --- .../platforms/windows/qwindowsfontdatabase.cpp | 11 +++------- .../platforms/windows/qwindowsfontdatabase_ft.cpp | 6 +++--- 4 files changed, 14 insertions(+), 30 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp index 9b60ab291c..b4b6123147 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp @@ -55,16 +55,7 @@ void QAndroidPlatformFontDatabase::populateFontDatabase() QList entries = dir.entryInfoList(QStringList() << QStringLiteral("*.ttf") << QStringLiteral("*.otf"), QDir::Files); for (int i = 0; i < int(entries.count()); ++i) { const QByteArray file = QFile::encodeName(entries.at(i).absoluteFilePath()); - QSupportedWritingSystems supportedWritingSystems; - QStringList families = addTTFile(QByteArray(), file, &supportedWritingSystems); - - extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem); - for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) { - if (i == QFontDatabase::Any || supportedWritingSystems.supported(QFontDatabase::WritingSystem(i))) { - QChar::Script script = QChar::Script(qt_script_for_writing_system(QFontDatabase::WritingSystem(i))); - m_fallbacks[script] += families; - } - } + QBasicFontDatabase::addTTFile(QByteArray(), file); } } @@ -73,15 +64,16 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami QFont::StyleHint styleHint, QChar::Script script) const { - Q_UNUSED(family); - Q_UNUSED(style); - + QStringList result; if (styleHint == QFont::Monospace || styleHint == QFont::Courier) - return QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";") + m_fallbacks[script]; + result.append(QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";")); else if (styleHint == QFont::Serif) - return QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(";") + m_fallbacks[script]; + result.append(QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(";")); + else + result.append(QString(qgetenv("QT_ANDROID_FONTS")).split(";")); + result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script)); - return QString(qgetenv("QT_ANDROID_FONTS")).split(";") + m_fallbacks[script]; + return result; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.h b/src/plugins/platforms/android/qandroidplatformfontdatabase.h index 45de47a58c..89a9ed8bc0 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.h +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.h @@ -47,9 +47,6 @@ public: QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; - -private: - QHash m_fallbacks; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index b1bb944fc6..3b27964b0e 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1080,11 +1080,7 @@ QWindowsFontDatabase::~QWindowsFontDatabase() QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) { - if (script == QChar::Script_Common) - return new QWindowsMultiFontEngine(fontEngine, script); - // ### as long as fallbacksForFamily() does not take script parameter into account, - // prefer QFontEngineMulti's loadEngine() implementation for complex scripts - return QPlatformFontDatabase::fontEngineMulti(fontEngine, script); + return new QWindowsMultiFontEngine(fontEngine, script); } QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) @@ -1666,11 +1662,10 @@ QString QWindowsFontDatabase::familyForStyleHint(QFont::StyleHint styleHint) QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { - QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script); - if (!result.isEmpty()) - return result; + QStringList result; result.append(QWindowsFontDatabase::familyForStyleHint(styleHint)); result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); + result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script)); qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint << script << result; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index ad75a0bd54..795554698c 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -661,9 +661,7 @@ QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qrea QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { - QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script); - if (!result.isEmpty()) - return result; + QStringList result; result.append(QWindowsFontDatabase::familyForStyleHint(styleHint)); @@ -679,6 +677,8 @@ QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QF result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); + result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script)); + qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint << script << result; -- cgit v1.2.3 From 839af2268e2b0b8079d1f107db71dcf0390c11ee Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 18 May 2015 09:32:14 +0400 Subject: Micro optimization to Basic/Android FDB::populateFontDatabase() Re-use QDir to check if dir exists (QDir::exists() also returns false if path specifies a file), and use somewhat faster QDir::entryInfoList() to iterate the font files. Change-Id: Iea3a6e5548928a01db71037425adf170cb722151 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/android/qandroidplatformfontdatabase.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp index b4b6123147..be1a3d7bdf 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp @@ -45,16 +45,19 @@ QString QAndroidPlatformFontDatabase::fontDir() const void QAndroidPlatformFontDatabase::populateFontDatabase() { QString fontpath = fontDir(); + QDir dir(fontpath); - if (!QFile::exists(fontpath)) { + if (!dir.exists()) { qFatal("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?", qPrintable(fontpath)); } - QDir dir(fontpath); - QList entries = dir.entryInfoList(QStringList() << QStringLiteral("*.ttf") << QStringLiteral("*.otf"), QDir::Files); - for (int i = 0; i < int(entries.count()); ++i) { - const QByteArray file = QFile::encodeName(entries.at(i).absoluteFilePath()); + QStringList nameFilters; + nameFilters << QLatin1String("*.ttf") + << QLatin1String("*.otf"); + + foreach (const QFileInfo &fi, dir.entryInfoList(nameFilters, QDir::Files)) { + const QByteArray file = QFile::encodeName(fi.absoluteFilePath()); QBasicFontDatabase::addTTFile(QByteArray(), file); } } -- cgit v1.2.3 From a416647e385e3d9bd394e960d108bc11d3209d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Wed, 13 May 2015 18:35:36 +0200 Subject: Android: Manually detach the thread after calling quitApp. On Android 5.0 ART will complain when we don't detach the thread before the application is about to quit (non-fatal). This is because we re-attach to call quitApp and then leave it attached. Change-Id: I4571ef5f38d92afcaf91cb920ebe121a7be7835a Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/androidjnimain.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index cf81f92e47..a04bf1eccb 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -443,6 +443,11 @@ static void *startMainMethod(void */*data*/) if (m_applicationClass) QJNIObjectPrivate::callStaticMethod(m_applicationClass, "quitApp", "()V"); + // All attached threads should be detached before returning from this function. + JavaVM *vm = QtAndroidPrivate::javaVM(); + if (vm != 0) + vm->DetachCurrentThread(); + return 0; } -- cgit v1.2.3 From 4067bbc24cf7a6d3058387225d9e67ad093991cd Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 14 Jul 2015 18:31:03 +0200 Subject: Fix shortcut handling with modifiers Since d7ca800a87a2291c94c6580f0cfe068bb2280caf the shortcut events were only sent once. The one sent by QGuiApplication did not create a QKeyEvent with the full native modifier state - basically the extended key event expected everywhere. That means that shortcuts on some keyboard layouts - like ctrl-shift-7 on the German keyboard (resulting in ctrl+/) - would not work when the shortcut override was tested from QGuiApplication, but then the same shortcut was sent from QApplication with the full information, so it worked the second time. Shortcuts of this type in Qt Quick were broken before. Task-number: QTBUG-47062 Change-Id: I8390b9a96d0d998a2a538ac65503702e0d299cc7 Reviewed-by: Andy Shaw Reviewed-by: Gatis Paeglis --- src/plugins/platforms/cocoa/qnsview.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 456c9d8c68..d802a36676 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1430,8 +1430,12 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) if (eventType == QEvent::KeyPress) { - if (m_composingText.isEmpty()) - m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(focusWindow, timestamp, keyCode, modifiers, text, [nsevent isARepeat], 1); + if (m_composingText.isEmpty()) { + QKeyEvent override(QEvent::ShortcutOverride, keyCode, modifiers, + nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1); + override.setTimestamp(timestamp); + m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutOverrideEvent(focusWindow, &override); + } QObject *fo = QGuiApplication::focusObject(); if (m_sendKeyEvent && fo) { -- cgit v1.2.3