summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
Commit message (Collapse)AuthorAgeFilesLines
* Windows QPA: Fix text input with Input Method EditorsAndré de la Rocha2022-05-161-15/+1
| | | | | | | | | | | | | | | Removes a workaround that was added to force the Windows On-Screen Keyboard to automatically appear on Windows tablets, since it is no longer needed in currently supported Windows releases and was interfering with text input using Input Method Editors. Also remove logic for programmatically disabling the OSK, since it is no longer needed here as well, and is already supported in the UI Automation code elsewhere in the Windows QPA. Pick-to: 6.2 6.3 Fixes: QTBUG-98003 Change-Id: I6c4781852a5e9f96330d54a24ee3893dcd43a28c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Windows: Make QScreen::name() more user-friendly, take 2Yuhang Zhao2022-05-162-13/+45
| | | | | | | | | | | | | | | | | | | | | | | | The first attempt introduced in e9fd1c6aab28f had an unwanted side-effect which makes the screen name non-unique and made the screen manager think multiple different monitors with the same name is one same monitor. This behavior is of course wrong and unwanted but it was missed due to there's no unit test for this property and I was not familiar enough with QPA stuff. As a result the change was reverted in 851dc581cf9a76. However, the original change is still a good improvement, so we bring it back, but fixed the side-effect mentioned above, by letting the screen manager compare the device name instead of monitor name. If multiple monitors have the same name, a numeric suffix will be appended to the monitor name to let people still be able to distinguish between them. Change-Id: Ic03105d0825abbb3d21cb51d1da3ab2cbb4ca913 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-16105-3996/+216
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Correctly read and write CF_DIB bmp dataViktor Arvidsson2022-05-161-0/+12
| | | | | | | | | | | | | | | | | | | | When decoding CF_DIB data through the bmp handler we have to do some assumptions on where the pixel data starts since there's no file header to get the offset value from. We have to do this because theres some optional data after the info header that needs to be skipped over in some cases. These optional color mask values are now also written when putting a CF_DIB into the clipboard for maximum compatibility with other apps on Windows. This fixes the issue where pasted dibs would be offset by 3 pixels on Windows. Fixes: QTBUG-100351 Pick-to: 6.2 6.3 Change-Id: Icafaf82e0aa3476794b671c638455402a0d5206f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Windows QPA: Send screen change before geometry changeMorten Sørvig2022-05-101-3/+3
| | | | | | | | | | | | | | | | | | Fix bug where the device independent QWindow size was set incorrectly, due to usage of incorrect screen and scale factor. This could happen when a window's screen was set to QGuiApplication::primaryScreen() as a fallback, before QWindowsWindow::initialize() would determine the correct screen. By sending the screen change first we make sure that that QWindowSystemInterface::handleGeeometryChange() uses the correct screen for the window. Change-Id: I5520ae67a4db60903d38db856fc314c75a3c0219 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Windows QPA: Fix crash in some rare casesYuhang Zhao2022-05-101-1/+2
| | | | | | | | | | | | | | For the WM_SETTINGCHANGE message, lParam sometimes may be NULL [1] and that will lead to crash without extra safe guard. Amends commit qtbase/1ed449e168af133184633d174fd7339a13d1d595 [1] https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-settingchange Change-Id: Ibd1e94b4c1d7882db0719c31a66a5fcc9299c3bd Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Revert "Windows QPA: Remove dependency on swprintf_s() pulled in via ↵Kai Köhne2022-05-061-20/+1
| | | | | | | | | | | | | | | | | _com_error::ErrorMessage()." This reverts commit 043529c9dc609f3dc4bc6c79b7bc4d33ca3a3ba3, that was introduced to keep compatibility with Windows XP. This is not necessary anymore, as support for Windows XP got dropped. The now removed code also had an issue in the format of the fifth argument of FormatMessage, that is supposed to be a pointer to a pointer for FORMAT_MESSAGE_ALLOCATE_BUFFER. Pick-to: 6.2 6.3 Change-Id: Ib75b6a53a778801388d71388701340d3b79dacce Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ihor Dutchak <ihor.youw@gmail.com>
* Windows: Fix pop-up windows being incorrectly moved to primary displayAndré de la Rocha2022-05-051-1/+1
| | | | | | | | | | | | Amends a previous workaround used with AMD graphic adapters, which under some circumstances could incorrectly move pop-up windows and cause issues with menus. Fixes: QTBUG-97533 Pick-to: 6.2 6.3 Change-Id: Icc83198913b0e78ae3d7c0679e46f8b46b7015bf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Plugins: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-05-046-12/+12
| | | | | | | Task-number: QTBUG-98434 Change-Id: If64c294033c114ae46dfc327c40da7f3c7a598f5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Plugins: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-048-26/+42
| | | | | | | | | As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Task-number: QTBUG-98434 Change-Id: I7fadd3cf27ad099028d70f05956303e3af62c0f5 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Plugins: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-05-021-1/+1
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: Id76add7e86b6dfb89f758a9efb0644067f0f44de Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove noop calls to QPlatformInputContext base classTor Arne Vestbø2022-04-291-2/+0
| | | | | | | | | | | | | | Like most QPlatformFoo base classes the default implementations are empty, or have default behavior that should be completely replaced by subclasses. By making it consistent across all the platform plugins when we call base class methods, we avoid confusion of whether a base class call is needed or not. Change-Id: Idd8e4a6fa0e24a1dffd21b63471c9b1c2348691f Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Windows QPA: Only refresh the window theme if it really changesYuhang Zhao2022-04-261-11/+14
| | | | | | | | | | | | | | | WM_SETTINGCHANGE may be triggered in many different reasons, we don't have to verify whether the system changes the global theme or not in all cases. Although not officially documented, there's a widely known and used technique to detect whether the user actually changes the personalize settings or not, that is when wParam is 0 and lParam is "ImmersiveColorSet", this combination indicates system's personalize settings has been changed. We can get rid of most unneeded verify of system theme by only execute the logic in this specific case. Change-Id: Iaf934c29975b3b2090fd692776f80b1125d3ddb3 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Windows QPA: fix the FullScreen standard keyYuhang Zhao2022-04-231-1/+0
| | | | | | | | | | | | | If you try to use the QKeySequence::FullScreen as a shortcut for your Qt applications, you'll find it's not working. This is due to this key combination is being skipped by Qt and it's being passed to Windows's default handling procedure. This is wrong because Windows doesn't provide any default action for this shortcut so nothing will happen. Change-Id: Id73b7275764fe63c119a6d673a665b0090944fef Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Windows QPA: Enhance theme change notifyYuhang Zhao2022-04-231-5/+12
| | | | | | | | DWM colorization color change should also be considered as a theme change event. Change-Id: I55562b9d43988aafc8a60a6264fe16dccbefff92 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Send ThemeChange event to all windows when system theme changesTor Arne Vestbø2022-04-221-2/+1
| | | | | | | | | | | | | | | | | | | The QWSI event for theme change has an optional window parameter to specify the window affected, but most platform react to global theme changes, and end up passing nullptr into the event. The reasonable thing to do in QGuiApplication in that case is send a theme change event to every QWindow, so that they are all notified about the situation. This approach is what the Windows platform plugin was doing already, but did so by iterating manually over the windows, resulting in multiple calls to QGuiApplicationPrivate::handleThemeChanged -- one for each QWSI event. Change-Id: Ifb27b6c31231377c0df389a592cafd0075d3d8bb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Don't blit individual rects of region when when scrolling backingstoreTor Arne Vestbø2022-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | The QPlatformBackingStore::scroll() API takes a QRegion as input, but we have no guarantee that the individual source and destination rects of the region will not overlap each other when applying the scroll offset, so we can't naively iterate the rects and call qt_scrollRectInImage for each one. The reason this didn't cause any issues in practice was that the QWidget repaint manager was always passing in a single rect as the region. On the other hand, the client has requested a scroll of the given region, so it might assume any other part of the backing store is preserved as is. Scrolling the bounding rect of the region violates this assumption. Amends 19ef76b0606621f189d3bc56549d200f2f5ebb25. Pick-to: 6.2 6.3 Change-Id: I27934dd6685311c0b53ea2adb60fa5997e360f6c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Windows QPA: Fix slowdown with large table/tree views with accessibilityAndré de la Rocha2022-03-311-12/+4
| | | | | | | | | | | | | | The accessibility code for notifying focus changes related to a table/tree view was iterating over all items to find the focused one, which for a very large number of items could cause a major slowdown and UI freeze. This patch avoids the issue by removing the loop and implementing the focusChild() method in the table/tree accessibility classes. Fixes: QTBUG-100997 Pick-to: 6.2 6.3 5.15 Change-Id: I04c847a5e65223b7a93ab82363feb32e1ebab9f3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Windows QPA: Avoid sending accessibility notifications before activationAndré de la Rocha2022-03-312-0/+9
| | | | | | | | | | | | | | When accessibility was activated after the application startup, it would send state update notifications for every accessible object, which for a large number of objects could result in a flood of UI Automation notifications and UI slowdown. This patch ignores these notifications until QAccessible is activated, which should avoid the slowdown and seems to cause no side effects with accessibility tools. Fixes: QTBUG-95114 Pick-to: 6.2 6.3 5.15 Change-Id: If1495d0aa846d7810b3d297b7e156563a7e5f6e6 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Windows QPA: Avoid slowdown with UI Automation name change notificationAndré de la Rocha2022-03-311-6/+10
| | | | | | | | | | | | | | | A previous fix for QTBUG-70621, which allowed changes in the state of a Quick combo box control to be detected by accessibility clients has reportedly caused significant slowdowns under some difficult to reproduce circumstances, probably associated with a large number of accessible objects. This patch restricts the name change notification to combo boxes, which seem to be the only kind of control requiring them for accessibility, instead of sending it for all control types. Fixes: QTBUG-97103 Pick-to: 6.2 6.3 5.15 Change-Id: I18c0067478df5a80f7365195d3559b3f04faa815 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Misc: Do not depend on transitive includesFabian Kosmale2022-03-172-0/+3
| | | | | | | | As a drive-by, remove superfluous includes from qnetworkmanagerservice.h and obey the coding conventions for includes in a few more places. Change-Id: I65b68c0cef7598d06a125e97637040392d4be9ff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Compose render-to-texture widgets through QRhiLaszlo Agocs2022-03-111-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QPlatformTextureList holds a QRhiTexture instead of GLuint. A QPlatformBackingStore now optionally can own a QRhi and a QRhiSwapChain for the associated window. Non-GL rendering must use this QRhi everywhere, whereas GL (QOpenGLWidget) can choose to still rely on resource sharing between contexts. A widget tells that it wants QRhi and the desired configuration in a new virtual function in QWidgetPrivate returning a QPlatformBackingStoreRhiConfig. This is evaluated (among a top-level's all children) upon create() before creating the repaint manager and the QWidgetWindow. In QOpenGLWidget what do request is obvious: it will request an OpenGL-based QRhi. QQuickWidget (or a potential future QRhiWidget) will be more interesting: it needs to honor the standard Qt Quick env.vars. and QQuickWindow APIs (or, in whatever way the user configured the QRhiWidget), and so will set up the config struct accordingly. In addition, the rhiconfig and surface type is (re)evaluated when (re)parenting a widget to a new tlw. If needed, this will now trigger a destroy - create on the tlw. This should be be safe to do in setParent. When multiple child widgets report an enabled rhiconfig, the first one (the first child encountered) wins. So e.g. attempting to have a QOpenGLWidget and a Vulkan-based QQuickWidget in the same top-level window will fail one of the widgets (it likely won't render). RasterGLSurface is no longer used by widgets. Rather, the appropriate surface type is chosen. The rhi support in the backingstore is usable without widgets as well. To make rhiFlush() functional, one needs to call setRhiConfig() after creating the QBackingStore. (like QWidget does to top-level windows) Most of the QT_NO_OPENGL ifdefs are eliminated all over the place. Everything with QRhi is unconditional code at compile time, except the actual initialization. Having to plumb the widget tlw's shareContext (or, now, the QRhi) through QWindowPrivate is no longer needed. The old approach does not scale: to implement composeAndFlush (now rhiFlush) we need more than just a QRhi object, and this way we no longer pollute everything starting from the widget level (QWidget's topextra -> QWidgetWindow -> QWindowPrivate) just to send data around. The BackingStoreOpenGLSupport interface and the QtGui - QtOpenGL split is all gone. Instead, there is a QBackingStoreDefaultCompositor in QtGui which is what the default implementations of composeAndFlush and toTexture call. (overriding composeAndFlush and co. f.ex. in eglfs should continue working mostly as-is, apart from adapting to the texture list changes and getting the native OpenGL texture id out of the QRhiTexture) As QQuickWidget is way too complicated to just port as-is, an rhi manual test (rhiwidget) is introduced as a first step, in ordewr to exercise a simple, custom render-to-texture widget that does something using a (not necessarily OpenGL-backed) QRhi and acts as fully functional QWidget (modeled after QOpenGLWidget). This can also form the foundation of a potential future QRhiWidget. It is also possible to force the QRhi-based flushing always, regardless of the presence of render-to-texture widgets. To exercise this, set the env.var. QT_WIDGETS_RHI=1. This picks a platform-specific default, and can be overridden with QT_WIDGETS_RHI_BACKEND. (in sync with Qt Quick) This can eventually be extended to query the platform plugin as well to check if the platform plugin prefers to always do flushes with a 3D API. QOpenGLWidget should work like before from the user's perspective, while internally it has to do some things differently to play nice and prevent regressions with the new rendering architecture. To exercise this better, the qopenglwidget example gets a new tab-based view (that could perhaps replace the example's main window later on?). The openglwidget manual test is made compatible with Qt 6, and gets a counterpart in form of the dockedopenglwidget manual test, which is a modified version of the cube example that features dock widgets. This is relevant in particular because render-to-texture widgets within a QDockWidget has its own specific quirks, with logic taking this into account, hence testing is essential. For existing applications there are two important consequences with this patch in place: - Once the rhi-based composition is enabled, it stays active for the lifetime of the top-level window. - Dynamically creating and parenting the first render-to-texture widget to an already created tlw will destroy and recreate the tlw (and the underlying window). The visible effects of this depend on the platform. (e.g. the window may disappear and reappear on some, whereas with other windowing systems it is not noticeable at all - this is not really different from similar situtions with reparenting or when moving windows between screens, so should be acceptable in practice) - On iOS raster windows are flushed with Metal (and rhi) from now on (previously this was through OpenGL by making flush() call composeAndFlush(). Change-Id: Id05bd0f7a26fa845f8b7ad8eedda3b0e78ab7a4e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Revert "QScreen_win: retrieve user friendly monitor name"Morten Johan Sørvig2022-03-111-15/+4
| | | | | | | | | | | | | | This made the screen names be non-unique (in my case “28E850”), which causes the code in handleScreenChanges() to think they are the same screen. This reverts commit e9fd1c6aab28f027760da76ebc154f0ff9aefcf8. Pick-to: 6.3 6.2 Change-Id: I97fb76aeb66857b4bf9b3c5b4bd6db6024446798 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Yuhang Zhao <2546789017@qq.com>
* Fix deprecated uses of QScopedPointerMårten Nordheim2022-03-081-4/+6
| | | | | | | | | By changing it to unique_ptr. Pick-to: 6.2 6.3 Change-Id: I91abb69445b537d4c95983ae735341882352b29d Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows QPA: Add convenient overload to query window frameYuhang Zhao2022-03-012-0/+11
| | | | | | | | | | | | To be used in a later commit. As a drive-by, return early in the frameOnPrimaryScreen overload to avoid calling GetWindowLong in cases we don't need them. Pick-to: 6.3 6.2 Change-Id: Ia69f4acbbf3e044073f818f357e614d4c6680d21 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Windows QPA: Add some offset to the system menu when appropriateYuhang Zhao2022-03-011-1/+23
| | | | | | | | | | | | | | | | Before this patch, the system menu will always appear on the top-left corner of the window if the window doesn't have the standard window frame. However, this doesn't look very good on most situations, especially when the window has a homemade title bar. This patch adds an extra check for this kind of situations. This patch will automatically apply an appropriate offset for the system menu if the user is trying to use a self-made title bar for their frameless or customized windows. Pick-to: 6.3 6.2 Change-Id: I55e1c4ac26a4051ca48928d4a2ac3456dce117d1 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Windows QPA: fix window style correction for context help buttonYuhang Zhao2022-03-011-3/+8
| | | | | | | | | | | | | | According to Microsoft Docs [1][2], WS_MINIMIZEBOX and WS_MAXIMIZEBOX must be accompanied by the WS_SYSMENU style, and the WS_EX_CONTEXTHELP style is not compatible with WS_MINIMIZEBOX and WS_MAXIMIZEBOX. This patch adds additional checks for these situations. [1] https://docs.microsoft.com/en-us/windows/win32/winmsg/window-styles [2] https://docs.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles Pick-to: 6.3 6.2 Change-Id: If32f8b42e25cfc67ffd1e84cc4b061f21a01042a Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Windows QPA: Use less magic numberYuhang Zhao2022-03-011-19/+21
| | | | | | | | | | | | | | | | | | | The correct calculation of the invisible frame margin and the window border width (they are the same thing actually) is the thickness of the size frame plus the thickness of the padded border. When DPI is 96, both of them is 4px and thus the invisible frame margin and window border width is 8px. So previously the empirical magic number can work normally is because the error is very small. It's not a big thing because even on a high DPI screen the error is still very small. For example, on my 4K monitor with 200% scaling, the error is only 2px, human eyes almost can't find the visual difference. But since we now know how to calculate these values correctly, let's use the correct calculation instead. The magic numbers and empirical expressions just make people confused. Pick-to: 6.3 6.2 Change-Id: Ieda4796231935f2ad1b6f28e4aa4af5b5bce2256 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Windows QPA: Highlight the first entry in the system menuYuhang Zhao2022-02-251-1/+9
| | | | | | | | | This is what native Win32 applications usually do. Pick-to: 6.3 6.2 Change-Id: I19f1170113b4064f1d683dbd13b7de7d263105f0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Windows QPA: More debug enhancementsYuhang Zhao2022-02-251-12/+61
| | | | | | | Pick-to: 6.3 Change-Id: Ibf03fa82f14cf704267b85348ce11ee2d505ff24 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Windows QPA: Calculate window frame for frameless windows the same for all ↵Viktor Arvidsson2022-02-222-17/+23
| | | | | | | | | | | | | | | | | | | | | | code paths When we add the WS_THICKFRAME/WS_CAPTION window flags to a frameless window the return value of AdjustWindowRectEx is no longer 0. This works fine when creating the window since the version of QWindowsGeometryHint::frame used during creation checks the FramelessWindowHint, however later when the window changes screen, the screen change code checks the fullFrameMargins which uses a version of QWindowsGeometryHint::frame that does not early out, causing a missmatch in the geometries of the backing store and platform window. This fixes aero snapping shortcuts for frameless windows on multi monitor setups. Fixes: QTBUG-84466 Pick-to: 6.2 6.3 Change-Id: I2357ea32669e4676645549996a3ac6073f3df15c Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Always include qt_windows header firstVolker Hilsheimer2022-02-222-3/+2
| | | | | | | | | | qt_windows takes care of setting NOMINMAX, which prevents native headers from defining `min` and `max` as macros, breaking the build. So include that header always as the first header. Pick-to: 6.3 Change-Id: I82cd8b21d263102000e6e66f135465bc2c126db4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove unused variable which causes compiler errorPiotr Srebrny2022-02-211-1/+0
| | | | | | Pick-to: 6.2 6.3 Change-Id: I87348370d10d2047e8fa861d7675bc0cd3db080b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Windows: use QSystemLibrary instead of LoadLibrary directlyAndy Shaw2022-02-182-7/+14
| | | | | | | | | | | | Using QSystemLibrary ensures that it will only use the expected copy of the system library and not one that has been placed in the application's working directory or elsewhere in the PATH environment variable. Pick-to: 5.15 6.2 6.3 Change-Id: Ic4234334f73482b38ee5f06345bf11f8c029edc5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Windows QPA: Correct mistake when calculating minmaxinfoViktor Arvidsson2022-02-141-1/+1
| | | | | | | | | | | | | | | Amends 46e9852a1d04357c98b2c62338e1e2af0de9b486 The previous code would fail if the windows taskbars are placed to the top or left on the screen. The mistake was missed because Windows seems to adjust the window position automatically in case the window handles WM_NCCALCSIZE and returns 0, which was the case for me. Task-number: QTBUG-51327 Pick-to: 5.15 6.2 6.3 Change-Id: I38ef974f7518be63a0bacf080f3359c219284078 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Windows QPA: Fix frameless maximize on secondary screensViktor Arvidsson2022-02-111-13/+11
| | | | | | | | | | | | | | Frameless windows shouldn't cover the taskbar when maximized. This has been fixed for the main screen in the past but did not work for secondary screens. According to the code the MINMAXINFO is only available for the main screen but I believe this is a misunderstanding of the Windows documentation. Besides we use QScreen::availableGeometry() which seems to be correct. Fixes: QTBUG-51327 Pick-to: 5.15 6.2 6.3 Change-Id: Ib2205c480359d1a870dcfcf0312fbe417f650e28 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Remove unused .qrc filesJoerg Bornemann2022-01-172-30/+0
| | | | | | | | Task-number: QTBUG-94446 Change-Id: I136d8b4ab070a832866aa50b5701fc6bd863df8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QScreen_win: retrieve user friendly monitor nameYuhang Zhao2022-01-121-4/+15
| | | | | | | | | | | [ChangeLog][QtGui][QScreen] QScreen::name() now returns the user friendly name instead of the GDI device name on Windows. This is consistent with other platforms and also obeys the documentation. Fixes: QTBUG-74317 Pick-to: 6.3 6.2 Change-Id: Iefbfaa1f9fd504277a0b5eb8c7a1fc13257c01f2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace QString::utf16() with data() in memcpy() and QByteArray ctorØystein Heskestad2022-01-071-3/+3
| | | | | | | | | | | QString::utf16() needlessly detaches fromRawData() to ensure a terminating NUL. Use data() where we don't require said NUL, taking care not to call the mutable data() overload, which would detach, too. Task-number: QTBUG-98763 Change-Id: I7075a8f18ab1f82ebbcf8cfab1643e8ab7f38d51 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Windows: Don't crash in mouse handling when QApplication is recreatedVolker Hilsheimer2021-12-221-1/+3
| | | | | | | | | | | | | | | | | We store the primary pointing device in a static variable to avoid the lookup for each mouse event. However, when QApplication is destroyed, then the device is destroyed, and the pointer needs to be reset so that QApplication can be created again by the same process without the first mouse event crashing the program. Use QPointer to prevent the pointer from becoming dangling. Fixes: QTBUG-99319 Pick-to: 6.2 6.3 Change-Id: Ie534c5eee48afb83e3a4adf70fc6cb4a2c310a7a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Windows QPA: Enhance debug informationYuhang Zhao2021-12-171-0/+74
| | | | | | | | | https://docs.microsoft.com/en-us/windows/win32/winmsg/window-styles https://docs.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos Change-Id: I54392b36c52c4318c0d2d5489bbfd582ff7bccb3 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Windows QPA: Correctly respond to WM_ERASEBKGNDYuhang Zhao2021-12-153-4/+6
| | | | | | | | | | | | | | | | According to Microsoft Docs [1], applications should return non-zero in response to WM_ERASEBKGND if it processes the message and erases the background and that's indeed the case for Qt. Although I can't see any visual difference, this patch obeys the official documentation at least. [1] https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-erasebkgnd Pick-to: 6.3 6.2 Change-Id: I8aa0bfb25259013bfc2ca4074f05a97c7865159c Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Windows QPA: Remove extra class name from the function nameYuhang Zhao2021-12-151-1/+1
| | | | | Change-Id: Iabe7c0093acc9b892182aa7e69e5af50abf61275 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Windows QPA: Fix cursors getting out of sync after restoring override ↵Friedemann Kleint2021-12-085-5/+24
| | | | | | | | | | | | | | cursors on native windows Introduce a flag to QWindowsWindow which forces the cursor to be applied after restoring override cursors. Fixes: QTBUG-98856 Pick-to: 6.2 5.15 Change-Id: Id62cdc2dd01f45324503a542446b1c11a1fe6f44 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* QPA: Set focus reason when window activation changes focusVolker Hilsheimer2021-12-031-1/+1
| | | | | | | | | | | | | | | QApplication hides the fact that the reason is never set by several QPA plugins, but Quick items don't receive the correct reason on Windows, Android, the offscreen plugin, and other platforms. Add relevant scenario to the QFocusEvent test case, and fix the plugins to always set the focus reason when handling window activation changes. Exclude the minimal plugin from the test, it seems largely unmaintained anyway. Task-number: QTBUG-75862 Change-Id: I5404a225b387fc9a3851b6968d0777c687127ed1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Windows QPA: Further cleanup of pre-Win10 codeYuhang Zhao2021-11-2413-383/+105
| | | | | | | | | | | | | | | | | Mostly a removal of dynamically loaded Win32 APIs. Since Qt 6's minimum supported platform is Win10 1809 (10.0.17763, code name RS5), all these functions will be available and no need to resolve them at run-time. Things not remove: WinTab functions in "qwindowstabletsupport.cpp". Not my familiar area, so not touch it. Pick-to: 6.2 Task-number: QTBUG-84432 Change-Id: I7ad6c3bc8376f6c0e3ac90f34e22f7628efeb694 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Windows QPA: Fix multi-touch support in some devicesAndré de la Rocha2021-11-182-9/+37
| | | | | | | | | | | | | | | | Some multi-touch devices send touch information for each finger using different WM_POINTER messages/frames, instead of a single one with a list of touches, like most devices. This would result in the generation of multiple touch events, which can cause unexpected behavior in applications (the QTouchEvent documentation specifies that it should contain all simultaneous touches). This patch adds a workaround to ensure all simultaneous touches are included in the events, to comply with the expected behavior. Pick-to: 6.2 5.15 Change-Id: I12a2f84b35a6bdd49ee53d25de580c0941a9aea6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Windows QPA: Set SWP_NOCOPYBITS during resize to avoid jitterYuhang Zhao2021-11-121-1/+6
| | | | | | | | | | | | | Allowing Windows to re-use parts of the client area when resizing might result in jitter. See discussion in: https://stackoverflow.com/questions/53000291/how-to-smooth-ugly-jitter-flicker-jumping-when-resizing-windows-especially-drag Fixes: QTBUG-97774 Pick-to: 6.2 Change-Id: Idc8f0d1953dd0a8b329312d8a9fd0509cc24d81f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Bump WINVER, _WIN32_WINNT and _WIN32_IE to _WIN32_WINNT_WIN10 (0x0A00)Yuhang Zhao2021-11-106-25/+12
| | | | | | | | | | | And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time, to unblock the developers from accessing the latest Windows APIs. Pick-to: 6.2 Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* windows qpa: re-apply 8d6e825dMorten Johan Sørvig2021-10-291-0/+2
| | | | | | | | | | | | “Handle invisible child windows gracefully on dpi changes” This fix was accidentally removed by commit cd96d870 “Move VM_DPICHANGE handling to QWindowsWindow”. Fixes: QTBUG-96466 Pick-to: 6.2 Change-Id: I3774f6305631ba47282d43e8480e2acaba517a96 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>