summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
Commit message (Collapse)AuthorAgeFilesLines
* QNSView: Remove isMenuView propertyGabriel de Dietrich2018-04-053-13/+3
| | | | | | | This is always NO and no longer needed. Change-Id: I32a3dca6cc427cb074ee3d58bf2202f57af4c623 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-04-051-3/+5
|\ | | | | | | Change-Id: I954bd6418bc862a04691240c0f1766f6ce033640
| * Cocoa: Make QMacNativeWidget paint correctlyMorten Johan Sørvig2018-04-031-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | QWindows with transparent pixels (of which QMacNativeWidget is an example) must be composited, even if they are content views. This will display the NSWindow background instead of solid black for the areas where the Qt backingstore has transparent pixels. Change-Id: Ibee1327e11bc64975900b4c5d632dd5f103da4c8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Move delivery of update requests into QPlatformWindowTor Arne Vestbø2018-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Having deliverUpdateRequest in QWindowPrivate was a bit awkward and asymmetric to the QPlatformWindow::requestUpdate() API. Keeping them together follows the existing pattern of plumbing things through the platform window, and also allows us to move away from platform plugins relying on QWindowPrivate implementation details. Change-Id: Ib131ccdd1c2bdd6ff1c8d95facbc3f6f88a1abcf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-03-282-3/+7
|\| | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_mouse.mm src/testlib/testlib.pro Change-Id: Ia0ce4243418fe6a485b0f290c67bd433b3b04ff2
| * macOS: Handle NaN mouse event positionsNathan Collins2018-03-211-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | When performing gestures such as Exposé or Mission Control with the mouse button down, the position of the mouse release event is returned with NaN values. This causes QGuiApplicationPrivate::processMouseEvent to be called recursively and ultimately crash. Task-number: QTBUG-67194 Change-Id: If1536bc4dc2075c498cdd6c5afe57c86bdaac13b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * Cocoa: Restore resizable window mask setting to 5.9 behaviorMorten Johan Sørvig2018-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | This should be tied to the CustomizeWindowHint flag: if that flag is set we start out without NSResizableWindowMask and possibly add it later on if WindowMaximizeButtonHint is set. Change-Id: I7e826d4bd357a8a17c60cfef948af25d61b66ebf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Cocoa: Deliver window activation events synchronouslyMorten Johan Sørvig2018-03-261-2/+2
| | | | | | | | | | | | | | | | | | This prevents delivering queued activation events to windows that have been hidden or destroyed. Task-number: QTBUG-66536 Change-Id: I4edf86b6c8592751130f836876725c786452933c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Cocoa: Remove m_viewIsEmbedded and m_ViewIsToBeEmbeddedMorten Johan Sørvig2018-03-214-30/+31
| | | | | | | | | | | | | | | | | | | | | | | | Implement QCocoaWindow::isEmbedded() which detects this property based on parent view and window type. This avoids having to use a setter function to set the state. The detection can’t handle all cases, but should be sufficient for our use case. Change-Id: I12a5b90b4e4a7e10714f7275ae001e99c9361e2c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | macOS: Make [QNSView wantsLayer] declarativeTor Arne Vestbø2018-03-212-3/+12
| | | | | | | | | | Change-Id: Ib5dc8178293d13542a54d51484181debd57580f5 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Provide helper property for resolving the display ID of a screenTor Arne Vestbø2018-03-203-3/+15
| | | | | | | | | | Change-Id: I144bd33a2c122d53ea1435a53483a3d8b46fd093 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Remove stray qDebug in [QNSView setNeedsDisplayInRect:]Tor Arne Vestbø2018-03-201-1/+0
| | | | | | | | | | Change-Id: Ia253edf84bc0c890f291499ed2635d8287b18327 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Do layer updates via the CALayerDelegate protocolTor Arne Vestbø2018-03-202-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The updateLayer function is only called when the layer is a _NSViewBackingLayer instance, which is what the default implementation of [NSView makeBackingLayer] returns. Once we move to optionally returning a CAMetalLayer, we need to use the more generic displayLayer: API, so we do that now as a first step. This matches the way we draw and send expose events on iOS. Change-Id: I49721ff005ca9dfddebff645705f96b5ab46abb4 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | macOS: Move QNSView drawing related functionality to its own fileTor Arne Vestbø2018-03-203-117/+172
| | | | | | | | | | Change-Id: Iaeaa5c57368445a1fd67d110823c919aa7173a7a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Cocoa: Fix crash in currentModalSession()Morten Johan Sørvig2018-03-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add null-pointer checks to QCocoaEventDispatcher:: currentModalSession(): - window->handle() may return nullptr if the window has been destroyed. - We call beginModalSessionForWindow, which processes events. This can potentially destroy or delete the current window; pointers to it must be checked again. This also has the effect that currentModalSessionCached is not set to a session that does not have a window, also prevents clearing the cleanupModalSessionsNeeded flag for such sessions. Task-number: QTBUG-66536 Change-Id: Ie055933c872a8ede3c938882fb2d4f7cf8ff3c81 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | macOS: Split up qnsview.mm into separate category-files for major areasTor Arne Vestbø2018-03-179-1657/+2016
| | | | | | | | | | | | | | | | | | | | Makes it easier to get an overview of the code, work on separate sections/areas in isolation, and highlights which part of the APIs we are using from outside of QNSView, and internally between the different parts of QNSView. Change-Id: Ia2c5ab9a68bf75feddba853ac20d3bb397f7564b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | macOS: Limit @interface declarations in headers to public interfaceTor Arne Vestbø2018-03-172-48/+3
| | | | | | | | | | | | | | | | | | We've never had the policy to declare every function that we override, so to clean up the headers and for consistency we remove any declaration that's not part of the public interface. Change-Id: Ie71dc062b9d2252872e1434ca19f8f537cdd6f96 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | macOS: Clean up some more Objective-C usage in QNSView implementationTor Arne Vestbø2018-03-172-48/+45
| | | | | | | | | | | | | | | | | | | | - Format selectors consistently - Use proper style for init methods Follow-up to ba871065e0f40e9197fa4ee0ffe76530bb6fca11 Change-Id: I5742e248b83d5955b1d110038dd1b4d79d701fbb Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | macOS: Group stray input context function with other input context functionsTor Arne Vestbø2018-03-172-10/+10
| | | | | | | | | | Change-Id: I9be3c170c20aca8a7d3c8bb81b7b019cd555b3f1 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | macOS: Remove 'cocoa' infix in QPA logging categoriesTor Arne Vestbø2018-03-147-48/+48
| | | | | | | | | | | | | | | | Makes the naming of QPA logging categories the same across different platforms, which makes it easier to debug an unfamiliar platform. Change-Id: I60ed34892d154e86723c8e4bcff3c28fcab1f7a1 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-03-085-46/+54
|\| | | | | | | Change-Id: Idf471ca5c6cf211813466b539ce45bdc1ae9b97c
| * QCocoaMenuItem: Make QCocoaNSMenu the item targetGabriel de Dietrich2018-03-075-46/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we made the NSMenu delegate a singleton we could not rely on it to have enough information to implement worksWhenModal. At the same time as the delegate change, we derived NSMenu into QCocoaNSMenu. This allows us to extend the menu functionality and, in this case, serve as target for the Cocoa menu items. We also refactor setting the item's target/action. Manually tested against menurama and bigmenucreator tests, the test-case for QTBUG-17291, and the richtext/textedit example. Change-Id: I222241f71db82611711b23d4a8c6122a741370ae Task-number: QTBUG-66676 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-03-071-0/+1
|\| | | | | | | Change-Id: I110feec4750bd304975bab4f3f33d3a61a4e08bd
| * cocoa: add qCDebug in QNSview::scrollWheelShawn Rutledge2018-03-061-0/+1
| | | | | | | | | | | | | | | | | | If you enable both qt.qpa.input.touch and qt.qpa.cocoa.mouse you can see the order and interleaving of the touch and scroll events. Task-number: QBUG-66329 Change-Id: I8e1a63e2958b85f7964bb597e49cf8529cb3f32e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | macOS: Base window collection behavior on the correct window flagsTor Arne Vestbø2018-03-051-7/+11
| | | | | | | | | | | | | | | | | | When QCocoaWindow::setWindowFlags is called, the window()'s flags have not been updated, so re-computing the collection behavior based on those would not be correct. Change-Id: I5512da75104483eac7100880c164a9d08fd82984 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | macOS: Don't keep window flags around, we can get them from the QWindowTor Arne Vestbø2018-03-053-43/+41
| | | | | | | | | | Change-Id: I629a58e699ad39ec429e1e275152434db4abc572 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-02-281-0/+5
|\| | | | | | | Change-Id: Ib21e6b9030b4d5363f440d082ce3df28098d1b95
| * macOS: Warn the user when KVO-observing QCocoaNSWindowTor Arne Vestbø2018-02-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We recreate the window of our QNSView in various situation such as changing the styleMask, which results in either a new QNSwindow or QNSpanel being set as the window of the view. KVO-observing the window property of the view will fail we then have a new window instance, and will crash when trying to remove the observer from the new window. Unfortunately catching the NSRangeException that happens when removing an observer from a 'switched' window is not possible, so the user is left with: Terminating app due to uncaught exception 'NSRangeException', reason: Cannot remove an observer <Foo 0xabc> for the key path "bar" from <QNSPanel 0xdef> because it is not registered as an observer. Change-Id: Ib2adbb99f19303a054fb1eb65e959aecd32b1162 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-02-261-3/+4
|\| | | | | | | Change-Id: I5a919ac999c4c5a3ca2024b63a78c094a44a1191
| * Cocoa: Fix incorrect QSystemTrayIcon::geometry()Morten Johan Sørvig2018-02-261-3/+4
| | | | | | | | | | | | | | | | | | | | The coordinate conversion was wrong. Use QCocoaScreen::mapFromNative() instead. Task-number: QTBUG-53184 Change-Id: I50f18d68ba5d7e1cb5046523a608bfa2e076d7ea Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-02-231-13/+16
|\| | | | | | | Change-Id: I01dfc41e18333ac55954296cef8f01475adab27e
| * Cocoa: fix grabWindow when mixing highDPI and non-highDPI screensPablo Marcos Oltra2018-02-221-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | CGDisplayCreateImageForRect seems to have a weird behavior when mixing highDPI and non-highDPI screens since it may take part of the non-highDPI screen when the highDPI display is at the left or at the top of the main monitor. To workaround this issue, we capture the whole screen and then crop the image to the desired size. Task-number: QTBUG-47643 Change-Id: Ib2a3850a0a549964c7fe272abb563bd23518c234 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-02-211-4/+2
|\| | | | | | | Change-Id: I9c90d71fde002544fd97df7e8a2690953cf9f817
| * Merge "Merge remote-tracking branch 'origin/5.10.1' into 5.11" into ↵Tony Sarajärvi2018-02-201-1/+1
| |\ | | | | | | | | | refs/staging/5.11
| | * Merge remote-tracking branch 'origin/5.10.1' into 5.11Liang Qi2018-02-191-1/+1
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/sqldrivers/psql/qsql_psql.cpp Change-Id: I070b455078b41e75c46562fcea5676d6218cd00c
| | | * QCocoaWindow: be more careful when flushing eventsRichard Moe Gustavsen2018-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Flushing the QPA event queue is problematic since we can then end up delivering several events to Qt (or the app) at the same time on the call stack. This again can easily leave objects in an inconsistent state if they receive callbacks from subsequent events while being occupied processing the first. This is also what happens in the listed report. A QMenu shows a sub menu when the mouse enters a menu item. The show leads to QPA flushing events, which in some cases also includes flushing another pending move event. The move event is delivered to the same QMenu, which will clear a private variable (currentAction). When the show returns, the state of QMenu has unexpectedly changed, which causes a crash to happen since currentAction is null. This patch will fix the root cause of the problem by stopping QCocoaWindow from flushing user input events when the call location does a flush to deliver geometry events. Task-number: QTBUG-66093 Change-Id: Id277550b0a080ad98c81e8c30dc7098dc73723d5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * | | macOS: Don't assume m_view is QNSView when calling requestUpdateTor Arne Vestbø2018-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I98833c5ecc5816a0926045e10ef0442a39be6b2e Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * | | macOS: Remove unused variableTor Arne Vestbø2018-02-191-2/+0
| |/ / | | | | | | | | | | | | | | | Change-Id: I7e016db57cbf347529b6aa003d84585eeab0767d Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Clean up our Objective-C usageJake Petroules2018-02-2026-316/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Move ivars into @implementation - Use instancetype where applicable - Use dot notation for property access - Use subscript operator for dictionaries and arrays - Format selectors consistently - Use proper style for init methods - Use generics instead of void pointers where possible - Use "range for" loops instead of indexing - Replace or replace IBAction/IBOutlet with void Change-Id: I1667812a51d4dfe44ae80fe337cb1f4bc9699d92 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-02-168-37/+92
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/tools.pri Change-Id: I705630f9cecbf0ce51a22fc6116b8c49611259e9
| * | Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-154-29/+61
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/corelib.pro src/corelib/global/qrandom.cpp src/network/access/qhttpnetworkrequest_p.h src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/cocoa/qcocoansmenu.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/offscreen/qoffscreenintegration.h src/widgets/kernel/qaction.cpp src/widgets/widgets.pro Done-with: Andy Shaw <andy.shaw@qt.io> Change-Id: Ib01547cf4184023f19858ccf0ce7fb824fed2a8d
| | * \ Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-02-071-2/+5
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoamenu.mm Change-Id: I11c5f8466c5b51e13e5ef6a8fc6e3f2dd79122a7
| | * | | macOS: Share view update code between layered and non-layered modeTor Arne Vestbø2018-02-051-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I8eaf0607c1ede18ed20180fd43cc93744c99962d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
| | * | | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-02-021-4/+8
| | |\ \ \ | | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp Change-Id: Ia28ea4f29d308ba3aa16c2a86ffc57049c6ea590
| | * | | Merge remote-tracking branch 'origin/5.10.1' into 5.10Liang Qi2018-02-013-27/+39
| | |\ \ \ | | | | | | | | | | | | | | | | | | Change-Id: Ibbe355f5e8ef12e5ffeb4e33b6a80760c3e2b464
| | | * | | macOS: Handle update requests via setNeedsDisplay more carefullyTor Arne Vestbø2018-02-013-27/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of trying to detect situations where we need to send a real expose event instead of an update request in response to a drawRect call, we keep track of when we've asked the view to display due to a requestUpdate call, and only deliver the corresponding drawRect as an update request if no other code has asked the view to display. This should cover all cases of asking the view to display, issued from our code or from AppKit, such as the view changing its backing scale factor, or otherwise needing a real expose event. Task-number: QTBUG-65663 Change-Id: I1783787823aee889dad8e48f34a1cb0f1b7b06bd Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| | * | | | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-291-2/+0
| | |\ \ \ \ | | | |/ / / | | |/| | | | | | | | | Change-Id: I6b40ecee4db13e6329e7a0433b57c5bca473c63f
| | * | | | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-261-0/+18
| | |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | Change-Id: I7bfb75083f60190aa1def82d153f89925a92fd56
| | * | | | | Cocoa: Make dialogs non-resizable againMorten Johan Sørvig2018-01-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix regression from commit 8b3a120a where also dialogs got NSResizableWindowMask, making them have a Zoom button. Task-number: QTBUG-65668 Change-Id: I21054b3aa6fc11eab3d93f78ede44ae771522e2c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * | | | | | Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-144-8/+31
| |\ \ \ \ \ \ | | | |_|_|_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/animation/qvariantanimation.cpp src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/corelib/io/qprocess_win.cpp src/corelib/json/qjsonarray.cpp src/corelib/tools/qsimd_p.h src/corelib/tools/qtimezoneprivate_p.h src/corelib/xml/qxmlstream_p.h src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qsimpledrag_p.h src/plugins/generic/generic.pro src/plugins/platforms/cocoa/qcocoamenu.mm src/widgets/styles/qmacstyle_mac.mm tests/auto/concurrent/qtconcurrentmap/BLACKLIST tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qmessagebox/BLACKLIST Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e