summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.h
Commit message (Collapse)AuthorAgeFilesLines
* macOS: Decouple NSWindow notifications and delegate callbacks from QNSViewTor Arne Vestbø2016-10-271-5/+23
| | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | The parent window is available through QPlatformWindow::parent(). Change-Id: I2436c001ec18f5abba99db3061acb0edcd8035a2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* macOS: Get rid of m_qtView member in QCocoaWindow that aliased m_viewTor Arne Vestbø2016-10-101-2/+0
| | | | | | | | | | | | | 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>
* Implement QMacCocoaViewContainer in terms of foreign windowTor Arne Vestbø2016-10-051-1/+0
| | | | | | | | | | | | 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-5/+5
| | | | | | | | | | | | | | 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-34/+5
| | | | | | | | 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>
* Cococa integration - close popups in a windowWillClose callbackTimur Pocheptsov2016-07-271-0/+1
| | | | | | | | | | | | '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>
* Cocoa integration - inconsistent window types/stylesTimur Pocheptsov2016-06-161-0/+1
| | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-191-7/+32
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Cocoa: Add QCocoaWindowPointerGabriel de Dietrich2016-05-061-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch extends 5b54c352edbc597ec5283bc9cfdd77906350161f by abstracting the watcher pattern. The class is specialized for QCocoaWindow since it's aware of the QObject sentinel there. We update the usage in QNSWindowHelper and extend it to the forward window (this one is used for mouse coordinate conversion when docking windows). Change-Id: I628415527593daec835bbad1b6e83d13fe7b6703 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-271-0/+6
|\| | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_win.cpp src/widgets/itemviews/qheaderview.cpp Change-Id: I0a59ade9cd6e91f770fdf298a7d72a41e79fd761
| * Cocoa integration - add a protection against dangling pointersTimur Pocheptsov2016-04-221-0/+6
| | | | | | | | | | | | | | | | Backport watcher-sentinel trick (QPointer->QObject) from dev. Task-number: QTBUG-42059 Change-Id: I9b2c7cde635c2ed9a3f667f216da62870d0b5ccb Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | 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>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-141-1/+0
|\| | | | | | | | | | | | | | | | | Conflicts: tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/io/qprocess/tst_qprocess.cpp tests/auto/corelib/tools/qversionnumber/qversionnumber.pro Change-Id: Ia93ce500349d96a2fbf0b4a37b73f088cc505c6e
| * Clean up cancel operation handling on OS XTor Arne Vestbø2015-09-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic for handling cancel operations was spread out through the code base and sometimes hard-coded to only include the Escape key shortcut, missing the Command+. shortcut. We now intercept both attempts at cancel operations from the system through cancelOperation, which we forward as normal key events. A new QKeySequence::StandardKey has been added for the Cancel sequence, which maps to Escape on all platforms, and Command+. in addition for OS X. The hard-coded logic in QWidget and subclasses for dealing with closing the dialogs has been replaced with this key sequence, which allows clients to override the behavior. Note that the widget code is not wrapped in checks for QT_NO_SHORTCUT, as we don't care about keeping widgets building and working under that define. The logic in QCocoaWindow to bypass windowShouldClose when delivering IM events has been removed as we now handle that specific case by also forwarding Escape as a cancel operation. Task-number: QTBUG-47557 Task-number: QTBUG-45771 Task-number: QTBUG-44076 Change-Id: Ibe0b3a4819f8659d246a2142dd7d9cd3a826ef78 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | Link to AppKit instead of Cocoa.Jake Petroules2015-09-051-1/+1
|/ | | | | | | | | | | | | Cocoa is basically just AppKit + CoreData. Since we do not use CoreData in Qt, there is no reason to link to it or (transitively) import its headers. This is just a mechanical replacement of -framework Cocoa with -framework AppKit and <Cocoa/Cocoa.h> with <AppKit/AppKit.h> Change-Id: Ibcfc8a03c0ddff27a67fbc87dd7bd58a4b648956 Reviewed-by: Mika Lindqvist <postmaster@raasu.org> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* OS X adaptations to the high-DPI APIMorten Johan Sørvig2015-08-061-1/+1
| | | | | | | | | | | | Use QPlatformWindow::windowGeometry() and friends instead of the QWindow API, which now returns (possibly scaled) values in device-independent pixels. Rename QCocoaWindow::windowGeometry() -> nativeWindowGeometry() Change-Id: I70279145079c3df793059d16fed9aafba2d49a6d Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-07-011-26/+26
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
| * Add missing Q_DECL_OVERRIDE in Cocoa specific header filesGabriel de Dietrich2015-06-241-26/+26
| | | | | | | | | | | | Change-Id: I91831390e9e0d97ab28f0e34ca0573fb2c84e954 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add QCocoaWindowFunctions and add a function to find the clip offsetJorgen Lind2015-06-111-0/+3
| | | | | | | | | | | | Change-Id: I0f9cd1f923867f6f24b3bc54e442a16b5d2a11e4 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* | Fix crash in tst_qfiledialog on OS XSimon Hausmann2015-06-041-0/+2
| | | | | | | | | | | | | | | | | | | | The test aggressively shows and hides dialogs and popups, and we would end up installing this global event monitor frequently. However we never cleaned up properly, for example if the window didn't get hidden properly or if the monitor was already installed for some reason. Change-Id: I6fa28eaeb03e089ced735912dbe29b0b8ad75d58 Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-03-241-0/+1
|\| | | | | | | Change-Id: If5d2e621c2fa5476c3ab687a3f4620c54fc3b32e
| * Cocoa: Don't let key events triggering input method events close dialog.Christoph Schleifenbaum2015-03-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | Added a flag to QCocoaWindow to ignore shouldCloseWindow. This is set from within QNSView when escape is pressed and the current focus widgets is processing input method events (like QTextEdit). This lead to unwanted dialog rejects. Task-number: QTBUG-44076 Change-Id: Ic90a8a6ba8c5cddbc0d486563acad57dd384d179 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-03-161-1/+0
|\| | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbnativeinterface.h Change-Id: I31b38ba439b9341d51a01c0fd54bea33f7410076
| * Cocoa: Correct mouse event forwarding for popupsMorten Johan Sørvig2015-03-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to track the active popup globally, having parent windows track child popups is not sufficient since there may be one or more intermediate windows in between the event receiving window and popup window. Add API to QOCocoaIntegration for tracking the global popup window and use it instead of the per-window tracking. Make sure to only close popups on clicks outside the popup only. Add code to QNSView::handleMouseEvent that redirects mouse events to the active popup. Add manual test. Change-Id: Ia3e3fd42d8fddf5c69f0c6879b333ca544521f61 Task-number: QTBUG-43464 Task-number: QTBUG-31937 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* | Cocoa integration - do not report invalid coordinatesTimur Pocheptsov2015-03-061-0/+1
|/ | | | | | | | | | | | | setStyleMask with NSBorderlessWindow will call (indirectly) windowDidResize (window.delegate's method) and view's updateGeometry. At this point view.window can be nil (Cocoa is re-parenting the content view (?). If this is the case, do not set this updated geometry on a QWindow/platform window (since window is nil, self.window.frame is returned as {{0, 0} {0, 0}} by Cocoa). Found by tst_QWidget::setGeometry. Change-Id: Ic3cc0d944b5a8a5095c7fd0fdf2df7c9ea602b2a Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | 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: Guard against recursive event deliveryMorten Johan Sørvig2014-11-051-0/+1
| | | | | | | | | | | | Fix "Recursive repaint" crash. Add guard to QCococaWindow::setGeometry and QNSView updateGeometry to prevent processing window system events during setGeometry. Task-number: QTBUG-41449 Change-Id: I304fdf134d433cbc50fafd997ecd91e31cb57f4e Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-031-6/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/accessible/qaccessiblecache_mac.mm src/gui/accessible/qaccessiblecache_p.h src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/widgets/kernel/qwidget_qpa.cpp Manually moved change in qwidget_qpa.cpp to qwidget.cpp (cd07830e3b27da7e96a0a83f91ba08c168b45e62) Change-Id: Ia51f471f9b53de2f3b07d77ea89db9303ac8961d
| * Cocoa: Handle Qt::WA_ShowWithoutActivatingMorten Johan Sørvig2014-07-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Forward the flag to QWindow by setting the _q_showWithoutActivating property on the window in QWidgetPrivate::create_sys(). Implement by refusing to become the key window or first responder during QCocoaWindow::setVisible(). Task-number: QTBUG-19194 Change-Id: I8446927ec510d7226a5a7b51b7be49d2f9bfd098 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
| * Cocoa: Handle Qt::WindowDoesNotAcceptFocusMorten Johan Sørvig2014-07-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make windows with the Qt::WindowDoesNotAcceptFocus flag refuse to become the key window. This is in addition to the existing refusal to become the first responder in QNSView. Refactor the common test into a new function: bool shouldRefuseKeyWindowAndFirstResponder() Task-number: QTBUG-32385 Change-Id: I31021b5d8895a17c48f94f3691e6590c90b68627 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
| * Cocoa: Fix Qt-in-namespace build.Tim Blechmann2014-07-021-6/+13
| | | | | | | | | | | | | | | | Wrap cocoa classes in namespace macros. Task-number: QTBUG-39382 Change-Id: Id840e666105afca21760fcb529b5765e0a534120 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* | OS X: Fix build with QT_NO_OPENGLSergio Martins2014-06-301-0/+6
|/ | | | | | Task-number: QTBUG-31151 Change-Id: I7ed8117ae05ba0eebaf85731c7fdd2bb51d6ed04 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Send expose event on screen change.Morten Johan Sørvig2014-04-101-0/+1
| | | | | | | | | Required to repaint OpenGL content properly. Task-number: QTBUG-38105 Change-Id: Ie9441d56bd9d1a4eb399210369592f03e19c4929 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Mac: Implement unified toolbar look for QTabBarMorten Johan Sørvig2014-04-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Extend the unified title and toolbar gradient to tabs in document mode that are adjacent unified tool bars. Change the updateMacBorderMetrics() function to register the tab bar geometry and visibility status with the Cocoa platform plugin. The Cocoa platform plugin will then merge this area with other registered areas if possible. Add QCocoaNativeInterface::testContentBorderPosition(). This function tests whether the given point is within the unified title and toolbar area. Use testContentBorderPosition() in QMacStyle to enable code paths that skips drawing the QToolBar bottom separator line and paints the active tab background with transparent pixels to make the background gradient visible. Change-Id: I2b70f9bb0c2c59af053a691a7df538f958783dab Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Cocoa: Update unified toolbar area on toolbar hideMorten Johan Sørvig2014-04-091-2/+5
| | | | | | | | | | | | | | | | | | | | | Add setContentBorderAreaEnabled() which us used to enable or disable an area. Used together with registerContentBorderArea() this allows changing the border area geometry and enabled status independently. Add section to the QToolBar show/hide event handler which calls setContentBorderAreaEnabled(). Make sure QToolBar and QToolBarLayout uses the same identifier - the QToolBar object pointer. Rename enableContentBorderArea -> setContentBorderEnabled. The "ContentBorder" is now the entire unified toolbar area while "ContentBorderArea"s are the sub-areas covered by toolbars. Change-Id: I339f381a50856e048ae40e7ffadd6a8a510c4994 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* OSX: a window can be de-maximized by resizingShawn Rutledge2014-03-271-0/+1
| | | | | | | | After that, QWidget::isMaximized() should return false. Task-number: QTBUG-37703 Change-Id: Ic8b0de63ab007066cd277f511dfaa969404ff069 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* OSX: make reported window state consistent with realityShawn Rutledge2014-03-251-0/+1
| | | | | | | | | | | | | You can't always get what you want: if you exit from fullscreen mode via showNormal, it might actually be maximized; or if you exit via showMaximized, it might actually be normal, if that's the mode the NSWindow remembers. We can't set the state, we can only toggle it. But now at least it's predictable, so that if you call showNormal or showMaximized twice, you will definitely get back to that state. Task-number: QTBUG-35166 Change-Id: I7422960a64f624920566c25763f5c3b03a684fb5 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Cocoa: Fix geometry for embedded QWindows.Morten Johan Sørvig2014-03-201-0/+1
| | | | | | | | | | | | | | | | Report for correct geometry for QMacNativeWidget and other QWindows that are embedded in a NSView hierarchy. This also makes mapFrom/ToGlobal work. The implementation is different than for the other cases: Add a QCoocaWindow::geometry() overload and query the geometry there, instead of using a geometry change notification which sets the geometry on the QWindow. Task-number: QTBUG-36322 Change-Id: Iab5f0c96b89610c8a4b4a7de49887b0683d551dd Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Set unified toolbar height accurately.Morten Johan Sørvig2014-03-201-0/+12
| | | | | | | | | | | | | | | Add registerContentBorderArea() to the Cocoa native interface which allows registering multiple "unified toolbar" areas for each window. Use this function in QToolBarLayout::setGeometry() to register the area for each TopToolBarArea toolbar. Task-number: QTBUG-36700 Change-Id: I52efcc5662556bb94f25f504be3710d0491f79b9 Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
* Cocoa: Disable the zoom button when appropriateMorten Johan Sørvig2014-03-151-0/+1
| | | | | | | | | | Disable the zoom (maximize) button for fixed-size windows and customized windows with the MaximizeButton flag not set. Task-number: QTBUG-37078 Change-Id: I6da88496474713de37b48aa65742203632ba99d6 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Cocoa: Fix crash when closing window from title barGabriel de Dietrich2014-03-141-0/+1
| | | | | | | | | | Some mouse event may result in the window being deleted so we need to take extra precaution when calling the super class' 'sendEvent:' method. Task-number: QTBUG-37287 Change-Id: Idf89ea177c78053bcdef52c54a197409e20bf38e Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Cocoa: Keep child NSWindow alive while it grabs the mouseGabriel de Dietrich2014-03-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise, Cocoa loses sight on which window to send the dragging mouse event. If the window is kept alive (but hidden) Cocoa will send the events to it, and we can forward them to the actual QWindow. This is the expected use-case: 1. Start dragging a QWindow and change its flags. 2. This triggers a call to QCocoaWindow::recreateWindow(), which will get rid of the old NSWindow and create a new one (the QNSView is moved to the new NSWindow). 3. When we stop dragging, the NSWindow is finally destroyed. QNSView Pointer References Remarks: In QNSView, m_window points to the QWindow which remains unchanged until deleted. Similarly m_platformWindow remains valid until deleted, in which case we delete the QNSView, the NSWindow and its helper (see QCocoaWindow destructor). This fixes undocking QToolBars when they are a child NSWindow. Task-number: QTBUG-33082 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Change-Id: I6fc53292cd96586cfdf401481c5442d759f1fae5 Reviewed-by: Liang Qi <liang.qi@digia.com>
* Cocoa: Use helper class for event handling in native windowsGabriel de Dietrich2014-03-041-11/+39
| | | | | | | | | | | | | | | | | | | | | | | | | QNSWindow and QNSPanel duplicate some code when it comes to event handling, which can be refactored. Also, it's currently not possible to keep an NSWindow derived instance temporarily alive as QCocoaWindow is not designed to keep track of more than one NSWindow. Finally, we can reduce the size of (and eventually remove) the QCocoaWindowCategory which polutes the NSWindow namespace. We move QNSWindow and QNSPanel specific API into QNSWindowProtocol, and define QCocoaNSWindow as NSWindow extended by that protocol. This gives us a type we can refer to any of the native windows QCocoaWindow instanciates. We introduce QNSWindowHelper which gathers the common code between QNSWindow and QNSPanel. This is a one-to-one mapping that keeps a weak (non-retaining) reference to the NSWindow and a weak reference to the QCocoaWindow. It has the same life span as its associated NSWindow. Task-number: QTBUG-33082 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Change-Id: I38d001bf13f64a1ba4f1439291c5103c3f755183 Reviewed-by: Liang Qi <liang.qi@digia.com>
* Cocoa: Bring back two-class native window systemGabriel de Dietrich2014-02-121-21/+32
| | | | | | | | | | | | | | While inheriting from NSPanel proved to be robust enough, it is not really future proof as we're at the mercy of Apple changing NSPanel's behavior. On the other hand, we can't inherit exclu- sively from NSWindow as the tool window case, where the QWindow should look like an NSPanel, can't be emulated perfectly without using private APIs. This reverts commits 79fb39a87ce5ffbda and df86721bb4028ae. Change-Id: I9021193e3614633a943578df9e2794b00094a1f7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2014-02-111-1/+0
|\ | | | | | | refs/staging/dev
| * Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-071-1/+0
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/plugins/platforms/android/androidjnimain.cpp src/plugins/platforms/android/qandroidplatformintegration.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/android/qandroidplatformopenglcontext.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/sql/doc/src/sql-driver.qdoc src/widgets/widgets/qtoolbararealayout.cpp Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
| | * Cocoa: Popups should not become keyGabriel de Dietrich2014-01-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... at least not like that. We still need to find a way for the popup to receive and process key events on its own, instead of depending on other layers inside Qt. This would make Qt Quick control's PopupWindow implementation much simpler, for example. Revert "Cocoa: Allow popups to grab mouse and keyboard" This reverts commit a25e6528d3806d3b5fd87c5a1cacd6c748215db1. Task-number: QTBUG-35820 Task-number: QTBUG-35904 Change-Id: Ica10529308ab25938397c16b9c1e1ce6cbd8f247 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* | | Cocoa: Add setNSToolbar(QWindow *, NSToolBar *)Morten Johan Sørvig2014-02-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling this function associates the given native toolbar with the QWindow. QWindow will then set it on the native NSWindow at the appropriate time during window creation. Change-Id: I2a50f79b2a0453cc739f8d68e965e37b95998083 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>