summaryrefslogtreecommitdiffstats
path: root/src/gui/platform/windows
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>
* Make some QScreen native interfaces publicDavid Redondo2023-12-081-5/+11
| | | | | | | | | | [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>
* Mime type conversion: clarify and clean up documentationVolker Hilsheimer2023-11-221-0/+18
| | | | | | | | | | | | | | | | 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>
* Gui: include mocsMårten Nordheim2023-07-071-0/+2
| | | | | Change-Id: I915071413b05884e61cfad4924a29b0269fab310 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* API review: disable copy for new mime converters classesVolker Hilsheimer2023-01-261-0/+1
| | | | | | | | 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>
* 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>
* Reintroduce converter APIs for supporting native clipboard formatsVolker Hilsheimer2022-11-163-59/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* QWindowsMime: Fix namespace issueMårten Nordheim2022-11-081-0/+4
| | | | | Change-Id: Iac40ee9dc92a27a53491ffa7f4359ec37fef77a5 Reviewed-by: Fabian Kosmale <fabian.kosmale@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>
* Enable access to QWindowsScreen from QScreenPiotr Srebrny2022-07-061-0/+10
| | | | | | | | | This patch adds access to the QWindowsScreen interface from QScreen with the aim to provide the native handle of QScreen. This handle will be used in QtMultmedia to find DXGI interfaces related to that screen. Change-Id: I93f066b3f0d4d70331aeedab36bb0db111a34556 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-164-153/+9
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Make sure all qtbase private headers include at least one otherThiago Macieira2022-02-241-0/+1
| | | | | | | | | | See script in qtbase/util/includeprivate for the rules. Since these files are being touched anyway, I also ran the updatecopyright.pl script too. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b6 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Document which header to include for the various native interfacesTor Arne Vestbø2021-12-041-0/+1
| | | | | | | Fixes: QTBUG-98654 Pick-to: 6.2 Change-Id: Ic5ea3cc7d90ed336a5b6e827d1523bdd58fabc13 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add message debug entry for DPI change eventsMorten Johan Sørvig2021-10-071-0/+6
| | | | | | | | WM_GETDPISCALEDSIZE and WM_DPICHANGED. Pick-to: 6.2 Change-Id: I0614b0f552e52fc77d026dbc7e8c13b05f7d0e9e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Rejig native interface plumbingTor Arne Vestbø2021-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The initial approach for providing public access to native interfaces via T::nativeInteface<I>() was based on the template not being defined, and then having explicit instantiations of the supported types in a source file, so that the accessors were exported and available to the user. This worked fine for "simple" types such as QOpenGLContext and QOffscreenSurface, but presented a problem in the context of classes with subclasses, such as Q{Core,Gui}Application. To ensure that a native interface for QCoreApplication was accessible both from QCoreApplication and its subclasses, while at the same time preventing a native interface for QGuiApplication to be accessible for QCoreApplication, the nativeInterface() template function had to be declared in each subclass. Which in turn meant specializing each native interface once for each subclass it was available in. This quickly became tedious to manage, and the requirements for exposing a new native interface wasn't very clear with all these template specializations and explicit instantiations spread around. To improve on this situation, while also squashing a few other birds at the same time, we change the approach to use type erasure. The definition of T::nativeInteface<I>() is now inline, passing on the requested interface to a per type (T, not I) helper function, with the interface type flattened to a std::type_info. The type_info requested by the user is then compared to the available types in a single per-type (T) "switch statement", which is a lot easier to follow for someone trying to trace the logic of how a native interface is resolved. We can safely rely on type_info being stable between the user application and the Qt library as a result of exporting the type info for each native interface, by explicitly ensuring they have a key function. This is the same mechanism that ensures we can safely dynamic_cast these interfaces, even across library boundaries. The use of a free standing templated helper function instead of a member function in the type T, is to avoid shadowing issues, and to not pollute the class namespace of T with the helper function. Since we are already changing the plumbing for how a user resolves a native interface for a type T, we take the opportunity to add a few extra safeguards to the machinery. First, we add a static assert in the T::nativeInteface<I>() definition, that ensures that only compatible interfaces, as declared by the interface themselves, are allowed. This ensures a compile time error when an incompatible interface is requested, which improves on the link time errors we had prior to this patch, and also offsets the one downside of type erasure, namely that errors are only caught at runtime. Secondly, each interface meant for public consumption through T::nativeInteface<I>() is declared with a revision, which is checked when requesting the interface. This allows us to bump the revision when we make breaking changes to the interface that would have otherwise been binary incompatible. Since the user will never see this interface due to the revision check, they will not end up calling methods that have been removed or renamed. One advantage of moving to a type-erased approach for the plumbing is that we're not longer exposing the native interface types as part of the T::nativeInteface symbols. This means that if we ever want to rename a native interface, the only exported symbol that the user code relies on is the type info. Renaming is then possible by just exporting the type info for the old interface, but leaving it empty. Since no class in Qt implements the old native interface, the user will just get a nullptr back, similarly to bumping the revision of an interface. Change-Id: Ie50d8fb536aafe2836370caacb22afbcfaf1712a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Doc: Use correct include for QWGLContextPaul Wicking2021-03-041-1/+1
| | | | | | | Pick-to: 6.1 6.0 Task-number: QTBUG-91500 Change-Id: If487a2d14dd61d127dc35aa039f9b71915128da1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: Specify correct include for QWGLContextPaul Wicking2021-03-031-0/+1
| | | | | | | Pick-to: 6.1 6.0 Fixes: QTBUG-91500 Change-Id: Ie842c9e911fe5492cc13aeba459d28d6553438fd Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-071-7/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Doc: Fix documentation warnings for Qt GUITopi Reinio2020-11-191-2/+20
| | | | | | | | | | | | | | | - Remove obsolete dependencies and references. - Restore previously deleted snippet code referenced in richtext.qdoc. - Add widgets snippets path to exampledirs; some classes were moved from QtWidgets to QtGUI and related \snippet commands were broken. - Mark internal functions under QNativeInterface::Private as \internal. Task-number: QTBUG-86295 Change-Id: I9c165c860c7191dac65972d702698a1745bff77f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* doc: Update and flesh out native interface docsTor Arne Vestbø2020-10-181-0/+247
| | | | | | | | | The namespace and overviews are in the qtdoc repository. Docs for individual interfaces should live with their platform. Change-Id: Iba5fd7e9ebc4f1f634ec9dc3ec125ce88a1312ba Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Rename QtGui native interface implementation filesTor Arne Vestbø2020-10-122-1/+1
| | | | | | | Follows the naming convention used by the plugins as well. Change-Id: Icba62fc2aaa5acf0ab3c88599a63aab1f530a2ab Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Rename the new platform APIs from QPlatformInterface to QNativeInterfaceTor Arne Vestbø2020-10-072-9/+9
| | | | | | | | | | | | We were already using the 'native' nomenclature when referring to these kinds of APIs, e.g. when talking about native handles, or the existing QPlatformNativeInterface on a QPA level. Using 'native' for the user facing APIs also distinguishes them from the 'platform' backend layer in QPA and elsewhere. Change-Id: I0f3273265904f0f19c0b6d62471f8820d3c3232e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Cleanup API of QMimeDataLars Knoll2020-09-211-1/+1
| | | | | | | | | | | | | Do not use QVariant::Type anymore, instead use QMetaType For some reason, this pushed the qvariant autotest over the limit where MSVC requires the /bigobj flag, so add that one. [ChangeLog][QtCore][QMimeData] The signature of the virtual retrieveData() function has changed and now takes a QMetaType instead of a QVariant::Type. Change-Id: Ib46773bd731ee2177b1ef74d8162d744be7017ef Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QEventDispatcherWin32: create internal window on constructionAlex Trotsenko2020-09-161-1/+0
| | | | | | | | | | | | | | | | | When QCoreApplication object is instantiated, creation of the internal message window is delayed until QEventDispatcherWin32::processEvents() is called or socket/event notifier is registered. But, if the user uses a native event loop, posted events are not delivered and timers do not work. This problem was fixed in a4ac4b326318ed9034466305222280ed8d1651b5 for QWindowsGuiEventDispatcher in the same way. So, the risk of regression is minimal. Change-Id: I7bbb721d96046f64d21a7b0e553e46798b37189c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add missing 'We mean it' header to qwindowsmime_p.hKai Koehne2020-08-171-0/+11
| | | | | Change-Id: Ia0085b75b9127d99b10518768cecbb79a4286c8e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Windows QPA: Move mime-type related classes to the new interfaceFriedemann Kleint2020-07-283-1/+79
| | | | | | | | | | | | Move QWindowsMime (which was a public class in Qt 4 and moved to the QPA plugin in Qt 5) to the platform namespace and add register functions to the native application. Move in test code from QtWinExtras. Task-number: QTBUG-83252 Change-Id: Iaac440e2d5cb370110919921b1eeb779600b5b65 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QPlatformInterface::Private::QWindowsWindowFriedemann Kleint2020-07-221-0/+3
| | | | | | | | Remove QWindowsWindowFunctions Task-number: QTBUG-83252 Change-Id: Iacfdf2e0f430208901c182e461c4617e1ef526ce Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Start the native interface QWindowsApplicationFriedemann Kleint2020-07-211-0/+2
| | | | | | | | | | | | Implement the static parts of QWindowsWindowFunctions. Move some things around and make them static in tablet support to make this easier. Task-number: QTBUG-83252 Change-Id: I24c3b0b3c6548eb96c4f3285a4e46385a1e79ef5 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix no-OpenGL build after introducing QOpenGLContext platform interfaceTor Arne Vestbø2020-07-031-0/+4
| | | | | | Change-Id: I355f43c200adb3a12e71e0b02aa10060672bb9e4 Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Introduce platform API abstraction for QOpenGLContextTor Arne Vestbø2020-07-022-1/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API is available by including qopenglcontext.h as usual, but scoped in the QPlatformInterface namespace. The namespace exposes platform specific type-safe interfaces that provide: a) Factory functions for adopting native contexts, e.g. QCocoaGLContext::fromNative(nsContext, shareContext); b) Access to underlying native handles, e.g. openGLContext->platformInterface<QCocoaGLContext>->nativeContext() c) Platform specific functionality, e.g. static QWGLContext::openGLModuleHandle() openGLContext->platformInterface<QEGLContext>->doSomething(); The platform interfaces live close to the classes they extend, removing the need for complex indirection and plumbing, and avoids kitchen-sink modules and APIs such as the extras modules, QPlatformFunctions, or QPlatformNativeInterface. In the case of QOpenGLContext these platform APIs are backed by the platform plugin, so dynamic_cast is used to ensure the platform plugin supports the requested interface, but this is and implementation detail. The interface APIs are agnostic to where the implementation lives, while still being available to the user as part of the APIs they extend/augment. The documentation will be restored when the dust settles. Task-number: QTBUG-80233 Change-Id: Iac612403383991c4b24064332542a6e4bcbb3293 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Move the Windows Event Dispatcher into QtGuiFriedemann Kleint2020-06-093-0/+308
Task-number: QTBUG-83255 Change-Id: Ida86f27d7f52b9be48fbea909979320866ff8dae Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>