summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/.prev_CMakeLists.txt150
-rw-r--r--src/plugins/platforms/cocoa/CMakeLists.txt154
-rw-r--r--src/plugins/platforms/cocoa/cocoa.pro2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm27
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm17
7 files changed, 341 insertions, 12 deletions
diff --git a/src/plugins/platforms/cocoa/.prev_CMakeLists.txt b/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..1491340b65
--- /dev/null
+++ b/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
@@ -0,0 +1,150 @@
+# Generated from cocoa.pro.
+
+#####################################################################
+## QCocoaIntegrationPlugin Plugin:
+#####################################################################
+
+qt_add_plugin(QCocoaIntegrationPlugin
+ OUTPUT_NAME qcocoa
+ TYPE platforms
+ SOURCES
+ main.mm
+ messages.cpp messages.h
+ qcocoaapplication.h qcocoaapplication.mm
+ qcocoaapplicationdelegate.h qcocoaapplicationdelegate.mm
+ qcocoabackingstore.h qcocoabackingstore.mm
+ qcocoaclipboard.h qcocoaclipboard.mm
+ qcocoacursor.h qcocoacursor.mm
+ qcocoadrag.h qcocoadrag.mm
+ qcocoaeventdispatcher.h qcocoaeventdispatcher.mm
+ qcocoahelpers.h qcocoahelpers.mm
+ qcocoainputcontext.h qcocoainputcontext.mm
+ qcocoaintegration.h qcocoaintegration.mm
+ qcocoaintrospection.h qcocoaintrospection.mm
+ qcocoakeymapper.h qcocoakeymapper.mm
+ qcocoamenu.h qcocoamenu.mm
+ qcocoamenubar.h qcocoamenubar.mm
+ qcocoamenuitem.h qcocoamenuitem.mm
+ qcocoamenuloader.h qcocoamenuloader.mm
+ qcocoamimetypes.h qcocoamimetypes.mm
+ qcocoanativeinterface.h qcocoanativeinterface.mm
+ qcocoansmenu.h qcocoansmenu.mm
+ qcocoascreen.h qcocoascreen.mm
+ qcocoaservices.h qcocoaservices.mm
+ qcocoasystemtrayicon.h qcocoasystemtrayicon.mm
+ qcocoatheme.h qcocoatheme.mm
+ qcocoawindow.h qcocoawindow.mm
+ qcocoawindowmanager.h qcocoawindowmanager.mm
+ qiosurfacegraphicsbuffer.h qiosurfacegraphicsbuffer.mm
+ qmacclipboard.h qmacclipboard.mm
+ qmultitouch_mac.mm qmultitouch_mac_p.h
+ qnsview.h qnsview.mm
+ qnswindow.h qnswindow.mm
+ qnswindowdelegate.h qnswindowdelegate.mm
+ PUBLIC_LIBRARIES
+ ${FWAppKit}
+ ${FWCarbon}
+ ${FWCoreServices}
+ ${FWCoreVideo}
+ ${FWIOKit}
+ ${FWIOSurface}
+ ${FWMetal}
+ ${FWQuartzCore}
+ Cups::Cups
+ Qt::ClipboardSupportPrivate
+ Qt::Core
+ Qt::CorePrivate
+ Qt::FontDatabaseSupportPrivate
+ Qt::GraphicsSupportPrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::ThemeSupportPrivate
+)
+
+# Resources:
+set(qcocoaresources_resource_files
+ "images/sizeallcursor.png"
+ "images/spincursor.png"
+ "images/waitcursor.png"
+)
+
+qt_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
+ PREFIX
+ "/qt-project.org/mac/cursors"
+ FILES
+ ${qcocoaresources_resource_files}
+)
+
+
+#### Keys ignored in scope 1:.:.:cocoa.pro:<TRUE>:
+# OTHER_FILES = "cocoa.json"
+
+## Scopes:
+#####################################################################
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_opengl
+ SOURCES
+ qcocoaglcontext.h qcocoaglcontext.mm
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_vulkan
+ SOURCES
+ qcocoavulkaninstance.h qcocoavulkaninstance.mm
+ PUBLIC_LIBRARIES
+ Qt::VulkanSupportPrivate
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_accessibility
+ SOURCES
+ qcocoaaccessibility.h qcocoaaccessibility.mm
+ qcocoaaccessibilityelement.h qcocoaaccessibilityelement.mm
+ PUBLIC_LIBRARIES
+ Qt::AccessibilitySupportPrivate
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+ SOURCES
+ qcocoasessionmanager.cpp qcocoasessionmanager.h
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION TARGET Qt::PlatformCompositorSupportPrivate
+ PUBLIC_LIBRARIES
+ Qt::PlatformCompositorSupportPrivate
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION TARGET Qt::Widgets
+ SOURCES
+ qpaintengine_mac.mm qpaintengine_mac_p.h
+ PUBLIC_LIBRARIES
+ Qt::WidgetsPrivate
+)
+
+#### Keys ignored in scope 8:.:.:cocoa.pro:TARGET Qt::Widgets:
+# QT_FOR_CONFIG = "widgets"
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION TARGET Qt::PrintSupport AND TARGET Qt::Widgets
+ SOURCES
+ qcocoaprintdevice.h qcocoaprintdevice.mm
+ qcocoaprintersupport.h qcocoaprintersupport.mm
+ qprintengine_mac.mm qprintengine_mac_p.h
+ PUBLIC_LIBRARIES
+ Qt::PrintSupportPrivate
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_colordialog AND TARGET Qt::Widgets
+ SOURCES
+ qcocoacolordialoghelper.h qcocoacolordialoghelper.mm
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_filedialog AND TARGET Qt::Widgets
+ SOURCES
+ qcocoafiledialoghelper.h qcocoafiledialoghelper.mm
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_fontdialog AND TARGET Qt::Widgets
+ SOURCES
+ qcocoafontdialoghelper.h qcocoafontdialoghelper.mm
+)
+
+#### Keys ignored in scope 13:.:.:cocoa.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
+# PLUGIN_EXTENDS = "-"
diff --git a/src/plugins/platforms/cocoa/CMakeLists.txt b/src/plugins/platforms/cocoa/CMakeLists.txt
new file mode 100644
index 0000000000..9e8b162aec
--- /dev/null
+++ b/src/plugins/platforms/cocoa/CMakeLists.txt
@@ -0,0 +1,154 @@
+# Generated from cocoa.pro.
+
+# special case:
+qt_find_package(Cups PROVIDED_TARGETS Cups::Cups)
+
+#####################################################################
+## QCocoaIntegrationPlugin Plugin:
+#####################################################################
+
+qt_add_plugin(QCocoaIntegrationPlugin
+ OUTPUT_NAME qcocoa
+ DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES cocoa # special case
+ TYPE platforms
+ SOURCES
+ main.mm
+ messages.cpp messages.h
+ qcocoaapplication.h qcocoaapplication.mm
+ qcocoaapplicationdelegate.h qcocoaapplicationdelegate.mm
+ qcocoabackingstore.h qcocoabackingstore.mm
+ qcocoaclipboard.h qcocoaclipboard.mm
+ qcocoacursor.h qcocoacursor.mm
+ qcocoadrag.h qcocoadrag.mm
+ qcocoaeventdispatcher.h qcocoaeventdispatcher.mm
+ qcocoahelpers.h qcocoahelpers.mm
+ qcocoainputcontext.h qcocoainputcontext.mm
+ qcocoaintegration.h qcocoaintegration.mm
+ qcocoaintrospection.h qcocoaintrospection.mm
+ qcocoakeymapper.h qcocoakeymapper.mm
+ qcocoamenu.h qcocoamenu.mm
+ qcocoamenubar.h qcocoamenubar.mm
+ qcocoamenuitem.h qcocoamenuitem.mm
+ qcocoamenuloader.h qcocoamenuloader.mm
+ qcocoamimetypes.h qcocoamimetypes.mm
+ qcocoanativeinterface.h qcocoanativeinterface.mm
+ qcocoansmenu.h qcocoansmenu.mm
+ qcocoascreen.h qcocoascreen.mm
+ qcocoaservices.h qcocoaservices.mm
+ qcocoasystemtrayicon.h qcocoasystemtrayicon.mm
+ qcocoatheme.h qcocoatheme.mm
+ qcocoawindow.h qcocoawindow.mm
+ qcocoawindowmanager.h qcocoawindowmanager.mm
+ qiosurfacegraphicsbuffer.h qiosurfacegraphicsbuffer.mm
+ qmacclipboard.h qmacclipboard.mm
+ qmultitouch_mac.mm qmultitouch_mac_p.h
+ qnsview.h qnsview.mm
+ qnswindow.h qnswindow.mm
+ qnswindowdelegate.h qnswindowdelegate.mm
+ PUBLIC_LIBRARIES
+ ${FWAppKit}
+ ${FWCarbon}
+ ${FWCoreServices}
+ ${FWCoreVideo}
+ ${FWIOKit}
+ ${FWIOSurface}
+ ${FWMetal}
+ ${FWQuartzCore}
+ Cups::Cups
+ Qt::ClipboardSupportPrivate
+ Qt::Core
+ Qt::CorePrivate
+ Qt::FontDatabaseSupportPrivate
+ Qt::GraphicsSupportPrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::ThemeSupportPrivate
+)
+
+# Resources:
+set(qcocoaresources_resource_files
+ "images/sizeallcursor.png"
+ "images/spincursor.png"
+ "images/waitcursor.png"
+)
+
+qt_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
+ PREFIX
+ "/qt-project.org/mac/cursors"
+ FILES
+ ${qcocoaresources_resource_files}
+)
+
+
+#### Keys ignored in scope 1:.:.:cocoa.pro:<TRUE>:
+# OTHER_FILES = "cocoa.json"
+
+## Scopes:
+#####################################################################
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_opengl
+ SOURCES
+ qcocoaglcontext.h qcocoaglcontext.mm
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_vulkan
+ SOURCES
+ qcocoavulkaninstance.h qcocoavulkaninstance.mm
+ PUBLIC_LIBRARIES
+ Qt::VulkanSupportPrivate
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_accessibility
+ SOURCES
+ qcocoaaccessibility.h qcocoaaccessibility.mm
+ qcocoaaccessibilityelement.h qcocoaaccessibilityelement.mm
+ PUBLIC_LIBRARIES
+ Qt::AccessibilitySupportPrivate
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+ SOURCES
+ qcocoasessionmanager.cpp qcocoasessionmanager.h
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION TARGET Qt::PlatformCompositorSupportPrivate
+ PUBLIC_LIBRARIES
+ Qt::PlatformCompositorSupportPrivate
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION TARGET Qt::Widgets
+ SOURCES
+ qpaintengine_mac.mm qpaintengine_mac_p.h
+ PUBLIC_LIBRARIES
+ Qt::WidgetsPrivate
+)
+
+#### Keys ignored in scope 8:.:.:cocoa.pro:TARGET Qt::Widgets:
+# QT_FOR_CONFIG = "widgets"
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION TARGET Qt::PrintSupport AND TARGET Qt::Widgets
+ SOURCES
+ qcocoaprintdevice.h qcocoaprintdevice.mm
+ qcocoaprintersupport.h qcocoaprintersupport.mm
+ qprintengine_mac.mm qprintengine_mac_p.h
+ PUBLIC_LIBRARIES
+ Qt::PrintSupportPrivate
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_colordialog AND TARGET Qt::Widgets
+ SOURCES
+ qcocoacolordialoghelper.h qcocoacolordialoghelper.mm
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_filedialog AND TARGET Qt::Widgets
+ SOURCES
+ qcocoafiledialoghelper.h qcocoafiledialoghelper.mm
+)
+
+qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_fontdialog AND TARGET Qt::Widgets
+ SOURCES
+ qcocoafontdialoghelper.h qcocoafontdialoghelper.mm
+)
+
+#### Keys ignored in scope 13:.:.:cocoa.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
+# PLUGIN_EXTENDS = "-"
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index a919963cf4..953346c56e 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -101,6 +101,8 @@ QT += \
qtConfig(vulkan): QT += vulkan_support-private
+qtHaveModule(platformcompositor_support-private): QT += platformcompositor_support-private
+
CONFIG += no_app_extension_api_only
qtHaveModule(widgets) {
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index 0c14e07551..30838ba254 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -128,6 +128,8 @@ public:
void beep() const override;
+ void closePopups(QWindow *forWindow = nullptr);
+
private Q_SLOTS:
void focusWindowChanged(QWindow *);
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 61308d6bf9..b2698b05fe 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -68,6 +68,10 @@
#include <QtFontDatabaseSupport/private/qfontengine_coretext_p.h>
+#if QT_CONFIG(opengl)
+#include <QtPlatformCompositorSupport/qpa/qplatformbackingstoreopenglsupport.h>
+#endif
+
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/qtwidgetsglobal.h>
#if QT_CONFIG(filedialog)
@@ -324,10 +328,16 @@ QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *wi
return nullptr;
}
+ QPlatformBackingStore *backingStore = nullptr;
if (platformWindow->view().layer)
- return new QCALayerBackingStore(window);
+ backingStore = new QCALayerBackingStore(window);
else
- return new QNSWindowBackingStore(window);
+ backingStore = new QNSWindowBackingStore(window);
+
+#if QT_CONFIG(opengl)
+ backingStore->setOpenGLSupport(new QPlatformBackingStoreOpenGLSupport(backingStore));
+#endif
+ return backingStore;
}
QAbstractEventDispatcher *QCocoaIntegration::createEventDispatcher() const
@@ -487,6 +497,19 @@ void QCocoaIntegration::beep() const
NSBeep();
}
+void QCocoaIntegration::closePopups(QWindow *forWindow)
+{
+ for (auto it = m_popupWindowStack.begin(); it != m_popupWindowStack.end();) {
+ auto *popup = *it;
+ if (!forWindow || popup->window()->transientParent() == forWindow) {
+ it = m_popupWindowStack.erase(it);
+ QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(popup->window());
+ } else {
+ ++it;
+ }
+ }
+}
+
void QCocoaIntegration::focusWindowChanged(QWindow *focusWindow)
{
// Don't revert icon just because we lost focus
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index b15c0ac31c..4bff1de515 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -151,6 +151,7 @@ public:
Q_NOTIFICATION_HANDLER(NSWindowDidEndLiveResizeNotification) void windowDidEndLiveResize();
Q_NOTIFICATION_HANDLER(NSWindowDidBecomeKeyNotification) void windowDidBecomeKey();
Q_NOTIFICATION_HANDLER(NSWindowDidResignKeyNotification) void windowDidResignKey();
+ Q_NOTIFICATION_HANDLER(NSWindowWillMiniaturizeNotification) void windowWillMiniaturize();
Q_NOTIFICATION_HANDLER(NSWindowDidMiniaturizeNotification) void windowDidMiniaturize();
Q_NOTIFICATION_HANDLER(NSWindowDidDeminiaturizeNotification) void windowDidDeminiaturize();
Q_NOTIFICATION_HANDLER(NSWindowWillEnterFullScreenNotification) void windowWillEnterFullScreen();
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 9cb4470e02..28da4fcf5d 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -71,14 +71,6 @@ enum {
defaultWindowHeight = 160
};
-static void qt_closePopups()
-{
- while (QCocoaWindow *popup = QCocoaIntegration::instance()->popPopupWindow()) {
- QWindowSystemInterface::handleCloseEvent(popup->window());
- QWindowSystemInterface::flushWindowSystemEvents();
- }
-}
-
Q_LOGGING_CATEGORY(lcCocoaNotifications, "qt.qpa.cocoa.notifications");
static void qRegisterNotificationCallbacks()
@@ -819,6 +811,11 @@ void QCocoaWindow::windowDidExitFullScreen()
}
}
+void QCocoaWindow::windowWillMiniaturize()
+{
+ QCocoaIntegration::instance()->closePopups(window());
+}
+
void QCocoaWindow::windowDidMiniaturize()
{
if (!isContentView())
@@ -1157,7 +1154,7 @@ void QCocoaWindow::viewDidChangeGlobalFrame()
void QCocoaWindow::windowWillMove()
{
// Close any open popups on window move
- qt_closePopups();
+ QCocoaIntegration::instance()->closePopups();
}
void QCocoaWindow::windowDidMove()
@@ -1286,7 +1283,7 @@ void QCocoaWindow::windowWillClose()
{
// Close any open popups on window closing.
if (window() && !windowIsPopupType(window()->type()))
- qt_closePopups();
+ QCocoaIntegration::instance()->closePopups();
}
// ----------------------- NSWindowDelegate callbacks -----------------------