summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm42
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm73
-rw-r--r--src/plugins/platforms/cocoa/qnsview_complextext.mm4
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac.mm1
-rw-r--r--src/plugins/platforms/wasm/wasm.pro2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp43
7 files changed, 96 insertions, 74 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 1a3c7793c0..f9a03e5b58 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -358,8 +358,9 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
return [NSValue valueWithRange: NSMakeRange(0, 0)];
} else if ([attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) {
// FIXME This is not correct and may impact performance for big texts
- return [NSValue valueWithRange: NSMakeRange(0, iface->textInterface()->characterCount())];
-
+ if (QAccessibleTextInterface *text = iface->textInterface())
+ return [NSValue valueWithRange: NSMakeRange(0, text->characterCount())];
+ return [NSValue valueWithRange: NSMakeRange(0, iface->text(QAccessible::Name).length())];
} else if ([attribute isEqualToString:NSAccessibilityInsertionPointLineNumberAttribute]) {
if (QAccessibleTextInterface *text = iface->textInterface()) {
int position = text->cursorPosition();
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 8515190bd7..774ccdbf4c 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -898,34 +898,36 @@ void QCocoaWindow::raise()
qCDebug(lcQpaWindow) << "QCocoaWindow::raise" << window();
// ### handle spaces (see Qt 4 raise_sys in qwidget_mac.mm)
- if (!isContentView())
- return;
-
- if (m_view.window.visible) {
- {
- // Clean up autoreleased temp objects from orderFront immediately.
- // Failure to do so has been observed to cause leaks also beyond any outer
- // autorelease pool (for example around a complete QWindow
- // construct-show-raise-hide-delete cyle), counter to expected autoreleasepool
- // behavior.
- QMacAutoReleasePool pool;
- [m_view.window orderFront:m_view.window];
- }
- static bool raiseProcess = qt_mac_resolveOption(true, "QT_MAC_SET_RAISE_PROCESS");
- if (raiseProcess) {
- [NSApp activateIgnoringOtherApps:YES];
+ if (isContentView()) {
+ if (m_view.window.visible) {
+ {
+ // Clean up auto-released temp objects from orderFront immediately.
+ // Failure to do so has been observed to cause leaks also beyond any outer
+ // autorelease pool (for example around a complete QWindow
+ // construct-show-raise-hide-delete cycle), counter to expected autoreleasepool
+ // behavior.
+ QMacAutoReleasePool pool;
+ [m_view.window orderFront:m_view.window];
+ }
+ static bool raiseProcess = qt_mac_resolveOption(true, "QT_MAC_SET_RAISE_PROCESS");
+ if (raiseProcess)
+ [NSApp activateIgnoringOtherApps:YES];
}
+ } else {
+ [m_view.superview addSubview:m_view positioned:NSWindowAbove relativeTo:nil];
}
}
void QCocoaWindow::lower()
{
qCDebug(lcQpaWindow) << "QCocoaWindow::lower" << window();
- if (!isContentView())
- return;
- if (m_view.window.visible)
- [m_view.window orderBack:m_view.window];
+ if (isContentView()) {
+ if (m_view.window.visible)
+ [m_view.window orderBack:m_view.window];
+ } else {
+ [m_view.superview addSubview:m_view positioned:NSWindowBelow relativeTo:nil];
+ }
}
bool QCocoaWindow::isExposed() const
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 03c5001270..7f826942f3 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -68,6 +68,8 @@
// Private interface
@interface QT_MANGLE_NAMESPACE(QNSView) ()
- (BOOL)isTransparentForUserInput;
+@property (assign) NSView* previousSuperview;
+@property (assign) NSWindow* previousWindow;
@end
@interface QT_MANGLE_NAMESPACE(QNSView) (Drawing) <CALayerDelegate>
@@ -153,6 +155,9 @@
self.focusRingType = NSFocusRingTypeNone;
self.cursor = nil;
+ self.previousSuperview = nil;
+ self.previousWindow = nil;
+
[self initDrawing];
[self registerDragTypes];
@@ -195,8 +200,40 @@
return description;
}
+// ----------------------------- Re-parenting ---------------------------------
+
+- (void)removeFromSuperview
+{
+ QMacAutoReleasePool pool;
+ [super removeFromSuperview];
+}
+
+- (void)viewWillMoveToSuperview:(NSView *)newSuperview
+{
+ Q_ASSERT(!self.previousSuperview);
+ self.previousSuperview = self.superview;
+
+ if (newSuperview == self.superview)
+ qCDebug(lcQpaWindow) << "Re-ordering" << self << "inside" << self.superview;
+ else
+ qCDebug(lcQpaWindow) << "Re-parenting" << self << "from" << self.superview << "to" << newSuperview;
+}
+
- (void)viewDidMoveToSuperview
{
+ auto cleanup = qScopeGuard([&] { self.previousSuperview = nil; });
+
+ if (self.superview == self.previousSuperview) {
+ qCDebug(lcQpaWindow) << "Done re-ordering" << self << "new index:"
+ << [self.superview.subviews indexOfObject:self];
+ return;
+ }
+
+ qCDebug(lcQpaWindow) << "Done re-parenting" << self << "into" << self.superview;
+
+ // Note: at this point the view's window property hasn't been updated to match the window
+ // of the new superview. We have to wait for viewDidMoveToWindow for that to be reflected.
+
if (!m_platformWindow)
return;
@@ -210,6 +247,36 @@
}
}
+- (void)viewWillMoveToWindow:(NSWindow *)newWindow
+{
+ Q_ASSERT(!self.previousWindow);
+ self.previousWindow = self.window;
+
+ // This callback is documented to be called also when a view is just moved between
+ // subviews in the same NSWindow, so we're not necessarily moving between NSWindows.
+ if (newWindow == self.window)
+ return;
+
+ qCDebug(lcQpaWindow) << "Moving" << self << "from" << self.window << "to" << newWindow;
+
+ // Note: at this point the superview has already been updated, so we know which view inside
+ // the new window the view will be a child of.
+}
+
+- (void)viewDidMoveToWindow
+{
+ auto cleanup = qScopeGuard([&] { self.previousWindow = nil; });
+
+ // This callback is documented to be called also when a view is just moved between
+ // subviews in the same NSWindow, so we're not necessarily moving between NSWindows.
+ if (self.window == self.previousWindow)
+ return;
+
+ qCDebug(lcQpaWindow) << "Done moving" << self << "to" << self.window;
+}
+
+// ----------------------------------------------------------------------------
+
- (QWindow *)topLevelWindow
{
if (!m_platformWindow)
@@ -239,12 +306,6 @@
// viewDidUnhide so no reason to override it here.
}
-- (void)removeFromSuperview
-{
- QMacAutoReleasePool pool;
- [super removeFromSuperview];
-}
-
- (BOOL)isTransparentForUserInput
{
return m_platformWindow->window() &&
diff --git a/src/plugins/platforms/cocoa/qnsview_complextext.mm b/src/plugins/platforms/cocoa/qnsview_complextext.mm
index d357082d33..6ff9b26ca4 100644
--- a/src/plugins/platforms/cocoa/qnsview_complextext.mm
+++ b/src/plugins/platforms/cocoa/qnsview_complextext.mm
@@ -307,8 +307,8 @@
{
Q_UNUSED(textInputContextKeyboardSelectionDidChangeNotification)
if (([NSApp keyWindow] == self.window) && self.window.firstResponder == self) {
- QCocoaInputContext *ic = qobject_cast<QCocoaInputContext *>(QCocoaIntegration::instance()->inputContext());
- ic->updateLocale();
+ if (QCocoaInputContext *ic = qobject_cast<QCocoaInputContext *>(QCocoaIntegration::instance()->inputContext()))
+ ic->updateLocale();
}
}
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
index ce7f92f2c7..5c880b1cad 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
@@ -313,7 +313,6 @@ static void qt_mac_draw_pattern(void *info, CGContextRef c)
}
pat->image = qt_mac_create_imagemask(pm, pm.rect());
CGImageRelease(swatch);
- CGContextRelease(pm_ctx);
w *= QMACPATTERN_MASK_MULTIPLIER;
h *= QMACPATTERN_MASK_MULTIPLIER;
#endif
diff --git a/src/plugins/platforms/wasm/wasm.pro b/src/plugins/platforms/wasm/wasm.pro
index f1205702ef..eaaba53aa2 100644
--- a/src/plugins/platforms/wasm/wasm.pro
+++ b/src/plugins/platforms/wasm/wasm.pro
@@ -1,4 +1,4 @@
-TARGET = wasm
+TARGET = qwasm
CONFIG += static plugin
QT += \
core-private gui-private \
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 2ffb5d2629..ddb8f45188 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include <QDebug>
-#if QT_CONFIG(library)
-#include <QLibrary>
-#endif
#include "qxcbwindow.h"
#include "qxcbscreen.h"
@@ -61,10 +58,6 @@
#include "qxcbglintegration.h"
-#if !defined(QT_STATIC) && QT_CONFIG(dlopen)
-#include <dlfcn.h>
-#endif
-
QT_BEGIN_NAMESPACE
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
@@ -627,41 +620,7 @@ void QGLXContext::swapBuffers(QPlatformSurface *surface)
QFunctionPointer QGLXContext::getProcAddress(const char *procName)
{
-#ifdef QT_STATIC
- return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName));
-#else
- typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *);
- static qt_glXGetProcAddressARB glXGetProcAddressARB = 0;
- static bool resolved = false;
-
- if (resolved && !glXGetProcAddressARB)
- return 0;
- if (!glXGetProcAddressARB) {
- QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_display, GLX_EXTENSIONS)).split(' ');
- if (glxExt.contains("GLX_ARB_get_proc_address")) {
-#if QT_CONFIG(dlopen)
- void *handle = dlopen(NULL, RTLD_LAZY);
- if (handle) {
- glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB");
- dlclose(handle);
- }
- if (!glXGetProcAddressARB)
-#endif
- {
-#if QT_CONFIG(library)
- QLibrary lib(QLatin1String("GL"));
- if (!lib.load())
- lib.setFileNameAndVersion(QLatin1String("GL"), 1);
- glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
-#endif
- }
- }
- resolved = true;
- }
- if (!glXGetProcAddressARB)
- return 0;
- return (void (*)())glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName));
-#endif
+ return glXGetProcAddress(reinterpret_cast<const GLubyte *>(procName));
}
QSurfaceFormat QGLXContext::format() const