diff options
Diffstat (limited to 'src/plugins/platforms')
10 files changed, 62 insertions, 32 deletions
diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index 023cce30ec..b426839f3d 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -565,33 +565,37 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface) m_nativeWindow = nativeWindow; if (m_waitForWindow) m_waitForWindowSemaphore.release(); - if (m_androidPlatformIntegration && !sameNativeWindow) { - m_surfaceMutex.unlock(); - m_androidPlatformIntegration->surfaceChanged(); - } else if (m_androidPlatformIntegration && sameNativeWindow) { - QPlatformScreen *screen = m_androidPlatformIntegration->screen(); + + if (m_androidPlatformIntegration) { QSize size = QtAndroid::nativeWindowSize(); + QPlatformScreen *screen = m_androidPlatformIntegration->screen(); QRect geometry(QPoint(0, 0), size); QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry); QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry); - // Resize all top level windows, since they share the same surface - foreach (QWindow *w, QGuiApplication::topLevelWindows()) { - QAndroidOpenGLPlatformWindow *window = - static_cast<QAndroidOpenGLPlatformWindow *>(w->handle()); - - if (window != 0) { - window->lock(); - window->scheduleResize(size); - - QWindowSystemInterface::handleExposeEvent(window->window(), - QRegion(window->window()->geometry())); - window->unlock(); + if (!sameNativeWindow) { + m_surfaceMutex.unlock(); + m_androidPlatformIntegration->surfaceChanged(); + } else { + // Resize all top level windows, since they share the same surface + foreach (QWindow *w, QGuiApplication::topLevelWindows()) { + QAndroidOpenGLPlatformWindow *window = + static_cast<QAndroidOpenGLPlatformWindow *>(w->handle()); + + if (window != 0) { + window->lock(); + window->scheduleResize(size); + + QWindowSystemInterface::handleExposeEvent(window->window(), + QRegion(window->window()->geometry())); + window->unlock(); + } } + + m_surfaceMutex.unlock(); } - m_surfaceMutex.unlock(); } else { m_surfaceMutex.unlock(); } diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp index f9262c69f6..4934047af9 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp @@ -84,9 +84,19 @@ void QAndroidOpenGLPlatformWindow::invalidateSurface() } } +void QAndroidOpenGLPlatformWindow::updateStaticNativeWindow() +{ + QWriteLocker locker(&m_staticSurfaceLock); + m_staticNativeWindow = QtAndroid::nativeWindow(false); +} + void QAndroidOpenGLPlatformWindow::resetSurface() { - m_referenceCount.ref(); + // Only add a reference if we're not already holding one, otherwise we're just updating + // the native window pointer + if (m_window == 0) + m_referenceCount.ref(); + if (m_staticSurface == 0) { QWriteLocker locker(&m_staticSurfaceLock); QEglFSWindow::resetSurface(); @@ -94,12 +104,17 @@ void QAndroidOpenGLPlatformWindow::resetSurface() m_staticNativeWindow = m_window; } else { QReadLocker locker(&m_staticSurfaceLock); - Q_ASSERT(m_staticSurface != m_surface); m_window = m_staticNativeWindow; m_surface = m_staticSurface; } - QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event + { + lock(); + scheduleResize(QtAndroid::nativeWindowSize()); + QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event + unlock(); + } + QWindowSystemInterface::flushWindowSystemEvents(); } diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h index 36a110e1a8..9a25957ccd 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h @@ -71,6 +71,8 @@ public: void destroy(); + static void updateStaticNativeWindow(); + private: QSize m_scheduledResize; QMutex m_lock; diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp index 045eb57148..286d4cc7f2 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp @@ -171,6 +171,7 @@ void QAndroidPlatformIntegration::invalidateNativeSurface() void QAndroidPlatformIntegration::surfaceChanged() { + QAndroidOpenGLPlatformWindow::updateStaticNativeWindow(); foreach (QWindow *w, QGuiApplication::topLevelWindows()) { QAndroidOpenGLPlatformWindow *window = static_cast<QAndroidOpenGLPlatformWindow *>(w->handle()); diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 3ac48df09e..14b8dee101 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -457,7 +457,9 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf // Else, we need to transform 'pos' to window or screen coordinates. NSPoint nsPos = NSMakePoint(pos.x() - 1, pos.y()); if (view) { + // Flip y-coordinate first, the convert to content view space. nsPos.y = view.frame.size.height - nsPos.y; + nsPos = [view convertPoint:nsPos toView:view.window.contentView]; } else if (!QGuiApplication::screens().isEmpty()) { QScreen *screen = QGuiApplication::screens().at(0); nsPos.y = screen->availableVirtualSize().height() - nsPos.y; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 46d3b7329e..5fc2975a9d 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -795,6 +795,7 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow) QRect rect = window()->geometry(); NSRect frame = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()); [m_contentView setFrame:frame]; + [m_contentView setHidden: YES]; } const qreal opacity = qt_window_private(window())->opacity; @@ -913,7 +914,8 @@ void QCocoaWindow::clearNSWindow(NSWindow *window) [window setContentView:nil]; [window setDelegate:nil]; [window clearPlatformWindow]; - [[NSNotificationCenter defaultCenter] removeObserver:m_contentView]; + [[NSNotificationCenter defaultCenter] removeObserver:m_contentView + name:nil object:window]; } // Returns the current global screen geometry for the nswindow associated with this window. @@ -1025,7 +1027,7 @@ qreal QCocoaWindow::devicePixelRatio() const void QCocoaWindow::exposeWindow() { - if (!m_isExposed) { + if (!m_isExposed && ![[m_contentView superview] isHidden]) { m_isExposed = true; QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 51c3953af1..b8a31329fe 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -107,12 +107,9 @@ static QTouchDevice *touchDevice = 0; m_maskImage = 0; m_maskData = 0; m_window = 0; - if (m_subscribesForGlobalFrameNotifications) { - m_subscribesForGlobalFrameNotifications = false; - [[NSNotificationCenter defaultCenter] removeObserver:self - name:NSViewGlobalFrameDidChangeNotification - object:self]; -} + m_subscribesForGlobalFrameNotifications = false; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + delete currentCustomDragTypes; [super dealloc]; @@ -603,6 +600,7 @@ static QTouchDevice *touchDevice = 0; QWindowSystemInterface::handleCloseEvent(m_platformWindow->m_activePopupWindow); QWindowSystemInterface::flushWindowSystemEvents(); m_platformWindow->m_activePopupWindow = 0; + return; } if ([self hasMarkedText]) { NSInputManager* inputManager = [NSInputManager currentInputManager]; diff --git a/src/plugins/platforms/offscreen/offscreen.pro b/src/plugins/platforms/offscreen/offscreen.pro index f9c5bd2165..5db5e32e65 100644 --- a/src/plugins/platforms/offscreen/offscreen.pro +++ b/src/plugins/platforms/offscreen/offscreen.pro @@ -17,7 +17,7 @@ HEADERS = qoffscreenintegration.h \ OTHER_FILES += offscreen.json -contains(QT_CONFIG, xcb):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2) { +contains(QT_CONFIG, xlib):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2) { SOURCES += qoffscreenintegration_x11.cpp HEADERS += qoffscreenintegration_x11.h system(echo "Using X11 offscreen integration with GLX") diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 745f6548b5..0e6c49aedb 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1801,8 +1801,8 @@ void QWindowsXpNativeFileDialog::populateOpenFileName(OPENFILENAME *ofn, HWND ow QString defaultSuffix = m_options->defaultSuffix(); if (defaultSuffix.startsWith(QLatin1Char('.'))) defaultSuffix.remove(0, 1); - if (!defaultSuffix.isEmpty()) - ofn->lpstrDefExt = qStringToWCharArray(defaultSuffix); + // QTBUG-33156, also create empty strings to trigger the appending mechanism. + ofn->lpstrDefExt = qStringToWCharArray(defaultSuffix); } // Flags. ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_PATHMUSTEXIST); diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 498bd509fa..49fdfc15b8 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -39,6 +39,12 @@ ** ****************************************************************************/ +// SHSTOCKICONINFO is only available since Vista +#if _WIN32_WINNT < 0x0600 +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0600 +#endif + #include "qwindowstheme.h" #include "qwindowsdialoghelpers.h" #include "qwindowscontext.h" |