summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaapplication.mm
Commit message (Collapse)AuthorAgeFilesLines
* macOS: Simplify Objective-C namespacingTor Arne Vestbø2019-10-151-3/+3
| | | | | | | | | | | | | | | | We only need to use the QT_MANGLE_NAMESPACE macro when declaring the interface of the class. As long as we couple that with an alias declaration using QT_NAMESPACE_ALIAS_OBJC_CLASS, any further uses of the class name can be un-namespaced, including declaring categories on the class. The only snag with QT_NAMESPACE_ALIAS_OBJC_CLASS is that it can only be used once per class and translation unit, so forward declarations get hairy, but we can avoid that by just including the headers instead. Change-Id: I333bcd18fe1e18d81fbd560b0941c98b1c32460e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Update all deprecated enums to their 10.12+ equivalentsTor Arne Vestbø2018-08-311-3/+3
| | | | | Change-Id: I3034258da95c9c70eb6758db92967f438617f6e9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Cocoa QPA: Clean up 0 as pointerGabriel de Dietrich2018-04-191-1/+1
| | | | | | | | We use nil for Objective-C null pointers and nullptr everywhere else, including CoreFoundation and similar opaque types. Change-Id: Id75c59413dec54bf4d8e83cf7ed0ff7f3d8bb480 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Replace category methods with functionsPavol Markovic2018-01-101-25/+5
| | | | | | | | | | | | | | Objective-C category methods prohibit safe unloading of dynamic libraries / plugins statically linked to Qt. Although they can be called in convenient way they can be replaced with standalone functions without noticeable drawback. Remove unused qt_validModesForFontPanel category method. Remove empty NSStatusItem (Qt) category. Task-number: QTBUG-59884 Change-Id: I69503a115b1177623da91c67b62d72e56f43ffcf Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Cocoa: Force sending key equivalent up eventsGabriel de Dietrich2016-11-151-2/+22
| | | | | | | | | | | | | | | | Cocoa is known for not sending key up events for key equivalents, regardless of whether it's an actual recognized key equivalent. Notice that only Cmd-based shortcuts suffer from this feature. We decide to force fate and forward the key event to the key (focus) window. However, non-Qt windows will not (and should not) get any special treatment, only QWindow-owned NSWindows. Since we know that Cocoa will not send it to the key window, we can safely forward it and ensure no duplicated key events. Change-Id: I0449f7f5195a327eef6d792bd441fc3fd0882db1 Task-number: QTBUG-36839 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Cocoa QPA Menus: Clean-up QCocoaMenuLoader related codeGabriel de Dietrich2016-08-011-5/+0
| | | | | | | | | | | | | | | Now that QCocoaMenuLoader is a singleton, we can access it the natural way. In all cases, it already needed to be done in an Objective-C file, so it doesn't change anything from this point of view. Furthermore, we decide to remove private accessor APIs in QCocoaApplication and QCocoaApplicationDelegate which are now redundant. Change-Id: I4190ed2e2536b778482c513727e279c9318acb7e Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Use quotes instead of angle brackets for local includes in cocoa plugin.Jake Petroules2016-04-011-4/+4
| | | | | | | This fixes an inconsistency with all other files in platform plugins. Change-Id: If790f51e250c1e3b2e4525efbc18c59be9c5568b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Introduce Qt::AA_PluginApplication replacing Qt::AA_MacPluginApplication.Friedemann Kleint2015-09-011-2/+2
| | | | | | | | | | | Reuse the enumeration value for a generic Qt::AA_PluginApplication attribute since there are also initializations in platform ports other than OS X that need to be suppressed in the plugin case. Task-number: QTBUG-47556 Task-number: QTBUG-45762 Change-Id: I885f75030a251ccf66597aae3580499d012934e7 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* Mangle QNSApplication and methods into a namespaceMelanie Cappelaere2015-07-141-10/+10
| | | | | | | | | | [OS X] Mangle the event handle related calls on QNSApplication, so that the events are passed through the correct QApplications when several Qt5's with different namespaces do UI in the same process. Change-Id: Ibb44246fbcf4a2bc3af5a93c48db0382a1380328 Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Cocoa: fix compiler warning.Erik Verbruggen2015-04-221-1/+1
| | | | | | | | | | /Users/erik/dev/qt5-stable/qtbase/src/plugins/platforms/cocoa/qcocoaapplication.mm:137:18: warning: case value not in enumerated type 'NSEventSubtype' [-Wswitch] case QtCocoaEventSubTypePostMessage: ^ Change-Id: Ib496e61a6939f021c90234fef3689b1643003ddd Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Fixed compilation on Mac OS X (qt namespace and preprocessor issues))Sergei Kulik2015-03-201-5/+5
| | | | | | | | Configured with -qtnamespace <...> -no-opengl -D QT_NO_PRINTER Change-Id: I1c959a89afda08d29a854f21e6e51732d136753c Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Fixed license headersJani Heikkinen2015-02-171-1/+1
| | | | | Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-23/+15
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* cocoa: don't override NSApplication-sendEvent if configured as ↵Tim Blechmann2014-09-151-0/+10
| | | | | | | | AA_MacPluginApplication Change-Id: I48cebbcb814ee8e97583c3165e7cb668077cfbad Task-number: QTBUG-40409 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Fix compiler warning for cast from int to id.Erik Verbruggen2013-11-151-2/+2
| | | | | | | | | | | qcocoaapplication.mm:118:61: warning: cast to 'id' from smaller integer type 'int' [-Wint-to-pointer-cast] id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 intValue] : args->arg1; ^ qcocoaapplication.mm:119:61: warning: cast to 'id' from smaller integer type 'int' [-Wint-to-pointer-cast] id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 intValue] : args->arg2; Change-Id: Ibcf3d5d5698ff863f3c9bd65e0388ccca147f419 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Revert Mac event loop changes.Morten Johan Sørvig2013-09-021-15/+31
| | | | | | | | | | | | | | | "Make QGuiApplication::exec() run within NSApplicationMain()" "Make Qt process native and timer events on Cocoa applications" "Cocoa: Fix QFontDialog, QColorDialog auto-tests" This reverts commits 1e14762b8d79118540bd09a84dd3e48f4f5e113e e4b2a0b4bab2a17a65fedafe9bae50af1fe019f6 df7944e7d7dd8b2bbccbd639eff0ab09745d6cc3 Change-Id: I80b65b5ee0297b090f807bd420664233dfc44f7b Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QGuiApplication::exec() run within NSApplicationMain()Gabriel de Dietrich2013-08-291-31/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We follow the same pattern as for iOS and Windows ports, making sure the user's main() runs in a platform friendly environment. In this particular case, it means calling the user's main() during the call of NSApplicationMain(), and calling the user's main() function (renamed to qMain() as in Windows) after receiving NSApplicationDidFinishLaunchingNotification. In practice, this means that NSApp is running when qMain() is called, and therefore when QCoreApplication::exec() is called. For those command-line utilities running on QGuiApplication, or any deriving class, and that do not provide a bundle, we override the main bundle's dictionary and get NSApplicationMain() to run as usual. Added cocoa/cocoamain "subdir" to build libqtcocoamain.a (together with cocoa/cocoaplugin -- plugins/platforms/cocoa is made a subdirs project). This library is linked against all GUI Qt apps and provides the actual main() function. It also catches the launching NSApplication notifications, and calls the user's qMain() function. Note that this will happen in the same cases when the user's application will run with the Cocoa QPA plugin. Launch related code in QCocoaApplicationDelegate is moved to libqtcocoamain, QNSApplication is removed (but sendEvent: redirection still there), and code in QCocoaEventDispatcher dealing with calling [NSApp run] and related has been removed since it's become unreachable. ChangeLog: [Qt for Mac] Make QGuiApplication::exec() run within NSApplicationMain() Change-Id: I790e5138c29aac2e0215a9147d0148fece40ca22 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Improve Qt-in-namespace implementation in the Cocoa platform pluginRomain Perier2013-05-161-5/+5
| | | | | | | | | | | | | Objective-C++ does not support namespaces. In order to make this work, we decorate each symbol with suffix using the macro QT_MANGLE_NAMESPACE. However, with such a technic each public symbol needs to be explicitly exported through this macro. The use of @compatibility_alias allows to define alias to use it automatically and transparently. Task-number: QTBUG-23946 Change-Id: Id521b8160bab126fda40a9d960277b1c04cc8b66 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Support native event filter for Mac OS XLiang Qi2012-11-091-12/+16
| | | | | | | | | | | Ported from Qt 4 implementation, updated with QAbstractEventDispatcher::filterNativeEvent() call. Tested with an example. Change-Id: I3271f8a565d06d80b7b48ba81728bcdb7b1c32e3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-25/+25
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Cocoa: Remove unused QApplicationPrivate from QCocoaApplicationDelegateBradley T. Hughes2012-06-121-5/+0
| | | | | | | | | | To avoid a QtWidget dependency, we should use QGuiApplicationPrivate isntead, but instead of storing, we can use QGuiAppliationPrivate::instance() instead. Change-Id: If3f63fee804b7ad32fe8d612bf70c051b70f54c8 Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa implementation of QPA menu interface.James Turner2012-05-191-11/+0
| | | | | | | | | | | Implement the QPA platform menu interface for Cocoa, including native menubar support and merging with the predefined menus created from the bundled .nib. Cleanup code previously used to maintain the menus, and add a manual test of the menus code. Change-Id: Ia99267ddb6485e18e05c540eb32c5aee6cbb85db Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Add check to make sure qApp exists before usingChris Meyer2011-12-191-1/+1
| | | | | | | | | | Check for qApp before using. I'm aware that this is in commented out code right now; but I wanted to make sure it doesn't accidently slip back in without this check so I'm submitting this patch. It caused problems at shutdown in 4.8. Change-Id: I1c2358ab94f8b698e5519b3e0f988fb5cdd653fa Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: clean up compiler warnings.Morten Sorvig2011-10-231-0/+2
| | | | | Change-Id: I2cb65bb455b79b218a317b21e5a3b0d9792e0e22 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: Fix spelling errors in comments.Morten Sorvig2011-10-031-1/+1
| | | | | | | | | | This could be the basis for a "english spelling for norwegians" course. Change-Id: I1d6de11b6673ec0a8ba3c2ff12dd8472fb467703 Reviewed-on: http://codereview.qt-project.org/5691 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: QMenu refactor.Morten Sorvig2011-09-071-0/+227
This change prepares for enabling native menus on OS X. Move code from src/widgets to cocoa: - qcocoaapplicaiton - qcocoaapplicaitondelegate - qcocoamenuloader - qcocoamenu - qmenu_mac - misc helpers to qcocoahelpers Create a QNSApplication and QCocoaApplicationDelegate at application startup. New Lighthouse API: - class QPlatformMenu - class QPlatformMenuBar - QPlatformIntegration::createPlatformMenu() - QPlatformIntegration::createPlatformMenuBar() Platforms that wants a native menu integration subclasses QPlatformMenu[|Bar] and implements the create function. The default implementation returns 0, which causes QMenu to use the standard Qt menus. This API is based on the current native menu abstraction that Mac, Wince and S60 uses in Qt 4. The main difference is that the platform classes are proper standalone classes and not #ifdeffed into QMenuPrivate. Change-Id: I3da41f80b0ae903a476937908b1f9b88014b7954 Reviewed-on: http://codereview.qt.nokia.com/4068 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>