summaryrefslogtreecommitdiffstats
path: root/src/gui/platform
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* Copy memory to buffer when saving files on wasm with threading onMikolaj Boc2023-04-251-4/+28
| | | | | | | | | | | | | | | wasm heap uses a shared array buffer, which cannot be fed to FileSystemWritableFileStream.write due to security limitations. Heap memory has to be copied to a temporary buffer for the operation to succeed. This is only done if __EMSCRIPTEN_SHARED_MEMORY__ is on to optimize the non-threading path. Fixes: QTBUG-112881 Pick-to: 6.5 Change-Id: I0d117a8703caf4c17abc67b30df5248a53406d5f Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* qxkbcommon: Amend comment for Qt::Key upper-case transformationAndrey Butirsky2023-04-201-6/+6
| | | | | | | | | | | | | This should make it clear enough that the issue here is a quirk of Qt::Key and not something otherwise special about case-change affecting whether a character is in Latin-1 (for all that this is the root cause of the quirk in Qt::Key). Pick-to: 6.5 Change-Id: I80fa6b78a0d0c431401a3fea18edf6149de08b92 Reviewed-by: Andrey Butirsky <butirsky@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QXkbCommon: set Qt::KeypadModifier when keypad button is pressedMario Roessel2023-04-202-2/+5
| | | | | | | | Pick-to: 6.5 Task-number: QTBUG-111503 Done-With: Liang Qi <liang.qi@qt.io> Change-Id: Ic7ca48ea8709d38aa83c95a9b5a7d39ff82f08c7 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Guard qopenglcontext_p.h with the QT_NO_OPENGL checkAlexey Edelev2023-04-051-1/+4
| | | | | | | | | | | QtGui/private/qopenglcontext_p.h needs to be guarded to avoid compilation errors when building Qt with openGL disabled. Fixes: QTBUG-112656 Pick-to: 6.5 Change-Id: I21d120ed2bdb22e7aa2338e396a9a426adb80dbe Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Implement setBadgeNumber for xcb backendCarl Schwan2023-04-042-0/+32
| | | | | | | | | | | | This use the unity launcher specification which is defined here https://wiki.ubuntu.com/Unity/LauncherAPI This spec is used by Plasma and Unity. On other Linux desktop platform where the unity DBus interface is not detected this is no-op. Change-Id: I81a9b95fe4886ad597bb4e775641926b161c49a5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Revert "D-Bus system tray: properly check whether StatusNotifierHost available"Ilya Fedin2023-04-054-10/+13
| | | | | | | | | | | | | | | | | This reverts commit 23e9b57e3d261f66168a8a28ccb8e5c886b4841f. The original commit was made based on a KDE workaround for libdbusmenu-qt crash, but Qt is not using libdbusmenu-qt, Qt is not watching for StatusNotifierHost registration and Qt is not capable to switch backends on the fly leading to tray support being not detected on Plasma Wayland sessions and falling back to the poor legacy protocol on X11. Task-number: QTBUG-94871 Pick-to: 6.5 Change-Id: Ic3e4a9c2d6db00299ed1f2b14043c4b675fb8ccc Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Make flatpak check more backward compatibleIlya Fedin2023-04-041-1/+1
| | | | | | | | | | Since 68de00e0d4f2c574162a6e033d41786e3757d25d, the check doesn't work with flatpak versions lesser than 1.13.1. Checking the file in the root directory works since flatpak 0.6.10. Pick-to: 6.5 6.2 Change-Id: Icc83ea5de4a962b52a737c9842248df3b60b1331 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "Revert "qxkbcommon: Treat XKB_KEY_{Super,Hyper}_{L,R} as ↵Andrey Butirsky2023-03-311-1/+1
| | | | | | | | | | | | Qt::Key_Meta by default"" This reverts commit 101e57d37c3b1c1c24173f1b37f54f9efaedc329. We have a separate change to fix Qt Wayland Compositor. Change-Id: Ia00f73c9864921523fed205a813496ab417810a8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* Replace Q_CORE_EXPORT with Q_AUTOTEST_EXPORT in qlocalfileapi_p.hMikolaj Boc2023-03-201-3/+6
| | | | | | | The only consumer outside of gui is the autotest target Change-Id: I2c6b41029ed5c53a2fd5f31f542128616620ddcf Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Support filter list for file input when opening a file on WASMMikolaj Boc2023-03-073-51/+81
| | | | | | | | | | The polyfill for file input on WASM now makes use of the supplied filter list. Some changes were introduced in the abstraction for filters so that they are usable both for the new file API and the legacy file input. Change-Id: Id6341be4d6a1647e17382d13da7be42491cfaf80 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Revert "qxkbcommon: Treat XKB_KEY_{Super,Hyper}_{L,R} as Qt::Key_Meta by ↵Liang Qi2023-02-231-1/+1
| | | | | | | | | | | | default" This reverts commit 610bafdfc58e90f24e3908e1a5932e2f510eac7e. It breaks the tests for Qt Wayland Compositor. Task-number: QTBUG-111423 Change-Id: I8e411792e991d23cb0cb6b114ab1697c3b9e8c0e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qxkbcommon: Treat XKB_KEY_{Super,Hyper}_{L,R} as Qt::Key_Meta by defaultAndrey Butirsky2023-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most keyboards today do not have a dedicated Meta key. Instead, they may have a Win key (Windows logo, Penguin logo, etc), which is delivered by evdev as e.g. KEY_LEFTMETA, but then mapped by libxcbcommon to LWIN via the default config from xkeyboard-config: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/master/keycodes/evdev#L203 and then mapped further to Super_L https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/master/symbols/pc#L24 which is the key symbol that we in Qt see. As it is common to use Qt::Key_Meta in keyboard shortcuts, it would be useful if the Win key resulted in key events as if a dedicated Meta key had been pressed. This is already something we do for X11, where we consume the events from xkbcommon, but then use X-specific heuristics to determine if there is an actual Meta key, and if not, we assume Super/Hyper is Meta. For plain xkbcommon, we don't have enough information to do the same kind of heuristics, so we've previously defaulted to not treating Super/Hyper as Meta. But, as the above xkeyboard-config configs show, a saner default would be to assume that there is no Meta key, and do the same mapping as we do for X11 for all consumers of xkbcommon, such as Wayland and EGLFS. This does mean that clients that were relying on dedicated Super or Hyper keys producing Qt::Key_Super or Qt::Key_Hyper will no longer see these keys being pressed. [ChangeLog][QtGui][Linux/Wayland][Linux/Yocto] Super ("Win" key) and Hyper keys will no longer produce the corresponding Qt::Key_Super or Qt::Key_Hyper key events, but will instead be mapped to Qt::Key_Meta and result in Qt::MetaModifier being set. Fixes: QTBUG-62102 Change-Id: Ied4c8b60a0639e87116ab70c7e40d4082f52b18d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Rename Qt::Appearance to Qt::ColorSchemeTor Arne Vestbø2023-02-132-26/+26
| | | | | | | | | | | | Based on discussions in the 6.5 API review, where we concluded that 'appearance' is too general. Instead, we follow the CSS standard and use the term 'color scheme'. Pick-to: 6.5 Change-Id: I8ceaf4138ecadff5ccd962480e8e5beb39b556ec Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jonas Kvinge <jonas@jkvinge.net> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: map Qt::Key_Return to NSCarriageReturnCharacter in menusVolker Hilsheimer2023-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | On macOS, key combinations with the Return key do not get delivered through NSView::keyDown, but they are seen by the QCocoaNSMenu::menuHasKeyEquivalent override. We already use that override to check whether any menu item uses a matching shortcut, and give Qt's focus object a chance to override the shortcut. The key mapper used the NSNewlineCharacter '\n' for Qt::Key_Return. However, the character we get from macOS for the return key is the NSCarriageReturnCharacter character, '\r'. This makes the lookup fail, and shortcut overrides are not delivered for shortcuts using Qt::Key_Return. To fix this, map Qt::Key_Return to NSCarriageReturnCharacter. The inverse mapping maps both NSCarriageReturnCharacter and NSNewlineCharacter to Qt::Key_Return, and there are no other users of this function in Qt. Pick-to: 6.5 6.4 Fixes: QTBUG-107526 Change-Id: I716190adf3cd94697e2b3ad1afc25b95d8ebde25 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Clean up QUtiMimeConverter APIVolker Hilsheimer2023-02-083-14/+20
| | | | | | | | | | | | | Based on header review comments, make the internal constructor private and declare classes that need it as friends. QFlag-ify the HandlerScope enum, as it is a list of flags, and adjust code accordingly. Pick-to: 6.5 Change-Id: I1d8843265e49e696d463e9eea8306f4dbae75c78 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* xkbcommon: make shortcuts persistent across layoutsAndrey Butirsky2023-01-311-36/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | It can happen the same key has different Latin symbols on different layouts: for example, "`" symbol on English layout, no symbol ("^" dead key) on German and ";" symbol on Czech and Hebrew layouts. This creates a problem as these keys will produce different shortcuts depending on what layout is currently active. This patch makes keys generate the same shortcuts corresponding to the first Latin layout configured in the system, independently of layout actually active. For example, when having settings like: setxkbmap -model pc105 -layout "us,de" -option "grp:alt_shift_toggle" After Alt+Shift, the layout changes to de from us. But Ctrl+"^" still generates Ctrl+` shortcut which is from the first(or default) layout. [ChangeLog][QtGui][QXkbCommon] make keys produce the same shortcuts independently of current layout Fixes: QTBUG-108761 Change-Id: Id204a1609ca731f9c56ed3d32847ca18b94be4a0 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
* QUtiMimeConverter: document as public and fix \sinceVolker Hilsheimer2023-01-301-6/+6
| | | | | | | | | | | It's a new public API, so don't document it as internal. Fix the \since to 6.5 - it's an old class under a new name, and make a small language improvement in related documentation. Pick-to: 6.5 Change-Id: I57bfa868f19aa293c01d6a1f8bbbff1bebe7541a Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* API review: disable copy for new mime converters classesVolker Hilsheimer2023-01-262-0/+2
| | | | | | | | These classes are polymorphic, so shouldn't be copyable. Pick-to: 6.5 Change-Id: I80b6b3de5f5594e00c4011f64846841e3344c152 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QWindowsMimeConverter: fix copyright yearMarc Mutz2023-01-171-1/+1
| | | | | | | | Noted in API review. Pick-to: 6.5 Change-Id: I08a5cb5cec1d7a13d96c22b69c7999eccfb4f932 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add QEGLContext::invalidateContextThomas Senyk2023-01-121-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | QEGLContext::invalidateContext will mark that egl context is invalide and trigger SceneGraph to destroy it, create a new one and re-create and re-upload all resources (e.g. textures) associated with the current state of the SceneGraph In addition this change also improves QEglFSWindow::invalidateSurface() and QEglFSContext::eglSurfaceForPlatformSurface(..) Where QEglFSWindow::invalidateSurface() will now destroy the corresponding EGLSurface via eglDestroySurface, including "unbinding" it from the current thread via eglMakeCurrent and un-setting the screen's EGLSurface in case it's the same resource. QEglFSContext::eglSurfaceForPlatformSurface(..) will now call QEglFSWindow::resetSurface() in case of getting a EGL_NO_SURFACE from the QEglFSWindow (which happens if above invalidateSurface() was called before) - therefor re-creating the resource if it was destoyed via QEglFSWindow::invalidateSurface() Pick-to: 6.5 Change-Id: I37badd1fc11e993c395fb1502e9bd27ebe18b821 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* wasm: align QWasmLocalFileAccess API with 6.4Morten Sørvig2022-12-282-8/+86
| | | | | | | | | | | | | | | | | | | | | | This API is undocumented, but by keeping unchanged makes it easier to use from external projects. openFile(): Copy the accept/filter list parsing function from 6.4. It makes sense to implement this behind the API, so that user code doesn't have to reimplement it. saveFile(): Slightly more complicated; the new variant which takes a QByteArray is better since the implementation can then keep a reference to the data for as long as it needs, without copying the data. Add the const char * variant to keep existing code going for now. Adjust the calling code in widgets. Pick-to: 6.5 Change-Id: I1899ebffdb90e40429dcb10313ccc5334f20c34f Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Avoid mutual ownership in qstdweb's File::streamMikolaj Boc2022-12-221-1/+1
| | | | | | | | | | | | | | The mutual ownership of chunkCompleted<->fileReader caused both not to be freed, which resulted in a memory leak. Resolve this by introducing the ChunkedFileReader class which owns itself until file read is finished. Also, resolve a similar issue in qwasmlocalfileaccess. Fixes: QTBUG-109436 Pick-to: 6.5 Change-Id: Ieec4cde15a893fa6a2e21a62d3bb6637374c5364 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Add xdg-activation support to QGenericUnixServicesNicolas Fella2022-12-131-41/+121
| | | | | | | | | | | | | | | This is needed to transfer focus to the receiving application if that is already running It uses the new native interface for QWaylandWindow to access the existing xdg-activation support of QtWayland. The received token is passed in the options map for portal calls (as defined in the portal spec) or passed via env variable when launching the relevant helpers Change-Id: I524bc58d88033af914e8af2c6db26b1a86afb863 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Add possibility to retrieve displayId for AndroidPiotr Mikolajczyk2022-12-091-0/+4
| | | | | | | | | | When handling multiple screens in Android system it is needed to have the information about the display's Id. This patch provides this possibility. Task-number: QTBUG-105325 Change-Id: Id91aeaa59b17d5a098b672e220a5182b97320703 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QNativeInterface::Private::QWaylandWindowDavid Redondo2022-11-291-0/+11
| | | | | | | | | | | | | | | | | | Allows to access the wl_surface, the setCustomMargins functions and the object corresponding to the surface role of the surface. Also adds the xdg activation token functionality as it is needed by another change in qtbase. If the type passed to surfaceRole does not match the actual type of the current surface role nullptr is returned. QVariant is not used for transferring the surface role object because it requires Q_DECLARE_OPAQUE_POINTER for storing and retrieving from the QVariant. However QtWayland uses a plugin system for shell integrations with known external plugins so it is not possible to centrally do this for every possible pointer type. The alternative would be that plugin and consumer delcare it both which does not make for an ergonomic API. Change-Id: I6f4e036846485ba1895e7435bb28827b83249024 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QWindowsMimeConverter: Fix forward-declaration of foreign structsMårten Nordheim2022-11-261-5/+6
| | | | | | | It was inside the Qt namespace so it would try to use it as such. Change-Id: I8c8960e5f4758e945bef95b52247211e8f86efad Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QPlatformTheme::MouseCursorTheme and MouseCursorSizeLiang Qi2022-11-181-0/+26
| | | | | | | | | | | | | | | | | | | | Also implement in QGenericUnixTheme/QKdeTheme/QGnomeTheme/QGtk3Theme. On Wayland, there is wl_cursor_theme_load() and etc in wayland-cursor.h. On X11/xcb, cursor theme and size are common, either in XCURSOR_THEME and XCURSOR_SIZE envs, or in gsettings for gtk/gnome world. On Windows, cursor theme is part of theme file, see SetWindowTheme in https://learn.microsoft.com/en-gb/windows/win32/api/uxtheme/nf-uxtheme-setwindowtheme . For system settings, for example on Windows 10, Mouse Settings, Additional mouse options, Pointers Tab, Scheme. On macOS, it looks like cursor theme is deprecated. Change-Id: I5821377d966c281fb8330da1f5baa7f0ddf86a9f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Reintroduce converter APIs for supporting native clipboard formatsVolker Hilsheimer2022-11-167-124/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5, QWin(dows)Mime and QMacMime lived in the respective Extras modules, which were removed and partially folded into the relevant modules in Qt. QWindowsMime and QMacMime continued to provide the abstraction for implementing built-in support for native clipboard formats and UTIs within Qt, but only as private APIs. After the recent clean up of those APIs and respective infrastructure, we can now bring them back as public converter interfaces. Application developers can subclass those and instantiate an instance of their implementation to add support for platform or application specific data formats. These interfaces are not in the QNativeInterface namespace, as applications don't call into Windows or macOS using those interfaces. I.e. there is no class on which an application would call auto *converter= nativeInterface<QWindowsMimeConverter>(); Also, since applications override those converter types, we do want to guarantee binary and source compatibility. [ChangeLog][QtGui][QWindowsMimeConverter] Reintroduced to allow applications to add support for conversion from and to Windows-native clipboard formats to MIME-encoded data. [ChangeLog][QtGui][QUtiMimeConverter] Reintroduced to allow applications to add support for conversion from and to clipboard data on macOS and iOS to MIME-encoded data. Fixes: QTBUG-93632 Change-Id: Iebd909c3970015d203f59d5ab15e306b3d312f6e Reviewed-by: Yuhang Zhao <2546789017@qq.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make QMacMime::canConvert a non-virtual helper for other virtualsVolker Hilsheimer2022-11-092-85/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | Implementors are expected to return whether the converter can convert both ways between a mime and a uti. However, this is implied in the mimeForUti and utiForMime functions, and almost all converter implemented canConvert by returning mimeForUti(uti) == mime. A notable exception is the QMacMimeTypeName implementation, which can only convert from from mime to uti using hard-coded special format names and dummy data to provide place holders for drag'n'drop operations that originate in Qt. That converter returned always false from canConvert, but mapped the special "application/x-qt-mime-type-name" mime type to the special "com.trolltech.qt.MimeTypeName" uti. Since nobody ever requests data as "com.trolltech.qt.MimeTypeName", we still always ignore that converter. The uti is then special-cased in the QMacClipboard code. Lower-level code where only mime type or UTI are known can still call the virtuals directly and check whether the returned string is empty, which indicates that the converter does not support the conversion. As a drive-by, fix coding style and variable naming. Change-Id: I3d5d60faa82f8b31d9873c9da0097a308b9eeb50 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QWindowsMime: Fix namespace issueMårten Nordheim2022-11-081-0/+4
| | | | | Change-Id: Iac40ee9dc92a27a53491ffa7f4359ec37fef77a5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMacMime API cleanup: use uti instead of flavorVolker Hilsheimer2022-11-073-250/+272
| | | | | | | | Update documentation. Task-number: QTBUG-93632 Change-Id: I69a57608ba2a06211e89fcf511bc582509c00dc4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Standardize QMacMime and QWindowsMimeVolker Hilsheimer2022-11-073-52/+55
| | | | | | | | | Make name of virtual functions explicit, following the QWindowsMime API. Task-number: QTBUG-93632 Change-Id: I7ada2b1aa86bc6e28b47383a32ab9cbaf9ad93e5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Make QMacMime's handler scope type-safeVolker Hilsheimer2022-11-074-33/+36
| | | | | | | | | | | | | | | | | | The value indicates for which systems the handler is relevant, e.g. clipboard and/or drag'n'drop. Rename the enum from "MimeType", which is something else already, to "HandlerScope". Make the enum a scoped enum to avoid implicit conversion to uchar, and to allow for better value names. Use the type in APIs and only convert to uchar when needed. Make respective arguments default to both DnD and clipboard implicitly, instead of explicitly interpreting an invalid zero-value as a default value. Task-number: QTBUG-93632 Change-Id: I85ab982f6c9fe78ea4d030dd0b0791c8ab866f67 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Rename QMacInternalPasteboardMime to QMacMimeVolker Hilsheimer2022-11-074-127/+126
| | | | | | | | | | | | | | | We want to make it public, and there is no need for "pasteboard" since it also coveres drag'n'drop. Add a default constructor that defaults to supporting both clipboard and drag'n'drop, and clean up the code by using that constructor where applicable. Historical note: the converter interface was called QMacMime up to Qt 4.2, when due to macOS changes it had to be replaced by QMacPasteboardMime. Task-number: QTBUG-93632 Change-Id: Id9712300039375aa6394598b104827e6f5d6c948 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Windows: simplify registration of QWindowsMime implementationsVolker Hilsheimer2022-11-072-1/+157
| | | | | | | | | | | | | | | | | Register the QWindowsMime implementation instance in the QWindowsMime constructor, and remove it again in the destructor. Provide a convenience static method to register a mime type. This makes it a lot easier to use the type, without having to use native interfaces. Since this requires adding a qwindowsmime.cpp file, move the (so far internal) documentation there. Task-number: QTBUG-93632 Change-Id: I3b5e45be6255bd11a576127304c4aec9d7364e69 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix spelling of converterVolker Hilsheimer2022-11-041-3/+3
| | | | | | | Primarily in the Cocoa clipboard code. Change-Id: I39fede6144be5a0007a94e2ac2464892c958732f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Clean-up: const'ify QMacInternalPasteboardMime APIVolker Hilsheimer2022-11-032-110/+135
| | | | | | | | | | | Pass parameters as const-reference, and declare member functions as const. They have no reason to modifty the converter itself, and converters are expected to return the same result for identical input. Task-number: QTBUG-93632 Change-Id: I19ef799c1aca956f2cd1aaea1d4f7ecb565fc017 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Clean up QMacMimeRegistry: remove convertorVolker Hilsheimer2022-11-032-19/+0
| | | | | | | | | | | It's not called anywhere, we always get all convertors and iterate over them to find the best match for the relevant context. Change those loops to use ranged for. Task-number: QTBUG-93632 Change-Id: Icb450ca56310a0acab881899234ac647792ce0c9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Clean up QMacInternalPasteboardMime: remove convertorNameVolker Hilsheimer2022-11-033-78/+4
| | | | | | | | | | | | The function was primarily called to generate debug output. The only other usage was to identify the Rtf converter so that we can avoid that we convert outgoing HTML to RTF. This is just as easily (and more accurately) done by skipping any converter that converts HTML to RTF. Task-number: QTBUG-93632 Change-Id: Ibe5bdece982399e2d9823f6df67393d1f81501fe Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Refactor: split QMacMime registry and virtual interfaceVolker Hilsheimer2022-11-034-176/+243
| | | | | | | | | | | | | | | | The logic for registration of converter implementations is only used internally through static functions. Move those, and related global functions, to a QMacMimeRegistry namespace. Reduce the QMacInternalPasteboardMime to the abstract interface for converting between native and Qt clipboard data. Historically, mime converters can have different "types"; make that API type-safe. Task-number: QTBUG-93632 Change-Id: I0e16fefa350398b693486199fe10357fd84abcd6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QNativeInterface::Private::QWaylandScreenDavid Redondo2022-10-271-0/+11
| | | | | Change-Id: Ib18c95fa64ab9176195f591e8ffd45177be510b9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QNativeInterface::QWaylandApplicationDavid Redondo2022-10-251-0/+45
| | | | | | | | | | | | | | This exposes the same objects that were ere available through QPlatformNativeInterface except egldisplay for which we may find a better place. [ChangeLog][QtWaylandClient][QGuiApplication] Add QNativeInterface::QWaylandApplication that allows to access central native wayland objects. Task-number: QTBUG-94729 Change-Id: I8611522a4c9bddec3afbb5f183ffa68565f61f68 Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
* offer an opt out of automatic xdg-desktop-portal useHarald Sitter2022-10-221-0/+3
| | | | | | | | this allows users to skip over the portal invocation if it is undesirable (e.g. during early stages of session setup on KDE's Plasma) Change-Id: I43e3c3a59b9bb71c77012f8f0ec7ad7ba904a050 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-112-5/+5
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-043-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix build without opengl featureAlexey Edelev2022-09-241-1/+3
| | | | | | | | | | Guard private includes of private opengl headers and make public opengl headers available even if feature is disabled, since they can be used by user projects. Task-number: QTBUG-103196 Change-Id: If492c97b5cfb21d8aac0d607bc7add38b6d0c73e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>