summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.mm
Commit message (Collapse)AuthorAgeFilesLines
* 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
| * | | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-011-0/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/win/msvc_version.cpp configure.pri mkspecs/macx-ios-clang/features/default_post.prf mkspecs/macx-ios-clang/features/resolve_config.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/resolve_config.prf src/corelib/io/qsettings_mac.cpp src/corelib/json/qjsondocument.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.h src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/ios.pro src/plugins/platforms/ios/kernel.pro src/plugins/platforms/ios/qiosintegration.h src/plugins/platforms/minimalegl/qminimaleglintegration.cpp tests/auto/gui/painting/qpainter/tst_qpainter.cpp tools/configure/environment.cpp Change-Id: I654845e54e40f5951fb78aab349ca667e9f27843
| | * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-221-0/+2
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/eglfs/qeglfshooks.cpp Change-Id: I483f0dbd876943b184803f0fe65a0c686ad75db2
| | | * macOS: Only show menu and allow dragging on proxy when a file path is setAndy Shaw2016-10-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there is no file path set then it should not be possible to see a menu or to drag from a proxy icon in the titlebar. Task-number: QTBUG-56082 Change-Id: Ib8305bcab5717bc8cb7ddabbb079f152debbdded Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | | macOS: Allow windows to be created on any screen within the virtual desktopTor Arne Vestbø2016-10-281-17/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting the geometry of a window to a position outside of the primary screen, but within the virtual desktop, would not result in the window being created on the secondary screen, as macOS does not seem to translate the global screen position when creating new windows. We work around this by translating the position ourselves, and using the overload of [NSWindow initWithContentRect:] that takes the NSScreen to create the window on. Due to a bug in the macOS window manger, this fails for windows that are created within a certain region of rotated screens. This is not an issue for setting the geometry after creating a window, so we should investigate making the window-creation code set its geometry via the same code path, after creating the window (without having the window momentarily show up in the wrong position). Change-Id: Iba8eefe65e2c91667856299d90a8606e361ceacb Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | macOS: Keep reference to NSScreen instead of mapping QCocoaScreen by indexTor Arne Vestbø2016-10-281-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're mostly using the result of looking up the index anyways. Change-Id: I2ada58a9e6159a567691568b42fef76a82797eb3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | | macOS: Remove m_parentCocoaWindow in favor of QPlatformWindow::parent()Tor Arne Vestbø2016-10-281-29/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Or, in some cases, m_view.window.parentWindow directly. Change-Id: Ibded4d4229a65c861ef25537e00bc70a77009453 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | macOS: Remove m_childWindows in favor of m_view.window.childWindowsTor Arne Vestbø2016-10-281-29/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Verified NSWindowChild use-case with windowchildgeometry manual test. Change-Id: If52abdcb87b3762182322a88d1935615a07cf162 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | macOS: Remove m_isNSWindowChild in favor of m_view.window.parentWindowTor Arne Vestbø2016-10-281-76/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of manually maintaining the m_isNSWindowChild state, a new function has been introduced, isChildNSWindow(), which evaluates the condition based on whether or not m_view.window has a parent NSWindow. To achieve this, the recreateWindow() function was refactored to make it the sole point of deciding whether or not a reconfigure is needed, instead of having the logic partily at the call sites. That means the shouldUsePanel() and isNativeWindowTypeInconsistent() functions are no longer needed. QNSWindowHelper is only used for QNSWindow and QNSPanel, and m_isNSWindowChild is only set if the window has a parent (and child NSWindows was explicitly enabled), so we can use the normal QWindow topLevel logic. There's more potential for cleanup in recreateWindowIfNeeded(), but that's for later patches to keep this patch as small as possible. Verified NSWindowChild use-case with windowchildgeometry manual test. Change-Id: I34e8ca0cc2f8a1c399cc72691d66e09fab843f4d Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | | macOS: Merge QCocoaWindow::setNSWindow into code path it was usedTor Arne Vestbø2016-10-271-14/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function was only used from a single code path, and moving the logic there makes it easier to refactor the code in followup commits. Change-Id: I9a7c3aeb95df8f3f507fed83d463e16fa4908374 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | macOS: Handle NSViewGlobalFrameDidChangeNotification via QCocoaWindowTor Arne Vestbø2016-10-271-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The notification is only posted for NSViews with attached surfaces, meaning NSOpenGLContext, so there's no need to guard the subscription within [QNSView setQCocoaGLContext:]. Change-Id: I8179e58c84925a756315b711d15fa9c356adaecf Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | macOS: Handle NSViewFrameDidChangeNotification via QCocaWindowTor Arne Vestbø2016-10-271-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no need to set postsFrameChangedNotifications = YES, it's already the default. Change-Id: I8c50dc119ba3779cdc6b3114d39c64f3cb236172 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | macOS: Decouple NSWindow notifications and delegate callbacks from QNSViewTor Arne Vestbø2016-10-271-19/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic for handling NSWindow events was split partly between QNSView observing notifications, and QNSWindowDelegate implementing direct delegate callbacks. The logic of how to handle the events was then split further by sometimes handling the event in the delegate callback or notification handler, and sometimes forwarding the event to QCocoaWindow. We now handle most events via notifications, and propagate these directly to QCocoaWindow, so that all the logic is in one place. This improves the situation for foreign windows, since we're not relying on having a QNSView, or being able to inject our QNSWindowDelegate. To keep code duplication to a minimum and risking missing a notification in the forwarding logic, the logic is based on QMetatType and QMetaMethod tags, so that the notifications are declared in the header file, along with the handler function. Change-Id: I2fb6372010048a8a1f6e4426b988a3f6f5abdbab Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | | macOS: Remove unneeded argument to QCocoaWindow::recreateWindow()Tor Arne Vestbø2016-10-211-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The parent window is available through QPlatformWindow::parent(). Change-Id: I2436c001ec18f5abba99db3061acb0edcd8035a2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | | | Merge branch 5.8 into devTor Arne Vestbø2016-10-181-8/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qnsview.mm Change-Id: I655e8d04cece341e8b9fb69e94c09335ffa108e1
| * | | macOS: Remove QNSView member m_window in favor of going via m_platformWindowTor Arne Vestbø2016-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The two should never be out of sync, but by having them as separate members we risk that they do. By going though m_platformWindow for QWindow access, it's also more clear in the callsites that we're dealing with a QWindow instead of a NSWindow, as referenced though self.window. Finally, removing the member slims down memory use of a QNSView, however small. Change-Id: Iec96cebf813fae82d3af339331781419f234c28b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
| * | | macOS: Use QPointer to track QNSView -> QCocoaWindowTor Arne Vestbø2016-10-131-7/+0
| | | | | | | | | | | | | | | | | | | | Change-Id: I4de581dda03d25e781112eff34de28dfd1797a7f Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-131-128/+91
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakeevaluator.cpp (cherry picked from commit 1af6dc2c8fb4d91400fddc5050166f972ae57c9a in qttools) src/corelib/kernel/qcore_mac_objc.mm src/gui/painting/qcolor.h src/plugins/platforms/cocoa/qcocoawindow.mm Change-Id: I5b3ec468a5a9a73911b528d3d24ff8e19f339f31
| * | | macOS: Get rid of m_qtView member in QCocoaWindow that aliased m_viewTor Arne Vestbø2016-10-101-37/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The member was mirroring m_view in all cases except for foreign windows. Instead of a member we now check window()->type() != Qt::ForeignWindow, which is more explicit, especially for people not normally working on the macOS platform. To call methods that are only implemented for our QNSView subclass, a new qnsview_cast() function has been introduced. Change-Id: I0a2cfe1a5e4502250c17e1c3ebdce19e9ee5e572 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
| * | | Replace QCFString::to(CF/NS/Q)String usage with QString methodsTor Arne Vestbø2016-10-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Slims down QCFString and leaves only one implementation of converting back and forth between CF/NS strings and QStrings. Change-Id: I068568ffa25e6f4f6d6c99dcf47078b7a8e70e10 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
| * | | Implement QMacCocoaViewContainer in terms of foreign windowTor Arne Vestbø2016-10-051-21/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This leaves a clearer separation between the foreign-window and non-foreign window use-cases, where a single QCococaWindow can only be in one mode, which is determined in the constructor and doesn't change after that. There are no source or binary compatibility guarantees for the QPA classes, meaning the helper function in QPlatformNativeInterface can be removed. Change-Id: I3232aedca1d98c49a8f54e16750832187f9dc69a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
| * | | macOS: Rename m_contentView to m_view, to distinguish from [NSWindow ↵Tor Arne Vestbø2016-10-051-61/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | contentView] The contentView is the root view of a NSWindow, but our m_contentView is just the corresponding NSView of a QWindow, and doesn't always match the contentView property of the NSWindow. This is part of a multi part cleanup to the Cocoa platform plugin in preparation for improved foreign-window support. Change-Id: Ifaffb12f35544ec05e4a83964b346b47fa4b0576 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
| * | | Remove QCocoaWindowPointer in favor of QCocoaWindow inheriting QObjectTor Arne Vestbø2016-10-011-20/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As already done by the iOS, Mir, and Haiku platform plugins. Change-Id: I449f396dbf234e27206625b178c7d20e3f5b956f Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | | | macOS: fix 32-bit buildsJake Petroules2016-09-211-2/+2
|/ / / | | | | | | | | | | | | Change-Id: I767b8907f91fd45f662b67ba7b9a8378a3e4851e Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | | macOS: Move image conversion functions to QtGuiTor Arne Vestbø2016-09-181-0/+1
| | | | | | | | | | | | | | | Change-Id: I911f2648e506f27519e98be1bffe2c5ab0f388f1 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | Cococa integration - close popups in a windowWillClose callbackTimur Pocheptsov2016-07-271-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'Orphan' popups were already partially fixed as a side-effect of 10126b37d2e4655e17a2ea25b10801d8f9186f1c (orphan since the 'parent' is moving but popup stays in a now wrong position). This patch also tries to fix the case when a window closed. Change-Id: I0bbf474ab4f3b845d8bd337dae2abbae23192d0e Task-number: QTBUG-46262 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | QCocoaWindow: Fix usage on deprecated APIGabriel de Dietrich2016-07-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Most APIs related to ProcessSerialNumber have been deprecated since 10.9. Change-Id: I6be5ae92cfe2c8f80d557af6c6a79c0cd016ba90 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | | Cocoa integration - inconsistent window types/stylesTimur Pocheptsov2016-06-161-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NSWindow does not support 'utility window' style, but NSPanel - does. If we first create a normal widget, then later make it a Qt::Tool, we still have NSWindow with (now) invalid 'floating panel' window level (but no 'utility window' style) - it's a window that stays on top even when we switch to a different application. Change-Id: I691bc6f681cdf8bc2a9637444da33e7e6200ee2f Task-number: QTBUG-45938 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | darwin: Add Foundation conversion functions for QSize/QSizeFTor Arne Vestbø2016-06-141-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fromCGPoint function was left out for QSize, as the foundation type is using CGFloats internally. Clients should use an explicit QSizeF::toSize() when potentially throwing away precision. Change-Id: I12d43ae0881f09ad8d79f2caaa000c3983f4ef30 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-131-2/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure mkspecs/features/uikit/sdk.prf src/corelib/global/qhooks.cpp src/corelib/io/qfilesystemwatcher.cpp src/corelib/io/qlockfile_unix.cpp src/corelib/tools/qalgorithms.h src/gui/kernel/qwindowsysteminterface.h src/gui/text/qtextdocument_p.cpp src/network/access/access.pri src/network/access/qnetworkaccessmanager.cpp src/network/access/qnetworkreplynsurlconnectionimpl.mm src/src.pro src/testlib/qtestcase.cpp src/widgets/kernel/qwidgetbackingstore_p.h src/widgets/styles/qwindowscestyle.cpp src/widgets/styles/qwindowsmobilestyle.cpp tests/auto/corelib/io/qdiriterator/qdiriterator.pro tests/auto/corelib/io/qfileinfo/qfileinfo.pro tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp tools/configure/configureapp.cpp Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-061-2/+6
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf config.tests/unix/nis/nis.cpp mkspecs/unsupported/freebsd-g++/qplatformdefs.h src/corelib/tools/qdatetime.cpp src/corelib/tools/qsimd.cpp src/corelib/tools/qsimd_p.h src/network/access/access.pri src/network/access/qnetworkreplynsurlconnectionimpl.mm src/network/access/qnetworkreplynsurlconnectionimpl_p.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/printsupport/windows/qwindowsprintdevice.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/widgets/widgets/qopenglwidget/BLACKLIST Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
| | * Cocoa integration - fix QCocoaWindow::setContentViewTimur Pocheptsov2016-05-251-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - QCocoaWindow::setContentView calls -removeFromSuperView and this is not valid for a view that is a content view for a NSWindow: using it will release the view but not clear the window.contentView pointer. Set contentView to nil instead. Fixing this makes visible the second problem: - QNSWindowHelper in its -handleWindowEvent: can access content view and assumes it's QNSView - it is not always guaranteed and can result in invalid message sent to a view, we can use m_qtView instead (it will be nil if it has a type different from QNSView, the call will be noop then). Task-number: QTBUG-53325 Change-Id: I0472eba8165a04b6a3f81b2171b3bb9827ff5681 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | darwin: Add Foundation conversion functions for QRect/QRectFTor Arne Vestbø2016-06-101-1/+1
|/ / | | | | | | | | | | | | | | | | | | The fromCGRect function was left out for QRect, as the foundation type is using CGFloats internally. Clients should use an explicit QRectF::toRect() when potentially throwing away precision. Change-Id: I0d4c5c5a4e6a45ea3287e3f37a00b69b0bfdefcf Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-191-15/+22
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp src/network/access/qnetworkaccessmanager.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h src/widgets/widgets/qlineedit_p.cpp src/widgets/widgets/qlineedit_p.h src/winmain/winmain.pro tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp tools/configure/configureapp.cpp Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a