diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-08-02 22:49:38 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-08-02 22:52:32 +0200 |
commit | ee07b912a1768ea0b103544f9eeac41f3cf50cf6 (patch) | |
tree | 15bfa7e4a9c098511c1fc89e2b2c240520b85e2d /src/plugins/platforms | |
parent | 4bfff6a98b59b32605d881a463ad3edc221a7dc8 (diff) | |
parent | a96656a8fb6a3c1fc7765659efff28f807fd0deb (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/plugins/platforms/xcb/qxcbconnection.h
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
src/plugins/styles/mac/qmacstyle_mac.mm
src/widgets/widgets/qdockarealayout.cpp
src/widgets/widgets/qmainwindow.cpp
src/widgets/widgets/qmainwindowlayout.cpp
src/widgets/widgets/qmainwindowlayout_p.h
tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
tests/auto/other/macnativeevents/BLACKLIST
tests/auto/widgets/widgets/qmenu/BLACKLIST
Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
Diffstat (limited to 'src/plugins/platforms')
15 files changed, 94 insertions, 33 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index a2e0876073..4478895538 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -167,7 +167,12 @@ QT_END_NAMESPACE - (void)onCancelClicked; @end -@interface QT_MANGLE_NAMESPACE(QNSPanelContentsWrapper) : NSView +@interface QT_MANGLE_NAMESPACE(QNSPanelContentsWrapper) : NSView { + NSButton *_okButton; + NSButton *_cancelButton; + NSView *_panelContents; + NSEdgeInsets _panelContentsMargins; +} @property (nonatomic, readonly) NSButton *okButton; @property (nonatomic, readonly) NSButton *cancelButton; diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 37e69fa8c8..9f9618177d 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -301,6 +301,11 @@ QT_END_NAMESPACE */ @implementation QNSPanelContentsWrapper +@synthesize okButton = _okButton; +@synthesize cancelButton = _cancelButton; +@synthesize panelContents = _panelContents; +@synthesize panelContentsMargins = _panelContentsMargins; + - (instancetype)initWithPanelDelegate:(id<QT_MANGLE_NAMESPACE(QNSPanelDelegate)>)panelDelegate { if ((self = [super initWithFrame:NSZeroRect])) { diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index 8295d4a36c..1224d138d9 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -75,7 +75,7 @@ // window.screen.visibleFrame directly, as that ensures we have the same // behavior for both use-cases/APIs. Q_ASSERT(window == m_cocoaWindow->nativeWindow()); - return m_cocoaWindow->screen()->availableGeometry().toCGRect(); + return NSRectFromCGRect(m_cocoaWindow->screen()->availableGeometry().toCGRect()); } #if QT_MACOS_DEPLOYMENT_TARGET_BELOW(__MAC_10_11) @@ -90,7 +90,7 @@ { Q_UNUSED(proposedSize); Q_ASSERT(window == m_cocoaWindow->nativeWindow()); - return m_cocoaWindow->screen()->geometry().size().toCGSize(); + return NSSizeFromCGSize(m_cocoaWindow->screen()->geometry().size().toCGSize()); } #endif diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp index 5f85e4b0b0..e218d580a2 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp @@ -142,7 +142,7 @@ void QEglFSKmsGbmDevice::handleDrmEvent() { drmEventContext drmEvent; memset(&drmEvent, 0, sizeof(drmEvent)); - drmEvent.version = DRM_EVENT_CONTEXT_VERSION; + drmEvent.version = 2; drmEvent.vblank_handler = nullptr; drmEvent.page_flip_handler = pageFlipHandler; diff --git a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp index c9fbb8281c..e15d6fee24 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp @@ -314,7 +314,7 @@ void QLinuxFbDevice::swapBuffers(Output *output) while (output->backFb == fbIdx) { drmEventContext drmEvent; memset(&drmEvent, 0, sizeof(drmEvent)); - drmEvent.version = DRM_EVENT_CONTEXT_VERSION; + drmEvent.version = 2; drmEvent.vblank_handler = nullptr; drmEvent.page_flip_handler = pageFlipHandler; // Blocks until there is something to read on the drm fd diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp index 81512b1561..a716a6092a 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp @@ -100,6 +100,7 @@ QMinimalEglIntegration::QMinimalEglIntegration() QMinimalEglIntegration::~QMinimalEglIntegration() { destroyScreen(mScreen); + delete mFontDb; } bool QMinimalEglIntegration::hasCapability(QPlatformIntegration::Capability cap) const diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.cpp b/src/plugins/platforms/qnx/qqnxeglwindow.cpp index aa2e4db193..33ce0f924c 100644 --- a/src/plugins/platforms/qnx/qqnxeglwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxeglwindow.cpp @@ -140,11 +140,17 @@ EGLSurface QQnxEglWindow::getSurface() if (m_newSurfaceRequested.testAndSetOrdered(true, false)) { const QMutexLocker locker(&m_mutex); //Set geomety must not reset the requestedBufferSize till //the surface is created - if (m_eglSurface != EGL_NO_SURFACE) { - platformOpenGLContext()->doneCurrent(); - destroyEGLSurface(); + + if ((m_requestedBufferSize != bufferSize()) || (m_eglSurface == EGL_NO_SURFACE)) { + if (m_eglSurface != EGL_NO_SURFACE) { + platformOpenGLContext()->doneCurrent(); + destroyEGLSurface(); + } + createEGLSurface(); + } else { + // Must've been a sequence of unprocessed changes returning us to the original size. + resetBuffers(); } - createEGLSurface(); } return m_eglSurface; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index d87fb75d14..6d4b7922db 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -988,8 +988,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, d->m_creationContext->obtainedGeometry.moveTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); return true; case QtWindows::NonClientCreate: - if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 && d->m_creationContext->window->isTopLevel()) + if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 && d->m_creationContext->window->isTopLevel() + && !d->m_creationContext->window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid()) { enableNonClientDpiScaling(msg.hwnd); + } return false; case QtWindows::CalculateSize: return QWindowsGeometryHint::handleCalculateSize(d->m_creationContext->customMargins, msg, result); diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 0e15ab08c1..af4304cb19 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -387,12 +387,13 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, && (!hasCapture || currentWindowUnderMouse == window)) || (m_previousCaptureWindow && window != m_previousCaptureWindow && currentWindowUnderMouse && currentWindowUnderMouse != m_previousCaptureWindow)) { + QPoint localPosition; qCDebug(lcQpaEvents) << "Entering " << currentWindowUnderMouse; - if (QWindowsWindow *wumPlatformWindow = QWindowsWindow::windowsWindowOf(currentWindowUnderMouse)) + if (QWindowsWindow *wumPlatformWindow = QWindowsWindow::windowsWindowOf(currentWindowUnderMouse)) { + localPosition = wumPlatformWindow->mapFromGlobal(globalPosition); wumPlatformWindow->applyCursor(); - QWindowSystemInterface::handleEnterEvent(currentWindowUnderMouse, - currentWindowUnderMouse->mapFromGlobal(globalPosition), - globalPosition); + } + QWindowSystemInterface::handleEnterEvent(currentWindowUnderMouse, localPosition, globalPosition); } // We need to track m_windowUnderMouse separately from m_trackedWindow, as // Windows mouse tracking will not trigger WM_MOUSELEAVE for leaving window when diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 6b737207f5..15906961ac 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -515,7 +515,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag // Sometimes QWindow doesn't have a QWindow parent but does have a native parent window, // e.g. in case of embedded ActiveQt servers. They should not be considered a top-level // windows in such cases. - QVariant prop = w->property("_q_embedded_native_parent_handle"); + QVariant prop = w->property(QWindowsWindow::embeddedNativeParentHandleProperty); if (prop.isValid()) { embedded = true; parentHandle = reinterpret_cast<HWND>(prop.value<WId>()); @@ -1061,6 +1061,8 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w, \ingroup qt-lighthouse-win */ +const char *QWindowsWindow::embeddedNativeParentHandleProperty = "_q_embedded_native_parent_handle"; + QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) : QWindowsBaseWindow(aWindow), m_data(data), @@ -1858,7 +1860,7 @@ bool QWindowsWindow::isFullScreen_sys() const if (testFlag(HasBorderInFullScreen)) geometry += QMargins(1, 1, 1, 1); QPlatformScreen *screen = screenForGeometry(geometry); - return screen && geometry == QHighDpi::toNativePixels(screen->geometry(), screen); + return screen && geometry == screen->geometry(); } /*! diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 60289bdc08..982f3dfd30 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -332,6 +332,8 @@ public: void setHasBorderInFullScreen(bool border); static QString formatWindowTitle(const QString &title); + static const char *embeddedNativeParentHandleProperty; + private: inline void show_sys() const; inline QWindowsWindowData setWindowFlags_sys(Qt::WindowFlags wt, unsigned flags = 0) const; diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp index 5696ae7a10..283825a880 100644 --- a/src/plugins/platforms/winrt/qwinrttheme.cpp +++ b/src/plugins/platforms/winrt/qwinrttheme.cpp @@ -61,6 +61,26 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcQpaTheme, "qt.qpa.theme") +class QWinRTApiInformationHandler { +public: + QWinRTApiInformationHandler() + { + HRESULT hr; + hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Foundation_Metadata_ApiInformation).Get(), + IID_PPV_ARGS(&m_apiInformationStatics)); + Q_ASSERT_SUCCEEDED(hr); + } + + ComPtr<IApiInformationStatics> apiInformationStatics() const + { + return m_apiInformationStatics; + } + +private: + ComPtr<IApiInformationStatics> m_apiInformationStatics; +}; +Q_GLOBAL_STATIC(QWinRTApiInformationHandler, gApiHandler); + static IUISettings *uiSettings() { static ComPtr<IUISettings> settings; @@ -86,17 +106,16 @@ static inline QColor fromColor(const Color &color) static bool uiColorSettings(const wchar_t *value, UIElementType type, Color *color) { - static ComPtr<IApiInformationStatics> apiInformationStatics; - HRESULT hr; + ComPtr<IApiInformationStatics> apiInformationStatics = gApiHandler->apiInformationStatics(); if (!apiInformationStatics) { - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Foundation_Metadata_ApiInformation).Get(), - IID_PPV_ARGS(&apiInformationStatics)); - RETURN_FALSE_IF_FAILED("Could not get ApiInformationStatics"); + qErrnoWarning("Could not get ApiInformationStatics"); + return false; } static const HStringReference enumRef(L"Windows.UI.ViewManagement.UIElementType"); HStringReference valueRef(value); + HRESULT hr; boolean exists; hr = apiInformationStatics->IsEnumNamedValuePresent(enumRef.Get(), valueRef.Get(), &exists); @@ -149,6 +168,14 @@ static void nativeColorSettings(QPalette &p) // Starting with SDK 15063 those have been removed. #ifndef QT_WINRT_DISABLE_PHONE_COLORS //Phone related + ComPtr<IApiInformationStatics> apiInformationStatics = gApiHandler->apiInformationStatics(); + boolean phoneApiPresent = false; + HRESULT hr; + HStringReference phoneRef(L"Windows.Phone.PhoneContract"); + hr = apiInformationStatics.Get()->IsApiContractPresentByMajor(phoneRef.Get(), 1, &phoneApiPresent); + if (FAILED(hr) || !phoneApiPresent) + return; + if (uiColorSettings(L"PopupBackground", UIElementType_PopupBackground, &color)) { p.setColor(QPalette::ToolTipBase, fromColor(color)); p.setColor(QPalette::AlternateBase, fromColor(color)); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 674b0cef4b..13f5cd5842 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -428,6 +428,7 @@ public: #if QT_CONFIG(xinput2) void xi2Select(xcb_window_t window); + void xi2SelectStateEvents(); bool isAtLeastXI21() const { return m_xi2Enabled && m_xi2Minor >= 1; } bool isAtLeastXI22() const { return m_xi2Enabled && m_xi2Minor >= 2; } #endif diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index bf17e9c1e1..8ed6909990 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -79,6 +79,7 @@ void QXcbConnection::initializeXInput2() qCDebug(lcQpaXInput, "Using XInput version %d.%d", xiMajor, m_xi2Minor); m_xi2Enabled = true; xi2SetupDevices(); + xi2SelectStateEvents(); break; case BadRequest: // Must be an X server with XInput 1 qCDebug(lcQpaXInput, "X server does not support XInput 2"); @@ -90,6 +91,22 @@ void QXcbConnection::initializeXInput2() } } +void QXcbConnection::xi2SelectStateEvents() +{ + // These state events do not depend on a specific X window, but are global + // for the X client's (application's) state. + unsigned int bitMask = 0; + unsigned char *xiBitMask = reinterpret_cast<unsigned char *>(&bitMask); + XIEventMask xiEventMask; + bitMask = XI_HierarchyChangedMask; + bitMask |= XI_DeviceChangedMask; + xiEventMask.deviceid = XIAllDevices; + xiEventMask.mask_len = sizeof(bitMask); + xiEventMask.mask = xiBitMask; + Display *dpy = static_cast<Display *>(m_xlib_display); + XISelectEvents(dpy, DefaultRootWindow(dpy), &xiEventMask, 1); +} + void QXcbConnection::xi2SetupDevice(void *info, bool removeExisting) { XIDeviceInfo *deviceInfo = reinterpret_cast<XIDeviceInfo *>(info); @@ -373,17 +390,6 @@ void QXcbConnection::xi2Select(xcb_window_t window) #else Q_UNUSED(xiBitMask); #endif - - { - // Listen for hotplug events - XIEventMask xiEventMask; - bitMask = XI_HierarchyChangedMask; - bitMask |= XI_DeviceChangedMask; - xiEventMask.deviceid = XIAllDevices; - xiEventMask.mask_len = sizeof(bitMask); - xiEventMask.mask = xiBitMask; - XISelectEvents(xDisplay, window, &xiEventMask, 1); - } } QXcbConnection::TouchDeviceData *QXcbConnection::touchDeviceForId(int id) diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 8ba6834565..c8efe2fce8 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -329,12 +329,15 @@ QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const void QXcbIntegration::initialize() { + const QLatin1String defaultInputContext("compose"); // Perform everything that may potentially need the event dispatcher (timers, socket // notifiers) here instead of the constructor. QString icStr = QPlatformInputContextFactory::requested(); if (icStr.isNull()) - icStr = QLatin1String("compose"); + icStr = defaultInputContext; m_inputContext.reset(QPlatformInputContextFactory::create(icStr)); + if (!m_inputContext && icStr != defaultInputContext && icStr != QLatin1String("none")) + m_inputContext.reset(QPlatformInputContextFactory::create(defaultInputContext)); } void QXcbIntegration::moveToScreen(QWindow *window, int screen) |