summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
Commit message (Collapse)AuthorAgeFilesLines
* Add QMenu::menuInAction as a static helperVolker Hilsheimer2021-11-011-1/+1
| | | | | | | | | | | | | | QAction::menu is deprecated, as it makes QAction (a QtGui class) depend on QtWidgets. The template hack works, but shouldn't become a permanent solution and is already deprecated. To get the QMenu out of a QAction that contains it, add a static helper to QMenu instead. QAction continues to store the menu pointer so that we don't have to use a dynamic property or an associative container in QMenu. Change-Id: Ieb6a2b1900d2fc2f16dd5a4a8ab7da98604642d3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove unused statements in QWindowDavid Skoland2021-10-261-2/+0
| | | | | Change-Id: I91f0d23d22923f7c2b8c9099371288d226d541c6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Fix qdoc warnngsVenugopal Shivashankar2021-10-231-0/+2
| | | | | | | | | | | qt5/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:75: (qdoc) warning: Cannot tie this documentation to anything [qdoc found a /*! ... */ comment, but there was no topic command (e.g., '\fn', '\page') in the comment and no function definition following the comment.] qt5/qtbase/src/gui/text/qtextformat.cpp:1500: (qdoc) warning: Overrides a previous doc qt5/qtbase/src/gui/text/qtextformat.cpp:1487: (qdoc) warning: (The previous doc is here) qt5/qtbase/src/gui/text/qtextformat.cpp:1533: (qdoc) warning: Overrides a previous doc qt5/qtbase/src/gui/text/qtextformat.cpp:1520: (qdoc) warning: (The previous doc is here) Change-Id: I5a089bef1841d6d69bff4c780805d20e5926fe6f Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Centralize maybeLastWindowClosed checking in QWindowTor Arne Vestbø2021-10-204-22/+30
| | | | | | | | | | | | | | | | | Instead of plumbing QWidgetWindow close events via handleCloseEvent, we just implement closeEvent directly. This allows QWindow do save the state of the window/widget before the close event, so that we know whether we should trigger lastWindowClosed handling, even if the window was deleted as a result of the close event. This also relieves QGuiApplication and QApplication from dealing with the close logic in their notify functions, so that these functions can focus on the propagation of events -- not how the event is handled. Change-Id: I8b586b53a53b1df1d8630c1acb635c60f191bb4b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix correspondence between QFileDialog::Option and ↵Alexander Volkov2021-10-191-4/+5
| | | | | | | | | | QFileDialogOption::FileDialogOptions It was broken by fe4a5a27e09b8109381e52aa1b71135a916dff1a. Pick-to: 6.2 Change-Id: I77da7ec9cdedc80a72b7f11980950a8bebfdaf3b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Prevent recursive calls to QWindow::closeTor Arne Vestbø2021-10-181-0/+2
| | | | | | | | | QWidget will call close() in its destructor, which we might end up in if a user deletes the widget in the closeEvent. Pick-to: 6.2 Change-Id: I39684aec0ca130033dad60f2bbf823364a5edcec Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Decouple quitOnLastWindowClosed from quitLockEnabledTor Arne Vestbø2021-10-182-7/+13
| | | | | | | | | | | | | | | | | | | In a512e210ac5b032c5fc2edf1ddf72e5a414485fda512e21 quitOnLastWindowClosed was changed to be implemented in terms of quitLockEnabled, but without any documentation to that end. Although the two features are similar (automatic quit under certain conditions), and interact, it doesn't make sense to overlap them until we actually expose them as a single property (automaticQuit e.g.) The logic for determining whether we can can quit automatically has been refactored to take both properties into account, on both a Core and Gui level. The call sites still need to check the individual properties to determine whether to activate automatic quit for that particular code path. Change-Id: I38c3e8cb30db373ea73dd45f150e5048c0db2f4d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deduplicate lastWindowClosed handlingTor Arne Vestbø2021-10-164-37/+43
| | | | | | | | | | | | | | | | | | | | | | | Whenever a window was closed, we had logic to check if it was the last window, and if so emitted lastWindowClosed and then tried to quit the application. But the automatic quit process also checked if there were any remaining windows, as this process could be triggered as a result of a QEventLoopLocker going out of scope. The two paths now share the same logic for determining if there are any remaining windows. The docs have been updated to reflect the original intent of the logic, dealing only with primary windows (top levels without a transient parent). This was how both the original code paths implemented their logic. For historical reasons the Qt::WA_QuitOnClose attribute is closely tied to the lastWindowClosed signal, and isn't merely limited to controlling whether we try an automatic quit when the last window closes. For now this behavior has been kept, but the docs have been updated to clarify how the attribute is handled in practice. Change-Id: If3d06b065236aad2e59e9091cac3146bc4cf79f6 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix high DPI position of foreign child windows on WindowsJoerg Bornemann2021-10-151-1/+2
| | | | | | | | | | | | | | | | | | | | Suppose you have a child window that is a foreign window. In the bug report's example it's a QAxWidget that wraps the Windows Media Player. This means, we have a non-top-level QWindow with a platformWindow assigned. If windows:dpiawareness is set to 1 (system-DPI aware) and the window is displayed on a screen with origin != (0, 0), then we called QPlatformWindow::setGeometry with a position in native coordinates. This moved the child window outside of the visible area. Fix this by calling QHighDpi::toNativeWindowGeometry instead of QHighDpi::toNativePixels. The former function takes child windows properly into account. Pick-to: 6.2 Fixes: QTBUG-96114 Change-Id: Ibb0f844b10aece8ede99cb34289c0430ac283fa0 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Initialize m_dpiAdjustmentPolicy from correct envMorten Johan Sørvig2021-10-141-1/+1
| | | | | | | | | | Commit 4d1f13f354 accidentally changed the code to read envScaleFactorRoundingPolicy instead of envDpiAdjustmentPolicy. Pick-to: 6.2.1 6.2 Fixes: QTBUG-97443 Change-Id: I26f519fd8829860af26fa8439df9bbf15cd7352f Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Call QWidget close handling in QWidget::close for non-toplevel native widgetsDoris Verria2021-10-141-1/+1
| | | | | | | | | | | | | | Since commit 7ba75d0 we close the QWindow in QWidget::close for native widgets and trigger the closeEvent in QWidgetWindow. However, if the widget's window handle is not a top level window, QWindow::close() will not close the window, failing in this way to deliver the closeEvent and call the close handling in QWidgetPrivate::handleClose. To fix, call handleClose() from QWidget::close for such widgets. Task-number: QTBUG-74606 Pick-to: 6.2 Change-Id: Ied342eced3340aaf19b5443762935b1a5fc5c27b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove unneeded function QGuiApplicationPrivate::emitLastWindowClosedTor Arne Vestbø2021-10-132-10/+2
| | | | | | | | It only has a single call site nowadays. Change-Id: I6f486dec51f76e1fb231fb7276bc8c856885bee1 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* gui: Fix typos in documentationJonas Kvinge2021-10-127-8/+8
| | | | | | Pick-to: 5.15 6.2 Change-Id: I533f5a55cd0cd60a76990b552d7dab51a301ac1c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* gui: Fix typos in source code commentsJonas Kvinge2021-10-122-3/+3
| | | | | | Pick-to: 5.15 6.2 Change-Id: Ie53e5542a8f93856470982939ecd8ec90b323d69 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Handle WM_GETDPISCALEDSIZEMorten Johan Sørvig2021-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By handling WM_GETDPISCALEDSIZE we can keep QWindow’s device independent size constant across DPI changes. This is done by scaling QPlatformWindow’s native size such that the change of scale factor and change of QPlatformWindow size cancels out. Qt now handles DPI change using two events: WM_GETDPISCALEDSIZE: Compute the new size for the window. WM_DPICHANGED: Apply the new DPI and window geometry. The reason for this complication is that Windows retains control over the window position during the DPI change, in order to e.g. accurately track the cursor position during a screen change. The default WM_GETDPISCALEDSIZE implementation (provided by Windows) scales the win32 window size linearly with the DPI change. We want to use linear scaling as well, however the win32 window size includes the margins, which do not change linearly as the DPI changes. Instead, scale the QPlatformWindow size, and then add the new margins. Pick-to: 6.2 Change-Id: I4f225be8fad56b1fa77e9e3cfd6538a206589d73 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix scrolling of QRasterBackingStore when operating on QRasterGLSurfaceTor Arne Vestbø2021-10-012-0/+13
| | | | | | | | | | | | We were to strict in what surface type we allowed scrolling for. The RasterGLSurface type is an odd one, used by widgets to compose GL and raster content, which means we still have a raster backingstore we can scroll. It's just the flush that's different. Pick-to: 6.2 Change-Id: Ia229c21c00ad38df9e87f4fc78e341e030ef228d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Allocate synchronously delivered QWSI events on the stackVolker Hilsheimer2021-10-012-182/+134
| | | | | | | | | | | | | | | | | If we know at compile time that a window system interface event will be delivered synchronously, then we can allocate it on the stack avoid a new/delete. This is the case for a large number of events. Add a template helper class that is specialized for the three delivery types to allocate the event object on the stack if possible, and on the heap otherwise. We can use that factory in the event handler functions, via a helper function, to replace the heap-allocation and call to handleWindowSystemEvent. Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Change-Id: If92fc91ef07f3542a37dfb0fed20e15a3d19b8f0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove conditioning on Android embeddedEdward Welbourne2021-09-171-3/+3
| | | | | | | | It is no longer handled separately from Android. This effectively reverts commit 6d50f746fe05a7008b63818e77784dd0c99270a1 Change-Id: Ic2d75b8c5a09895810913311ab2fe3355d4d2983 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Deduplicate maybeQuitOnLastWindowClosed handlingTor Arne Vestbø2021-09-174-42/+44
| | | | | | | | | | | | | | | | | | The functionality now lives in QGuiApplication, and is triggered by QGuiApplication and QApplication after dispatching the close event to the window. The slight difference between how a Qt GUI and Qt Widget app determines if a window should contribute to the close-on-quit behavior has been abstracted into a QWindowPrivate helper. The additional checks that were in place for skipping out of the whole maybeQuitOnLastWindowClosed machinery have been kept. Task-number: QTBUG-53286 Change-Id: I81bd474755f9adb3a2b082621e5ecaa1c4726808 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix QGuiApplication command line options documentation for X11Tor Arne Vestbø2021-09-171-3/+3
| | | | | | | Fixes: QTBUG-96600 Pick-to: 6.2 5.15 Change-Id: Ic3670b952d97270cce4f0a8df8bba79e934e4a6d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add QPlatformTheme::Appearance for detecting light/dark modesMitch Curtis2021-09-172-0/+13
| | | | | | | | | And implement it on Windows and macOS. Fixes: QTBUG-83908 Fixes: QTBUG-94859 Change-Id: I7b0c062adf5d4dbaefa64c862ab8ab1348809d71 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make the closeAllPopup helper virtual in QGuiApplicationVolker Hilsheimer2021-09-151-0/+1
| | | | | | | | | | | | | | QPA plugins might have to close popups for events that are not delivered to QWindow or QWidget instances. For instance, the Cocoa plugin has to explicilty close popups when the user clicks into the window frame. Expose this functionality through a virtual in QGuiApplicationPrivate, and move the QApplication implementation from a static helper into the override. Task-number: QTBUG-96450 Change-Id: I52be5710c8d7515b9ae2e4bbadb069df4b3ed546 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* doc: use \note in QKeyEvent documentationTor Arne Vestbø2021-09-151-8/+8
| | | | | | Pick-to: 6.2 Change-Id: I0924f5a540ab5e58f7830c1af099ce6e44287811 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Use QHighDpi::toNativeWindowGeometry()Morten Sørvig2021-09-151-7/+1
| | | | | | | | | This function implements the isTopLevel() logic, which we now don’t have to duplicate at each call site. Change-Id: Ic8b857aa7cd3c3c23d5e950d9f50b66c81ba3ccf Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPlatformWindow: fix isAncestorOf not breaking recursionRichard Moe Gustavsen2021-09-131-1/+1
| | | | | | | | | | | | The current implementation got stuck always asking for the parent of the same child This patch will make sure we actually walk up the parent chain. Pick-to: 6.2 6.2.0 6.1 5.15 Change-Id: I9f67f6305e0143526f53952a563d496e760ac2e7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Expose the config and display for EGL-based QOpenGLContextsLaszlo Agocs2021-09-131-0/+3
| | | | | | | | | | | | | | | | ...in the native interface. Using OpenXR is impossible on some platforms (for example, Android) without knowing all three. The EGLContext alone is not enough, and EGL offers no way to query the EGLConfig a context was created with. https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_KHR_opengl_es_enable Therefore, expose all three so libs/apps can use the new way to query these native resource without resorting to the old-style nativeResourceFor* queries. Change-Id: I7efb0a26b858150da55e711752af99426e744322 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Move QWINDOWSIZE_MAX to platform headersPaul Olav Tvete2021-09-102-2/+1
| | | | | | | | | | | QWINDOWSIZE_MAX is needed to implement platform plugins and Wayland shell integrations. Moving the #define from qwindow_p.h to qplatformwindow.h makes it available from a supported header file. This should not break anything, since qwindow_p.h includes qplatformwindow.h Change-Id: Ie003b1e9d6494695057d59aba5a17ad7fd51c654 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Always give Qt::SubWindows a default window state of Qt::WindowNoStateTor Arne Vestbø2021-09-101-0/+3
| | | | | | | | | | On platforms such as iOS, the default window state is Qt::WindowMaximized, so that calling show() will fill the entire screen. But sub-windows should not get this treatment, as their geometry is typically managed manually. Pick-to: 6.2 6.2.0 Change-Id: Ib17c2011a16baf6023fe368b94fa7f38e12bd777 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use wayland platform plugin on GNOME wayland sessions by defaultJan Grulich2021-09-091-15/+1
| | | | | | | | | | | Qt wayland platform plugin has improved quite a lot and it is now pretty much usable on Gnome. It also improves user experience a lot on HiDPI displays. Pick-to: 6.2 Change-Id: I943e0bb969f384bdc3c603e290ce9c8358b70f63 Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Clear up QWindow::isActive() documentationTor Arne Vestbø2021-09-081-1/+3
| | | | | | | | | | The isActive function does not determine if a window should be active, but whether it is currently active. The way the documentation was phrased may have lead people to believe the former. Pick-to: 6.2 6.2.0 5.15 Change-Id: I05a4cb3d8784a2fefa24bdd42ea96cfdae22b9d1 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix segfault when closing widget and destroying window in QDialog::doneVolker Hilsheimer2021-09-061-3/+7
| | | | | | | | | | | | On OpenSUSE we seem to get an Enter event after or while the QWindow is closed, and that appears to reset the currentMouseWindow after we cleared it in QWindowPrivate::destroy. Apply a workaround similar to the focus_window to make sure that currentMouseWindow and currentMousePressWindow don't point to destroyed objects. Pick-to: 6.2 Change-Id: I61afdaa7d8d1d437058624012319460be2f2567f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* doc: Add the PixelScroll device capability (new in 6.2)Shawn Rutledge2021-09-041-0/+5
| | | | | | | | | | Followup to 69c833dae91d004b48f815e0156d6caeb4cdb491 Pick-to: 6.2 Task-number: QTBUG-72167 Task-number: QTBUG-87646 Change-Id: I4ac7cbacd6dc1407ad3b565674a6d6494ec8857f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: add more notes about full screen windows on macOSVolker Hilsheimer2021-09-031-0/+3
| | | | | | | Fixes: QTBUG-68069 Pick-to: 6.2 5.15 Change-Id: I8fc99f708cfa19a9c8cc8d13f6889549c79dd3b3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: add note that hiding a window doesn't close a full screen spaceVolker Hilsheimer2021-09-031-0/+7
| | | | | | | Fixes: QTBUG-52450 Pick-to: 6.2 5.15 Change-Id: I3f819bac470b5a883a74fb58f6fa2d27740eaaf2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QWidget: close the QWindow in QWidget::closeVolker Hilsheimer2021-09-022-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | We want to close the window, end full screen mode on macOS, and free platform resources. This is all done by QWindow::close. QWindow::close closes the platform window, triggering a closeEvent to QWidgetWindow, which then calls QWidgetPrivate::close_helper. This way, closing a window via QWidget::close, QWindow::close, or interactively by the user are all equivalent. The QCloseEvent generated by the widget needs to be spontaneous for window-system generated events (i.e. the user clicked the close button), and non-spontaneous if the window closes because of a call to QWindow::close. To keep track of whether the event originated in an explicit call to QWindow::close, add a boolean to the QWindowPrivate. Add a test case that verifies that the window resources is destroyed, and that events are delivered as they should. Done-with: Morten Johan Sørvig <morten.sorvig@qt.io> Fixes: QTBUG-46701 Pick-to: 6.2 Change-Id: Iacb6a2c8d5e880b16b0c8f0c9257ed94bed36f5b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Port to QImage and QPixmap deviceIndependentSize()Morten Sørvig2021-09-011-3/+1
| | | | | | | | | Replace the “size() / devicePixelRatio()” pattern with a call to deviceIndependentSize(). Change-Id: I9d9359e80b9e6643e7395028cd43e3261d449ae7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix deprecation of QMouseEvent::source() and flags()Shawn Rutledge2021-08-272-1/+3
| | | | | | | | | | Amends 53496e67f0b78645c6080e9218c7a36bc5a9d76d: - move flags() out of the QT_DEPRECATED_SINCE block in the header - add QT_DEPRECATED_SINCE block around source() implementation Pick-to: 6.1 6.2 Change-Id: Id52fa6b04a13efbede3e6ac440060f90b283e773 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFileDialog: Use static const QRegularExpressionWaqar Ahmed2021-08-181-1/+1
| | | | | | | This avoids rebuilding the same pattern. Caught by clazy. Change-Id: Ibd0f2063617df1a9e975f58e34df556d1983afff Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Properly scale gesture positions in hi-DPI casePovilas Kanapickas2021-08-121-3/+15
| | | | | | | | The local/global positions for gestures should be handled the same as for other events as they mean effectively the same thing. Change-Id: Ic5ad995607ecd3daf385a7c7be3b67cbae312e7b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QGuiApplication: move two static variables from DATA to BSSMarc Mutz2021-08-101-2/+2
| | | | | | | | | | | | | | | | | The {mouse,touch}DoubleXDistance variables were initialized to -1, which forces them into the DATA segments. But this value is completely unused, since these variables are also set in initThemeHints(), called from QGuiApplicationPrivate::init(), before their only user, QGuiApplicationPrivate::processMouseEvent(), can possibly execute. By changing the default value to 0, then, we allow the compiler to place these variables into the BSS segment. Change-Id: I86144559ee2410b844f70a4f2499c8d3140d14cf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QInputDeviceManager: make QT_NO_KEYWORDS-cleanMarc Mutz2021-08-061-1/+1
| | | | | Change-Id: I1ba43c4dce82a8488e51c471fa3409fc08be1529 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Add native interface for X11 application, exposing display and connectionTor Arne Vestbø2021-08-063-0/+90
| | | | | | | | | | | | | | | | | | | | | The major use-case of the now private QX11Info from Qt X11 Extras was getting hold of the Xlib display and XCB connection, for example in KDE: https://lxr.kde.org/search?%21v=kf5-qt5&_filestring=&_string=QX11Info A new native interface for QGuiApplication has now been added that exposes these two properties, e.g.: if (auto *x11App = app.nativeInterface<QX11Application>()) qDebug() << x11App->display() << x11App->connection(); To avoid type clashes one of the enum values of QXcbNativeInterface's ResourceType had to be renamed. Pick-to: 6.2 Task-number: QTBUG-93633 Change-Id: I2e366a2bb88bd3965ac6172ad000ae32209f43e7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QInputDeviceManager: ++explicit, ++out-of-line-dtorsMarc Mutz2021-08-062-1/+4
| | | | | | | | | It's private API, but exported, so de-inline the dtor to pin the vtable in QtCore instead of potentially duplicating it in every plugin that uses the class. Change-Id: Ia948985bb94677c8453a8e7be27a14085303aaf5 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Improve WM_DPICHANGED handlingMorten Johan Sørvig2021-08-061-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resize QPlatformWindow on DPI change, so that QWindow size can stay approximately constant. For example, a 100x100 QWindow at 100% scaling will have a 100x100 QPlatformWindow. If the scaling is changed to 200% then the QPlatformWindow is resized to 200x200, while the size of the QWindow stays at at 100x100. In practice the QWindow size will also change slightly, due to inaccuracies in how we adjust for the size of the non-client window area. This will be addressed in a later commit. We can get DPI change independently of screen change, so no resizing should happen in screen change events. Disable the resize code in QGuiApplication for Q_OS_WIN, and remove the WithinDpiChanged flag. The new flow for handling DPI change is: 1) Send screen change (if any), so that the correct screen will be used when calculating scale factors during the following resize. 2) Resize the native window, which will trigger geometry change events, possibly also for the QWindow. 3) Resize child windows; WM_DPICHANGED is sent to top-level windows only. Fixes: QTBUG-89294 Pick-to: 6.2 Change-Id: I0e2d44bae72d20ebdafc3d410db7be9964ad851b Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Register mouse devices on cocoaShawn Rutledge2021-08-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | It would have been nice to ensure that a device is registered already in mouseEnteredImpl(); but in that context, NSEvent.deviceID is always 0, and we can't find out anything else about the device. QWindowSystemInterface::handleEnterEvent() doesn't currently take a QPointingDevice either. In handleMouseEvent() and scrollWheel(), deviceID seems unique for each trackpad or Magic Mouse, but 0 for any plain USB mouse. There, the first mouse that the user interacts with becomes primaryPointingDevice(): its deviceID is assigned to systemID (except if deviceID == 0, we use 1 instead, to avoid the auto-incrementing device ID assignment in the QInputDevicePrivate ctor.) When scrolling occurs, we update the capabilities to have PixelScroll if theEvent.hasPreciseScrollingDeltas. So over time, QInputDevice::devices() should build up to a complete list, with capabilities() also distinguishing plain mice from those that have the PixelScroll capability. And in the common case that the user has only one Apple pointing device, it becomes primaryPointingDevice(). Pick-to: 6.2 Task-number: QTBUG-46412 Task-number: QTBUG-63363 Task-number: QTBUG-72167 Change-Id: Id9771b4dfd765e49023bd57d42a2aa4d0635a3b2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: Ensure deprecated APIs in Gui are documented as suchNico Vertriest2021-07-264-28/+57
| | | | | | | | | | | Added missing #if-ery and deprecation macros to a QFont constructor that was only documented as deprecated. Fixes: QTBUG-94521 Fixes: QTBUG-95310 Pick-to: 6.2 6.1 Change-Id: I3d0418a3f7dca191a9068cc22627fe4deb7c53c5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QOpenGlContext: remove duplicated includeIvan Solovev2021-07-201-1/+0
| | | | | | | | Spotted during API review for 6.2 Pick-to: 6.2 Change-Id: Ib31020848ec6ffabc126c6984cc82547266d4a1d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use member function instead of template function to resolve native interfaceTor Arne Vestbø2021-07-176-23/+16
| | | | | | | | | | | | | | The use of a freestanding function is not needed now that the name doesn't alias the nativeInterface accessor function, and was just adding complexity to the machinery. People not familiar with the code will have an easier time following the flow through the helper member function, and we no longer need to declare our own export macros. Pick-to: 6.2 Change-Id: I17530b7e89939cfc19ab8ffaa076b7129ae02dcf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QClipboard: remove a useless default switch-case labelWenTao Song2021-07-161-2/+1
| | | | | | | | | | The switch condition expression has already dealt width all the conditions, so a `default` label is not necessary (it introduces a warning). Delete it. Fixes: QTBUG-95223 Change-Id: Iac3d9bb5d0b6fd8372d4dc16d920ce0a7b0511db Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Add note about precision of QNativeGestureEvent::delta; fix in Qt 7Shawn Rutledge2021-07-152-5/+19
| | | | | | | | | | | We keep QVector2D storage Qt 6 BC (to avoid making QNativeGestureEvent larger), but in Qt 7 we should return exactly the same value as given (for what it's worth, in spite of this being overkill for panning a reasonable distance). Change-Id: Iecbd4c9b60ad9ae5e0466c7027b038ddb85b8c8b Pick-to: 6.2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>