summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.mm
Commit message (Collapse)AuthorAgeFilesLines
* macOS: Use same naming for QPA event forwarding functionsTor Arne Vestbø2017-07-091-20/+20
| | | | | | | Expose events and others will follow. Change-Id: I8e11a133381a678517b54ad1872fe302515d4104 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Simplify QCocoaWindow::handleGeometryChangeMorten Johan Sørvig2017-07-091-10/+9
| | | | | | | | | | | | | | There are really only two cases here, where the difference is the coordinate system of the window position. 1) Child QWindow and embedded QWindow: The position is relative to parent view/window origin. 2) Top-level QWindow: The position is relative to screen origin. Change-Id: I867133a5adbbf3a690f574aec06b70c2bc64ad95 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Move geometry reporting from QNSView to QCocoaWindowTor Arne Vestbø2017-07-081-4/+53
| | | | | | | | | | | There's no longer any reason to call out from QCocoaWindow to QNView for this, as the geometry events from AppKit are delivered directly to the QCocoaWindow. Most of the data used in the implementation are coming from QCocoaWindow anyways, and this enables geometry events for foreign windows in the future. Change-Id: Idd724d078e9981304dcbe6742b9ddc71640a2350 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Relieve platform plugins of having to persist geometry on WM callbacksTor Arne Vestbø2017-07-071-5/+2
| | | | | | | | | We can offload this to QGuiApplication, just like the geometry of the QWindow is set. This ensures that all platforms behave the same, and that the documentation of QPlatformWindow::setGeometry is adhered. Change-Id: I19dbc32cb4fb146d716ec289c28030a547d3afaa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove requirement to call QWindow::setMask after creating windowTor Arne Vestbø2017-06-281-1/+4
| | | | | | | | | | | Like other QWindow properties we can just store it, and the platform window should pick it up on creation like other properties. [ChangeLog][QtGui][QWindow] setMask() no longer requires the window to be created to have an effect; it can be set at any time. Change-Id: I55b616363801b770bd61bda5325b443013b99866 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* macOS: Allow maximizing utility windowsTor Arne Vestbø2017-06-271-3/+3
| | | | | | | | | They have a native maximize/zoom button in their titlebar, so there's no reason for us to prevent the same action via the API. The only states that are prevented are minimized and fullscreen. Change-Id: I84fa48b31b243fa838c90ecdeee92a2f3448ee14 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Merge QCocoaWindow::setWindowShadow into its only callerTor Arne Vestbø2017-06-261-10/+3
| | | | | Change-Id: I14149231d12658c59e3f9f87f2943ccdfbea4d43 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Simplify recreateWindowIfNeeded debug outputTor Arne Vestbø2017-06-241-7/+3
| | | | | Change-Id: I0e12502de544f79636ec1a67b87bc856ddfc6675 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Remove support for child NSWindowsTor Arne Vestbø2017-06-211-280/+32
| | | | | | | | | | | | | | | The private feature was only used by QToolBar to solve QTBUG-33082, but the solution doesn't work, and complicates the macOS platform plugin quite a bit. A better solution is likely to use Core Animation layers, which is a direction we're going in anyways. To make it easier to modernize the macOS platform plugin, including moving to using layers, we remove the child NSWindows codepaths for now. Change-Id: I4b19464be3980fd84dd7af8316d4d5e85ba813b1 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* macOS: Move QNSWindow implementation into separate fileTor Arne Vestbø2017-06-211-383/+1
| | | | | Change-Id: Ie75419c7ffb7a8fdf78d53e1ea14afee63ef1656 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-05-291-4/+92
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/common/msvc-desktop.conf mkspecs/win32-g++/qmake.conf mkspecs/win32-icc/qmake.conf src/platformsupport/fontdatabases/mac/coretext.pri src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm Change-Id: I74a6f7705c9547ed8bbac7260eb4645543e32655
| * macOS: Don't keep WA_MacAlwaysShowToolWindow windows always on topTor Arne Vestbø2017-05-241-2/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On macOS if an application is no longer active then it will cause any tool windows to hide until the application is active again. For applications that did not want this behavior and thus wanted the tool window to stay visible, the WA_MacAlwaysShowToolWindow flag is available. In order to ensure that this flag is respected, the tool window needs to have its level changed when the application active status changes. Once it is no longer active the window needs to be seen as a normal window, and when it is active then it needs to be set to be a window that is always on top to get the right behavior. Due to various bugs in AppKit we need to explicitly order windows in front during this process, which requires us to then iterate the windows in back-to-front order. For macOS versions < 10.12 there is no way to get an ordered list of windows, so we fall back to using the window creation order. Task-number: QTBUG-57581 Change-Id: If20b4698616707685f83b1378f87593f8169c8c6 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
| * macOS: Don't create NSWindow for embedded viewsTor Arne Vestbø2017-05-161-2/+10
| | | | | | | | | | | | | | | | | | | | | | An embedded view does not have a QCocoaWindow parent, but that doesn't mean it's a top level. Improved debug logging to make issues related to this code easier to spot in the future. Change-Id: I15b5acdd8d7112600618465a3b65b64fddc306f7 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Remove workaround when adding view as subviewTor Arne Vestbø2017-05-221-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | a6b34517e introduced this code as a workaround for stale QCocoaWindow pointers during event delivery, but these days QCocoaWindow is a QObject and guarded by QPointer. Disassembly of AppKit also shows that the view is removed for us, so there's no need to do it explicitly, especially as this causes two distinct event callbacks from AppKit for what should be one atomic operation. Task-number: QTBUG-42059 Change-Id: I212c894adf6aee51256ceff03c9821a995c2a63d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Remove workaround when setting view as content viewTor Arne Vestbø2017-05-221-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | abde2a59c60 introduced this code on the basis that setContentView does not remove the view from its superview, but disassembly of AppKit shows that it does. Since commit 52767b8ee754 we also ensure that the previous NSWindow has its contentView property cleared, so this workaround is no longer needed. Task-number: QTBUG-39628 Change-Id: I21e179263d006f3af1f8a55e9e2f7e8eeab2a632 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Guard on platform window instead of window delegate in QNSWindowHelperTor Arne Vestbø2017-05-121-2/+2
| | | | | | | | | | | | | | | | | | The platform window is cleared in detachFromPlatformWindow, just like the delegate, but the platform window may be cleared due to other reasons as well, so use that as a guard before calling functions on the pw. Change-Id: Ie0773182073d4932b2bca8bc0fc8af24b8895a9d Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Reduce usage of m_nsWindow to manipulate the view's NSWindowTor Arne Vestbø2017-05-091-111/+138
| | | | | | | | | | | | | | | | | | | | | | | | With the right guards for isContentView() we can use m_view.window directly. The only instances left of m_nsWindow are during window creation, which will be removed in a followup. Message send syntax for reading or writing Objective-C properties has been replaced with dot syntax where appropriate. Change-Id: I86925753612516625c93ea5bbedc98a3ddd8fec4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | macOS: Reduce usage of m_nsWindow in favor of isContentView()Tor Arne Vestbø2017-05-081-31/+33
| | | | | | | | | | | | | | | | | | | | | | The m_nsWindow member both indicates whether or not the QCocoaWindow represents the content view of a NSWindow, and provides access to that NSWindow. The former is better expressed through isContentView(), which allows us to then replace m_nsWindow entirely in a followup with access though m_view.window, removing the need to cache the NSWindow. Change-Id: I6e7de4b6d64b29fc9023222be045254f18be28cd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-05-071-0/+2
|\| | | | | | | | | | | | | | | Conflicts: src/network/access/qnetworkreply.cpp tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp Change-Id: Iadf766269454087e69fb216fc3857d85b0ddfaad
| * macOS: Add autorelease-pool when recreating NSWindowTor Arne Vestbø2017-05-021-0/+2
| | | | | | | | | | | | | | | | Significantly reduces the number of objects left to rot in the root pool, which is only drained on application shutdown. Change-Id: Iad7520ab083715416d95413a63474b9153f22fb5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-201-2/+4
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.h src/corelib/tools/qdatetime.h src/corelib/tools/qstring.h src/corelib/tools/qversionnumber.h src/plugins/platforms/android/qandroidplatformintegration.cpp tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp Change-Id: Iefd92a435e687a76cd593099e40d9a9620a1454d
| * macOS: Initialize window geometry early on, instead of when creating NSWindowTor Arne Vestbø2017-04-191-2/+4
| | | | | | | | | | | | | | | | | | We don't need to defer to NSWindow creation before determining the initial window geometry, and we don't need to redetermine each time we re-create an NSWindow for a QCocoaWindow. Change-Id: Ie13380830b44e96670ff16513f29deef5f5ae313 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-041-16/+13
|\| | | | | | | | | | | | | | | Conflicts: src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h src/plugins/platforms/xcb/qxcbwindow.cpp Change-Id: Ic747c3c50e68c005b425e7a1ec2a90965527c8bd
| * macOS: Remove workaround for default-sized NSViewsTor Arne Vestbø2017-03-281-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The workaround introduced in 38a55c7 to explicitly call viewDidChangeFrame() was not ideal for a multitude of reasons. Instead we can just initialize the NSView with a NSZeroRect frame, which will ensure that whatever geometry we set from the Qt side will result in geometry change and expose events. The only case where we will not receive an expose event is if the QWindow is requested to be 0x0 sized, but that wouldn't warrant an expose event anyways. Also, it's not possible to initialize a QWindow to 0x0 from the Qt side, as that will trigger QPlatformWindow::initialGeometry() to pick the default size (160x160 in the case of macOS). Task-number: QTBUG-58963 Change-Id: Ia84de7edcfdf26b90e4e93186fabe8b5c7382caa Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * Avoid expensive QHash::values() callsAnton Kudryavtsev2017-03-281-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | qcocoawindow.mm: we can replace QHash::values() with std::vector since CoW is needless here and std::vector is more cache-friendly. Also replace foreach with range-based for. qitemeditorfactory.cpp: QHash::values() is used as auxiliary container to create QSet. Replace it with std::vector since CoW is needless here and apply sort-unique idiom to remove duplicates. Also avoid needless allocations. Change-Id: If34c7016977ceb7fab68e9298bf2e1944af79139 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * QCocoaWindow - fix a compilation errorTimur Pocheptsov2017-03-281-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Clang does not like Q_FALLTHROUGH in 'default' label, the diagnostics is: 'fallthrough annotation does not directly precede switch label'. Accodring to their docs: "The fallthrough (or clang::fallthrough) attribute is used to annotate intentional fall-through between switch labels. It can only be applied to a null statement placed at a point of execution between any statement and the next switch label." - obviously, there is no 'next switch label' in our case. Change-Id: Ia7dba4cb965a85d229d44b04b69633a8f07d4a0c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * macOS: Disassociate NSView from contentView when switching NSWindowsTor Arne Vestbø2017-03-271-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a NSView is the contentView of a NSWindow, it still has a superview, in this case an NSThemeFrame, and the theme frame is the view that retains the view, not the contentView property of the window. Unfortunately, when a view is removed from the NSThemeFrame by means of [NSView removeFromSuperview], or indirectly via [NSView addSubview:], AppKit does not update the contentView property of the corresponding NSWindow. The result is that the NSView might be deallocated while the NSWindow still is around, with a stale contentView property. To work around this we explicitly disassociate the view from the NSWindow when we know that we are going to release the NSWindow. This will take care of both resetting the property to nil, and remove the view from the NSThemeFrame superview. Task-number: QTBUG-59734 Change-Id: I1111d492f52fe5bdf86bbae071421f6a8a7a38b8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-201-0/+7
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qfilesystemengine_win.cpp src/gui/text/qdistancefield.cpp src/plugins/platforms/xcb/qxcbconnection.h Change-Id: I1be4a6f440ccb7599991159e3cb9de60990e4b1e
| * QCocoaWindow: fix geometry issue when only minimumSize is setOleg Yadrov2017-03-181-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | When only minimumSize was set and it matched to the size NSView was created with, viewDidChangeFrame() was not called for the window and it's internal geometry value was still (0, 0) what led to unpleasant side effects such as QML content was not displayed until something caused an update. Task-number: QTBUG-58963 Change-Id: Ib12d36d405969971e7ff62b79b50c3d78928a649 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | Make QWindow's windowState a QFlags of the WindowStateOlivier Goffart2017-03-161-3/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | This reflects QWidget API, and restores some behavior from Qt4. Some WM can have several state at the same time. On Plasma for example, when a window is both maximized and minimized, the "maximized" checkbox is checked from the taskbar entry. The API of QPlatformWindow was changed to take a QFlag and the platform plugins were adapted. - On XCB: Always send the full state to the WM. And read the full state. - On Windows: The code was originally written with '&' in Qt4, and was changed to == when porting. Some adaptation had to be made so the states would be preserved. - On macOS: Only a single state can be set and is reported back for now, with the possibly to expand this in the future. - Other platforms: Just do as before with the effective state. Task-number: QTBUG-57882 Task-number: QTBUG-52616 Task-number: QTBUG-52555 Change-Id: I7a1f7cac64236bbd4c591f796374315639233dad Reviewed-by: Gunnar Sletta <gunnar@crimson.no> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* macOS: Make sure NSResizableWindowMask is set when toggling fullscreenTor Arne Vestbø2017-02-221-14/+28
| | | | | | | | | | | | Instead of setting the mask in toggleFullScreen(), which is only hit when going to fullscreen via our own API, we do it in the window notification callbacks, which also includes going to full screen via the native macOS title bar buttons. This allows making customized windows without Qt::WindowMaximizeButtonHint full screen with the full geometry of the screen. Change-Id: I63c3e4582ea7c4fe8c0008265793c5f656b830b2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QWindow: Remove "_q_foreignWinId" dynamic propertyTor Arne Vestbø2017-02-221-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The platform plugins reading this out of the QWindow was a layering violation, and propagates the notion that a window can shape shift into representing a new native handle, while none of the platform plugins support this. A foreign QWindow is created via the factory function fromWinId(), at which point we can pass the WId all the way to the platform plugin as function arguments, where the platform will create a corresponding platform-window. The platform window can then answer the question of whether or not it's representing a foreign window, which determines a few behavioral changes here and there, as well as supplying the native window handle back for QWindow::winId(); [ChangeLog][QtGui][QWindow] The "_q_foreignWinId" dynamic property is no longer set nor read. [ChangeLog][QtGui][QPA] The function createForeignWindow() has been added to QPlatormIntegration and is now responsible for creating foreign windows. The function isForeignWindow() in QPlatformWindow has been added, and platforms should implement this to return true for windows created by createForeignWindow(). Task-number: QTBUG-58383 Change-Id: If84142f95172f62b9377eb5d2a4d792cad36010b Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* macOS: Retain foreign windowsTor Arne Vestbø2017-02-201-0/+1
| | | | | | | | | | | | | Regression after 89842b97d74d1, where the retain was part of setView. We release m_view in the destructor, regardless of how the view was acquired, and the non-foreign window retains by being the one creating the view. Task-number: QTBUG-59001 Change-Id: I6d9621a63ea6ec2cee008986b0ab72ff61110ad7 Reviewed-by: René J.V. Bertin <rjvbertin@gmail.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Move NSWindow creation properties into createNSWindow()Tor Arne Vestbø2017-02-161-56/+36
| | | | | | | | | | Allows the block in recreateWindowIfNeeded() that calls createNSWindow() to focus on how to (re)parent windows/views, while createNSWindow() takes care of how to set up the window. Dynamic properties that may change later on are handled in e.g. setWindowFlags(). Change-Id: Ice0e44d004bd2608b2b54e6dde0f404a1e07dc10 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* macOS: Rewrite window state handlingTor Arne Vestbø2017-02-161-86/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of relying on specific notifications to change the window state we now evaluate the state based on the current window state. This allows us to get rid of windowShouldZoom in the window delegate, making window state handling work for foreign windows as well, and also allows us to re-evaluate the state in more places, such as when moving a window, which may bring it out of maximized state. The full screen state is tracked by a helper category that doesn't just rely on the styleFlag, but also on the full screen notifications. This is needed as macOS will complain if you try to go in or out of fullscreen while a transition is in effect. The differentiation between performFoo: and foo: has been removed, as the latter works in both cases and doesn't rely on the button being visible/enabled. These changes fixes many observed quirks in the window state handling that also resulted in making it hard to write tests that relied on the fullscreen/maximized operations always working. Change-Id: I0538c42d9223a56f20ec9156f4939288e0750552 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Don't hide NSWindowZoomButton when window can go into fullscreenTor Arne Vestbø2017-02-151-1/+2
| | | | | | | | | | | | | | | The button in the title bar is used both for going into full screen and maximizing (zooming) the window. We can't hide/disable it unless both Qt::WindowFullscreenButtonHint and Qt::WindowMaximizeButtonHint are off. This means that when Qt::WindowMaximizeButtonHint is off, it's still going to be possible to Option-click the button to maximize the window, but this is less of a concern than hiding the full screen button when Qt::WindowFullscreenButtonHint is set. Change-Id: I70dbe27b3197fe22c1781277f8bf9a818d71d04d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Handle window state changes directly in QCocoaWindowTor Arne Vestbø2017-02-111-11/+19
| | | | | | | | | | | | | Now that notification callbacks are delivered directly to QCocoaWindow, it doesn't make sense to then send them to QPA via QNSView. By skipping the QNSView roundtrip we also enable window state notifications for foreign windows. As an optimization we no longer flush all window system events, but use the new synchronous API to deliver the window state change event. Change-Id: I529b625fbe22e664c34a51bcd4448d1bf0392e6b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add QPlatformWindow::isForeignWindow()Tor Arne Vestbø2017-02-091-6/+6
| | | | | | | | Simplifies code at call sites and allows for refactoring how to decide if a window is foreign or not at a later point. Change-Id: Icc51a83bac187f4975535366b53b4990832b6c82 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2017-01-251-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/common/msvc-desktop.conf mkspecs/common/msvc-version.conf mkspecs/common/winrt_winphone/qmake.conf mkspecs/features/mac/default_post.prf mkspecs/features/mac/sdk.prf mkspecs/features/qt.prf mkspecs/features/uikit/default_post.prf mkspecs/features/winrt/default_pre.prf mkspecs/winphone-arm-msvc2013/qmake.conf mkspecs/winphone-x86-msvc2013/qmake.conf mkspecs/winrt-arm-msvc2013/qmake.conf mkspecs/winrt-x64-msvc2013/qmake.conf mkspecs/winrt-x86-msvc2013/qmake.conf qmake/generators/win32/msvc_vcproj.cpp src/gui/kernel/qwindowsysteminterface.cpp src/network/kernel/qhostaddress.cpp src/plugins/platforms/mirclient/qmirclientplugin.cpp src/plugins/platforms/mirclient/qmirclientplugin.h src/widgets/util/qsystemtrayicon.cpp tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp tools/configure/Makefile.mingw tools/configure/Makefile.win32 Done-with: Jake Petroules <jake.petroules@qt.io> Done-with: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Change-Id: I4be3262d3994e11929d3b1ded2c3379783797dbe
| * Cocoa: fix regression preventing windows from showing upOleg Yadrov2017-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The regression was introduced by 593ab638609 which fixed another bug related to window modality. To determine whether the window needs to be (made key and ordered front) or just (ordered front), instead of calling currentModalSession() which might change internal state of event dispatcher we just check if cocoaModalSessionStack is empty or not. Task-number: QTBUG-57991 Task-number: QTBUG-56166 Change-Id: I6c4f92860d8c93decd44e572af1690ed7be6f1f0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | macOS: Keep reference to NSScreen via index instead of pointerTor Arne Vestbø2017-01-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Manual revert of 73e68a9c0f8b6, which was flawed. macOS can, and will, dealloc and realloc NSScreen instances for a given screen index, for example when deallocing an NSWindow, which has the screen as an auxiliary resource. This is also documented for +[NSScreen screens], which states that "The array should not be cached". Task-number: QTBUG-58128 Change-Id: I926513a26cb7af52acd7fc5ee9380ef29ede65e6 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | QCocoaWindow: Fix 10.10 sheet API deprecation warningGabriel de Dietrich2017-01-121-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 'beginSheet:modalForWindow:modalDelegate:didEndSelector: contextInfo:' is deprecated: first deprecated in macOS 10.10 - Use -[NSWindow beginSheet:completionHandler:] instead [-Wdeprecated-declarations] Similarly, although it won't emit any warning, we replace the usage of -[NSApplication endSheet:] wit -[NSWindow endSheet:]. Change-Id: Iae71247f818b7183d09c6831fa4cb1b71a54a87a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | macOS: Don't update screen for child windowsTor Arne Vestbø2017-01-041-7/+9
| | | | | | | | | | | | | | | | Results in 'Attempt to set a screen on a child window' warning from QWindow. Change-Id: Ib421bada07d2085c33a4dcb62e705b2c8e2ba1c4 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | macOS: Remove unused method QCocoaWindow::parentCocoaWindow()Tor Arne Vestbø2016-11-231-9/+0
| | | | | | | | | | | | | | | | | | | | | | Last used in 2011, to determine QCocoaWindow::globalGeometry(), which probably shouldn't have used transientParent in the first place. The parent is available through casting QPlatformWindow::parent(). Change-Id: I93fbcb41765944fbe0b79981ccf7d0062bb57719 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-171-19/+41
|\| | | | | | | | | | | | | | | Conflicts: mkspecs/features/mac/default_post.prf mkspecs/features/uikit/default_post.prf Change-Id: I2a6f783451f2ac9eb4c1a050f605435d2dacf218
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-161-19/+41
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/common/linux-android.conf src/gui/opengl/qopengl.h src/network/socket/qnativesocketengine_winrt.cpp src/network/socket/qnativesocketengine_winrt_p.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/eglfs/api/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp sync.profile Change-Id: If70aaf2c49df91157b864cf0d7d9513546c9bec4
| | * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-151-19/+41
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/plugins/platforms/eglfs/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp Change-Id: Id2da7c775439adb62646d5b741ee7c638042b34b
| | | * Cocoa: Make child window cursors work correctlyMorten Johan Sørvig2016-11-081-19/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing cursor logic had a couple of issues: - It made the faulty assumption that we could not use the NSWindow invalidateCursorRectsForView API for child NSViews. - It used NSWindow invalidateCursorRectsForView and NSView resetCursorRects. This API has been replaced by the more general NSTrackingArea API. - It did not implement falling back to the parent window cursor if the current window has no cursor set. Document that QWindow cursors work the same way as QWidget cursors in that a QWindow with no set cursor will fall back to the parent window cursor. Change the cocoa platform code to use NSTrackingArea exclusively and implement NSView cursorUpdate which sets the cursor. Handle immediate change on QWindow:: setCursor() manually. Add QWindow::effectiveWindowCursor() and applyEffectiveWindowCursor() which finds the correct window cursor. Add a manual test for the child window, child widget, and QWidget::createWindowChild cases. Task-number: QTBUG-33479 Task-number: QTBUG-52023 Change-Id: I0370e11bbadb2da95e8632e61be6228ec2cd5e9d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | | macOS: fix 32-bit buildsJake Petroules2016-11-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | amends e39a436d0ca00fbcbef1428e32f74266c7a8d34d and 1ad6ae21f015ead3dcc4bed21a988f0d7d5d0d2d. Change-Id: Ib5c0b516ea2e5ec8d89f3e2e9888ef3eb8de6de4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-021-0/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Blacklist tst_QMenuBar::taskQTBUG46812_doNotLeaveMenubarHighlighted() on macOS. Conflicts: mkspecs/features/mac/default_post.prf mkspecs/features/mac/sdk.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/sdk.prf src/angle/src/libEGL/libEGL.pro src/platformsupport/fontdatabases/fontdatabases.pro src/platformsupport/platformsupport.pro src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp src/plugins/platforms/ios/ios.pro src/plugins/platforms/ios/kernel.pro tests/auto/widgets/widgets/qmenubar/BLACKLIST tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp Task-number: QTBUG-56853 Change-Id: If58785210feee3550892fc7768cce90e75a2416c