summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-08-13 09:46:17 +0200
committerLiang Qi <liang.qi@qt.io>2019-08-13 09:46:17 +0200
commit1dade1bd8ad13a16152aff36351ac570b5b9fdf6 (patch)
treeeafed5710b34c327a98381ca15fe1985a6487b10 /src/plugins
parentd45908e24292a41ff7838366b34be7340bf9fda5 (diff)
parentfb703aea697b12de4810deec9f8605fd062208bd (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: mkspecs/win32-clang-msvc/qmake.conf src/corelib/tools/qlist.h src/gui/painting/qcompositionfunctions.cpp src/gui/painting/qtriangulator_p.h src/gui/text/qfontengine_p.h src/network/kernel/qhostinfo_p.h src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: Ib8a0308cf77224c4fbdcf56778fdac4a43e37798
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/android/androidjnimenu.cpp12
-rw-r--r--src/plugins/platforms/android/qandroidplatformmenu.cpp43
-rw-r--r--src/plugins/platforms/android/qandroidplatformmenu.h5
-rw-r--r--src/plugins/platforms/android/qandroidplatformmenubar.cpp34
-rw-r--r--src/plugins/platforms/android/qandroidplatformmenubar.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm11
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.mm48
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm52
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindowmanager.mm3
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration.cpp1
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow.cpp9
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow_p.h1
-rw-r--r--src/plugins/platforms/wasm/qwasmintegration.cpp1
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp11
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm1
16 files changed, 173 insertions, 68 deletions
diff --git a/src/plugins/platforms/android/androidjnimenu.cpp b/src/plugins/platforms/android/androidjnimenu.cpp
index f51a3920b8..de2fdaa0e2 100644
--- a/src/plugins/platforms/android/androidjnimenu.cpp
+++ b/src/plugins/platforms/android/androidjnimenu.cpp
@@ -225,10 +225,11 @@ namespace QtAndroidMenu
QString itemText = removeAmpersandEscapes(item->text());
jstring jtext = env->NewString(reinterpret_cast<const jchar *>(itemText.data()),
itemText.length());
+ jint menuId = platformMenu->menuId(item);
jobject menuItem = env->CallObjectMethod(menu,
addMenuItemMethodID,
menuNoneValue,
- int(item->tag()),
+ menuId,
order++,
jtext);
env->DeleteLocalRef(jtext);
@@ -262,10 +263,11 @@ namespace QtAndroidMenu
QString itemText = removeAmpersandEscapes(item->text());
jstring jtext = env->NewString(reinterpret_cast<const jchar *>(itemText.data()),
itemText.length());
+ jint menuId = visibleMenuBar->menuId(item);
jobject menuItem = env->CallObjectMethod(menu,
addMenuItemMethodID,
menuNoneValue,
- int(item->tag()),
+ menuId,
order++,
jtext);
env->DeleteLocalRef(jtext);
@@ -290,7 +292,7 @@ namespace QtAndroidMenu
const QAndroidPlatformMenuBar::PlatformMenusType &menus = visibleMenuBar->menus();
if (menus.size() == 1) { // Expanded menu
- QAndroidPlatformMenuItem *item = static_cast<QAndroidPlatformMenuItem *>(menus.front()->menuItemForTag(menuId));
+ QAndroidPlatformMenuItem *item = static_cast<QAndroidPlatformMenuItem *>(menus.front()->menuItemForId(menuId));
if (item) {
if (item->menu()) {
showContextMenu(item->menu(), QRect(), env);
@@ -301,7 +303,7 @@ namespace QtAndroidMenu
}
}
} else {
- QAndroidPlatformMenu *menu = static_cast<QAndroidPlatformMenu *>(visibleMenuBar->menuForTag(menuId));
+ QAndroidPlatformMenu *menu = static_cast<QAndroidPlatformMenu *>(visibleMenuBar->menuForId(menuId));
if (menu)
showContextMenu(menu, QRect(), env);
}
@@ -341,7 +343,7 @@ namespace QtAndroidMenu
static jboolean onContextItemSelected(JNIEnv *env, jobject /*thiz*/, jint menuId, jboolean checked)
{
QMutexLocker lock(&visibleMenuMutex);
- QAndroidPlatformMenuItem * item = static_cast<QAndroidPlatformMenuItem *>(visibleMenu->menuItemForTag(menuId));
+ QAndroidPlatformMenuItem * item = static_cast<QAndroidPlatformMenuItem *>(visibleMenu->menuItemForId(menuId));
if (item) {
if (item->menu()) {
showContextMenu(item->menu(), QRect(), env);
diff --git a/src/plugins/platforms/android/qandroidplatformmenu.cpp b/src/plugins/platforms/android/qandroidplatformmenu.cpp
index d9cecebf2c..7ce603831f 100644
--- a/src/plugins/platforms/android/qandroidplatformmenu.cpp
+++ b/src/plugins/platforms/android/qandroidplatformmenu.cpp
@@ -62,6 +62,7 @@ void QAndroidPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatform
m_menuItems.end(),
static_cast<QAndroidPlatformMenuItem *>(before)),
static_cast<QAndroidPlatformMenuItem *>(menuItem));
+ m_menuHash.insert(m_nextMenuId++, menuItem);
}
void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
@@ -72,6 +73,21 @@ void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
static_cast<QAndroidPlatformMenuItem *>(menuItem));
if (it != m_menuItems.end())
m_menuItems.erase(it);
+
+ {
+ int maxId = -1;
+ QHash<int, QPlatformMenuItem *>::iterator it = m_menuHash.begin();
+ while (it != m_menuHash.end()) {
+ if (it.value() == menuItem) {
+ it = m_menuHash.erase(it);
+ } else {
+ maxId = qMax(maxId, it.key());
+ ++it;
+ }
+ }
+
+ m_nextMenuId = maxId + 1;
+ }
}
void QAndroidPlatformMenu::syncMenuItem(QPlatformMenuItem *menuItem)
@@ -139,6 +155,16 @@ void QAndroidPlatformMenu::showPopup(const QWindow *parentWindow, const QRect &t
QtAndroidMenu::showContextMenu(this, targetRect, QJNIEnvironmentPrivate());
}
+QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const
+{
+ for (QAndroidPlatformMenuItem *menuItem : m_menuItems) {
+ if (menuItem->tag() == tag)
+ return menuItem;
+ }
+
+ return nullptr;
+}
+
QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const
{
if (position < m_menuItems.size())
@@ -146,13 +172,20 @@ QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const
return 0;
}
-QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const
+int QAndroidPlatformMenu::menuId(QPlatformMenuItem *menu) const
{
- for (QPlatformMenuItem *menuItem : m_menuItems) {
- if (menuItem->tag() == tag)
- return menuItem;
+ QHash<int, QPlatformMenuItem *>::const_iterator it;
+ for (it = m_menuHash.constBegin(); it != m_menuHash.constEnd(); ++it) {
+ if (it.value() == menu)
+ return it.key();
}
- return 0;
+
+ return -1;
+}
+
+QPlatformMenuItem *QAndroidPlatformMenu::menuItemForId(int menuId) const
+{
+ return m_menuHash.value(menuId);
}
QAndroidPlatformMenu::PlatformMenuItemsType QAndroidPlatformMenu::menuItems() const
diff --git a/src/plugins/platforms/android/qandroidplatformmenu.h b/src/plugins/platforms/android/qandroidplatformmenu.h
index 47e650f2d7..b1d6a88787 100644
--- a/src/plugins/platforms/android/qandroidplatformmenu.h
+++ b/src/plugins/platforms/android/qandroidplatformmenu.h
@@ -73,6 +73,8 @@ public:
QPlatformMenuItem *menuItemAt(int position) const override;
QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
+ QPlatformMenuItem *menuItemForId(int menuId) const;
+ int menuId(QPlatformMenuItem *menuItem) const;
PlatformMenuItemsType menuItems() const;
QMutex *menuItemsMutex();
@@ -84,6 +86,9 @@ private:
bool m_enabled;
bool m_isVisible;
QMutex m_menuItemsMutex;
+
+ int m_nextMenuId = 0;
+ QHash<int, QPlatformMenuItem *> m_menuHash;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/qandroidplatformmenubar.cpp b/src/plugins/platforms/android/qandroidplatformmenubar.cpp
index 35930f0628..7c6299b4b7 100644
--- a/src/plugins/platforms/android/qandroidplatformmenubar.cpp
+++ b/src/plugins/platforms/android/qandroidplatformmenubar.cpp
@@ -61,6 +61,7 @@ void QAndroidPlatformMenuBar::insertMenu(QPlatformMenu *menu, QPlatformMenu *bef
m_menus.end(),
static_cast<QAndroidPlatformMenu *>(before)),
static_cast<QAndroidPlatformMenu *>(menu));
+ m_menuHash.insert(m_nextMenuId++, menu);
}
void QAndroidPlatformMenuBar::removeMenu(QPlatformMenu *menu)
@@ -69,6 +70,30 @@ void QAndroidPlatformMenuBar::removeMenu(QPlatformMenu *menu)
m_menus.erase(std::find(m_menus.begin(),
m_menus.end(),
static_cast<QAndroidPlatformMenu *>(menu)));
+
+ int maxId = -1;
+ QHash<int, QPlatformMenu *>::iterator it = m_menuHash.begin();
+ while (it != m_menuHash.end()) {
+ if (it.value() == menu) {
+ it = m_menuHash.erase(it);
+ } else {
+ maxId = qMax(maxId, it.key());
+ ++it;
+ }
+ }
+
+ m_nextMenuId = maxId + 1;
+}
+
+int QAndroidPlatformMenuBar::menuId(QPlatformMenu *menu) const
+{
+ QHash<int, QPlatformMenu *>::const_iterator it;
+ for (it = m_menuHash.constBegin(); it != m_menuHash.constEnd(); ++it) {
+ if (it.value() == menu)
+ return it.key();
+ }
+
+ return -1;
}
void QAndroidPlatformMenuBar::syncMenu(QPlatformMenu *menu)
@@ -86,12 +111,17 @@ void QAndroidPlatformMenuBar::handleReparent(QWindow *newParentWindow)
QPlatformMenu *QAndroidPlatformMenuBar::menuForTag(quintptr tag) const
{
- for (QPlatformMenu *menu : m_menus) {
+ for (QAndroidPlatformMenu *menu : m_menus) {
if (menu->tag() == tag)
return menu;
}
- return 0;
+ return nullptr;
+}
+
+QPlatformMenu *QAndroidPlatformMenuBar::menuForId(int menuId) const
+{
+ return m_menuHash.value(menuId);
}
QWindow *QAndroidPlatformMenuBar::parentWindow() const
diff --git a/src/plugins/platforms/android/qandroidplatformmenubar.h b/src/plugins/platforms/android/qandroidplatformmenubar.h
index f5935b8177..81a26c72f4 100644
--- a/src/plugins/platforms/android/qandroidplatformmenubar.h
+++ b/src/plugins/platforms/android/qandroidplatformmenubar.h
@@ -43,6 +43,7 @@
#include <qpa/qplatformmenu.h>
#include <qvector.h>
#include <qmutex.h>
+#include <qhash.h>
QT_BEGIN_NAMESPACE
@@ -60,6 +61,8 @@ public:
void syncMenu(QPlatformMenu *menu) override;
void handleReparent(QWindow *newParentWindow) override;
QPlatformMenu *menuForTag(quintptr tag) const override;
+ QPlatformMenu *menuForId(int menuId) const;
+ int menuId(QPlatformMenu *menu) const;
QWindow *parentWindow() const override;
PlatformMenusType menus() const;
@@ -69,6 +72,9 @@ private:
PlatformMenusType m_menus;
QWindow *m_parentWindow;
QMutex m_menusListMutex;
+
+ int m_nextMenuId = 0;
+ QHash<int, QPlatformMenu *> m_menuHash;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 7b124ea517..ba7d12ce30 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -197,8 +197,15 @@ NSOpenGLPixelFormat *QCocoaGLContext::pixelFormatForSurfaceFormat(const QSurface
attrs << NSOpenGLPFAStencilSize << format.stencilBufferSize();
if (format.alphaBufferSize() > 0)
attrs << NSOpenGLPFAAlphaSize << format.alphaBufferSize();
- if (format.redBufferSize() > 0 && format.greenBufferSize() > 0 && format.blueBufferSize() > 0) {
- const int colorSize = format.redBufferSize() + format.greenBufferSize() + format.blueBufferSize();
+
+ auto rbz = format.redBufferSize();
+ auto gbz = format.greenBufferSize();
+ auto bbz = format.blueBufferSize();
+ if (rbz > 0 || gbz > 0 || bbz > 0) {
+ auto fallbackSize = qMax(rbz, qMax(gbz, bbz));
+ auto colorSize = (rbz > 0 ? rbz : fallbackSize)
+ + (gbz > 0 ? gbz : fallbackSize)
+ + (bbz > 0 ? bbz : fallbackSize);
attrs << NSOpenGLPFAColorSize << colorSize << NSOpenGLPFAMinimumPolicy;
}
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index da0fc5c6a1..d384078e91 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -59,7 +59,6 @@
NSMenuItem *aboutItem;
NSMenuItem *aboutQtItem;
NSMenuItem *hideItem;
- NSMenuItem *lastAppSpecificItem;
NSMenuItem *servicesItem;
NSMenuItem *hideAllOthersItem;
NSMenuItem *showAllItem;
@@ -118,6 +117,9 @@
[appMenu addItem:[NSMenuItem separatorItem]];
// Preferences
+ // We'll be adding app specific items after this. The macOS HIG state that,
+ // "In general, a Preferences menu item should be the first app-specific menu item."
+ // https://developer.apple.com/macos/human-interface-guidelines/menus/menu-bar-menus/
preferencesItem = [[QCocoaNSMenuItem alloc] init];
preferencesItem.title = @"Preferences…";
preferencesItem.keyEquivalent = @",";
@@ -126,11 +128,6 @@
preferencesItem.hidden = YES;
[appMenu addItem:preferencesItem];
- // We'll be adding app specific items after this. The macOS HIG state that,
- // "In general, a Preferences menu item should be the first app-specific menu item."
- // https://developer.apple.com/macos/human-interface-guidelines/menus/menu-bar-menus/
- lastAppSpecificItem = preferencesItem;
-
[appMenu addItem:[NSMenuItem separatorItem]];
// Services item and menu
@@ -194,8 +191,6 @@
[showAllItem release];
[quitItem release];
- [lastAppSpecificItem release];
-
[super dealloc];
}
@@ -272,25 +267,20 @@
// No reason to create the item if it already exists.
for (NSMenuItem *item in appMenu.itemArray)
if (qt_objc_cast<QCocoaNSMenuItem *>(item).platformMenuItem == platformItem)
- return [[item retain] autorelease];
+ return item;
// Create an App-Specific menu item, insert it into the menu and return
// it as an autorelease item.
QCocoaNSMenuItem *item;
if (platformItem->isSeparator())
- item = [[QCocoaNSMenuItem separatorItemWithPlatformMenuItem:platformItem] retain];
+ item = [QCocoaNSMenuItem separatorItemWithPlatformMenuItem:platformItem];
else
- item = [[QCocoaNSMenuItem alloc] initWithPlatformMenuItem:platformItem];
-
- const auto location = [appMenu indexOfItem:lastAppSpecificItem];
+ item = [[[QCocoaNSMenuItem alloc] initWithPlatformMenuItem:platformItem] autorelease];
- if (!lastAppSpecificItem.separatorItem)
- [lastAppSpecificItem release];
- lastAppSpecificItem = item; // Keep track of this for later (i.e., don't release it)
+ const auto location = [self indexOfLastAppSpecificMenuItem];
+ [appMenu insertItem:item atIndex:NSInteger(location) + 1];
- [appMenu insertItem:item atIndex:location + 1];
-
- return [[item retain] autorelease];
+ return item;
}
- (void)orderFrontStandardAboutPanel:(id)sender
@@ -344,8 +334,24 @@
- (NSArray<NSMenuItem *> *)mergeable
{
// Don't include the quitItem here, since we want it always visible and enabled regardless
- // Note that lastAppSpecificItem may be nil, so we can't use @[] here.
- return [NSArray arrayWithObjects:preferencesItem, aboutItem, aboutQtItem, lastAppSpecificItem, nil];
+ auto items = [NSArray arrayWithObjects:preferencesItem, aboutItem, aboutQtItem,
+ appMenu.itemArray[[self indexOfLastAppSpecificMenuItem]], nil];
+ return items;
}
+- (NSUInteger)indexOfLastAppSpecificMenuItem
+{
+ // Either the 'Preferences', which is the first app specific menu item, or something
+ // else we appended later (thus the reverse order):
+ const auto location = [appMenu.itemArray indexOfObjectWithOptions:NSEnumerationReverse
+ passingTest:^BOOL(NSMenuItem *item, NSUInteger, BOOL *) {
+ if (auto qtItem = qt_objc_cast<QCocoaNSMenuItem*>(item))
+ return qtItem != quitItem;
+ return NO;
+ }];
+ Q_ASSERT(location != NSNotFound);
+ return location;
+}
+
+
@end
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index 7979e430ac..9bd19dd07c 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -177,6 +177,9 @@ void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine
QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard()
{
+ // Note: starting with macOS 10.14, the KeyboardSetupAssistant app bundle no
+ // longer contains the "Background.png" image. This function then returns a
+ // null pixmap.
const int ExpectedImageWidth = 242;
const int ExpectedImageHeight = 414;
QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier(
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 8f3c192745..0c7ec7f736 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1544,12 +1544,6 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
Qt::WindowType type = window()->type();
Qt::WindowFlags flags = window()->flags();
- // Note: The macOS window manager has a bug, where if a screen is rotated, it will not allow
- // a window to be created within the area of the screen that has a Y coordinate (I quadrant)
- // higher than the height of the screen in its non-rotated state, unless the window is
- // created with the NSWindowStyleMaskBorderless style mask.
- NSWindowStyleMask styleMask = windowStyleMask(flags);
-
QRect rect = geometry();
QScreen *targetScreen = nullptr;
@@ -1560,35 +1554,57 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
}
}
+ NSWindowStyleMask styleMask = windowStyleMask(flags);
+
if (!targetScreen) {
qCWarning(lcQpaWindow) << "Window position" << rect << "outside any known screen, using primary screen";
targetScreen = QGuiApplication::primaryScreen();
- // AppKit will only reposition a window that's outside the target screen area if
- // the window has a title bar. If left out, the window ends up with no screen.
- // The style mask will be corrected to the original style mask in setWindowFlags.
- styleMask |= NSWindowStyleMaskTitled;
+ // Unless the window is created as borderless AppKit won't find a position and
+ // screen that's close to the requested invalid position, and will always place
+ // the window on the primary screen.
+ styleMask = NSWindowStyleMaskBorderless;
}
rect.translate(-targetScreen->geometry().topLeft());
- QCocoaScreen *cocoaScreen = static_cast<QCocoaScreen *>(targetScreen->handle());
- NSRect frame = QCocoaScreen::mapToNative(rect, cocoaScreen);
+ auto *targetCocoaScreen = static_cast<QCocoaScreen *>(targetScreen->handle());
+ NSRect contentRect = QCocoaScreen::mapToNative(rect, targetCocoaScreen);
+
+ if (targetScreen->primaryOrientation() == Qt::PortraitOrientation) {
+ // The macOS window manager has a bug, where if a screen is rotated, it will not allow
+ // a window to be created within the area of the screen that has a Y coordinate (I quadrant)
+ // higher than the height of the screen in its non-rotated state (including a magic padding
+ // of 24 points), unless the window is created with the NSWindowStyleMaskBorderless style mask.
+ if (styleMask && (contentRect.origin.y + 24 > targetScreen->geometry().width())) {
+ qCDebug(lcQpaWindow) << "Window positioned on portrait screen."
+ << "Adjusting style mask during creation";
+ styleMask = NSWindowStyleMaskBorderless;
+ }
+ }
// Create NSWindow
Class windowClass = shouldBePanel ? [QNSPanel class] : [QNSWindow class];
- QCocoaNSWindow *nsWindow = [[windowClass alloc] initWithContentRect:frame
+ QCocoaNSWindow *nsWindow = [[windowClass alloc] initWithContentRect:contentRect
+ // Mask will be updated in setWindowFlags if not the final mask
styleMask:styleMask
// Deferring window creation breaks OpenGL (the GL context is
// set up before the window is shown and needs a proper window)
backing:NSBackingStoreBuffered defer:NO
- screen:cocoaScreen->nativeScreen()
+ screen:targetCocoaScreen->nativeScreen()
platformWindow:this];
- Q_ASSERT_X(nsWindow.screen == cocoaScreen->nativeScreen(), "QCocoaWindow",
- "Resulting NSScreen should match the requested NSScreen");
+ // The resulting screen can be different from the screen requested if
+ // for example the application has been assigned to a specific display.
+ auto resultingScreen = QCocoaScreen::get(nsWindow.screen);
+
+ // But may not always be resolved at this point, in which case we fall back
+ // to the target screen. The real screen will be delivered as a screen change
+ // when resolved as part of ordering the window on screen.
+ if (!resultingScreen)
+ resultingScreen = targetCocoaScreen;
- if (targetScreen != window()->screen()) {
+ if (resultingScreen->screen() != window()->screen()) {
QWindowSystemInterface::handleWindowScreenChanged<
- QWindowSystemInterface::SynchronousDelivery>(window(), targetScreen);
+ QWindowSystemInterface::SynchronousDelivery>(window(), resultingScreen->screen());
}
static QSharedPointer<QNSWindowDelegate> sharedDelegate([[QNSWindowDelegate alloc] init],
diff --git a/src/plugins/platforms/cocoa/qcocoawindowmanager.mm b/src/plugins/platforms/cocoa/qcocoawindowmanager.mm
index 879bfaa546..9c45d8c7fc 100644
--- a/src/plugins/platforms/cocoa/qcocoawindowmanager.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindowmanager.mm
@@ -92,7 +92,8 @@ void QCocoaWindowManager::modalSessionChanged()
if (NSApp.modalWindow) {
// Lower window to that of the modal windows, but no less
nativeWindow.level = NSModalPanelWindowLevel;
- [nativeWindow orderBack:nil];
+ if ([nativeWindow isVisible])
+ [nativeWindow orderBack:nil];
} else {
// Restore window's natural window level, whatever that was
nativeWindow.level = naturalWindowLevel;
diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
index c8a1ddf9b9..674f579b4f 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
@@ -265,6 +265,7 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
case RasterGLSurface: return false;
#endif
case WindowManagement: return false;
+ case OpenGLOnRasterSurface: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}
diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
index c1d5af47aa..1fed182882 100644
--- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
@@ -64,7 +64,6 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
m_backingStore(0),
m_rasterCompositingContext(0),
#endif
- m_raster(false),
m_winId(0),
m_surface(EGL_NO_SURFACE),
m_window(0),
@@ -94,11 +93,6 @@ void QEglFSWindow::create()
m_winId = newWId();
- // Save the original surface type before changing to OpenGLSurface.
- m_raster = (window()->surfaceType() == QSurface::RasterSurface);
- if (m_raster) // change to OpenGL, but not for RasterGLSurface
- window()->setSurfaceType(QSurface::OpenGLSurface);
-
if (window()->type() == Qt::Desktop) {
QRect fullscreenRect(QPoint(), screen()->availableGeometry().size());
QWindowSystemInterface::handleGeometryChange(window(), fullscreenRect);
@@ -329,7 +323,8 @@ QEglFSScreen *QEglFSWindow::screen() const
bool QEglFSWindow::isRaster() const
{
- return m_raster || window()->surfaceType() == QSurface::RasterGLSurface;
+ const QWindow::SurfaceType type = window()->surfaceType();
+ return type == QSurface::RasterSurface || type == QSurface::RasterGLSurface;
}
#ifndef QT_NO_OPENGL
diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
index b0091e2a62..be2a0630d3 100644
--- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
@@ -118,7 +118,6 @@ protected:
QOpenGLCompositorBackingStore *m_backingStore;
QOpenGLContext *m_rasterCompositingContext;
#endif
- bool m_raster;
WId m_winId;
EGLSurface m_surface;
diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp
index 116612c286..1e9f68027c 100644
--- a/src/plugins/platforms/wasm/qwasmintegration.cpp
+++ b/src/plugins/platforms/wasm/qwasmintegration.cpp
@@ -168,6 +168,7 @@ bool QWasmIntegration::hasCapability(QPlatformIntegration::Capability cap) const
case RasterGLSurface: return false; // to enable this you need to fix qopenglwidget and quickwidget for wasm
case MultipleWindows: return true;
case WindowManagement: return true;
+ case OpenGLOnRasterSurface: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 5db7deeef6..5539a6903c 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -2674,7 +2674,8 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re
// QTBUG-32663, suppress resize cursor for fixed size windows.
const QWindow *w = window();
if (!w->isTopLevel() // Task 105852, minimized windows need to respond to user input.
- || !(m_windowState & ~Qt::WindowActive)
+ || (m_windowState != Qt::WindowNoState)
+ || !isActive()
|| (m_data.flags & Qt::FramelessWindowHint)) {
return false;
}
@@ -2694,12 +2695,10 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re
return true;
}
if (localPos.y() < 0) {
- const QMargins margins = frameMargins();
- const int topResizeBarPos = margins.left() - margins.top();
- if (localPos.y() < topResizeBarPos) {
+ const int topResizeBarPos = -frameMargins().top();
+ if (localPos.y() >= topResizeBarPos)
*result = HTCAPTION; // Extend caption over top resize bar, let's user move the window.
- return true;
- }
+ return true;
}
}
if (fixedWidth && (localPos.x() < 0 || localPos.x() >= size.width())) {
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 968ca68619..a994aea12d 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -3899,6 +3899,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
CGContextScaleCTM(ctx, -1, 1);
CGContextTranslateCTM(ctx, -frameRect.left(), 0);
} else if (tabDirection == QMacStylePrivate::West && tp == QStyleOptionTab::Beginning) {
+ CGContextTranslateCTM(ctx, 0, opt->rect.top());
CGContextScaleCTM(ctx, 1, -1);
CGContextTranslateCTM(ctx, 0, -frameRect.right());
} else if (tabDirection == QMacStylePrivate::East && tp == QStyleOptionTab::End) {