summaryrefslogtreecommitdiffstats
path: root/src/plugins
Commit message (Collapse)AuthorAgeFilesLines
* Windows: Reevaluate dark frames if the application palette changesVolker Hilsheimer26 hours1-9/+14
| | | | | | | | | | | | | | | | | | | Since 5ea7e3a8111b2939f0c91b750aa1c62ab16ab715 we are using dark window frames if the default palette is dark, unless applications explicitly override dark frame support. If the palette changes during runtime, we didn't reevaluate that setting. Do that by handling ApplicationPaletteChange events in QWindowsWindow. We still have to respect an explicit opt-out. Simplify the code at the call sites of setDarkBorder(), we don't need to check all the time whether the application has opted out of dark frame support. Pick-to: 6.4 Task-number: QTBUG-72028 Change-Id: I94e7d33cd21f9656ca210b43e775f487abc25b54 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Let styles indicate that they support dark modeSanthosh Kumar26 hours2-0/+7
| | | | | | | | | | Add a style hint that allows styles to indicate that they support dark mode. The macOS and Fusion styles support dark mode, the other styles, in particular the Windows Vista style, do not. Task-number: QTBUG-72028 Change-Id: I02cac2e19a21898663f50f09a4ef419a613a73ec Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix the assert in QWasmClipboard::writeToClipboardApiMikolaj Boc30 hours1-1/+1
| | | | | | | The assert condition should be negated. Change-Id: I901b61012ffaf893744dfb9f762b009f267b629d Reviewed-by: David Skoland <david.skoland@qt.io>
* Use the browser compositor for drawing windows on WASMMikolaj Boc30 hours26-972/+934
| | | | | | | | | | | | | | | | Make the browser compositor draw the window non-client area (using css + html). Get rid of OpenGL usage in non-OpenGL windows and use canvas 2d context instead to blit the texture (QImage). Also, as part of the change, remove the deprecated canvas element support in QScreen. Fixes: QTBUG-107116 Fixes: QTBUG-107219 Change-Id: I65f0d91831c806315685ca681ac0e416673f5cd5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* IBus: Use portal in snapIlya Fedin35 hours1-3/+4
| | | | | | | | Snap supports the IBus portal for two years, but Qt applications don't take its advantage in snap without setting IBUS_USE_PORTAL Change-Id: I26a044d657c4b7040a21a8510116c0c7af7aaa52 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qnsview_drag: only ignore key modifier while dragging 'within the application'Timur Pocheptsov2 days2-3/+10
| | | | | | | | | | | | We return a mask containing several supported DND operations and if modifiers were ignored, an external application can select a 'wrong' operation (not the one we wanted when pressing a modifier). Saying that, the old logic of ignoring still applies if we are dragging 'within the application'. Fixes: QTBUG-99471 Change-Id: I67c9a656960e95d6d2298f4b3bdd2052faedb263 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* ibus: check object validity before honoring `inputMethodAccepted()`Phan Quang Minh2 days1-1/+1
| | | | | | | | | | | | | | | | | | | | | `inputMethodAccepted()` always return false if there is no current focus object. This means QIBusPlatformInputContext will fail to send the necessary `FocusOut` request to the input context, causing IBus to not send the appropriate content type information to the panel service when the application regains focus and issue a `FocusIn` request. This results in issues like https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5346, which can happen when a Qt application is in foreground as the IBus daemon fails to propagate the content type information to GNOME Shell, which acts as the panel service on GNOME systems. Fix this by checking for the validity of `object` before honoring the result of `inputMethodAccepted()`. Pick-to: 5.15 6.2 6.4 Change-Id: I6b79ffc7c5f03ffc05527c29e52a0859f3594bfa Reviewed-by: Liang Qi <liang.qi@qt.io>
* Proper clearing of WinRT factory cache in QWindowsThemeYuhang Zhao2 days1-0/+1
| | | | | | | | | | | | I've checked the whole qtbase code base, this is the only one that's left from the previous commit. Amends commit ffb9dee1b0954e4d4f9e9791175609a80ecafc31 Task-number: QTBUG-103611 Pick-to: 6.4 6.2 Change-Id: I76a9130654819d1336c27dac350f5ad56915ad81 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* wasm: fix build of wasm accessibilityLorn Potter3 days1-0/+1
| | | | | | | Some platforms need extra help finding includes Change-Id: I4f18b183cea780067dd9269e07dfb7db75606406 Reviewed-by: David Skoland <david.skoland@qt.io>
* macOS: Don't send posted events via runloop observerTor Arne Vestbø9 days2-39/+0
| | | | | | | | | | | | | | | | The logic was added in b0016ea9a6b225757e3ee06b50e8f7d05463ddf7, but the test-case in the bug report works fine without this logic. As sending events from a runloop observer is dubious, and causes problems since it's not tied to the quite complex machinery of the general event processing, it's better to remove it. The original issue is already tested by sendEventsOnProcessEvents in tst_QCore/GuiApplication. Task-number: QTBUG-4521 Change-Id: I857519a09a13a72b7434727c0229606403be7ed3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Migrate to using the constructor of QtLoaderMikolaj Boc9 days2-5/+5
| | | | | | | | | | Wasm shell used to call the function QtLoader instead of constructing a new QtLoader. Change this. Also change the doc to recommend using the constructor. Change-Id: I57c52eab389aa82449c7db3f4c646ffb234df778 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Add QPlatformTheme::MouseCursorTheme and MouseCursorSizeLiang Qi9 days1-0/+10
| | | | | | | | | | | | | | | | | | | | 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>
* Do not allow an empty rect to become a window rect on WASMMikolaj Boc9 days1-9/+14
| | | | | | | | For regular windows, the size should not be allowed to be empty. This emulates system-wide minimum size setting on various operating systems. Change-Id: I515fff8c9bfd14762dcfe88fb923ab10d8edd5c1 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Null-check for window when handling pointer eventsMikolaj Boc10 days1-2/+3
| | | | | | | | There might not be a window at the pointer event position on a WASM screen, especially when the main window is not fullscreen. Change-Id: I29aac8c410fdf2bf97cd1ed12433d87e18b4a354 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Fix QIBusPlatformInputContext leaksIlya Fedin11 days1-45/+48
| | | | | | | | | | | | QIBusPlatformInputContext re-creates various objects on ibus restart, but never deletes them. Sometimes this leads to multiplied input (the same character entered multiple times). Pick-to: 6.4 6.2 5.15 Change-Id: I34a898bfe56b19f9d76752c649e3aa64c77ae11a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Reintroduce converter APIs for supporting native clipboard formatsVolker Hilsheimer11 days12-66/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Plumb QMessageBox::iconPixmap() to QPlatformMessageDialogHelperTor Arne Vestbø11 days1-4/+13
| | | | | | | | | For now this plumbs the QPixmap directly, but as a follow up we should teach QMessageBox to deal with QIcons instead, and rejig the plumbing correspondingly. Change-Id: I51dee4240082abf0acb33b6ade553327295a99bd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Windows: centralize how we handle error messagesYuhang Zhao11 days6-114/+19
| | | | | | | | | | | | | | | | Currently QtBase contains multiple implementation of how to get the Win32 and COM error messages, and they are almost exactly the same, what's worse, Qt already has a private QSystemError class to do such things, so we are re-inventing the wheel in many places. This patch removes all other custom error message implementations besides the QSystemError one. And since there are a lot of places need the COM error message, move the implementation to QSystemError so that it can handle both Win32 error and COM error. Since I'm touching these lines anyway, break them into short lines if they are above the length limit. Change-Id: I1067c874011800303f0f114b5cb8830ac6810fc0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* macOS: Add dialog helper for native message boxesTor Arne Vestbø12 days8-6/+360
| | | | | | | | | | | | | | | | | The native implementation uses NSAlert, making a best effort to map the QMessageBox properties to the native dialog, falling back to the cross platform non-native dialog if the discrepancy is too big. The initial implementation focuses on the current state of the native dialog helper "protocol", but there's room for improvement here, which would allow even more dialog types and properties to be native. [ChangeLog][macOS] Message boxes such as QMessageBox now follow the platform look and feel by using native dialogs if possible. Change-Id: I4da33f99894194a7b301628cd1fbb44d646ddf18 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QNetworkInformation[win]: Capture another potential exceptionMårten Nordheim12 days1-1/+6
| | | | | | | | | | As reported by a user. Fixes: QTBUG-108382 Pick-to: 6.4 Change-Id: Ic94c65d533edd84c8fda5d713d9579a9492b88ae Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* win: resolve theme fonts at 96 dpiMorten Sørvig12 days1-8/+10
| | | | | | | | | | | | | | | | This code became out of sync with the changes to the LOGFONT_to_QFont() implementation introduced in edb00660. After that, LOGFONT_to_QFont() on longer adjusts the font size according to the DPI for the primary display. This means that the the code should also not get font metrics from the first display, but instead get metrics at 96 DPI. Fixes: QTBUG-105857 Pick-to: 6.4 6.2 Change-Id: I5974a77593e1944d889a45a352923fb9aa9a0dec Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Apply system background color for top level windowSanthosh Kumar12 days2-1/+16
| | | | | | | | | | | | Repaint top level window with system background color when it shows up first time. The system background color will be affected by dark or light mode settings in windows Fixes: QTBUG-106583 Pick-to: 6.4 Change-Id: I9205335540e74e90bb068e30fc3d4db037fd580f Reviewed-by: Yuhang Zhao <2546789017@qq.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Ensure NSApp initialization without relying on event processingTor Arne Vestbø12 days2-12/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | When processing events without QEventLoop::EventLoopExec we can not rely on [NSApp run] for running the native run loop. This can happen e.g. when running a dialog, or when processing events manually via processEvents(). Unfortunately, AppKit relies on at least one call to [NSApp run] for doing critical initialization of NSApplication, so when we end up spinning the native runloop via other means, we still need to ensure we pass through [NSApp run] at least once. Doing so in a way that relies on our own runloop sources firing and interrupting the NSApp run is fragile though. For example, the logic added in bffbfc5b3368abaa5f95b7e4f8342e9202ab065a to avoid live locks in CFRunLoop by skipping out event runloop source when processEvents() is called manually will also result in the [NSApp run] never being stopped. To fix this we use a dedicated runloop block instead, where we explicitly call [NSApp stop:] when first entering the runloop. In addition we ensure that none of our sources will process events, so that we don't end up recursing into a runModal or similar call until after we've initialized NSApp. Change-Id: I137df46d5fa4105cdc39fe74b6c12275cfd46127 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Always export and link in JSEvents and specialHTMLTargetsMikolaj Boc12 days2-83/+8
| | | | | | | | | | | | | | | The two symbols are linked in & exported by using a publicly visible symbol emscripten_set_wheel_callback. To actually link it, but avoid calling it, a volatile false boolean flag is used in a guarding if. This should ideally be done by setting DEFAULT_LIBRARY_FUNCS_TO_INCLUDE, but a cmake bug (see QTBUG-108444) is preventing this. Fixes: QTBUG-108423 Task-number: QTBUG-108444 Change-Id: I6b0406d1059dcec63b3942468e210c53292ffe90 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: unblock virtual keybaordLorn Potter2022-11-131-1/+1
| | | | | | | | | | | QtVirtualKeyboard can be used for non touch apps as well. We were not taking this into consideration and only allowing touch devices to access it. Pick-to: 6.4 Change-Id: I17fcb360b6655ace4fba7447eb85561ba75338a5 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Call qtUpdateApi on module as expectedMikolaj Boc2022-11-111-1/+1
| | | | | | | | | | | | The qtUpdateDpi function is a module function, not a scope function (regardless of it being window-scope self or QtLoader-scope self). Therefore it should be executed with module as this. Fixes: QTBUG-108112 Pick-to: 6.4 Change-Id: Ib4604a43dbdd0caa114d3d892ea97b5ee4c9a9a8 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Gtk3: fix stack smashing on mismatch between bool and gbooleanThiago Macieira2022-11-111-1/+1
| | | | | | | | | | | | | Glib is written in C and predates C99 (though not really, glib 2.0 was released in 2002), so it defines gboolean as int, a 4-byte type. C++'s bool is a 1-byte type, so this caused a buffer overflow. Problem introduced in 2b77e779ce43386d14bdd2d1109ee182bcd0d047 ("QGtk3Theme: implement appearance function to detect dark themes"). Pick-to: 6.2 6.4 Change-Id: Ieba79baf5ac34264a988fffd172650701fa54da8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Windows: Inform accessibility system about the focused child itemVolker Hilsheimer2022-11-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | When a complex object (i.e. one with children that are themselves not fully exposed objects) gets focus, then we need to inform the accessibility system about which child object actually has focus. This was only done for item views, but not for other complex widgets. An editable QComboBoxes is the focus proxy for its line edit. The line edit never gets focus itself (QComboBox forwards relevant events), and is the accessible child item with index 1. So when an editable combobox gets focus, it needs to raise the automation event for the line edit child. Implement QAccessibleComboBox::focusChild to return the interface to the lineedit for editable comboboxes so that the UI Automation bridge can correctly notify about the focus being moved to an editable text input field. Fixes: QTBUG-107572 Pick-to: 6.4 6.2 Change-Id: Id60e2791ec859365255baa9bfd01547979cd2b44 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y: Add support for Tables in macOS bridgeJan Arve Sæther2022-11-103-2/+261
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a11y purposes, a table needs to be mapped into a logical accessibility hierarchy. There are several ways of doing this mapping, and unfortunately macOS expects something different than what QAccessibleInterface does. So suppose we have a a 2x2 QTableView with both horizontal and vertical header like this (the names reflect the QAccessible::Role names): +-----------+--------------+--------------+ | | ColumnHeader | ColumnHeader | +-----------+--------------+--------------+ | RowHeader | Cell | Cell | +-----------+--------------+--------------+ | RowHeader | Cell | Cell | +-----------+--------------+--------------+ In order to be presented to the screen reader on a platform, it goes through two rounds of mapping: QAccessibleInterface will have all headers and cells as direct children of the table: - Table +- ColumnHeader +- ColumnHeader +- RowHeader +- Cell +- Cell +- RowHeader +- Cell +- Cell macOS expects a deeper hierarchy: - AXTable [QAccessible::Table] +- AXRow [Qt:no eqiuivalent] +- [QAccessible::Cell] (The content of the cell, e.g. AXButton, AXGroup or whatever) +- [QAccessible::Cell] (The content of the cell, e.g. AXButton, AXGroup or whatever) +- AXRow +- [QAccessible::Cell] (The content of the cell, e.g. AXButton, AXGroup or whatever) +- [QAccessible::Cell] (The content of the cell, e.g. AXButton, AXGroup or whatever) +- AXColumn (this seems to just store the geometry of the column) +- AXColumn (this seems to just store the geometry of the column) +- AXGroup (this represents the column headers) +- AXSortButton (clicking a header cell will trigger sorting) +- AXSortButton (clicking a header cell will trigger sorting) It's unclear to me how RowHeaders are mapped (they are rarer than ColumnHeaders, I expect to find them in e.g. spreadsheet applications). I haven't found any native usage of them. So this patch simply ignores them. Notice that macOS have a three layer deep hierarchy to represent a table (Table->Row->Cell), while QAccessibleInterface has a two-layer deep hierarchy (Table->Row/Cell). In the macOS bridge we therefore need to "inject" the Row/Column element to be "between" the table and the cell. The table will take ownership of all row and column elements that are children of the table. These elements are not inserted into the cache (it would be pointless, since the cache is basically just a mapping between the QAccessibleInterface -> QMacAccessibilityElement, and the row and column elements does not have a corresponding QAccessibleInterface to be mapped from). The rows and columns are therefore also created as soon as the table element is initialized, and they are stored in two NSMutableArray members of QMacAccessibilityElement. A table is constructed like any other accessibility element, with a valid axid and synthesizedRole set to nil. Each child row and column element is constructed with the same axid as the parent table element, and they will have the synthesizedRole set to either NSAccessibilityRow or NSAccessibilityColumn. With the synthesizedRole member we can then identify if we are a row, column or the actual table, and implement their respective behaviors. Notice that the child row/column is created with the parent's table axid in order for them to have a way of finding their parent table element. (there is no 'parent' member variable in QMacAccessibilityElement) This glorious scheme isn't pretty, but seems to work. Fixes: QTBUG-37207 Change-Id: I7c2451e629f5331b9a0ed61dc22c6e74a82cc173 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QNetworkInformation[Win]: Fix potential use-after/during-freeMårten Nordheim2022-11-093-12/+26
| | | | | | | | | | | | | | | | | | | | The WinRT NetworkStatusChanged callback may happen during or slightly before we unregister our token, which we usually follow up by destroying the object. So we have to avoid potentially doing work on a deallocated object. Do this using the old QPointer-trick. Neither me nor reporter can reproduce it locally, so this is only a best-measure. Further problems may be that the storage for the lambda has already been destroyed and repurposed, in which case the pointer may be valid, but junk, which would lead to another crash. But this is unavoidable as long as MS does not synchronize callbacks with (un)registering new callbacks. To attempt combatting this we hold our own lock around unregistration and the "meat" of the callback. Pick-to: 6.4 6.4.1 Fixes: QTBUG-108218 Change-Id: Iacf8b8f458cca3152ff395e9a38e8df193534f46 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Make QMacMime::canConvert a non-virtual helper for other virtualsVolker Hilsheimer2022-11-093-23/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* macOS: delay initialization of small fontVolker Hilsheimer2022-11-092-9/+14
| | | | | | | | | | | | | | | | | | During construction of a QStyle, QApplication might not yet be initialized, e.g. when calling QApplication::setStyle("macOS") before constructing QApplication. In that case, we cannot access the platform theme. We don't just want to skip initializing the small font either though. Store the smallSystemFont as a std::optional so that we can initialize it once, when the first widget gets polished. As a drive-by, remove the unused miniSystemFont variable. Fixes: QTBUG-108047 Pick-to: 6.4 6.2 Change-Id: Id750770a563611fdbc6c7031fe102a99ea692be7 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* wasm: add accessibility logging categoryMorten Sørvig2022-11-082-8/+12
| | | | | | | | Use it for logging TODO items. Change-Id: If3218effcc7f044269defd5187ec080d4132d674 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: tidy up qwasmcclipboard.cpp/hMorten Sørvig2022-11-082-28/+34
| | | | | | | | | Use private class functions and data. Move static paste function out of the class, next to the other static event handlers. Remove writeToClipboard()'s unused argument. Change-Id: I9098290a3885dc540ea29a989fe3e83f8f4d5396 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Android: Do not override app_pal by AndroidPlatformThemeBartlomiej Moskal2022-11-081-1/+0
| | | | | | | | | | | It may happen that other styles (especially QtQucik styles) apply different palette for applications. In such case AndroidPlatformTheme should not override it when Light/Dark mode is changed Task-number: QTBUG-83185 Pick-to: 6.4 6.2 Change-Id: I6a3b7ee047fcd729be03271a7202cd260360f83b Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Gtk3Theme: set XCURSOR_SIZE and XCURSOR_THEME for wayland sessionsJan Grulich2022-11-081-0/+14
| | | | | | | | | | | | | | | | | | GNOME doesn't set these for Wayland session and without those env variables set users might experience broken cursor with Qt apps as QWayland reads them to setup QWaylandInputDevice. There is no cursor protocol available on Wayland yet, see also https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/58 Qt Wayland QPA plugin still tries to load from those two envs. Fixes: QTBUG-67579 Fixes: QTBUG-87778 Pick-to: 6.4 6.2 5.15 Change-Id: I4e7f6871b56599170b12e796858238b1df6d47d1 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* macOS: clean up clipboard codeVolker Hilsheimer2022-11-073-108/+61
| | | | | | | | | | | | | | Replace flavor with uti, remove unused parameters, remove unused hasOSFlavor function. Hide QMacMimeData as an implementation detail, it is generally undefined behavior to cast an object to a type it is not an instance of (even if related and without new data members). Apply const, fix coding style. Task-number: QTBUG-93632 Change-Id: I3bc05a72bc47c78958f26211211e734387fbb024 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QMacMime API cleanup: use uti instead of flavorVolker Hilsheimer2022-11-073-40/+40
| | | | | | | | Update documentation. Task-number: QTBUG-93632 Change-Id: I69a57608ba2a06211e89fcf511bc582509c00dc4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Standardize QMacMime and QWindowsMimeVolker Hilsheimer2022-11-073-10/+10
| | | | | | | | | 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-075-26/+27
| | | | | | | | | | | | | | | | | | 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>
* QWindowsMime: port to use modern string literalsVolker Hilsheimer2022-11-071-25/+25
| | | | | | Task-number: QTBUG-93632 Change-Id: I75e780a0bf1137e99c6726fbff15be5cc68accd5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Rename QMacInternalPasteboardMime to QMacMimeVolker Hilsheimer2022-11-077-39/+36
| | | | | | | | | | | | | | | 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-071-113/+17
| | | | | | | | | | | | | | | | | 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 registration of Windows-specific custom mime typesVolker Hilsheimer2022-11-071-3/+9
| | | | | | | | | | | | | | | | | | | Data received by Qt from a native clipboard- or drag'n'drop-source is mapped to a application/x-qt-windows-mime;value=... mime type, where the "value" corresponds to the native clipboard format name, e.g. "FileGroupDescriptor". When we register such a mime type in Qt, then we need to get the same clipboard format number back. I.e. registering 'application/x-qt-windows-mime;value="FileGroupDescriptor"' needs to produce the same Windows clipboard format identifier as the call to RegisterClipboardFormat("FileGroupDescriptor"). Otherwise, a mime converter implementation has to operate on different clipboard format values in the implementations of the different virtual functions that are operating on FORMATETC data structures. Task-number: QTBUG-93632 Change-Id: I0b7e3a2fc0e3f72bffc4490fc0ff4b190e0929a3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNetworkInformation[Win]: Catch potential exceptionsMårten Nordheim2022-11-042-2/+15
| | | | | | | | | | | | | | Some Windows SDKs seem to throw an exception (sometimes?) when calling ConnectionProfile::NetworkAdapter. Catch the exception and ignore it, we would return Unknown anyway. And just in case it is needed, do the same for GetConnectionCost. This requires enabling exceptions for the plugin. Fixes: QTBUG-108156 Pick-to: 6.4 6.4.1 Change-Id: Ie6c5adb3715578aa94ef3391afae79d9aecdc5d3 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Fix spelling of converterVolker Hilsheimer2022-11-042-6/+6
| | | | | | | Primarily in the Cocoa clipboard code. Change-Id: I39fede6144be5a0007a94e2ac2464892c958732f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* xcb: Flush Display when processing xcb eventsLiang Qi2022-11-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Only calling xcb_flush() is not enough when users use xlib calls to paint with the Display, for example in QWidget::paintEvent(), and not call XFlush(). This fixes a regression since Qt 4.x. In Qt 4, we use XNextEvent() in x11 event dispatcher which implicitly called XFlush(). In Qt 5 and 6, we use xcb calls. See also https://www.x.org/releases/X11R7.5/doc/man/man3/XFlush.3.html Most client applications need not use this function because the output buffer is automatically flushed as needed by calls to XPending, XNextEvent, and XWindowEvent. Pick-to: 6.4 6.2 5.15 Fixes: QTBUG-46681 Fixes: QTBUG-100085 Change-Id: I08dc0800ad0e23f0c2293d0d4e4bd29d92155752 Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Liang Qi <liang.qi@qt.io>
* xcb: Add xlib wrapper for XFlush()Liang Qi2022-11-033-0/+26
| | | | | | | | | Also avoid to include xlib headers directly. Pick-to: 6.4 6.2 5.15 Change-Id: Id60a9b39a9d8284d5d0ab3df1ed61f844f1e68e4 Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Clean-up: const'ify QMacInternalPasteboardMime APIVolker Hilsheimer2022-11-031-10/+19
| | | | | | | | | | | 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-031-6/+4
| | | | | | | | | | | 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>