summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
Commit message (Collapse)AuthorAgeFilesLines
* wasm: delete unused requestUpdate() code pathMorten Sørvig2022-07-061-13/+1
| | | | | | | | | | Commit 5359d4 made it so that the window will always have a valid compositor pointer, which means that we don't have to keep the "no-compositor" fallback code path around. Change-Id: Id226e272937a7d488b27ea08dbc575fd9a039ac6 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* Make EGL use Qt X connection without xcb_xlib with EGL_EXT_platform_xcbIlya Fedin2022-07-052-12/+13
| | | | | | | | This allows to create EGL context without involving Xlib. This extension was created a year ago and is present in Mesa since 21.0 Change-Id: I7cb0aece1e67b4db59d453cbcfbd317bb5d9c777 Reviewed-by: Liang Qi <liang.qi@qt.io>
* iOS plugin: Add support for wheel eventsDoris Verria2022-07-051-0/+81
| | | | | | | | Use UIPanGestureRecognizer to handle mouse and trackpad scroll. Task-number: QTBUG-99795 Change-Id: I5db7fabf55b6f2e6f7ba90a0b90ecb08734e2329 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Android A11Y: Fix deadlock in QtAndroidAccessibility::runInObjectContext()Mike Achtelik2022-07-051-1/+7
| | | | | | | | | | | | | | | | | | | On android the event loop is normally blocked, when the application is suspended, e.g. when it enters the background or when the screen is locked (see android.app.background_running). This leads to a problem when we try to process events after this happens, e.g. when android sends us an ACTION_CLEAR_ACCESSIBILITY_FOCUS event after the event loop is suspended. While handling it we eventually call QtAndroidAccessibility::runInObjectContext() which tries to do a blocking call on the object context, however, with the event loop being suspended we run into a deadlock which leads to an ANR. So we need to make sure to never make a blocking call while the event loop is suspended. Task-number: QTBUG-102594 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I33f0440a3da84fb4bdae5ab0fc10d514c73f23ad Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Windows: Fix OpenGL window's screenYuhang Zhao2022-07-061-4/+9
| | | | | | | | | | | | The "GpuDescription::detect().gpuSuitableScreen" is a device name like "\\.\DISPLAY1", not a user-friendly name. Amends commit qtbase/75f22702933bad4f0da2b63a94ea183021771e4c Pick-to: 6.4 Change-Id: I525ecd026f3ee3bc467834449ae023ebfa1138c1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Ignore deprecation for kOnSystemDisk icon domainTor Arne Vestbø2022-07-051-1/+1
| | | | | | | | There's no good replacement yet, so for now ignore the deprecation. Pick-to: 6.2 6.3 6.4 5.15 Change-Id: I56928b73c47b677e3fdafd35cc5ae558e5285314 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Cocoa: deal with unexpected tablet events without proximityShawn Rutledge2022-07-011-6/+10
| | | | | | | | | | | | | | If the user has a Wacom stylus in proximity of the tablet already (perhaps left it lying on the tablet) and starts a Qt application, we don't get to see a proximity enter event, so a lot of device information is missing; nevertheless, creating a stop-gap device (with ID 0, type Unknown) makes it possible to get basic QTabletEvents with pressure, until the next time the stylus leaves and comes back into proximity. Pick-to: 6.4 Fixes: QTBUG-65559 Change-Id: Ibacbdb78461c0b62d4040c80d210a1b06074e952 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* iOS: Send touch events asynchronously to avoid deadlocking UIKit event loopTor Arne Vestbø2022-07-011-2/+10
| | | | | | | | | | | | | | | | | | | | | | Although CFRunLoop is documented to support nesting, the UIKit event delivery machinery is not prepared to handle nested event loops. If the user starts a nested event loop in response to e.g. a button press/release, it will deadlock the entire UIKit event machinery, stopping processing of both screen updates (CATransactions) as well as other events. This became an issue on iPhone hardware device in iOS 15, but can not be reproduces on iPads or in the simulator. To be on the safe side, we deliver all touch events asynchronously, even if that means the application code will always be one step behind the event delivered by the operating system. Fixes: QTBUG-98651 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Id0a9fa60b7bb7aa98606d46257e99eac144a1080 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Create a promise wrapper for C++ and port existing usesMikolaj Boc2022-06-301-98/+11
| | | | | | | | | | | | | | | Currently, to use a promise from C++ we either have to use an ASM block (which does not work well with dynamic linking) or declare exports in the EMSCRIPTEN_BINDINGS block, which is cumbersome and cannot be chained. This solution makes it easy to use js promises by introducing the WebPromiseManager which dispatches callbacks to appropriate callers when available. This is a preliminary patch for FileSystem support, which will heavily use async APIs. Task-number: QTBUG-99611 Change-Id: I368a8f173027eaa883a9ca18d0ea6a3e99b86071 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Windows: Don't rely on top level QWindow to scale children on DPI changeTor Arne Vestbø2022-06-301-13/+9
| | | | | | | | | | | | | | | | | The native size of a QWindow on Windows is the logical size of the window times the window's device pixel ratio. We manage this relationship for top level windows via the WM_GETDPISCALEDSIZE message, and during WM_DPICHANGED we then applied the same scale to child windows. This is problematic in the case where a child window does not have a QWindow parent, so instead of scaling all children when the parent gets a WM_DPICHANGED message, we scale each individual child in the child's WM_DPICHANGED_AFTERPARENT message. Task-number: QTBUG-103383 Pick-to: 6.4 Change-Id: Ia0845aa19a3bb97b7bc9e7d9554ac02b95ca65a5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Android: Fix the offset of the EditPopupMenuPekka Gehör2022-06-291-3/+14
| | | | | | | | | | Fix the offset of the EditPopupMenu on application window. Issue caused by a5bb7b3ca510c301baf84e1dd46d5aeeb4986eb2 Fixes: QTBUG-71900 Pick-to: 6.2 6.3 6.4 Change-Id: Ib95e1544fe91c273bc5317bd338a50a74fb1090a Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* xcb: update xkb_state mask as much as possibleLiang Qi2022-06-281-2/+2
| | | | | | | | | | | | | | | Though we can get xcb_xkb_state_notify_event_t for the change, but it looks like not enough, especially when a new usb barcode scanner was used, it should be a slave keyboard, and Qt only uses core_device_id for now. It should be enough to update xkb_state mask when we get key event. See also https://xkbcommon.org/doc/current/md_doc_quick_guide.html . Fixes: QTBUG-95933 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Ie1e82c19edd777630c7f9057a3b2b8b7cad59e38 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add a way to declare _exported_ logging categoriesGiuseppe D'Angelo2022-06-272-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a library declares a logging category that needs to be used by clients (e.g. via inline methods, macros, etc.), then the logging category function generated by Q_DECLARE_LOGGING_CATEGORY has to be exported. We've seen this problem with Q_NAMESPACE, Q_GADGET, etc.: these macros also declare functions or objects that in some cases need to be exported. And precisely like Q_NAMESPACE, Q_GADGET, etc., people end up relying on the implementation details of Q_DECLARE_LOGGING_CATEGORY (specifically, what does it expand to) in order to place the export directives in the right place. Introduce a more robust solution and apply it around qtbase. Cleanup some minor code as a drive-by (remove `extern` and useless semicolons). [ChangeLog][QtCore][QLoggingCategory] Added the Q_DECLARE_EXPORTED_LOGGING_CATEGORY macro, in order to allow dynamic libraries to declare a logging category that can be then used by client code. Change-Id: I18f40cc937cfe8277b8d62ebc824c27a0773de04 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Fix typo in codeDuan Ting2022-06-231-1/+1
| | | | | | | | | Found by codespell Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I75f4b14f3eded035a0c904d8a7174cb6f5b7d9ef Reviewed-by: Wang Bo <wangbo@uniontech.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: do not allow blocked windows to be resizedLorn Potter2022-06-221-5/+10
| | | | | | | Fixes: QTBUG-102869 Pick-to: 6.3 6.4 Change-Id: I69a4afbb67618dce7bcc499208e7e608e9adf212 Reviewed-by: David Skoland <david.skoland@qt.io>
* wasm: improve the specialHtmlTargets testMorten Sørvig2022-06-221-4/+8
| | | | | | | | | | | | It can actually be undefined, so test for that before checking the object type. This fixes the asyncify build. Pick-to: 6.4 Change-Id: I5a6a0bc60c153290c35c20242400c59cd1312403 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Add ExpandCollapse UI Automation pattern to combo boxesAndré de la Rocha2022-06-222-7/+14
| | | | | | | | | | | Also add support to expandable/expanded states to QAccessibleComboBox in widgets. QtDeclarative will still require updates so that QML combo boxes report the expanded/collapsed state and react to UIA actions. Task-number: QTBUG-103591 Pick-to: 6.4 6.3 Change-Id: Iff8ba5e3143778ce17998dbe7f5f76cae658dc19 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* xcb: Port XSync call in QXcbWindow::create to xcbIlya Fedin2022-06-211-3/+1
| | | | | | | | | QXcbConnection::sync is a full equivalent of calling XSync with false, they both are sending GetInputFocus request and getting its reply Pick-to: 6.4 Change-Id: I4f91b9447a02def41a8693a54312856b56e74811 Reviewed-by: Liang Qi <liang.qi@qt.io>
* xcb: set primary screen more correctlyLiang Qi2022-06-212-4/+17
| | | | | | | | | | | | | | | For example, when having virtual monitor which includes two real monitors, the primary information in xcb_randr_monitor_info_t is normally false, because user can only set it for output. Kudos to Jiang Wu for his first patch and details of the issue. Done-with: Jiang Wu <wujiang@kylinos.cn> Pick-to: 6.4 6.3 Change-Id: I6af443ff69d347a6d86efc9c8ea7a5d18f4c3e24 Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Jiang Wu <wujiang@kylinos.cn> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* xcb: clear m_singlescreen before updateJiang Wu2022-06-211-0/+1
| | | | | | Pick-to: 6.4 6.3 Change-Id: Iafff57be82b5beb1f5702c00e0b6d7d0dd3ccdc2 Reviewed-by: Liang Qi <liang.qi@qt.io>
* xcb: fix missing initialization of m_cursorNils Jeisecke2022-06-212-7/+6
| | | | | | | | | | | | | | | | | | | | Regression introduced in 9a4c98e55659b32db984612e6247ac193812a502: m_cursor is not initialized and never set when monitorInfo is not available in QXcbScreen::setMonitor. This seems to happen when running in VNC, e.g. on a Raspberry Pi. This usually results in crashing the application pretty soon. Using a unique_ptr solves both the initialization and a possible leak when setMonitor is called multiple times. [ChangeLog][Linux/XCB] Fixed crash when no monitorInfo is available (e.g. VNC). Fixes: QTBUG-104443 Pick-to: 6.3 6.4 Change-Id: If13493c177121a1994b5d00dfbd64f1da694df2e Reviewed-by: Liang Qi <liang.qi@qt.io>
* Windows: Avoid accidentally copying QWindowsScreenManagerTor Arne Vestbø2022-06-203-3/+4
| | | | | | Pick-to: 6.2 6.3 6.4 Change-Id: I60b219e9a3ea62a96c369ee910eacf06d61f4f71 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port QXlibEglIntegration::getCompatibleVisualId to xcbIlya Fedin2022-06-204-20/+142
| | | | | | | | | | In combination with EGL_EXT_platform_xcb support, this allows xcb_egl to be used without xlib. Without EGL_EXT_platform_xcb support, this still reduces amount of code using xlib. Pick-to: 6.4 Change-Id: I29e2b29f7ef8ea34320887f62697f84232b86fba Reviewed-by: Liang Qi <liang.qi@qt.io>
* Fix tst_AndroidAssets, broken by recent changes on assets load speedLouis du Verdier2022-06-201-4/+5
| | | | | | | | | | | | | | | | | | | | | | Recent changes on load speed of individual assets made AndroidAbstractFileEngine use a cache for basic information in order to avoid to have to open assets every time a QFileInfo is created, which was very expensive for older phones. However, size() method was forgotten and continued to expect that the asset would be opened first, and therefore QFileInfo().size() would always return -1. This change fixes this by caching as well the information about the size of the asset, and also reverts a part in open() to close() first in case asset would already be opened, in order to keep previous behavior (even if this did not cause any known issue). Fixes: QTBUG-104412 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I992f31b8f9e14dfec44cec78d0c1a2a3e18bdb7f Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Windows QPA: Fix indentionYuhang Zhao2022-06-191-42/+42
| | | | | | | | | It seems this block of code was originally copied from elsewhere so the original indention is preserved. Pick-to: 6.4 Change-Id: I53ab8e58b4304dfc768bd6472255a6c2d0471d5e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Windows: Replace lcQpaWindows logging with lcQpaScreen in screen codeTor Arne Vestbø2022-06-181-5/+5
| | | | | | Pick-to: 6.4 Change-Id: I1d2fd586aac1163aa449f813ce3b7244c6ebaee0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Windows: Decouple screen change monitoring from top level QWindowsTor Arne Vestbø2022-06-187-14/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The WM_DISPLAYCHANGE message it sent when displays are added, removed, or update their properties such as the scale/DPI. We were processing this message as part of QWindowsContext::windowsProc(), which meant that we would only react to display changes if there was a QWindow on screen. Just creating a QGuiApplication was insufficient to pick up changes to screens after startup. In addition, despite being documented to post messages to child windows, WM_DISPLAYCHANGE only ends up in top level windows. Presumably it's the top level window's responsibility to post the message to child windows. As a result, if a QWindow was a native child window of a foreign window, such as in audio plugins being hosted in a DAW, we would again fail to pick up display changes. We solve both these cases by decoupling the WM_DISPLAYCHANGE handling from QWindowsContext::windowsProc(), by creating a dedicated window for listening to WM_DISPLAYCHANGE. This is similar to how we already handle tray icons, power notifications, clipboard, etc -- the only difference being that since purely HWND_MESSAGE windows do not receive WM_DISPLAYCHANGE it's an actual invisible WS_TILED window. This also lets us remove the workaround for QTBUG-79248, which was doing screen updates in response to WM_DPICHANGED when detecting that there were no QWindows. Task-number: QTBUG-103383 Task-number: QTBUG-79248 Fixes: QTBUG-102343 Pick-to: 6.4 Change-Id: I905d8253069ec339b193edf05c052d21361ca3e9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: Fix up namespacing in wasm platform pluginLorn Potter2022-06-1813-7/+40
| | | | | | Pick-to: 6.4 Change-Id: I2fdbb6688b252743578dfcd58f9259eb5ac3cca8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: fix unicode inputLorn Potter2022-06-183-9/+9
| | | | | | | | | also remove duplicated function call to get Qt key for event Pick-to: 6.3 6.4 Fixes: QTBUG-78826 Change-Id: Ibaf0dd3eb428b65280ed1f840a4849b44f2868e0 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Update window state in QWindowsWindow and QXcbWindow geometry settersAxel Spoerl2022-06-172-0/+6
| | | | | | | | | | | | | | | | | When QWidget::resize() is called on a maximized or minimized QWidget, the window state of the widget and the corresponding QWindow is not updated (i.e. remains maximized or minimized). This patch updates the window state to Qt:WindowNoState when setGeometry() is called in QWindowsWindow or QXcbWindow. A test is added in tst_QWidget. Fixes: QTBUG-104201 Pick-to: 6.4 Change-Id: I07491fb9293d13509573fc403750da0a50f6a785 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* xcb: Get some style hints from xsettingsJiDe Zhang2022-06-181-2/+23
| | | | | | | | | | According to https://www.freedesktop.org/wiki/Specifications/XSettingsRegistry/. Added support for Net/CursorBlinkTime Net/DoubleClickTime Net/DoubleClickDistance Net/DndDragThreshold. Change-Id: Ief208736ed2938792d935bfd730fefdd745394b6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Windows QPA: Update screen on child window DPI changeMorten Sørvig2022-06-164-2/+19
| | | | | | | | | | | | | | | | | | | | | | Windows does not send WM_DPICHANGED to child windows, which means that the normal DPI change handling code does not run for QWindows which are embedded in a foreign, non-Qt, window. Add code which handles WM_DPICHANGED_AFTERPARENT. This event is sent to all child windows, but not the top-level window. Call checkForScreenChanged() here, similar to what the WM_DPICHANGED code does. This commit does not add code to resize the child window, since it is uncertain if this is the responsibility of the window which receives WM_DPICHANGED, or of each child window. Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Pick-to: 6.4 Task-number: QTBUG-103383 Change-Id: Icf85dd0afa806609dbbe0ffc36efbc5127962c39 Reviewed-by: <stefan.wastl@native-instruments.de> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: fix some coding styleLorn Potter2022-06-161-2/+7
| | | | | | | | | - shorten a couple extra long lines - add space between functions Pick-to: 6.4 Change-Id: I14ad7448372ba50f4b0299535c4261a5bbf415b7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* macOS: Avoid recursively updating screens when window moves screenTor Arne Vestbø2022-06-161-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QWSI APIs for reporting added or removed screens is not transactional, so when several screens change at once Qt will see each screen change as a separate state. As a result, Qt, or the application itself, may react to the first of many screen updates by moving a window to a different screen -- one which is going to updated (removed) in the next iteration of QWSI calls. This caused trouble on macOS, where we use many different signals to detect that the system has changed the screens, one of them being that a window has been moved to a different screen. In the scenario above, we would be in the process of updating screens in response to the system going to sleep, which means all 3 connected screens will be disconnected and replaced with one fake screen provided by the system. As we delivered the removal of the first QScreen, Qt or the application, would respond by moving the window to one of the other two screens, which in turn would recursively trigger another round of screen updates. This round would then proceed to remove (and delete) all remaining QScreens. When we then recursed back to the initial round of screen updates we would continue iterating and operating on screens that had already been removed, causing a crash. Since we know that the screens will stabilize eventually, and that QCocoaScreen has cached all info based on the displayId and NSScreen, we can safely skip any recursive invocations of updateScreens(). Fixes: QTBUG-102021 Fixes: QTBUG-84741 Pick-to: 5.15 6.2 6.3 6.4 Invaluable-help-by: Bruno Cadoret <bruno.cadoret_1@signify.com> Change-Id: I9ff96dbcbc6f308ad2729faf2db2de7ef08513c0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* qwasmtheme: Enable hover effects by defaultMaximilian Goldstein2022-06-151-0/+2
| | | | | | | | | | | | Previously hover effects had to be enabled manually due to not being enabled in the platform style. This change enables them by default. Pick-to: 6.4 Fixes: QTBUG-88799 Change-Id: I014e1f5dfcd9b15656f11e12ab75a77d42f4815c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix typos in docs and commentsKai Köhne2022-06-1511-17/+17
| | | | | | | | | Found by codespell Pick-to: 6.4 Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Android: Improve loading speed of individual assetsLouis du Verdier2022-06-151-18/+46
| | | | | | | | | | | | | | | | | | | | | | This change improves the loading speed of files stored in Android assets folder by caching the information about files already opened. Prior to the change, when creating a QFile or QFileInfo to an asset file, the engine would first scan all the file's directory and parent directories in order to cache all this in FolderIterator::m_assetsCache. Due to the nature of Android assets, it might be very slow, depending on the number of images in this tree. In this patch, individual file accesses will stop using FolderIterator and will simply open what is asked, caching the information about the resource in order to avoid to have to call the expensive AAssetManager_open if the file is accessed again (e.g. by QFileInfo). Fixes: QTBUG-101161 Change-Id: Iaedf4cdf83d5116053b51895a6795d43bc60f942 Pick-to: 6.4 6.3 6.2 5.15 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Replace QT_NO_ACCESSIBILITY with QT_CONFIG(accessibility)Allan Sandfeld Jensen2022-06-1518-34/+36
| | | | | | | Pick-to: 6.4 Change-Id: Iee4bd8970810be1b23bdba65a74de912401dca65 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Make rhiFlush() support custom source DPRMorten Sørvig2022-06-144-2/+6
| | | | | | | | | | | | | | | | | | | | | | | The rhiFlush() implementation currently assumes that QWindow->devicePixelRatio() is the correct scale factor for transforming device independent window geometry to source geometry. However, this assumption does not hold if/when we add support for drawing to a rounded-up DPR, with a downscale later in the rhiFlush implementation. Fix this by adding a sourceDevicePixelRatio argument to rhiFlush(), which is set to either QWindow::devicePixelRatio() or QWidget::devicePixelRatio(), depending on from where it is used. Change deviceRect() and friends in qbackingstoredefualtcompositor.cpp to be scale*() functions instead which take a scale factor instead of a QWindow. Update call sites to use srouceDevicePixelRatio where that makes sense. Pick-to: 6.4 Change-Id: Idb7b1e2f36816a201e00f0defe100d2dc079cb17 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* xcb: Replace qCWarning by qCDebug in QXcbConnection::printXcbError()Axel Spoerl2022-06-141-6/+6
| | | | | | | | | | | | | | | | Example: Error "BadWindow" (3) is raised by the XCB backend when a mouse event is processed on a resource that disappears between posting and processing of the event. That constellation is harmless and can occur in async environments. As XCB errors point to coding issues, this patch changes their logging behavior from qCWarning to qCDebug. Fixes: QTBUG-56893 Pick-to: 6.4 6.3 5.15 Change-Id: Idee5ee80efaf9cd6686448779f76c68d5e4c9b63 Reviewed-by: Liang Qi <liang.qi@qt.io>
* macOS: Resolve screen name via NSScreen on macOS 10.15+Tor Arne Vestbø2022-06-131-1/+6
| | | | | | | | | | Apple Silicon Macs no longer expose display information through IOKit. Luckily we can use the 10.15 localizedName property on NSString to resolve the name. Pick-to: 6.2 6.3 6.4 Change-Id: Ie75430df1a80808cb7b23d97d1e440d1f3bf75d6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* macOS: Ignore update requests for offline displaysTor Arne Vestbø2022-06-131-0/+5
| | | | | | | | | | | Accessing a display that's offline may cause crashes, so to be on the safe side we skip update requests in this situation. Task-number: QTBUG-102021 Pick-to: 6.2 6.3 6.4 5.15 Change-Id: I6b48b6722bccde628e510c538943d14f2b0271e5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Cocoa: fix build: add missing includeThiago Macieira2022-06-101-0/+1
| | | | | | | | | qcocoansmenu.mm:21:38: error: implicit instantiation of undefined template 'QVarLengthArray<unsigned short, 10>' Pick-to: 6.2 6.3 6.4 Change-Id: Iba16e8ea451b444ab213fffd16f4da39dfcc343d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fallback to PerMonitorDpiAware if V2DpiAware is not supported by systemVladimir Belyavsky2022-06-083-19/+21
| | | | | | | | | | | | | | DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 might not be supported on some legacy Windows 10 editions (prior Creator Update). In this case SetProcessDpiAwarenessContext returns ERROR_INVALID_PARAMETER. Fallback to DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE using old API SetProcessDpiAwareness in such cases as the most suitable. Fixes: QTBUG-103733 Pick-to: 6.3 6.4 Change-Id: I39216e63ecfcae96aaa159237a52b0a76bc5d956 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Windows: Don't terminate threads in QtVolker Hilsheimer2022-06-051-12/+10
| | | | | | | | | | | | | | | | | | | Terminating a thread that we don't have full control over might leave mutexes or critical sections locked, ending up with an application that can't allocate memory or open new windows. Also, if terminating of the thread would fail (which the code tried to handle), then deleting the QThread anyway would have triggered the assertion that we don't delete a running thread in ~QThread. So simplify this code: wait simply returns true if the thread isn't running anymore, no need for the double-check. Leave the thread running and leaking if it is stuck somewhere in Windows APIs while executing the native dialog. Fixes: QTBUG-103984 Change-Id: I34aa42cbde7c769a58c14bf524781cf3abd13b70 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qiostheme: Don't determine the appearance mode from the keyWindowDoris Verria2022-06-031-1/+1
| | | | | | | | | | | | We were querying the traitCollection property of the application's keyWindow in order to determine the appearance mode (light/dark) of the app. However, the application may not have a keyWindow (visible window) by the time the we set up the appearance mode, so get that information from the last window in the application's windows array instead. Change-Id: If7435d9f565b5c594a26027c971c16a1e3a9af26 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Windows: fix crash on closing an app when native file dialog is openedVladimir Belyavsky2022-06-032-37/+25
| | | | | | | | | | | | | | | | | | | | | The crash was provoked by QThread::terminate() called for QWindowsDialogThread from QWindowsDialogHelperBase destructor. It's still not clear why terminating the thread here causes a crash, but normally we should avoid terminating a thread anyway. Current changes make several improvements to avoid terminating the thread. The main problem was that QWindowsDialogThread::run() was never returned. That's because QWindowsNativeFileDialogBase::close() was not called on QWindowsDialogHelperBase destruction. The second problem was that QWindowsNativeFileDialogBase::close() may still not close native file dialog because it was not able to find HWND for IFileDialog instance in some circumstances, so make this by more robust way. Fixes: QTBUG-93298 Pick-to: 6.3 Change-Id: I55c8cf664ae2cf7c41c8cce43a6bb88a2680bf14 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Expose the qtloader object globallyDavid Skoland2022-06-031-1/+2
| | | | | | | | | | | | When testing, we need to query the state of the Qt application, so change the scope of qtloader from inside the init function to global scope. Additionally, adjust the test script accordingly to query and use this state to make good decisions on how to terminate. Change-Id: I6264ba20843716eb87340b160680617b718f6bd9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Streamline error handling in qtloader.jsDavid Skoland2022-06-031-13/+18
| | | | | | | | | | | | Added new function handleError which does the usual work whenever there there is an error, including logging the error to console. Also make the app exit when the emscripten module fails to load. Additionally, make sure we correctly report it as crash if the module fails to load. Change-Id: I9d723373a34ccbb146959a2207ebded8bcbd4f18 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Fix misuses of 0.9999 constantAllan Sandfeld Jensen2022-06-021-9/+3
| | | | | | | | | Replace it with floor and round. It appears the old behavior was to work around combining ceil with inaccurate FP, but it doesn't appear this hacky ceil is needed. Change-Id: I5c16ec0fa4916e17198a733c46937fde53f2ddb5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>