From 015bc9d7ce91ab2dfe361286317da8e062536846 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 2 Jun 2015 11:40:38 +0300 Subject: xcb: Track touch points on a per device basis Until now there was no connection between the tracked touch points and the touch device. So the touch point for one device could be updated by the touch event from another device. Change-Id: I09fcf03a171cc361c6b5b4995758aa53d29ff414 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.h | 1 - src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 2005ae0701..291193612c 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -607,7 +607,6 @@ private: #endif QXcbEventReader *m_reader; #if defined(XCB_USE_XINPUT2) - QHash m_touchPoints; QHash m_touchDevices; #endif #ifdef Q_XCB_DEBUG diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index c7784ddb48..b9f9a6843e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -52,6 +52,7 @@ struct XInput2TouchDeviceData { } XIDeviceInfo *xiDeviceInfo; QTouchDevice *qtTouchDevice; + QHash touchPoints; // Stuff that is relevant only for touchpads QHash pointPressedPosition; // in screen coordinates where each point was pressed @@ -552,15 +553,15 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo xXIDeviceEvent *xiDeviceEvent = static_cast(xiDevEvent); XInput2TouchDeviceData *dev = touchDeviceForId(xiDeviceEvent->sourceid); Q_ASSERT(dev); - const bool firstTouch = m_touchPoints.isEmpty(); + const bool firstTouch = dev->touchPoints.isEmpty(); if (xiDeviceEvent->evtype == XI_TouchBegin) { QWindowSystemInterface::TouchPoint tp; tp.id = xiDeviceEvent->detail % INT_MAX; tp.state = Qt::TouchPointPressed; tp.pressure = -1.0; - m_touchPoints[tp.id] = tp; + dev->touchPoints[tp.id] = tp; } - QWindowSystemInterface::TouchPoint &touchPoint = m_touchPoints[xiDeviceEvent->detail]; + QWindowSystemInterface::TouchPoint &touchPoint = dev->touchPoints[xiDeviceEvent->detail]; qreal x = fixed1616ToReal(xiDeviceEvent->root_x); qreal y = fixed1616ToReal(xiDeviceEvent->root_y); qreal nx = -1.0, ny = -1.0, d = 0.0; @@ -677,10 +678,10 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled())) qCDebug(lcQpaXInput) << " touchpoint " << touchPoint.id << " state " << touchPoint.state << " pos norm " << touchPoint.normalPosition << " area " << touchPoint.area << " pressure " << touchPoint.pressure; - QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xiDeviceEvent->time, dev->qtTouchDevice, m_touchPoints.values()); + QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xiDeviceEvent->time, dev->qtTouchDevice, dev->touchPoints.values()); if (touchPoint.state == Qt::TouchPointReleased) // If a touchpoint was released, we can forget it, because the ID won't be reused. - m_touchPoints.remove(touchPoint.id); + dev->touchPoints.remove(touchPoint.id); else // Make sure that we don't send TouchPointPressed/Moved in more than one QTouchEvent // with this touch point if the next XI2 event is about a different touch point. -- cgit v1.2.3 From 769cc4d878c18ca3228fce846deccb5290901887 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 3 Jun 2015 10:18:38 +0200 Subject: Make logicalDpi consistent in relation to device pixel ratio In GNOME/Unity XCB, logical DPI is scaled by device pixel ratio, and on Macs logical DPI is constant but pixel ratio is based on physical DPI, making logical DPI effectively physical DPI divided by pixel ratio. This patch ensure the same logic is used for other XCB desktops. Change-Id: I60f24618cd49f6b34a6ff1eff317883d191d3491 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/xcb/qxcbscreen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index c14ec0bb3f..63e4d9e75b 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -361,11 +361,11 @@ QDpi QXcbScreen::logicalDpi() const if (overrideDpi) return QDpi(overrideDpi, overrideDpi); - if (m_forcedDpi > 0) { - int primaryDpr = int(connection()->screens().at(0)->devicePixelRatio()); + int primaryDpr = int(connection()->screens().at(0)->devicePixelRatio()); + if (m_forcedDpi > 0) return QDpi(m_forcedDpi/primaryDpr, m_forcedDpi/primaryDpr); - } - return virtualDpi(); + QDpi vDpi = virtualDpi(); + return QDpi(vDpi.first/primaryDpr, vDpi.second/primaryDpr); } -- cgit v1.2.3 From 536c5df13f20ef7fe838f2f60cbaf075f8dc212e Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 13 Dec 2014 20:21:38 +0100 Subject: Cocoa: QCocoaApplicationDelegate - correctly install cleanup handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + (id)allocWithZone:(NSZone *)zone returns before the cleanup handler is installed. this causes the QCocoaApplicationDelegate not to be cleaned up by the garbage collector Change-Id: Ic4862b96228539f3da857955f08157402974a104 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index f3a0216870..6c673a4f5d 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -131,8 +131,8 @@ QT_END_NAMESPACE @synchronized(self) { if (sharedCocoaApplicationDelegate == nil) { sharedCocoaApplicationDelegate = [super allocWithZone:zone]; - return sharedCocoaApplicationDelegate; qAddPostRoutine(cleanupCocoaApplicationDelegate); + return sharedCocoaApplicationDelegate; } } return nil; -- cgit v1.2.3 From 4ee7bfaff4db65d35200fffeaca3be1cc026fc2c Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 4 Jun 2015 12:20:17 +0200 Subject: QNSImageView - remove observer before dealloc It can happen that NSMenuDidEndTrackingNotification comes after our imageCell QNSImageView was deallocated (for example, mouse button is not released yet when dealloc called). Remove soon-to-be-deallocated observer. Change-Id: Ib155cc5f0b884c6b1fed0f986d12599096b582c6 Task-number: QTBUG-46425 Reviewed-by: Thierry Bastian Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm index f50f552623..713758cc7e 100755 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm @@ -446,6 +446,7 @@ QT_END_NAMESPACE -(void)dealloc { [[NSStatusBar systemStatusBar] removeStatusItem:item]; + [[NSNotificationCenter defaultCenter] removeObserver:imageCell]; [imageCell release]; [item release]; [super dealloc]; -- cgit v1.2.3 From 50cd28b31dab6d775a72c5937fe39b208c6822df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 5 Jun 2015 09:30:51 +0200 Subject: Cocoa: Remove ToolTip windows from popup stack Match the cases for the adding logic. Change-Id: I61f49975b4cfcf2acf26b31b521cbc9b96f9d150 Task-number: QTBUG-46447 Reviewed-by: Erik Verbruggen Reviewed-by: Eike Ziller --- src/plugins/platforms/cocoa/qcocoawindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 86959869cc..92fc66a04f 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -749,7 +749,7 @@ void QCocoaWindow::setVisible(bool visible) monitor = nil; } - if (window()->type() == Qt::Popup) + if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) QCocoaIntegration::instance()->popupWindowStack()->removeAll(this); if (parentCocoaWindow && window()->type() == Qt::Popup) { -- cgit v1.2.3 From d32f47b70387713335656a8e93f289c819fb9b05 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 3 Jun 2015 17:04:53 +0200 Subject: fix usage of wince scope Fix style issues along the way. Change-Id: Ic6a6de28e198eb0b14c198b802e78845703909b9 Reviewed-by: Joerg Bornemann --- src/plugins/bearer/bearer.pro | 2 +- src/plugins/platforms/windows/windows.pri | 16 ++++++++-------- src/plugins/plugins.pro | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 7637bf1f5e..2239d52737 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -8,7 +8,7 @@ TEMPLATE = subdirs #win32:SUBDIRS += nla win32:SUBDIRS += generic blackberry:SUBDIRS += blackberry -win32:!wince*:SUBDIRS += nativewifi +win32:!wince: SUBDIRS += nativewifi mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan mac:SUBDIRS += generic android:!android-no-sdk:SUBDIRS += android diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index a0460630a7..de901aaeb1 100644 --- a/src/plugins/platforms/windows/windows.pri +++ b/src/plugins/platforms/windows/windows.pri @@ -1,14 +1,14 @@ # Note: OpenGL32 must precede Gdi32 as it overwrites some functions. LIBS *= -lole32 -!wince*:LIBS *= -luser32 -lwinspool -limm32 -lwinmm -loleaut32 +!wince: LIBS *= -luser32 -lwinspool -limm32 -lwinmm -loleaut32 contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):!contains(QT_CONFIG, dynamicgl): LIBS *= -lopengl32 mingw: LIBS *= -luuid # For the dialog helpers: -!wince*:LIBS *= -lshlwapi -lshell32 -!wince*:LIBS *= -ladvapi32 -wince*:DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\"" +!wince: LIBS *= -lshlwapi -lshell32 +!wince: LIBS *= -ladvapi32 +wince: DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\"" DEFINES *= QT_NO_CAST_FROM_ASCII @@ -103,22 +103,22 @@ contains(QT_CONFIG,dynamicgl) { } } -!wince*:!contains( DEFINES, QT_NO_TABLETEVENT ) { +!wince:!contains( DEFINES, QT_NO_TABLETEVENT ) { INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/wintab HEADERS += $$PWD/qwindowstabletsupport.h SOURCES += $$PWD/qwindowstabletsupport.cpp } -!wince*:!contains( DEFINES, QT_NO_SESSIONMANAGER ) { +!wince:!contains( DEFINES, QT_NO_SESSIONMANAGER ) { SOURCES += $$PWD/qwindowssessionmanager.cpp HEADERS += $$PWD/qwindowssessionmanager.h } -!wince*:!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ) { +!wince:!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ) { RESOURCES += $$PWD/cursors.qrc } -!wince*: RESOURCES += $$PWD/openglblacklists.qrc +!wince: RESOURCES += $$PWD/openglblacklists.qrc contains(QT_CONFIG, freetype) { DEFINES *= QT_NO_FONTCONFIG diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 587063b100..af4f6fc8fe 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -5,4 +5,4 @@ SUBDIRS *= sqldrivers qtHaveModule(gui): SUBDIRS *= imageformats platforms platforminputcontexts platformthemes generic qtHaveModule(widgets): SUBDIRS *= styles -!winrt:!wince*:qtHaveModule(widgets):SUBDIRS += printsupport +!winrt:!wince:qtHaveModule(widgets): SUBDIRS += printsupport -- cgit v1.2.3 From e098b934888c9914685d939154ff3c0714002f79 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 7 May 2015 17:10:12 +0300 Subject: xcb: Fix getting the window types from the property of QWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wm_window_type_property_id is a dynamic property, so we should check that it is set by using QObject::dynamicPropertyNames() instead of QMetaObject::indexOfProperty(). Change-Id: Ic7f3408a0d028f349538e0538c40c4b58360f7df Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index d1b688857d..cb5f4103c1 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -873,7 +873,7 @@ void QXcbWindow::show() updateNetWmStateBeforeMap(); } - if (window()->metaObject()->indexOfProperty(wm_window_type_property_id) >= 0) { + if (window()->dynamicPropertyNames().contains(wm_window_type_property_id)) { QXcbWindowFunctions::WmWindowTypes wmWindowTypes(window()->property(wm_window_type_property_id).value()); setWmWindowType(wmWindowTypes); } -- cgit v1.2.3 From 5ca4cab7122646a5e58cf09be36f1647bd616e78 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 3 Jun 2015 16:34:32 +0300 Subject: xcb: Ignore emulated pointer events X server sends emulated XI_Motion events before each touch sequence. Filter them out to avoid a mess with mouse events synthesized in QGuiApplication. Change-Id: Ic919c86b41e2467a594de7c903cc0f3fc88a6804 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index b9f9a6843e..b862bab417 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -526,7 +526,7 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) case XI_ButtonPress: case XI_ButtonRelease: case XI_Motion: - if (xi2MouseEvents() && eventListener) + if (xi2MouseEvents() && eventListener && !(xiDeviceEvent->flags & XIPointerEmulated)) eventListener->handleXIMouseEvent(event); break; -- cgit v1.2.3 From 861cbef49f0fe439c6498eb77fce12d301c23892 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 7 Jun 2015 14:15:06 +0200 Subject: Remove useless truncation to the size the string already has Caused by the refactor in 05351b0cde3e80d2d0ae3a838e802ff6086e4b59. The count was probably wrong in the creation of the QKeyEvent, so this commit keeps it wrong. Change-Id: I049a653beeb5454c9539ffff13e573bba826e927 Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 2d96ed1c21..ea541e4556 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -1473,8 +1473,6 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, } QString string = lookupString(xkb_state, code); - int count = string.size(); - string.truncate(count); // Ιf control modifier is set we should prefer latin character, this is // used for standard shortcuts in checks like "key == QKeySequence::Copy", @@ -1506,7 +1504,7 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, bool filtered = false; if (inputContext) { - QKeyEvent event(type, qtcode, modifiers, code, sym, state, string, isAutoRepeat, count); + QKeyEvent event(type, qtcode, modifiers, code, sym, state, string, isAutoRepeat, string.length()); event.setTimestamp(time); filtered = inputContext->filterEvent(&event); } @@ -1535,7 +1533,7 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, } if (!filtered && inputContext) { - QKeyEvent event(QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat, count); + QKeyEvent event(QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat, string.length()); event.setTimestamp(time); filtered = inputContext->filterEvent(&event); } -- cgit v1.2.3 From 5ef662f1af2fb0c340b98edc083939b4383a04ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Mon, 8 Jun 2015 18:07:06 +0200 Subject: Android: Delay initialization of Accessibility. The accessibility class was created and activated in onCreate(), which meant we where trying to activate accessibility before the platform plugin was properly initialized. With this change we will also activate, or deactivate, accessibility in Qt whenever the state is changed by Android, compared to doing it at start-up only. Task-number: QTBUG-46355 Change-Id: I5cbae125df43f7694d4464d5054e6cfec4626e26 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/androidjniaccessibility.cpp | 10 ++++++++++ src/plugins/platforms/android/androidjniaccessibility.h | 1 + .../platforms/android/qandroidplatformaccessibility.cpp | 5 ++++- src/plugins/platforms/android/qandroidplatformintegration.cpp | 6 ++++-- 4 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp index f8c3e26229..69f8bdbad7 100644 --- a/src/plugins/platforms/android/androidjniaccessibility.cpp +++ b/src/plugins/platforms/android/androidjniaccessibility.cpp @@ -42,6 +42,7 @@ #include "QtGui/qaccessible.h" #include #include +#include #include "qdebug.h" @@ -65,6 +66,15 @@ namespace QtAndroidAccessibility static jmethodID m_setTextSelectionMethodID = 0; static jmethodID m_setVisibleToUserMethodID = 0; + void initialize() + { + // API level > 16 is required. + if (QtAndroidPrivate::androidSdkVersion() < 16) + return; + + QJNIObjectPrivate::callStaticMethod(QtAndroid::applicationClass(), + "initializeAccessibility"); + } static void setActive(JNIEnv */*env*/, jobject /*thiz*/, jboolean active) { diff --git a/src/plugins/platforms/android/androidjniaccessibility.h b/src/plugins/platforms/android/androidjniaccessibility.h index 9201353118..a4cbab7834 100644 --- a/src/plugins/platforms/android/androidjniaccessibility.h +++ b/src/plugins/platforms/android/androidjniaccessibility.h @@ -40,6 +40,7 @@ QT_BEGIN_NAMESPACE namespace QtAndroidAccessibility { + void initialize(); bool registerNatives(JNIEnv *env); } diff --git a/src/plugins/platforms/android/qandroidplatformaccessibility.cpp b/src/plugins/platforms/android/qandroidplatformaccessibility.cpp index e3a8b1a8f4..339023bd9f 100644 --- a/src/plugins/platforms/android/qandroidplatformaccessibility.cpp +++ b/src/plugins/platforms/android/qandroidplatformaccessibility.cpp @@ -33,11 +33,14 @@ #include "qandroidplatformaccessibility.h" +#include "androidjniaccessibility.h" QT_BEGIN_NAMESPACE QAndroidPlatformAccessibility::QAndroidPlatformAccessibility() -{} +{ + QtAndroidAccessibility::initialize(); +} QAndroidPlatformAccessibility::~QAndroidPlatformAccessibility() {} diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index eb96bf11f0..2a127f5c3c 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -148,6 +148,10 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶ m_androidSystemLocale = new QAndroidSystemLocale; +#ifndef QT_NO_ACCESSIBILITY + m_accessibility = new QAndroidPlatformAccessibility(); +#endif // QT_NO_ACCESSIBILITY + QJNIObjectPrivate javaActivity(QtAndroid::activity()); if (javaActivity.isValid()) { QJNIObjectPrivate resources = javaActivity.callObjectMethod("getResources", "()Landroid/content/res/Resources;"); @@ -348,8 +352,6 @@ void QAndroidPlatformIntegration::setScreenOrientation(Qt::ScreenOrientation cur #ifndef QT_NO_ACCESSIBILITY QPlatformAccessibility *QAndroidPlatformIntegration::accessibility() const { - if (!m_accessibility) - m_accessibility = new QAndroidPlatformAccessibility(); return m_accessibility; } #endif -- cgit v1.2.3 From b38615c7e4fbaea198503a8fde3224066a0ae616 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Fri, 5 Jun 2015 13:43:41 +0200 Subject: Don't manually delete QPlatformScreen Change-Id: Ic0cdb08c948a0fd9a4da2d76fe321e72e1c478d5 Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxintegration.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 1bcf8036bb..071bab7920 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -560,7 +560,9 @@ void QQnxIntegration::removeDisplay(QQnxScreen *screen) void QQnxIntegration::destroyDisplays() { qIntegrationDebug() << Q_FUNC_INFO; - qDeleteAll(m_screens); + Q_FOREACH (QQnxScreen *screen, m_screens) { + QPlatformIntegration::destroyScreen(screen); + } m_screens.clear(); } -- cgit v1.2.3 From 45edf00fa863cf0a6b311a9789793b08eaf2c054 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 4 Jun 2015 13:44:29 +0200 Subject: iOS: handle loading assets with different format than jpg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current implementation assumed that the image format of the file loaded would be jpg. This has proven not to be correct, e.g sometimes the format is png. This patch will change how the image url is reconstructed so we doesn't loose/hard code the format. Change-Id: I22d8ca0108e52d3670c2601f0bb9255406b896cf Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosfileengineassetslibrary.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm index 44a7901160..f0b6afce2d 100644 --- a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm +++ b/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm @@ -429,11 +429,11 @@ void QIOSFileEngineAssetsLibrary::setFileName(const QString &file) // QUrl::fromLocalFile() will remove double slashes. Since the asset url is // passed around as a file name in the app (and converted to/from a file url, e.g // in QFileDialog), we need to ensure that m_assetUrl ends up being valid. - int index = file.indexOf(QLatin1String("asset.JPG?")); + int index = file.indexOf(QLatin1String("/asset")); if (index == -1) m_assetUrl = QLatin1String("assets-library://"); else - m_assetUrl = QLatin1String("assets-library://asset/") + file.mid(index); + m_assetUrl = QLatin1String("assets-library:/") + file.mid(index); } QStringList QIOSFileEngineAssetsLibrary::entryList(QDir::Filters filters, const QStringList &filterNames) const -- cgit v1.2.3 From 827e195f17599446d27124ef74a131277fb143c7 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 11 Jun 2015 10:37:21 +0200 Subject: OSX: check if we have a native drag before accessing it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We used to check if [sender draggingSource] != nil to determine if the current drag was started by the application itself or somewhere else. While this is correct use of the API, the problem is that a drag can also be started by UIKit if e.g dragging the file icon in the titlebar. And in that case, Qt has no no native drag data. Since we didn't take this usecase into account, we tried to access the data anyway, which led to a crash. This patch will instead check if we have native drag data directly before trying to access it, which will also cover the usecase mentioned above. Task-number: QTBUG-46598 Change-Id: Ic91b86f658670b895d90a1533246ba24a00dde41 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index ff6cd14bc7..d44cdb392c 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1913,8 +1913,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin QGuiApplicationPrivate::modifier_buttons = [QNSView convertKeyModifiers: [[NSApp currentEvent] modifierFlags]]; QPlatformDragQtResponse response(false, Qt::IgnoreAction, QRect()); - if ([sender draggingSource] != nil) { - QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); + QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); + if (nativeDrag->currentDrag()) { + // The drag was started from within the application response = QWindowSystemInterface::handleDrag(target, nativeDrag->platformDropData(), mapWindowCoordinates(m_window, target, qt_windowPoint), qtAllowed); [self updateCursorFromDragResponse:response drag:nativeDrag]; } else { @@ -1950,8 +1951,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations([sender draggingSourceOperationMask]); QPlatformDropQtResponse response(false, Qt::IgnoreAction); - if ([sender draggingSource] != nil) { - QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); + QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); + if (nativeDrag->currentDrag()) { + // The drag was started from within the application response = QWindowSystemInterface::handleDrop(target, nativeDrag->platformDropData(), mapWindowCoordinates(m_window, target, qt_windowPoint), qtAllowed); } else { QCocoaDropData mimeData([sender draggingPasteboard]); -- cgit v1.2.3 From 1d9a6d0859a7daca0385cbdfdf4c6b7caf32e6d8 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 5 May 2015 23:04:26 +0300 Subject: xcb: Set _NET_WM_WINDOW_TYPE from a single place MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge QXcbWindow::setNetWmWindowFlags(), which was called from QXcbWindow::setWindowFlags(), into QXcbWindow::setWmWindowType(). Now setWindowFlags() can't override window type set by QXcbWindowFunctions::setWmWindowType(). Also reorder _NET_WM_WINDOW_TYPE atoms in QXcbWindow::setWmWindowType() as it was in Qt 4. Change-Id: Id1752d78f91caf04e9d16bb1ac40ed180597df7b Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbwindow.cpp | 117 ++++++++++++++++--------------- src/plugins/platforms/xcb/qxcbwindow.h | 3 +- 2 files changed, 63 insertions(+), 57 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index cb5f4103c1..6e021ced23 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -873,11 +873,6 @@ void QXcbWindow::show() updateNetWmStateBeforeMap(); } - if (window()->dynamicPropertyNames().contains(wm_window_type_property_id)) { - QXcbWindowFunctions::WmWindowTypes wmWindowTypes(window()->property(wm_window_type_property_id).value()); - setWmWindowType(wmWindowTypes); - } - if (connection()->time() != XCB_TIME_CURRENT_TIME) updateNetWmUserTime(connection()->time()); @@ -1140,7 +1135,13 @@ void QXcbWindow::setWindowFlags(Qt::WindowFlags flags) xcb_change_window_attributes(xcb_connection(), xcb_window(), mask, values); - setNetWmWindowFlags(flags); + QXcbWindowFunctions::WmWindowTypes wmWindowTypes = 0; + if (window()->dynamicPropertyNames().contains(wm_window_type_property_id)) { + wmWindowTypes = static_cast( + window()->property(wm_window_type_property_id).value()); + } + + setWmWindowType(wmWindowTypes, flags); setMotifWindowFlags(flags); setTransparentForMouseEvents(flags & Qt::WindowTransparentForInput); @@ -1291,42 +1292,6 @@ void QXcbWindow::setWindowState(Qt::WindowState state) m_windowState = state; } -void QXcbWindow::setNetWmWindowFlags(Qt::WindowFlags flags) -{ - // in order of decreasing priority - QVector windowTypes; - - Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); - - switch (type) { - case Qt::Dialog: - case Qt::Sheet: - windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_DIALOG)); - break; - case Qt::Tool: - case Qt::Drawer: - windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_UTILITY)); - break; - case Qt::ToolTip: - windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_TOOLTIP)); - break; - case Qt::SplashScreen: - windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_SPLASH)); - break; - default: - break; - } - - if (flags & Qt::FramelessWindowHint) - windowTypes.append(atom(QXcbAtom::_KDE_NET_WM_WINDOW_TYPE_OVERRIDE)); - - windowTypes.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_NORMAL)); - - Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, - atom(QXcbAtom::_NET_WM_WINDOW_TYPE), XCB_ATOM_ATOM, 32, - windowTypes.count(), windowTypes.constData())); -} - void QXcbWindow::updateMotifWmHintsBeforeMap() { QtMotifWmHints mwmhints = getMotifWmHints(connection(), m_window); @@ -1703,10 +1668,10 @@ QSurfaceFormat QXcbWindow::format() const void QXcbWindow::setWmWindowTypeStatic(QWindow *window, QXcbWindowFunctions::WmWindowTypes windowTypes) { + window->setProperty(wm_window_type_property_id, QVariant::fromValue(static_cast(windowTypes))); + if (window->handle()) - static_cast(window->handle())->setWmWindowType(windowTypes); - else - window->setProperty(wm_window_type_property_id, QVariant::fromValue(static_cast(windowTypes))); + static_cast(window->handle())->setWmWindowType(windowTypes, window->flags()); } uint QXcbWindow::visualIdStatic(QWindow *window) @@ -1787,40 +1752,82 @@ QXcbWindowFunctions::WmWindowTypes QXcbWindow::wmWindowTypes() const return result; } -void QXcbWindow::setWmWindowType(QXcbWindowFunctions::WmWindowTypes types) +void QXcbWindow::setWmWindowType(QXcbWindowFunctions::WmWindowTypes types, Qt::WindowFlags flags) { QVector atoms; + // manual selection 1 (these are never set by Qt and take precedence) if (types & QXcbWindowFunctions::Normal) atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_NORMAL)); if (types & QXcbWindowFunctions::Desktop) atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_DESKTOP)); if (types & QXcbWindowFunctions::Dock) atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_DOCK)); - if (types & QXcbWindowFunctions::Toolbar) - atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_TOOLBAR)); - if (types & QXcbWindowFunctions::Menu) - atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_MENU)); + if (types & QXcbWindowFunctions::Notification) + atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_NOTIFICATION)); + + // manual selection 2 (Qt uses these during auto selection); if (types & QXcbWindowFunctions::Utility) atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_UTILITY)); if (types & QXcbWindowFunctions::Splash) atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_SPLASH)); if (types & QXcbWindowFunctions::Dialog) atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_DIALOG)); + if (types & QXcbWindowFunctions::Tooltip) + atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_TOOLTIP)); + if (types & QXcbWindowFunctions::KdeOverride) + atoms.append(atom(QXcbAtom::_KDE_NET_WM_WINDOW_TYPE_OVERRIDE)); + + // manual selection 3 (these can be set by Qt, but don't have a + // corresponding Qt::WindowType). note that order of the *MENU + // atoms is important + if (types & QXcbWindowFunctions::Menu) + atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_MENU)); if (types & QXcbWindowFunctions::DropDownMenu) atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_DROPDOWN_MENU)); if (types & QXcbWindowFunctions::PopupMenu) atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_POPUP_MENU)); - if (types & QXcbWindowFunctions::Tooltip) - atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_TOOLTIP)); - if (types & QXcbWindowFunctions::Notification) - atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_NOTIFICATION)); + if (types & QXcbWindowFunctions::Toolbar) + atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_TOOLBAR)); if (types & QXcbWindowFunctions::Combo) atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_COMBO)); if (types & QXcbWindowFunctions::Dnd) atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_DND)); - if (types & QXcbWindowFunctions::KdeOverride) + + // automatic selection + Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); + switch (type) { + case Qt::Dialog: + case Qt::Sheet: + if (!(types & QXcbWindowFunctions::Dialog)) + atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_DIALOG)); + break; + case Qt::Tool: + case Qt::Drawer: + if (!(types & QXcbWindowFunctions::Utility)) + atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_UTILITY)); + break; + case Qt::ToolTip: + if (!(types & QXcbWindowFunctions::Tooltip)) + atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_TOOLTIP)); + break; + case Qt::SplashScreen: + if (!(types & QXcbWindowFunctions::Splash)) + atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_SPLASH)); + break; + default: + break; + } + + if ((flags & Qt::FramelessWindowHint) && !(type & QXcbWindowFunctions::KdeOverride)) { + // override netwm type - quick and easy for KDE noborder atoms.append(atom(QXcbAtom::_KDE_NET_WM_WINDOW_TYPE_OVERRIDE)); + } + + if (atoms.size() == 1 && atoms.first() == atom(QXcbAtom::_NET_WM_WINDOW_TYPE_NORMAL)) + atoms.clear(); + else + atoms.append(atom(QXcbAtom::_NET_WM_WINDOW_TYPE_NORMAL)); if (atoms.isEmpty()) { Q_XCB_CALL(xcb_delete_property(xcb_connection(), m_window, atom(QXcbAtom::_NET_WM_WINDOW_TYPE))); diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index e62bfcba64..a379a6f9db 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -143,7 +143,7 @@ public: static uint visualIdStatic(QWindow *window); QXcbWindowFunctions::WmWindowTypes wmWindowTypes() const; - void setWmWindowType(QXcbWindowFunctions::WmWindowTypes types); + void setWmWindowType(QXcbWindowFunctions::WmWindowTypes types, Qt::WindowFlags flags); uint visualId() const; @@ -179,7 +179,6 @@ protected: NetWmStates netWmStates(); void setNetWmStates(NetWmStates); - void setNetWmWindowFlags(Qt::WindowFlags flags); void setMotifWindowFlags(Qt::WindowFlags flags); void updateMotifWmHintsBeforeMap(); -- cgit v1.2.3 From fb8b3e1bee867c86bbb848d2c3947e78f9d0e07e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 15 Jun 2015 10:52:14 +0200 Subject: Fix GLX backend in static builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not attempt to resolve dynamically in static builds. This is not wrong, but if the GL library is statically linked just like the rest of Qt, it won't work. Therefore just call the function directly in static builds, it should be no problem on modern systems. Task-number: QTBUG-46499 Change-Id: I35fd7c3b5b180d753becbb57377b27dd1a8747ad Reviewed-by: Andy Shaw Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index 5166372364..8b14fc7d70 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -540,6 +540,9 @@ void QGLXContext::swapBuffers(QPlatformSurface *surface) void (*QGLXContext::getProcAddress(const QByteArray &procName)) () { +#ifdef QT_STATIC + return glXGetProcAddressARB(reinterpret_cast(procName.constData())); +#else typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; static bool resolved = false; @@ -569,6 +572,7 @@ void (*QGLXContext::getProcAddress(const QByteArray &procName)) () if (!glXGetProcAddressARB) return 0; return (void (*)())glXGetProcAddressARB(reinterpret_cast(procName.constData())); +#endif } QSurfaceFormat QGLXContext::format() const -- cgit v1.2.3 From cef33870e4310ad4d86f33a1a3d967ace9f31433 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 15 Jun 2015 10:54:56 +0200 Subject: Workaround for Google Keyboard strangeness When deleting selected text, Google Keyboard will call deleteSurroundingText() with a negative beforeLength. This does not make any sense, and not all our controls are able to handle the resulting input method events. This patch interprets a negative beforeLength as a positive afterLength. This works with the cases I have seen so far, but since the keyboard is not following the specification, there may be more weirdness later. Task-number: QTBUG-46637 Change-Id: I410832417f6fb21139c338355e8fcfa57b9e544c Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidinputcontext.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 5c8406ca03..5a007b58c5 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -650,6 +650,11 @@ jboolean QAndroidInputContext::deleteSurroundingText(jint leftLength, jint right m_composingText.clear(); m_composingTextStart = -1; + if (leftLength < 0) { + rightLength += -leftLength; + leftLength = 0; + } + QInputMethodEvent event; event.setCommitString(QString(), -leftLength, leftLength+rightLength); sendInputMethodEventThreadSafe(&event); -- cgit v1.2.3 From 0bd936e7f3f3bf54612748f0ade2b43de3ccdb0f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 15 Jun 2015 12:07:48 +0200 Subject: Compile fix for QT_DEBUG_ANDROID_IM_PROTOCOL Change-Id: I45d1c1541f8c758995c988f52c5fa8bd4fa99177 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidinputcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 5a007b58c5..d264f74d66 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -917,7 +917,7 @@ jboolean QAndroidInputContext::setComposingRegion(jint start, jint end) m_blockUpdateSelection = updateSelectionWasBlocked; #ifdef QT_DEBUG_ANDROID_IM_PROTOCOL - QSharedPointer query2 = focusObjectInputMethodQuery(); + QSharedPointer query2 = focusObjectInputMethodQueryThreadSafe(); if (!query2.isNull()) { qDebug() << "Setting. Prev local cpos:" << localPos << "block pos:" < Date: Tue, 16 Jun 2015 15:09:09 +0200 Subject: OSX: show file dialog in showCocoaFilePanel, don't wait for exec() This reverts commit 21e6c7ae4745a76b676dfaa9fe17a2dd40fc0c5c because in QtQuick.Controls, we do not call exec(): we just set the dialog visible. If it is a sheet, then it is already acting as a modal dialog, basically. Task-number: QTBUG-46691 Change-Id: I7fe89f2a2ade0d4ddcf540c9bfc4f5963a077471 Reviewed-by: Timur Pocheptsov --- .../platforms/cocoa/qcocoafiledialoghelper.h | 1 - .../platforms/cocoa/qcocoafiledialoghelper.mm | 28 ++++++---------------- 2 files changed, 7 insertions(+), 22 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h index 36943a563e..48d7efe174 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h @@ -51,7 +51,6 @@ public: virtual ~QCocoaFileDialogHelper(); void exec(); - void execModalForWindow(QWindow *parent); bool defaultNameFilterDisables() const; diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 19f81c72a1..4ece1b5a22 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -254,22 +254,17 @@ static QString strippedText(QString s) || [self panel:nil shouldShowFilename:filepath]; [self updateProperties]; + QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder(); [mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]]; [mSavePanel setNameFieldStringValue:selectable ? QCFString::toNSString(info.fileName()) : @""]; NSWindow *nsparent = static_cast(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent)); - qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); - QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder(); - [mSavePanel beginSheetModalForWindow:nsparent completionHandler:^(NSInteger result){ - [[NSApplication sharedApplication] stopModalWithCode:result]; + mReturnCode = result; + if (mHelper) + mHelper->QNSOpenSavePanelDelegate_panelClosed(result == NSOKButton); }]; - - mReturnCode = [[NSApplication sharedApplication] runModalForWindow:nsparent]; - QAbstractEventDispatcher::instance()->interrupt(); - if (mHelper) - mHelper->QNSOpenSavePanelDelegate_panelClosed(mReturnCode == NSOKButton); } - (BOOL)isHiddenFile:(NSString *)filename isDir:(BOOL)isDir @@ -711,15 +706,14 @@ void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate() bool QCocoaFileDialogHelper::showCocoaFilePanel(Qt::WindowModality windowModality, QWindow *parent) { - Q_UNUSED(parent) - createNSOpenSavePanelDelegate(); if (!mDelegate) return false; if (windowModality == Qt::NonModal) [mDelegate showModelessPanel]; - // no need to show a Qt::ApplicationModal dialog here, since it will be done in exec; - // Qt::WindowModal will be done in execModalForWindow. + else if (windowModality == Qt::WindowModal && parent) + [mDelegate showWindowModalSheet:parent]; + // no need to show a Qt::ApplicationModal dialog here, since it will be done in _q_platformRunNativeAppModalPanel() return true; } @@ -751,14 +745,6 @@ void QCocoaFileDialogHelper::exec() } -void QCocoaFileDialogHelper::execModalForWindow(QWindow *parent) -{ - if (!parent) - return exec(); - - [mDelegate showWindowModalSheet:parent]; -} - bool QCocoaFileDialogHelper::defaultNameFilterDisables() const { return true; -- cgit v1.2.3 From 36df3305f9fc7847710dd8ab0e4ea5c4e3252bce Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 2 Jun 2015 11:53:14 +0300 Subject: xcb: Map touch points to screen coordinates Add QPointF overloads for QXcbScreen::mapToNative() and QXcbScreen::mapFromNative(). Use mapFromNative() to map the coordinates of a touch point to screen coordinates as we do it for mouse events. It fixes touch events when QT_DEVICE_PIXEL_RATIO is set. Change-Id: Id8362cda526e0f837b76899eba21d9bfc895988c Task-number: QTBUG-44840 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 8 +++++--- src/plugins/platforms/xcb/qxcbscreen.cpp | 12 ++++++++++++ src/plugins/platforms/xcb/qxcbscreen.h | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index b862bab417..2f46436ce2 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -562,10 +562,12 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo dev->touchPoints[tp.id] = tp; } QWindowSystemInterface::TouchPoint &touchPoint = dev->touchPoints[xiDeviceEvent->detail]; - qreal x = fixed1616ToReal(xiDeviceEvent->root_x); - qreal y = fixed1616ToReal(xiDeviceEvent->root_y); + QXcbScreen* screen = platformWindow->xcbScreen(); + QPointF pos = screen->mapFromNative(QPointF(fixed1616ToReal(xiDeviceEvent->root_x), + fixed1616ToReal(xiDeviceEvent->root_y))); + qreal x = pos.x(); + qreal y = pos.y(); qreal nx = -1.0, ny = -1.0, d = 0.0; - QXcbScreen* screen = m_screens.at(0); for (int i = 0; i < dev->xiDeviceInfo->num_classes; ++i) { XIAnyClassInfo *classinfo = dev->xiDeviceInfo->classes[i]; if (classinfo->type == XIValuatorClass) { diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index c14ec0bb3f..993566b11c 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -282,6 +282,18 @@ QPoint QXcbScreen::mapFromNative(const QPoint &pos) const return (pos - m_nativeGeometry.topLeft()) / dpr + m_geometry.topLeft(); } +QPointF QXcbScreen::mapToNative(const QPointF &pos) const +{ + const int dpr = int(devicePixelRatio()); + return (pos - m_geometry.topLeft()) * dpr + m_nativeGeometry.topLeft(); +} + +QPointF QXcbScreen::mapFromNative(const QPointF &pos) const +{ + const int dpr = int(devicePixelRatio()); + return (pos - m_nativeGeometry.topLeft()) / dpr + m_geometry.topLeft(); +} + QRect QXcbScreen::mapToNative(const QRect &rect) const { const int dpr = int(devicePixelRatio()); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index ec05e3bb25..44519470e9 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -143,6 +143,8 @@ public: QPoint mapToNative(const QPoint &pos) const; QPoint mapFromNative(const QPoint &pos) const; + QPointF mapToNative(const QPointF &pos) const; + QPointF mapFromNative(const QPointF &pos) const; QRect mapToNative(const QRect &rect) const; QRect mapFromNative(const QRect &rect) const; -- cgit v1.2.3 From 54675bdf7d0332d0643f5a95ae63d60b972770ce Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Thu, 18 Jun 2015 16:57:42 -0700 Subject: QCocoaMenu: Fix crash with 10.7 QFileDialog shortcuts Set target and action in menuHasKeyEquivalent in order to match the specification, and to avoid QFileDialog crashes on OSX 10.7. Task-number: QTBUG-17291 Change-Id: Ie8f88cbda31a42c3e1acd8d4ad36d54a295eac65 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoamenu.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index dd2c37d914..6668080725 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -163,6 +163,8 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate); // Whatever the current first responder is, let's give it a chance // and do not touch the Qt's focusObject (which is different from some native view // having a focus inside NSSave/OpenPanel. + *target = nil; + *action = menuItem.action; return YES; } -- cgit v1.2.3 From 52c35c1ce798e6ec3aef86d5081d211cabe5daaf Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 19 Jun 2015 10:34:24 +0200 Subject: xcb: make it possible to disable gl integrations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By setting QT_XCB_GL_INTEGRATION to the special value "none", no plugins will be considered for loading. This matches what eglfs does with QT_QPA_EGLFS_INTEGRATION. This allows widget or raster-QWindow-only apps to start up faster by not spending time on plugin loading and potential initialization steps there. Task-number: QTBUG-46765 Change-Id: Ifeec3548a9b58f619a18e0be75fe4a9f489677a9 Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbconnection.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 80c844e658..b8b665157b 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -532,9 +532,14 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra QStringList glIntegrationNames; glIntegrationNames << QStringLiteral("xcb_glx") << QStringLiteral("xcb_egl"); QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION")); - if (glIntegrationName.size()) { - glIntegrationNames.removeAll(glIntegrationName); - glIntegrationNames.prepend(glIntegrationName); + if (!glIntegrationName.isEmpty()) { + qCDebug(QT_XCB_GLINTEGRATION) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName; + if (glIntegrationName != QStringLiteral("none")) { + glIntegrationNames.removeAll(glIntegrationName); + glIntegrationNames.prepend(glIntegrationName); + } else { + glIntegrationNames.clear(); + } } qCDebug(QT_XCB_GLINTEGRATION) << "Choosing xcb gl-integration based on following priority\n" << glIntegrationNames; -- cgit v1.2.3 From 993889401b889b544171f4fa968d8aabb71241b7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 15 Jun 2015 11:34:34 +0200 Subject: Revert "Windows: Use DND effect chosen in DragEnter/Move for Drop." The change causes items in QListWidget and QTreeWidget to disappear during InternalMove since the widgets modify the actions of the event to remember an internal state. This reverts commit 988f1b2e5745646cf1bd7f9f65507356ff2ba12e. Task-number: QTBUG-46642 Task-number: QTBUG-43466 Change-Id: I27d888d7a1fdfcf8eaf8806ccd4ca33b292b9d8c Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsdrag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp index e10add9c7c..03438e3ee2 100644 --- a/src/plugins/platforms/windows/qwindowsdrag.cpp +++ b/src/plugins/platforms/windows/qwindowsdrag.cpp @@ -626,7 +626,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState, const QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_window, windowsDrag->dropData(), m_lastPoint / QWindowsScaling::factor(), - translateToQDragDropActions(m_chosenEffect)); + translateToQDragDropActions(*pdwEffect)); if (response.isAccepted()) { const Qt::DropAction action = response.acceptedAction(); -- cgit v1.2.3 From bac1116d4997fa0c7c58538b39528ecc354d88d1 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 19 Jun 2015 14:26:56 +0200 Subject: Only require polling when running on Windows XP Since the restriction for what gets notified for Wireless network configurations is only on Windows XP then we only want to do polling on Windows XP. This gives a performance boost as it does not query every 10 seconds for no reason. Task-number: QTBUG-40332 Change-Id: I73e3903834abe9ffc5adc678de20f7428a578d89 Reviewed-by: Richard J. Moore --- src/plugins/bearer/nativewifi/qnativewifiengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 19852b70a8..7baea55ee7 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -606,7 +606,7 @@ bool QNativeWifiEngine::requiresPolling() const { // On Windows XP SP2 and SP3 only connection and disconnection notifications are available. // We need to poll for changes in available wireless networks. - return true; + return QSysInfo::WindowsVersion <= QSysInfo::WV_2003; } QT_END_NAMESPACE -- cgit v1.2.3 From 32ce3b0eaf8568d62e6f197408a80f023f005f1d Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 1 Nov 2014 14:37:52 +0100 Subject: cocoa: QNSView - guard implementation against deleted window when embedding a QWindow into a native cocoa gui there are cases that the QWindow is destroyed while the QNSView is still available. this patch makes sure that the m_window pointer is cleared when the QWindow is destroyed and adds checks to the implementation to avoid that m_window is called when it has already been destroyed. Change-Id: I7e0614969dedb87b54df74d542a8c1fb15d8acf0 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qnsview.h | 2 +- src/plugins/platforms/cocoa/qnsview.mm | 40 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 32bc15d092..05ab8ae2c7 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -57,7 +57,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); CGImageRef m_maskImage; uchar *m_maskData; bool m_shouldInvalidateWindowShadow; - QWindow *m_window; + QPointer m_window; QCocoaWindow *m_platformWindow; NSTrackingArea *m_trackingArea; Qt::MouseButtons m_buttons; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index ff6cd14bc7..d2a135d013 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -608,7 +608,7 @@ QT_WARNING_POP - (BOOL)becomeFirstResponder { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return NO; if (!m_platformWindow->windowIsPopupType()) QWindowSystemInterface::handleWindowActivated([self topLevelWindow]); @@ -619,7 +619,7 @@ QT_WARNING_POP { if (m_platformWindow->shouldRefuseKeyWindowAndFirstResponder()) return NO; - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return NO; if ((m_window->flags() & Qt::ToolTip) == Qt::ToolTip) return NO; @@ -629,7 +629,7 @@ QT_WARNING_POP - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent { Q_UNUSED(theEvent) - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return NO; return YES; } @@ -768,7 +768,7 @@ QT_WARNING_POP - (void)mouseDown:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super mouseDown:theEvent]; m_sendUpAsRightButton = false; @@ -819,7 +819,7 @@ QT_WARNING_POP - (void)mouseDragged:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super mouseDragged:theEvent]; if (!(m_buttons & (m_sendUpAsRightButton ? Qt::RightButton : Qt::LeftButton))) qWarning("QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton)"); @@ -828,7 +828,7 @@ QT_WARNING_POP - (void)mouseUp:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super mouseUp:theEvent]; if (m_sendUpAsRightButton) { m_buttons &= ~Qt::RightButton; @@ -884,7 +884,7 @@ QT_WARNING_POP - (void)mouseMovedImpl:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return; QPointF windowPoint; @@ -917,7 +917,7 @@ QT_WARNING_POP Q_UNUSED(theEvent) m_platformWindow->m_windowUnderMouse = true; - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return; // Top-level windows generate enter events for sub-windows. @@ -936,7 +936,7 @@ QT_WARNING_POP Q_UNUSED(theEvent); m_platformWindow->m_windowUnderMouse = false; - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return; // Top-level windows generate leave events for sub-windows. @@ -949,7 +949,7 @@ QT_WARNING_POP - (void)rightMouseDown:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super rightMouseDown:theEvent]; m_buttons |= Qt::RightButton; m_sendUpAsRightButton = true; @@ -958,7 +958,7 @@ QT_WARNING_POP - (void)rightMouseDragged:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super rightMouseDragged:theEvent]; if (!(m_buttons & Qt::RightButton)) qWarning("QNSView rightMouseDragged: Internal mouse button tracking invalid (missing Qt::RightButton)"); @@ -967,7 +967,7 @@ QT_WARNING_POP - (void)rightMouseUp:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super rightMouseUp:theEvent]; m_buttons &= ~Qt::RightButton; m_sendUpAsRightButton = false; @@ -976,7 +976,7 @@ QT_WARNING_POP - (void)otherMouseDown:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super otherMouseDown:theEvent]; m_buttons |= cocoaButton2QtButton([theEvent buttonNumber]); [self handleMouseEvent:theEvent]; @@ -984,7 +984,7 @@ QT_WARNING_POP - (void)otherMouseDragged:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super otherMouseDragged:theEvent]; if (!(m_buttons & ~(Qt::LeftButton | Qt::RightButton))) qWarning("QNSView otherMouseDragged: Internal mouse button tracking invalid (missing Qt::MiddleButton or Qt::ExtraButton*)"); @@ -993,7 +993,7 @@ QT_WARNING_POP - (void)otherMouseUp:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super otherMouseUp:theEvent]; m_buttons &= ~cocoaButton2QtButton([theEvent buttonNumber]); [self handleMouseEvent:theEvent]; @@ -1072,7 +1072,7 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash) - (void)tabletPoint: (NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super tabletPoint:theEvent]; [self handleTabletEvent: theEvent]; @@ -1120,7 +1120,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)tabletProximity: (NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super tabletProximity:theEvent]; ulong timestamp = [theEvent timestamp] * 1000; @@ -1292,7 +1292,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) #ifndef QT_NO_WHEELEVENT - (void)scrollWheel:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super scrollWheel:theEvent]; QPoint angleDelta; @@ -1465,14 +1465,14 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)keyDown:(NSEvent *)nsevent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super keyDown:nsevent]; [self handleKeyEvent:nsevent eventType:int(QEvent::KeyPress)]; } - (void)keyUp:(NSEvent *)nsevent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super keyUp:nsevent]; [self handleKeyEvent:nsevent eventType:int(QEvent::KeyRelease)]; } -- cgit v1.2.3 From 02ea0235216beef390e9868ff770c7a54d70db83 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 11 Jun 2015 13:47:09 +0200 Subject: Add missing Q_DECL_OVERRIDE in Cocoa specific header files Change-Id: I91831390e9e0d97ab28f0e34ca0573fb2c84e954 Reviewed-by: Timur Pocheptsov Reviewed-by: Thiago Macieira --- src/plugins/platforms/cocoa/qcocoacursor.mm | 2 +- .../platforms/cocoa/qcocoafiledialoghelper.h | 16 +++---- src/plugins/platforms/cocoa/qcocoaintegration.h | 26 +++++------ .../platforms/cocoa/qcocoanativeinterface.h | 4 +- src/plugins/platforms/cocoa/qcocoatheme.h | 22 ++++----- src/plugins/platforms/cocoa/qcocoawindow.h | 52 +++++++++++----------- 6 files changed, 61 insertions(+), 61 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index 06e957cd86..922809f90d 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -73,7 +73,7 @@ void QCocoaCursor::setPos(const QPoint &position) pos.x = position.x(); pos.y = position.y(); - CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0); + CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, kCGMouseButtonLeft); CGEventPost(kCGHIDEventTap, e); CFRelease(e); } diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h index 36943a563e..573e137489 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h @@ -50,20 +50,20 @@ public: QCocoaFileDialogHelper(); virtual ~QCocoaFileDialogHelper(); - void exec(); - void execModalForWindow(QWindow *parent); + void exec() Q_DECL_OVERRIDE; + void execModalForWindow(QWindow *parent) Q_DECL_OVERRIDE; - bool defaultNameFilterDisables() const; + bool defaultNameFilterDisables() const Q_DECL_OVERRIDE; - bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent); - void hide(); + bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) Q_DECL_OVERRIDE; + void hide() Q_DECL_OVERRIDE; void setDirectory(const QUrl &directory) Q_DECL_OVERRIDE; QUrl directory() const Q_DECL_OVERRIDE; void selectFile(const QUrl &filename) Q_DECL_OVERRIDE; QList selectedFiles() const Q_DECL_OVERRIDE; - void setFilter(); - void selectNameFilter(const QString &filter); - QString selectedNameFilter() const; + void setFilter() Q_DECL_OVERRIDE; + void selectNameFilter(const QString &filter) Q_DECL_OVERRIDE; + QString selectedNameFilter() const Q_DECL_OVERRIDE; public: bool showCocoaFilePanel(Qt::WindowModality windowModality, QWindow *parent); diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index ee42a83446..8b5d78826c 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -61,19 +61,19 @@ public: // ---------------------------------------------------- // Virtual methods overridden from QPlatformScreen - QPixmap grabWindow(WId window, int x, int y, int width, int height) const; - QRect geometry() const { return m_geometry; } - QRect availableGeometry() const { return m_availableGeometry; } - int depth() const { return m_depth; } - QImage::Format format() const { return m_format; } - qreal devicePixelRatio() const; - QSizeF physicalSize() const { return m_physicalSize; } - QDpi logicalDpi() const { return m_logicalDpi; } - qreal refreshRate() const { return m_refreshRate; } - QString name() const { return m_name; } - QPlatformCursor *cursor() const { return m_cursor; } - QWindow *topLevelAt(const QPoint &point) const; - QList virtualSiblings() const { return m_siblings; } + QPixmap grabWindow(WId window, int x, int y, int width, int height) const Q_DECL_OVERRIDE; + QRect geometry() const Q_DECL_OVERRIDE { return m_geometry; } + QRect availableGeometry() const Q_DECL_OVERRIDE { return m_availableGeometry; } + int depth() const Q_DECL_OVERRIDE { return m_depth; } + QImage::Format format() const Q_DECL_OVERRIDE { return m_format; } + qreal devicePixelRatio() const Q_DECL_OVERRIDE; + QSizeF physicalSize() const Q_DECL_OVERRIDE { return m_physicalSize; } + QDpi logicalDpi() const Q_DECL_OVERRIDE { return m_logicalDpi; } + qreal refreshRate() const Q_DECL_OVERRIDE { return m_refreshRate; } + QString name() const Q_DECL_OVERRIDE { return m_name; } + QPlatformCursor *cursor() const Q_DECL_OVERRIDE { return m_cursor; } + QWindow *topLevelAt(const QPoint &point) const Q_DECL_OVERRIDE; + QList virtualSiblings() const Q_DECL_OVERRIDE { return m_siblings; } // ---------------------------------------------------- // Additional methods diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h index 0b95fea7ae..2250f7c084 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h @@ -54,9 +54,9 @@ public: QCocoaNativeInterface(); #ifndef QT_NO_OPENGL - void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context); + void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) Q_DECL_OVERRIDE; #endif - void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); + void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) Q_DECL_OVERRIDE; NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/cocoa/qcocoatheme.h b/src/plugins/platforms/cocoa/qcocoatheme.h index 203f05c8bb..0cd7b7d4c8 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.h +++ b/src/plugins/platforms/cocoa/qcocoatheme.h @@ -46,25 +46,25 @@ public: QCocoaTheme(); ~QCocoaTheme(); - virtual QPlatformMenuItem* createPlatformMenuItem() const; - virtual QPlatformMenu* createPlatformMenu() const; - virtual QPlatformMenuBar* createPlatformMenuBar() const; + QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE; + QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE; + QPlatformMenuBar* createPlatformMenuBar() const Q_DECL_OVERRIDE; #ifndef QT_NO_SYSTEMTRAYICON - QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const; + QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE; #endif - bool usePlatformNativeDialog(DialogType dialogType) const; - QPlatformDialogHelper *createPlatformDialogHelper(DialogType dialogType) const; + bool usePlatformNativeDialog(DialogType dialogType) const Q_DECL_OVERRIDE; + QPlatformDialogHelper *createPlatformDialogHelper(DialogType dialogType) const Q_DECL_OVERRIDE; - const QPalette *palette(Palette type = SystemPalette) const; - const QFont *font(Font type = SystemFont) const; - QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const; + const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE; + const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE; + QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const Q_DECL_OVERRIDE; QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size, - QPlatformTheme::IconOptions options = 0) const; + QPlatformTheme::IconOptions options = 0) const Q_DECL_OVERRIDE; - QVariant themeHint(ThemeHint hint) const; + QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE; QString standardButtonText(int button) const Q_DECL_OVERRIDE; static const char *name; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 4064f31cd7..455d4a8580 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -142,37 +142,37 @@ public: QCocoaWindow(QWindow *tlw); ~QCocoaWindow(); - void setGeometry(const QRect &rect); - QRect geometry() const; + void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; + QRect geometry() const Q_DECL_OVERRIDE; void setCocoaGeometry(const QRect &rect); void clipChildWindows(); void clipWindow(const NSRect &clipRect); void show(bool becauseOfAncestor = false); void hide(bool becauseOfAncestor = false); - void setVisible(bool visible); - void setWindowFlags(Qt::WindowFlags flags); - void setWindowState(Qt::WindowState state); - void setWindowTitle(const QString &title); - void setWindowFilePath(const QString &filePath); - void setWindowIcon(const QIcon &icon); - void setAlertState(bool enabled); - bool isAlertState() const; - void raise(); - void lower(); - bool isExposed() const; + void setVisible(bool visible) Q_DECL_OVERRIDE; + void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; + void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE; + void setWindowTitle(const QString &title) Q_DECL_OVERRIDE; + void setWindowFilePath(const QString &filePath) Q_DECL_OVERRIDE; + void setWindowIcon(const QIcon &icon) Q_DECL_OVERRIDE; + void setAlertState(bool enabled) Q_DECL_OVERRIDE; + bool isAlertState() const Q_DECL_OVERRIDE; + void raise() Q_DECL_OVERRIDE; + void lower() Q_DECL_OVERRIDE; + bool isExposed() const Q_DECL_OVERRIDE; bool isOpaque() const; - void propagateSizeHints(); - void setOpacity(qreal level); - void setMask(const QRegion ®ion); - bool setKeyboardGrabEnabled(bool grab); - bool setMouseGrabEnabled(bool grab); - QMargins frameMargins() const; - QSurfaceFormat format() const; + void propagateSizeHints() Q_DECL_OVERRIDE; + void setOpacity(qreal level) Q_DECL_OVERRIDE; + void setMask(const QRegion ®ion) Q_DECL_OVERRIDE; + bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE; + bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE; + QMargins frameMargins() const Q_DECL_OVERRIDE; + QSurfaceFormat format() const Q_DECL_OVERRIDE; - void requestActivateWindow(); + void requestActivateWindow() Q_DECL_OVERRIDE; - WId winId() const; - void setParent(const QPlatformWindow *window); + WId winId() const Q_DECL_OVERRIDE; + void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE; NSView *contentView() const; void setContentView(NSView *contentView); @@ -202,8 +202,8 @@ public: bool setWindowModified(bool modified) Q_DECL_OVERRIDE; - void setFrameStrutEventsEnabled(bool enabled); - bool frameStrutEventsEnabled() const + void setFrameStrutEventsEnabled(bool enabled) Q_DECL_OVERRIDE; + bool frameStrutEventsEnabled() const Q_DECL_OVERRIDE { return m_frameStrutEventsEnabled; } void setMenubar(QCocoaMenuBar *mb); @@ -220,7 +220,7 @@ public: void applyContentBorderThickness(NSWindow *window); void updateNSToolbar(); - qreal devicePixelRatio() const; + qreal devicePixelRatio() const Q_DECL_OVERRIDE; bool isWindowExposable(); void exposeWindow(); void obscureWindow(); -- cgit v1.2.3 From e2d3436e4dfdf461a0864aca722ef9cc97d3564b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 18 Jun 2015 14:23:37 +0200 Subject: Windows / Wifi plugin: Refactor code resolving symbols from wlanapi.dll. Instantiate QLibrary once and use member functions instead of using the static functions which instantiate QLibrary in each call. Strip suffix from file name. Task-number: QTBUG-46710 Change-Id: Ia6ec5542e1104ea9024961dda202e6f22bcf5b69 Reviewed-by: Joerg Bornemann --- src/plugins/bearer/nativewifi/main.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp index d5669e803a..48d79d37ee 100644 --- a/src/plugins/bearer/nativewifi/main.cpp +++ b/src/plugins/bearer/nativewifi/main.cpp @@ -56,26 +56,27 @@ static void resolveLibrary() #endif if (!triedResolve.load()) { + QLibrary wlanapiLib(QLatin1String("wlanapi")); local_WlanOpenHandle = (WlanOpenHandleProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanOpenHandle"); + wlanapiLib.resolve("WlanOpenHandle"); local_WlanRegisterNotification = (WlanRegisterNotificationProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanRegisterNotification"); + wlanapiLib.resolve("WlanRegisterNotification"); local_WlanEnumInterfaces = (WlanEnumInterfacesProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanEnumInterfaces"); + wlanapiLib.resolve("WlanEnumInterfaces"); local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanGetAvailableNetworkList"); + wlanapiLib.resolve("WlanGetAvailableNetworkList"); local_WlanQueryInterface = (WlanQueryInterfaceProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanQueryInterface"); + wlanapiLib.resolve("WlanQueryInterface"); local_WlanConnect = (WlanConnectProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanConnect"); + wlanapiLib.resolve("WlanConnect"); local_WlanDisconnect = (WlanDisconnectProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanDisconnect"); + wlanapiLib.resolve("WlanDisconnect"); local_WlanScan = (WlanScanProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanScan"); + wlanapiLib.resolve("WlanScan"); local_WlanFreeMemory = (WlanFreeMemoryProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanFreeMemory"); + wlanapiLib.resolve("WlanFreeMemory"); local_WlanCloseHandle = (WlanCloseHandleProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanCloseHandle"); + wlanapiLib.resolve("WlanCloseHandle"); triedResolve.storeRelease(true); } -- cgit v1.2.3 From 5757b8c516ad0d613739b222687583bca914a981 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Tue, 23 Jun 2015 22:37:10 +0100 Subject: Return format as specified in original QWindow Overload QPlatformWindow::format() to return the desired format defined in the QWindow. This is required for windows that define specific surface formats (such as those used in Qt3d which require a depth buffer). This is similar to what is done in the OS X Cocoa QPA plugin. Change-Id: I7661a2a9c4e13603d03d3a5be10d000f73c712e6 Reviewed-by: Sean Harmer --- src/plugins/platforms/ios/qioswindow.h | 2 ++ src/plugins/platforms/ios/qioswindow.mm | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index b45f629310..c53eee1afd 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -80,6 +80,8 @@ public: void clearAccessibleCache(); + QSurfaceFormat format() const Q_DECL_OVERRIDE; + private: void applicationStateChanged(Qt::ApplicationState state); void applyGeometry(const QRect &rect); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 80fba00ffb..3045a15380 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -93,6 +93,13 @@ QIOSWindow::~QIOSWindow() [m_view release]; } + +QSurfaceFormat QIOSWindow::format() const +{ + return window()->requestedFormat(); +} + + bool QIOSWindow::blockedByModal() { QWindow *modalWindow = QGuiApplication::modalWindow(); -- cgit v1.2.3 From dc6191ccb4f03d33314981f71cd63e7aecabe8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 23 Jun 2015 13:21:56 +0200 Subject: Treat color (ARGB) glyphs, e.g. Emoji, as having unreliable glyph outlines This is used by the scene graph to automatically switch over from distance field text to native text rendering for the given glyph node, which allows mixing regular text with Emoji in e.g. a Text item without having to set renderType to Text.NativeRendering. Change-Id: I5d96d1dab329a975e3442284bf4c5a82174177c9 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/windows/qwindowsfontengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index ef2ad110ca..16b9118e81 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -671,7 +671,7 @@ void QWindowsFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qre bool QWindowsFontEngine::hasUnreliableGlyphOutline() const { - return hasUnreliableOutline; + return hasUnreliableOutline || QFontEngine::hasUnreliableGlyphOutline(); } qreal QWindowsFontEngine::minLeftBearing() const -- cgit v1.2.3 From a7f2af09114cfa0996794c85bc48a601f665772d Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 28 May 2015 12:45:48 +0200 Subject: Replace MAC OS X with OS X Task-number: QTBUG-46374 Change-Id: I7bc633ab551740bd328a24b0ccae1d534af47138 Reviewed-by: Martin Smith --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 2 +- src/plugins/platforms/cocoa/qpaintengine_mac.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index a84c0c0f2a..5f97e2996c 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -776,7 +776,7 @@ QString qt_mac_removeAmpersandEscapes(QString s) returned if it can't be obtained. It is the caller's responsibility to CGContextRelease the context when finished using it. - \warning This function is only available on Mac OS X. + \warning This function is only available on OS X. \warning This function is duplicated in qmacstyle_mac.mm */ CGContextRef qt_mac_cg_context(QPaintDevice *pdev) diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm index 1131fb5fc6..a6b4456916 100644 --- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm @@ -559,7 +559,7 @@ QCoreGraphicsPaintEngine::begin(QPaintDevice *pdev) if ((w->windowType() == Qt::Desktop)) { if (!unclipped) - qWarning("QCoreGraphicsPaintEngine::begin: Does not support clipped desktop on Mac OS X"); + qWarning("QCoreGraphicsPaintEngine::begin: Does not support clipped desktop on OS X"); // ## need to do [qt_mac_window_for(w) makeKeyAndOrderFront]; (need to rename the file) } else if (unclipped) { qWarning("QCoreGraphicsPaintEngine::begin: Does not support unclipped painting"); -- cgit v1.2.3 From 11370f0a43bc2912b529573689941fe88446ff0f Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sat, 27 Jun 2015 19:51:30 +0200 Subject: eglfs: Destroy screens after windows Screens must be destroyed after windows otherwise the application will crash on QEglFSWindow::destroy() because the screen is NULL. Change-Id: I315ddc267dd0d2dd2a1c4f3a0c319c8f2c11ec28 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index d1688df8f5..5eb8485dc7 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -106,8 +106,11 @@ void QEglFSIntegration::initialize() void QEglFSIntegration::destroy() { + foreach (QWindow *w, qGuiApp->topLevelWindows()) + w->destroy(); qt_egl_device_integration()->screenDestroy(); - QEGLPlatformIntegration::destroy(); + if (display() != EGL_NO_DISPLAY) + eglTerminate(display()); qt_egl_device_integration()->platformDestroy(); } -- cgit v1.2.3