summaryrefslogtreecommitdiffstats
path: root/src/gui/platform
Commit message (Collapse)AuthorAgeFilesLines
* ColorScheme: remove unused QWindowsApplication::isDarkModeVolker Hilsheimer2024-04-251-9/+1
| | | | | | | | | | It unnecessarily duplicates and distributes logic for reporting whether the application should run in dark or light mode. Task-number: QTBUG-124490 Change-Id: I227660cf3e1f21afd5fd9b3d6452f6109f3cf799 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
* ColorScheme: clean up code to prepare adding a setterVolker Hilsheimer2024-04-231-1/+1
| | | | | | | | | | | | | | | | | | | The current QStyleHintsPrivate::setColorScheme is called when the system theme changes, handling the change and informing the application. It is not a setter. When we add a public setter, that setter will have to go through the QPlatformTheme to request an override for the application. That will then result in a call back to the QStyleHints to update the theme with the effective color scheme (or ignore the request for the override, on some platforms). Rename it (and similar misleading APIs in platform plugins) to updateColorScheme, and adjust outdated comments in some of the platform plugins. Task-number: QTBUG-124490 Change-Id: I6a852211254993df86acf2e2d42cf345e7401f4f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Add preliminary support for Qt for visionOSTor Arne Vestbø2024-04-182-5/+5
| | | | | | | | | | | | | | | | | | | | | | Qt already runs on Vision Pro as "Designed for iPad", using Qt for iOS. This change enables building Qt for visionOS directly, which opens the door to visionOS specific APIs and use-cases such as volumes and immersive spaces. The platform removes some APIs we depend on, notably UIScreen, so some code paths have been disabled or mocked to get something up and running. As our current window management approach on UIKit platforms depends on UIWindow and UIScreen there is currently no way to bring up QWindows. This will improve once we refactor our window management to use window scenes. To configure for visionOS, pass -platform macx-visionos-clang, and optionally add -sdk xrsimulator to build for the simulator. Change-Id: I4eda55fc3fd06e12d30a188928487cf68940ee07 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Apple icon engine: reverse implementation to avoid pixmapsVolker Hilsheimer2024-04-041-52/+53
| | | | | | | | | | | | | Instead of implementing scaledPixmap() to rasterize the vector image we get from App/UIKit, and calling that from paint, implement paint() to draw the vector image directly through the painter, and use that in scaledPixmap. Pick-to: 6.7 Change-Id: I2c62826f29406543bc8d8c7fa71199e91586d83b Reviewed-by: Amr Elsayed <amr.elsayed@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QDbusTrayIcon: handle open() failureGiuseppe D'Angelo2024-03-261-1/+4
| | | | | | | | | | QDbusTrayIcon has a convoluted workaround/hack that consists in putting an icon file in /tmp/ and then using that path as the icon. Opening the icon file may fail, so handle it. Change-Id: I5d1c681e2fe3cfb23e93fd20f6758d4c83fe1578 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qxkbcommon: fix isKeypadYifan Zhu2024-03-191-1/+40
| | | | | | | | | | | | This amends a34e81ab8be6445877e040b1afb85deeaa725f86 . The previous range comparison doesn't work since XKB_KEY_KP_9 is 0xffb9 while XKB_KEY_KP_Equal is 0xffbd. Change to an explicit switch. Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I3a340bac61fb074eef505ef9b06300a6468877f1 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Liang Qi <liang.qi@qt.io>
* Apple: use xmark.circle for the "clear" iconVolker Hilsheimer2024-02-221-1/+1
| | | | | | | | | Looks better as the action in a text input field. Pick-to: 6.7 Change-Id: I63fd9b963102919cf69f345723d1c5d83778f1f4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Karolina Sofia Bang <karolina.bang@qt.io>
* Apple icon engine: maintain aspect ratio of imageVolker Hilsheimer2024-02-202-24/+22
| | | | | | | | | | | | | | | | | Don't return fixed square icon sizes from availableSizes(), respect the aspect ratio of the input image we get from the system, and return an actualSize() that fits into the requested size, but uses the image's aspect ratio as well. Reuse the calculation in the rendering code. Amends 5b993fa8ede67871a8b2434505bc3c3d8bb906c6. Fixes: QTBUG-121764 Pick-to: 6.7 Change-Id: I672b90a1fbecb662fd6614dcfa5090e28b16f3c8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Apple: Fix a few deprecation warnings after bumping deployment targetsTor Arne Vestbø2024-02-191-1/+2
| | | | | | | | | | | | - kIOMasterPortDefault -> kIOMainPortDefault - Use UTType instead of Carbon Core functions/constants - NSWorkspace iconForFileType -> iconForContentType - Removed obsoleted kUTTypeInkText pasteboard type There are still a few more, but these will be fixed in follow ups. Change-Id: Ibbca226d578b4ba64bd9c8c5d0addc1870114a20 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Implement icon mapping for Apple, Android, and WindowsRayam Pinto2024-02-181-4/+239
| | | | | | | | | | | Not all xcb icons have a corresponding icon on all other desktop platforms, so we might want to remove those enums for which we have almost no coverage in a follow-up commit. Pick-to: 6.7 Change-Id: I8fdc64f773768ce4ed1e0050f2a3bddef976e688 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* AppleIconEngine: fix aspect ratio adjustmentVolker Hilsheimer2024-02-151-8/+9
| | | | | | | | | | The requested icon might not be square, so fit the image we have correctly into the requested size. Fixes: QTBUG-121764 Pick-to: 6.7 Change-Id: I877dedf5aa779cd82a75a1a49b26c08e3cea6163 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* cmake: Generate Apple privacy manifest files for Qt modulesTor Arne Vestbø2024-02-131-0/+23
| | | | | | | | | | | | | | | | | | | The default manifest is a minimal file that claims NSPrivacyTracking false, along with an empty list of NSPrivacyTrackingDomains and NSPrivacyCollectedDataTypes, as Qt does not generally do user tracking. Modules can override the default manifest by setting the PRIVACY_MANIFEST target property, specifying a custom privacy manifest. The NSPrivacyAccessedAPITypes key is only required for iOS for now. Even though we don't build Qt for iOS as frameworks yet, which is required to embed a privacy manifest, we include the keys for the APIs we known we use. Task-number: QTBUG-114319 Change-Id: I654bb52b98ee963adeeb744b35f3a1c2a1270969 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QGenericUnixServices: make sure the picker returns a colorLiang Qi2024-02-031-3/+7
| | | | | | | | This amends b646c7b76c7787cff57bca0fde04d9f58abdfbb8 . Pick-to: 6.7 6.6 6.5 Change-Id: Ic7183c06a93085d65b31c86380889b78c714548b Reviewed-by: David Edmundson <davidedmundson@kde.org>
* qxkbcommon: map XKB_KEY_XF86Calculator to Qt::Key_CalculatorYifan Zhu2024-01-311-0/+1
| | | | | | | | | | | | | cfd935fe6c26800befc10889afc0aebde311acca removed the erroneous mapping from XKB_KEY_XF86Calculator to Qt::Key_Launch1, leaving it unmapped. It should be mapped to Qt::Key_Calculator, just like XKB_KEY_XF86Calculater. Fixes: QTBUG-121713 Pick-to: 6.7 6.6 6.5 Change-Id: Iaa28e38792f43a7950a3c38397869a6ffed332d1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* Simplify new QIcon ThemeIcon constants and APIVolker Hilsheimer2024-01-261-14/+14
| | | | | | | | | | | | | | | | | | | | Originally we thought that exposing the string literal through the API would be useful for people that want to know what icon they will get when using a specific constant. But since the mapping from platform independent icon name to platform specific icon name is anyway hidden in the engine implementation, this is no longer useful. Based on header review comments, simplify this by making the ThemeIcon list of constants a scoped enum. If it's really useful for e.g. designers to know which exact icon they get on a specific platform, then we could, in a future release, add a static QIcon::themeIconName API that returns the platform specific icon string for a ThemeIcon constant. Pick-to: 6.7 Change-Id: I231eb98fefb4ac82d38209b4e1257bb3caadeb08 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QGenericUnixTheme: Rename ColorTheme enum value to ColorSchemeAxel Spoerl2023-12-291-3/+3
| | | | | | | | | | | | ColorScheme is used in Qt as a name for dark/light desktop mode properties. The enum value was named incorrectly. => Fix it. Pick-to: 6.7 6.6 6.5 Change-Id: I2aa72f81e36c0997127dd6de0e23d4773509ba40 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Doc: QAndroidScreen:displayId(): Fix capitalizationKai Köhne2023-12-281-1/+1
| | | | | | Pick-to: 6.7 Change-Id: Ib005db7fd9317250f5a4cf22ff3422eb83ed787c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Make some QScreen native interfaces publicDavid Redondo2023-12-083-12/+37
| | | | | | | | | | [ChangeLog][QtGui][QScreen] The QAndroidScreen, QWaylandScreen and QWaylandWindow native interfaces are now available on QScreen to provide a handle to the underlying platform screen. Task-number: QTBUG-113795 Change-Id: I83d70046678dfb79ee08544ddfc1820f3ff2d118 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Introduce a configure feature for WaylandDavid Redondo2023-12-072-2/+6
| | | | | | | | Using the presence of the wayland-client lib as a condition. Fixes: QTBUG-117386 Change-Id: If4336965ea06e3f4b06e9af661efdec38ba46136 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIcon: use (some) ThemeIcon constants in the Apple engine implementationVolker Hilsheimer2023-12-071-16/+15
| | | | | Change-Id: I4976bf3b6a389ad772cad9dfa768ab3447c6771c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add initial implementation of macOS and iOS icon theme implementationsVolker Hilsheimer2023-11-232-0/+294
| | | | | | | | | | | | | | | | | | | | | | | From macOS 13 on, AppKit provides an API to get a scalable system image from a symbolic icon name. We can map those icon names to the XDG-based icon names we support in Qt, and render the NSImage with palette-based coloring when needed, in an appropriate scale. On iOS, we can use the equivalent UIKit APIs. Coloring functionality is only available from iOS 15 on. Implement a QAppleIconEngine that does that in its scaledPixmap implementation. Use basic caching to store a single QPixmap version of the native vector image. We regenerate the pixmap whenever a different size, mode, or state is requested. Add a manual test for browsing all icons we can get from the various Qt APIs that: standard icons and pixmaps from QStyle, QPlatformTheme, and QIcon::fromTheme, in addition to showing all icon variations for a single QIcon. Task-number: QTBUG-102346 Change-Id: If5ab683ec18d140bd8700ac99b0edada980de9b4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Mime type conversion: clarify and clean up documentationVolker Hilsheimer2023-11-223-15/+35
| | | | | | | | | | | | | | | | The converters need to be instantiated (which implicitly registers) after QPA has been initialized, i.e. after QGuiApplication has been instantiated. Clarify this in the documentation of the types. Remove the dead documentation for the explicit registration function. The API does not exist, and the documentation was never generated for Qt 6 either. The function does not need to be called as long as new mime converters are instantiated correctly (after QPA was initialized). Pick-to: 6.6 6.5 Task-number: QTBUG-119216 Change-Id: I4e31b3773e88f7a6d579265f093bab46847cb028 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix build with qt-namespaceMårten Nordheim2023-11-172-1/+3
| | | | | | | | | | | Add missing include of global module header. Drop unneeded global namespace qualifier for constant in our namespace. Amends 6017695bfa98d8d9a6e5977ec80aafa1a4d3ee4d Change-Id: I04633030af13df3c3359fc09b08b4a5f031013a9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Windows: Improve hidpi style drawing and metricsMorten Sørvig2023-11-152-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up change from enabling DPI awareness, which caused some style elements (for instance check boxes) to be rendered incorrectly on non-primary displays, when there is a difference in DPI between displays. Use two approaches to get system metrics and themes: * Use forDpi() API variants and query at 96 DPI for style metrics, that are in device independent pixels. These are metrics which are used for layout calculations. * Get theme metrics at the target display DPI, and scale to device independent pixels when needed. This is used for OpenThemeData(), since this theme is used for drawing as well and needs to be in device pixels. One approach is not used any more: * Get metrics for the main display, and scale by the ratio between the main and target display. Change the theme cache to cache themes per window handle (HWND). This is required since OpenThemeData() returns theme data for a specific DPI, which means we can no longer use a shared cache. Clear the cache on theme change, DPI change, and when the window is destroyed. This handles cache invalidation when the window is moved to a different screen, and also when the DPI for a screen is changed. Move the cache implementation to QWindowsStyleSupport in QtGui, where it can be accessed by both the style and windows platform plugins. Task-number: QTBUG-110681 Change-Id: I5a4ff3a3753762bad8a51d08e51e8013bc7816a1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QXkbCommon: Use isKeypad() to replace duplicate logicLu YaNing2023-11-091-1/+1
| | | | | | | | This amends 298c9509129cf039a1da75d5682cbe273a341590 . Pick-to: 6.6 6.5 Change-Id: I44696464817d6d3f6b1b3a7d005334805fb1cc38 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Doc: Specify correct include for QWaylandApplicationPaul Wicking2023-10-301-0/+1
| | | | | | | | | | | | | | QDoc automatically generates include statements for types, by a set of rules used to determine Qt's convenience header. For the `QWaylandApplication` struct, no such convenience header is generated. Use QDoc's `\inheaderfile` command to specify the correct header for access to `QWaylandApplication`. Fixes: QTBUG-118315 Pick-to: 6.6 6.5 Change-Id: Ib3b120e3ce6b5d4df74078a21bb137adaaffa2ce Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add missing documentation for QWaylandApplication::seat()Nicolas Fella2023-10-181-0/+4
| | | | | | | | | Documentation for the other functions refer to seat(), but that itself isn't documented Pick-to: 6.6 Change-Id: I9a628e87153b687b2fa444798de1af74e6251eee Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Enable Latin key combinations when Command (⌘) modifier is pressedTor Arne Vestbø2023-10-171-5/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the Command key is pressed AppKit seems to do key equivalent matching using a Latin/Roman interpretation of the current keyboard layout. For example, for a Greek layout, pressing Option+Command+C produces a key event with chars="ç" and unmodchars="ψ", but AppKit still treats this as a match for a key equivalent of Option+Command+C. We can't do the same by just applying the modifiers to our key map, as that too contains "ψ" for the Option+Command combination. What we can do instead is take advantage of the fact that the Command modifier layer in all/most keyboard layouts contains a Latin layer. We then combine that with the modifiers of the event to produce the resulting "Latin" key combination. If the unmodified key is outside of Latin1, we also treat that as a valid key combination, even if AppKit natively does not. For example, for a Greek layout, we still want to support Option+Command+ψ as a key combination, as it's unlikely to clash with the Latin key combination we added above. However, if the unmodified key is within Latin1, we skip it, to avoid these types of conflicts. For example, in the same Greek layout, pressing the key next to Tab will produce a Latin ';' symbol, but we've already treated that as 'q', thanks to the Command modifier, so we skip the potential Command+; key combination. This is also in line with what AppKit natively does. Fixes: QTBUG-96371 Fixes: QTBUG-79493 Task-number: QTBUG-112736 Change-Id: I30d678c1c7860642d3eed29c7757133ff74c6521 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Filter out and prioritise key combinations that produce the same keyTor Arne Vestbø2023-10-171-3/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An incoming key event with a set of modifiers can potentially match a range of key combinations, depending on how the event's modifiers are combined to produce "intermediate" representations of the event. For example, given a normal US keyboard layout, the virtual key 23 combined with the Alt (⌥) and Shift (⇧) modifiers, can map to the following key combinations: - Alt+Shift+5 (Fully expressed combination) - Alt+% (Shift consumed to produce %) - Shift+∞ (Alt consumed to produce ∞) - fi (Shift and Alt consumed to produce fi) But in other cases the intermediate modifier combinations produce the same key/symbol as other modifier combinations. For example, pressing Alt (⌥) and Shift (⇧) with the 'c' key on a US layout will produce: - Alt+Shift+C (Fully expressed combination) - Shift+Ç (Alt consumed to produce Ç) - Ç (Shift and Alt consumed to produce Ç) In this case, we don't want to reflect the standalone 'Ç', as that has already been reflected in the more direct form via Shift+Ç. Consuming the additional Shift modifier does not produce any additional symbols. The same can happen without the number of modifiers being different, in case two modifiers produce the same symbol. In this case we want to prioritize Command over Option over Control over Shift. There is similar logic in the Windows and XKB key mappers, and the implementation in the Apple key mapper has been adapted from the Windows key mapper. Task-number: QTBUG-67200 Task-number: QTBUG-38137 Change-Id: I4f1aeebac78a5393f8da804b53cf588f7c802c1b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add the missing QtGui/qtgui-config.hAlexey Edelev2023-10-161-0/+1
| | | | | | | | | | QT_NO_OPENGL is defined in qtgui-config.h so we should include it before checking the definition. Fixes: QTBUG-115446 Pick-to: 6.5 6.6 Change-Id: I29b9d7d89fe4c079ca0cf767a1b1a63cc5621623 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Guard QAppleKeyMapper::fromNSString() with iOS defineTor Arne Vestbø2023-10-112-32/+33
| | | | | | | It's only used from iOS. Change-Id: I0d653cb76fc27085c74feb5d2628cb1a201ade05 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add verbose debug logging for QKeyMapper::possibleKeys()Tor Arne Vestbø2023-10-111-12/+0
| | | | | | | Generalized from the logging used in the Apple key mapper. Change-Id: I61cc120e31b72995071756961d36f6a7fae14553 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* xkb: fix build with libxkbcommon 1.6.0 and laterLiang Qi2023-10-101-0/+4
| | | | | | | | | | | A few XKB_KEY_dead_* defines got removed from 1.6.0. See also https://github.com/xkbcommon/libxkbcommon/blob/6073565903488cb5b9a8d37fdc4a7c2f9d7ad04d/NEWS#L9-L14 https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/70/diffs?commit_id=cb44799b72f611eb4c9d7cc185bc3b09e070be08 Pick-to: 6.6 6.5 6.2 5.15 Fixes: QTBUG-117950 Change-Id: I55861868f2bb29c553d68365fa9b9b6ed01c9aea Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Implement QAppleKeyMapper in terms of QPlatformKeyMapperTor Arne Vestbø2023-10-102-10/+11
| | | | | Change-Id: Icef9cbe2cbb50c856496d7d9a20784d94d66a079 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Implement XCB key mapper in terms of QPlatformKeyMapperTor Arne Vestbø2023-10-092-13/+28
| | | | | Change-Id: I81af1200b7b1113062d66a76a185a6d15eab0ba9 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Teach QKeySequencePrivate about QKeyCombinationTor Arne Vestbø2023-10-091-7/+7
| | | | | | | | | | Being explicit about whether we're dealing with QKeyCombination or a plain Qt::Key helps understand the code. Keys are still stored as ints though. Change-Id: I2cb7bf2c5fabcecbd4dd3e99ba6240fb1910dcc7 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Long live QPlatformKeyMapper!Tor Arne Vestbø2023-10-062-1/+2
| | | | | | | | | | | | | | The QKeyMapper class never got a platform integration companion. As we might be adding more functionality here in the future, let's fix that now, instead of adding more hooks directly to the platform integration class. The QKeyMapper will soon update its possibleKeys signature to return QKeyCombination, but for now transform the result. Change-Id: I88ef498180b2a8a7937a74627b7eb6b5156e872a Reviewed-by: Liang Qi <liang.qi@qt.io>
* revert "xkbcommon: make shortcuts persistent across layouts"Tor Arne Vestbø2023-09-291-3/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5e76a9569e37e6620a7ddf3a9d9620fbb9b9d04f. The change's stated goal was to make shortcuts "stable", i.e. work the same, regardless of which keyboard layout the user has selected. In doing so, it changed the semantics of shortcut handling to depend on the order of the keyboard layouts reflected by XKB, picking the first Latin layout in the list, instead of prioritizing the currently selected/active keyboard layout. This change in semantics is a major behavior change, and breaks common and valid setups such as having [en,fr] or [en,de] layouts. For example, the French layout uses an AZERTY layout, where the Q and A keys are switched compared to QWERTY. With the change in place, pressing the physical A key on a French keyboard, with Control pressed, no longer selects all text, but instead quits the application, as the shortcut is interpreted based on the English layout, which just happens to be first in the list. Similar issues exist for German layouts, which use QWERTZ, or more complex layouts such as the Neo layout. The semantics of prioritizing the order of declared layouts instead of the active one is inconsistent with both macOS and Windows, as well as other toolkits on Linux, including GTK and earlier versions of Qt. It's also not discoverable by the user that the order now matters. For example, there is no UX in the Gnome setting that tells the user to ensure the order matches their expectations for shortcut handling. And if there was, this would only apply to Qt apps built with 6.6.0, creating inconsistent behavior for users. Worse, the X server is limited to four concurrent keyboard layouts (groups), so if the user adds more layouts than that, Gnome will replace the X server's view of layouts only when switching to a layout beyond the first four. And in that case, the X server's view of the layouts is actually starting with the fifth layout declared in the Gnome preferences. The logic in the reverted patch does not take this into account, making it confusing for the user which layout actually takes precedence. Note that reverting this change does not affect our fallback logic for layouts that do not produce Latin symbols for the given key press, such as Greek or Russian. Those layouts will continue to fall back to a Latin layout for their QKeyEvent::key(). [ChangeLog][QtGui][X11/Wayland] A change in 6.6.0 that resulted in keyboard shortcuts not respecting the user's active layout has been reverted. Pick-to: 6.6 Task-number: QTBUG-108761 Change-Id: Iec2897cd1541c0c125cc5b1078d0beec12b501c0 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* Avoid crash when keysymToQtKey(keysym, Qt::ControlModifier) is calledAlexander Volkov2023-09-281-0/+2
| | | | | | | | For example when Ctrl+Home is sent by virtual keyboard on Wayland. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I41f1d2a28c9091efa621d5826a3b9e3e0e481ceb Reviewed-by: Liang Qi <liang.qi@qt.io>
* QGenericUnixServices: ensure xdg activation token callback is calledIlya Fedin2023-09-051-1/+3
| | | | | | | | | | | The callback doesn't get called if the signal is emitted immediately or if hitting the early returns Fixes: QTBUG-113995 Pick-to: 6.6 6.5 Change-Id: Ib3e1d324a2becd8148cd76b4441fce5c4cc725e8 Reviewed-by: David Redondo <qt@david-redondo.de> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* wasm: Fix QFileDialog file filterPiotr Wierciński2023-08-252-72/+12
| | | | | | | | | | | | File filter was not properly processed when using LocalFileAPI. The QtFormat->AcceptList conversion was happening twice, resulting in erronous types. This prevented dialog from appearing on Chrome. Additionally remove unused debug code. Fixes: QTBUG-115087 Pick-to: 6.5 6.6 Change-Id: Ie6770e2f1d2aa7c3ad19f9ab105dbec8102d45fc Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QGenericUnixThemesDBusListener: Remove stray qDebug()Axel Spoerl2023-07-181-1/+0
| | | | | | | | Remove a stray qDebug() statement, that was forgotten in the source. Pick-to: 6.6 6.5 Change-Id: I5c413b4356f05570474fa2a0d6ad661785c818b0 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Gui: include mocsMårten Nordheim2023-07-071-0/+2
| | | | | Change-Id: I915071413b05884e61cfad4924a29b0269fab310 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* qgenericunixservices: Move x11 specific code to the Xcb backendDavid Edmundson2023-07-051-3/+1
| | | | | | | | | | QGenericUnixServices is an abstract class subclassed by the wayland backend for wayland specific functionality. This moves to a consistent pattern where X11 code is also the X11 backend rather than guarded with if statements. Change-Id: I1cc7ebac811463451d744fdc034f5ad5fd022bc6 Reviewed-by: Liang Qi <liang.qi@qt.io>
* QXkbCommon::isLatin1 : Add a lower bound of Latin1Inho Lee2023-07-041-1/+1
| | | | | | | | | | | The range of the Latin1 key is from 0x20 to 0xff in both xkb_keysym and Qt::Key. Task-number: QTBUG-113387 Task-number: QTBUG-74479 Pick-to: 6.6 6.5 6.2 Change-Id: I2eaba3129bead9526910f716c211f637804ab592 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QtGui: code tidies: use the 4-arg connect overloadGiuseppe D'Angelo2023-06-281-2/+2
| | | | | | | | The 3-arg connect is error-prone and makes the lifetime of the connection unclear. Change-Id: I99aa3575a7f901ac52f451f9ef51aa903640d097 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make Gnome theme react to color theme changes without GTKAxel Spoerl2023-05-221-0/+3
| | | | | | | | | | | | Qt doesn't react to color theme changes on systems running Gnome without GTK. This patch adds support for such in QGnomeTheme, following https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/ Pick-to: 6.5 Change-Id: I1f6252d4f394b810b9e4aebe00f2715c8fec3b56 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QGenericUnixThemes: Make DBus listener configurableAxel Spoerl2023-05-211-50/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | The DBus locations and signals QGenericUnixThemesDBusListener has listened to, were hard coded. While these hard codings were in line with the signals emitted by the Linux systems officially supported by Qt, this approach has made it impossible for Qt to react to (color) theme changes when they are announced by other DBus signals. This patch replaces hard coded signals with a QFlatMap member. The member is populated with the DBus locations/signals currently supported. If the environment variable QT_QPA_DBUS_SIGNALS_SAVE contains a valid file name, the default configuration is stored in a JSON file. If the environment variable QT_QPA_DBUS_SIGNALS contains a valid file name, the default configuration is replaced with its content. While the patch doesn't change existing behavior, it adds the possibility to customize alternative DBus signals to listen to. Task-number: QTBUG-103093 Pick-to: 6.5 Change-Id: I37e085c74bf53eed5cda7ec0dd7105562df0ed21 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: Add DOM accessors functions through NativeInterfacePiotr Wierciński2023-05-051-0/+17
| | | | | | | | | | | Expose document and clientArea emscripten objects through NativeInterface. This is required by WebView implementation for wasm platform. Task-number: QTBUG-75183 Change-Id: I6f2f084a9dbceb80d2186c7395c008f268a91e39 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* OpenFile portal: do not use O_PATH fdsJan Grulich2023-05-031-8/+2
| | | | | | | | | | | | | Using O_PATH requires correctly specifying whether the fd is writable or not. Stating that the fd is writable without it actually being writable results into rejection on xdg-desktop-portal side. Other implementations like xdg-open or gtk have also moved away from O_PATH fds so this will make a matching implementation and avoid possible rejections from xdp. Fixes: QTBUG-113143 Pick-to: 6.5 5.15 Change-Id: Icc171752d73ee091282b7c655f71da3cb59179b1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>