summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Bring QWindowPrivate::deliverUpdateRequest() back temporarily"Liang Qi2018-04-061-6/+0
| | | | | | | | | | This reverts commit 6ada4155aff6a106d918ec1b93923bed9617ab27. The fix to use new private API landed in qtwayland e3fa740d20. Task-number: QTBUG-67480 Change-Id: Ie01e4b423ca326b81740f195562244e733a66d72 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Bring QWindowPrivate::deliverUpdateRequest() back temporarilyLiang Qi2018-04-041-0/+6
| | | | | | | | | | QtWayland is using that now. This change partly reverts commit bff59f87ba11cac1dfa710f021522372de7a776f. Task-number: QTBUG-67480 Change-Id: I36b75555baef220c80cf103226f5b8108d7a352c Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Move delivery of update requests into QPlatformWindowTor Arne Vestbø2018-03-291-9/+2
| | | | | | | | | | | | 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>
* Clarify that QExposeEvent/exposeEvent handles any invalidation of the windowTor Arne Vestbø2018-03-201-5/+7
| | | | | Change-Id: Ib6f649213e3268c6946c7fa973ce970e896a46a0 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add QPlatformWindow::close()Morten Johan Sørvig2018-02-211-4/+1
| | | | | | | | | | Platforms can reimplement this function to control how non-spontaneous window close is handled. Make QWindow::close() call this function. Change-Id: I3da13e6c8519de2af7e54334d8a1e833ce98cba1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* doc: Fix remaining qdoc warmings for Vulkan stuffMartin Smith2018-01-181-1/+1
| | | | | | | | | | | Several uses of #if QT_CONFIG(vulkan) were modified to for classes QVulkanFunctions and QVulkanDeviceFunctions was added to qplatformvulkaninstance.h, because the include file that contains them doesn't exist when vulkan isn't there. Change-Id: I392202ab5fe9bb4c558a991870e6ebf79254aec0 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QtGui/Windows: Fix wait cursors remaining activeFriedemann Kleint2017-12-121-0/+2
| | | | | | | | | | | In QWindowPrivate::applyCursor(), do not apply override cursors when the platform supports QPlatformCursor::OverrideCursor. Complements b05d1c2ebfebf0f427a92668c0a7b177d0952012. Task-number: QTBUG-65001 Change-Id: Ie84cc30ad99b22e037aae829a2ce847ec4bf900f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-11-091-1/+4
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qwindow.cpp src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowssystemtrayicon.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp tests/auto/widgets/kernel/qaction/tst_qaction.cpp Change-Id: Ifa515dc0ece7eb1471b00c1214149629a7e6a233
| * Fix dragging inside a modal window when a QShapedPixmapWindow is usedAndy Shaw2017-10-301-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | A regression was introduced with a3d59c7c7f675b0a4e128efeb781aa1c2f7db4c0 which caused dragging to fail within a modal dialog on the XCB platform. By adding an exception for the QShapedPixmapWindow, which is the window used for the drag, we can allow that to continue to work whilst blocking to the other newly created windows. Task-number: QTBUG-63846 Change-Id: I7c7f365f30fcf5f04f50dc1a7fff7a09e6e5ed6c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | QWindowPrivate::globalPosition(): Take embedded windows into accountFriedemann Kleint2017-11-031-1/+1
| | | | | | | | | | | | | | | | | | QPlatformWindow::mapToGlobal() should also be used in case a window is embedded. Task-number: QTBUG-64116 Change-Id: I1fbdf3d185659d0faea13a593db901e36ab27d8d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Fix build with -no-opengl and on watchOS in generalJake Petroules2017-10-061-0/+2
| | | | | | | | | | | | | | | | | | This fixes a regression introduced in 8e70241dcc. Task-number: QTBUG-63631 Change-Id: I5a2c23e06b790a482e1542ac2db3dcf25927caf2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Let QPlatformBackingStore handle its own QOpenGLContextTor Arne Vestbø2017-10-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The resources allocated by QPlatformBackingStore are owned by the class, and should be allocated in a context the class also owns. This removes the asymmetry of having to pass in a context to composeAndFlush, while having to make the same context current before destroying the platform backingstore. The context owned by QPlatformBackingStore is shared with the associated window though a new QWindowPrivate::shareContext() API. The result is that on e.g. iOS, the backingstore does not need to tie the resource allocation of QPlatformBackingStore to the global share context, but can instead tie them to the per-window context, and hence clean them up after each window is closed. Task-number: QTBUG-56653 Change-Id: Ic1bcae50dafeeafaa8d16a7febd83b840ec6367a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | macOS: Tighten up window icon and represented filename handlingTor Arne Vestbø2017-10-031-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Window icons on macOS are tied to document windows, and should not show up unless a represented filename has also been set according to the HIG. We follow this, and no longer create a document button based on the window title if one did no exists. We also fall back to using the filename of the file if a title has not been set, including being able to restore this default title after setting a custom title. The icon is no longer reset to nil after setting a QIcon(), which would remove the icon completely, but instead we restore the default behavior of showing the default filetype icon of the file. Finally, the two callbacks in QNSWindowDelegate dealing with the document icon/title popups and drags have been taught to look for spaces in the represented filename. This allows clients who really want the old behavior of setting an icon without caring about the filename to set the filename to a single space character, which will prevent the dropdowna and drag from occurring. The reason for not tying this behavior to the existence of the file in the filesystem is that being able to represent a file that is yet to be saved is a valid usecase. Task-number: QTBUG-63338 Change-Id: I7d4377c6358226fb6058f8c2b3c28588eec77ce5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Reset QWindowPrivate::platformWindow during destruction before deleting itTor Arne Vestbø2017-09-261-2/+7
| | | | | | | | | | | | | | | | | | Otherwise the deletion of the platform window may result in platform events that then conclude the QWindow has a valid platform window and calls into it, when it's been half-way destroyed. Change-Id: If9eaad1b4e6aa414ba0f96475756a2146e0c01d5 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-08-311-0/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/examples.pro qmake/library/qmakebuiltins.cpp src/corelib/global/qglobal.cpp Re-apply b525ec2 to qrandom.cpp(code movement in 030782e) src/corelib/global/qnamespace.qdoc src/corelib/global/qrandom.cpp src/gui/kernel/qwindow.cpp Re-apply a3d59c7 to QWindowPrivate::setVisible() (code movement in d7a9e08) src/network/ssl/qsslkey_openssl.cpp src/plugins/platforms/android/androidjniinput.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/widgets/widgets/qmenu.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp Change-Id: If7ab427804408877a93cbe02079fca58e568bfd3
| * QWidget: Call appropriate QWindow method from setGeometry_sys()Gabriel de Dietrich2017-08-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When calling resize() from showEvent(), we'd set the full geometry on the widget's QWindow. This resulted in the top-level window being moved to the top-left corner, even though no other call to move() or setGeometry() had happened before. The solution consists on calling the proper QWindow methods depending on whether setGeometry_sys() is called for a move, a resize or both. Furthermore, this needs QWindow::resize() to set its position policy to frame-exclusive. The documentation states that is already the case and we're setting the full geometry on the platform window, so we need to convey that bit of information. This also solves the age-old conundrum: "### why do we have isMove as a parameter?" Change-Id: I2e00fd632929ade14b35ae5e6495ed1ab176d32f Task-number: QTBUG-56277 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * Block input to a window shown while an application modal dialog is visibleAndy Shaw2017-08-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | Although the window is refused input for the most part from the system, it does not act like that it is blocked by the application modal dialog. This ensures that it is the case and prevents things like being able to double click on the title bar to maximize the window on Windows. Task-number: QTBUG-49102 Change-Id: If1582819b90cb2ec9d891f664da24f13bfec7103 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Revert "macOS: Create NSView as initially hidden, to match QWindow behavior"Shawn Rutledge2017-08-181-8/+1
| | | | | | | | | | | | | | | | | | | | It seems to break the ability to grab an offscreen QQuickView. That in turn breaks the tst_qquickimage::hugeImages autotest. This reverts commit 096b56f336e5bb994d46f073d55496d36d38e6b1. Task-number: QTBUG-62548 Change-Id: I11ce452341bfc2cc3cbc832b613c7366049b31d5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | macOS: Create NSView as initially hidden, to match QWindow behaviorTor Arne Vestbø2017-08-111-1/+8
| | | | | | | | | | Change-Id: I25af6635ea9b6aa3fcc642fa2da0553341aabda8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Add QPlatformWindow::initialize() for two-step window creationTor Arne Vestbø2017-07-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QWindow::create method calls createPlatformWindow, and assigns the result to d->platformWindow. If the platform sends any sort of events synchronously during the creation, the event will be delivered to a QWindow that doesn't have a handle() yet, resulting in noop handling of the event, or crashes. To mitigate this situations, platforms should do as little a possible in the QPlatformWindow constructor, and leave initialization to the new method, where the QWindow will have a handle(). The macOS platform plugin still has a m_initialized guard, to prevent sending geometry changes during initialization, as this will result in a resize event before a show event. This forced behavior seems dubious, but is left for a followup patch. Task-number: QTBUG-61977 Change-Id: I04d32d93391e89d068752b719270438e7024ad46 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-041-5/+5
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
| * Convert features.tabletevent to QT_CONFIGStephan Binner2017-06-281-2/+2
| | | | | | | | | | Change-Id: Ibd7ed7f269a64afddadee70979b20f1c58398378 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| * Convert features.wheelevent to QT_CONFIGStephan Binner2017-06-281-3/+3
| | | | | | | | | | Change-Id: I46083a9115c199d1ebe024ed5f64b160a27462f1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Remove requirement to call QWindow::setMask after creating windowTor Arne Vestbø2017-06-281-5/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Make QWindow::setVisible() work for widgetsMorten Johan Sørvig2017-05-111-65/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QWidget has its own setVisible() code that needs to be run in order to correctly transition widget visibility. It is desirable to be able to show and hide (native) widgets also from the QWindow side, for example from the platform plugin, or from generic QWindow handling code in QtGui. Add a new virtual QWindowPrivate::setVisible() and move the QWindow visibility implementation there. Subclasses can now override this function to add custom code. Make QWidgetPrivate::show/hide_sys() call the QWindowPrivate setVisible implementation instead of the QWindow setVisible public API. Change-Id: I082f174b100659e1221d5898b490f8a9f498abdf Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-05-071-7/+6
|\| | | | | | | | | | | | | | | Conflicts: src/network/access/qnetworkreply.cpp tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp Change-Id: Iadf766269454087e69fb216fc3857d85b0ddfaad
| * Fall back to QWindow's screen when resolving DPR instead of using qAppTor Arne Vestbø2017-04-211-7/+6
| | | | | | | | | | | | | | | | | | | | | | QGuiApplication::devicePixelRatio() should only be used when we don't know which window we're targeting. For QWindow::devicePixelRatio(), we can go though the associated screen to get a more accurate DPR. Change-Id: Idf511fa5c09562a6daf391cd4d0b8b99471045e7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-201-0/+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
| * Prevent QWindow transient parent loopTor Arne Vestbø2017-04-121-0/+4
| | | | | | | | | | | | | | | | Clients may wrongly set the transient parent to the window itself, causing endless loop when e.g. looking for the top level parent. Change-Id: Ib23cae3a5576320435ae9b76dd618d1e5ae08b5d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-281-7/+10
|\| | | | | | | | | | | | | | | | | Conflicts: examples/examples.pro tests/auto/corelib/tools/qchar/tst_qchar.cpp tests/auto/other/qaccessibility/accessiblewidgets.h Change-Id: I426696c40ab57d14dc295b8103152cede79f244c
| * Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-211-7/+10
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/eglfs/eglfs-plugin.pro Change-Id: Id76cdbb41b7758572a3b8ea4dcb40d49bac968db
| | * Fix crash in QWindowPrivate::applyCursor when screen is nullOlivier Goffart2017-03-161-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QWindow::setVisible calls QWindowPrivate::applyCursor without checking if screen() returns null. This patch adds a check in QWindowPrivate::applyCursor that the screen is not null. Now that it is tested there, no need to test it from the other caller (setCursor) This patch should not change behavior of setCursor at all, it should only fix the crash when coming from setVisible Task-number: QTBUG-59528 Change-Id: I06bbdb4e04c02ac840ba637242d1f2cfde5bdd62 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Basic Vulkan enablersLaszlo Agocs2017-03-171-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For Android, Windows and xcb. Verified on Win10 with NVIDIA, Win10 with AMD, Android with Tegra K1, Android aarch64 with Tegra X1, and Linux aarch64 with Tegra X1 (Jetson TX1, L4T). Introduce QPA-based Vulkan library loader, core function resolver, and instance creation support. In addition to creating a new VkInstance, adopting an existing one from an external engine is supported as well. The WSI specifics are hidden in the platform plugins. Vulkan-capable windows use the new surface type VulkanSurface and are associated with a QVulkanInstance. On Windows VULKAN_SDK is picked up automatically so finding vulkan.h needs no additional manual steps once the LunarG SDK is installed. [ChangeLog][QtGui] Added support for rendering to QWindow via the Vulkan graphics API. Task-number: QTBUG-55981 Change-Id: I50fa92d313fa440e0cc73939c6d7510ca317fbc9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | | Make QWindow's windowState a QFlags of the WindowStateOlivier Goffart2017-03-161-42/+80
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Make QPlatformSurface events work with QWindowContainerLaszlo Agocs2017-02-271-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Embeddeding a QWindow via QWidget::createWindowContainer() fails to deliver the SurfaceAboutToBeDestroyed event. This breaks any OpenGL or Vulkan based QWindow that releases resources upon this event, and is particularly critical with Vulkan where the only way to do properly ordered swapchain - surface cleanup is via this event. In the non-embedded case close() eventually ends up in an explicit destroy() in QWindow. In the embedded case destroy() only gets called from ~QWindow. This then silently breaks since the subclass' reimplemented event() virtual is not getting called anymore. To remedy the problem, simply add an explicit destroy() to QWindowContainer. Task-number: QTBUG-55166 Change-Id: I1671e8f4d39f6c44e19eca7b9387f55fe3788294 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | QWindow: Remove "_q_foreignWinId" dynamic propertyTor Arne Vestbø2017-02-221-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | QWindow: prevent window reparenting into Qt::Desktop windowsTor Arne Vestbø2017-02-151-14/+21
| | | | | | | | | | | | | | | | | | | | | | | | Qt::Desktop exists to support QDesktopWidget, which predates the QScreen API. QWidget internally has checks that prevents you from reparenting a QWidget into a QDesktopWidget, so we should have the same limitations on the QWindow level. This allows platform plugins to implement Qt::Desktop as simple (possibly shared) wrappers around QScreen without having to allocate native window resources for each desktop window. Change-Id: Ia1bac506febd3d827a6e0b8ad3bfd95be0cc7f9d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Don't create platform window for QWindows when calling setVisible(false)Tor Arne Vestbø2017-02-131-2/+5
| | | | | | | | | | | | | | We can defer the creation until the window is shown. Change-Id: I3d5b45ae59ee0925996cf12cd46dd574c8c6ef95 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | QWindow: don't destroy foreign windowsTor Arne Vestbø2017-02-091-21/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling QWindow::destroy() is documented to "release the native platform resources associated with this window.", but in the case of foreign windows we do not control the native platform resource, so we shouldn't destroy the platform window until the QWindow is destroyed. This also allows code paths to defer to the platform window to answer questions like winId() instead of having to duplicate the ID on the QWindow side in _q_foreignWinId. Change-Id: Ie00ee570bdddde958d97d49edcba2bc1bf519a99 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add QPlatformWindow::isForeignWindow()Tor Arne Vestbø2017-02-091-5/+7
| | | | | | | | | | | | | | | | 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>
* | Split QPlatformWindow::isEmbedded into isAncestorOf to separate concernsTor Arne Vestbø2017-01-051-2/+7
| | | | | | | | | | | | | | | | | | | | | | The function was doing two things, both checking window ancestry and whether or the window was a direct child of non-Qt window. The former has now been split of in a QPlatformWindow::isAncestorOf(), which simplifies the code in e.g. QApplicationPrivate::isWindowBlocked(). Change-Id: I259a190e03ef8def23356005474eeeee74c9ae89 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Add QWindow::AncestorMode overload of QWindow::parent()Tor Arne Vestbø2016-12-081-10/+24
| | | | | | | | | | | | | | | | | | Simplifies code that traverses the parent hierarchy, including transient parents. For Qt6 we should merge the two parent() functions, adding a default value for the mode, probably ExcludeTransients. Change-Id: Ic9cdae3e31a3a8e140a5b175160f3b934d2b6e00 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Move QWindowPrivate::globalPosition() definition out of headerTor Arne Vestbø2016-11-231-0/+14
| | | | | | | | | | Change-Id: Icaf68600a20d1845a5667a49306686948a20b42e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Introduce QWindow::setFlag and QWidget::setWindowFlagDaniel Vrátil2016-11-221-0/+19
| | | | | | | | | | | | | | | | | | | | Analogous to QWidget::setAttribute(), introduce an API to easily enable/disable a single window flag without having to resort to w.setFlags(w.flags() | Qt::NewFlag). Change-Id: Ib0f7254a34c8d884cdec181c41b99e5ef035d954 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-171-0/+3
|\| | | | | | | | | | | | | | | 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-0/+3
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+3
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | QWindow::setFlags: return early if the flags didn't changeDaniel Vrátil2016-11-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevents calling into QPlatformWindow::setWindowFlags() when there's no change. Change-Id: I2dccf3052b5895ee7f05623e6ed468be14bb0c0d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
* | | | Document that QWindow position is relative to its screen's virtualGeometryTor Arne Vestbø2016-11-041-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I36e14813d0d32aa1b5a30fa0e63e0a3c477acb01 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>