diff options
Diffstat (limited to 'src/plugins/platforms')
11 files changed, 39 insertions, 40 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h index 9a491d4d058..35fb7f24dd5 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h @@ -29,7 +29,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSStatusItem); QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QCocoaSystemTrayIcon : public QPlatformSystemTrayIcon +class QCocoaSystemTrayIcon : public QPlatformSystemTrayIcon { public: QCocoaSystemTrayIcon() {} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.h index 13dbdfbfbab..ba3d293e054 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.h +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.h @@ -9,7 +9,6 @@ #include "qwayland-qt-dmabuf-server-buffer.h" #include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h> -#include "dmabufserverbufferintegration.h" #include <QtWaylandClient/private/qwaylanddisplay_p.h> #include <QtCore/QTextStream> diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.h index a06bc96b87d..01ac4dbe718 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.h +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.h @@ -9,7 +9,6 @@ #include "qwayland-drm-egl-server-buffer.h" #include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h> -#include "drmeglserverbufferintegration.h" #include <QtWaylandClient/private/qwaylanddisplay_p.h> #include <QtCore/QTextStream> diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.h index 344046ae182..4f9e0aeced5 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.h +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.h @@ -8,7 +8,6 @@ #include "qwayland-shm-emulation-server-buffer.h" #include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h> -#include "shmserverbufferintegration.h" #include <QtWaylandClient/private/qwaylanddisplay_p.h> #include <QtCore/QTextStream> diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.h index 2f0867a8197..a1c413be5d9 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.h +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.h @@ -8,7 +8,6 @@ #include "qwayland-qt-vulkan-server-buffer-unstable-v1.h" #include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h> -#include "vulkanserverbufferintegration.h" #include <QtWaylandClient/private/qwaylanddisplay_p.h> #include <QtCore/QTextStream> diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index 780f5f3268e..6d86600bad2 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -82,8 +82,8 @@ private: friend class QWaylandWindow; }; -QT_END_NAMESPACE +} // namespace QtWaylandClient -} +QT_END_NAMESPACE #endif // QWAYLANDSHELLSURFACE_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h index bddb5c614e0..e2c54ef0078 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h @@ -52,8 +52,7 @@ public: const QString &app_id); }; -QT_END_NAMESPACE - -} +} // namespace QtWaylandClient +QT_END_NAMESPACE #endif // QWAYLANDXDGACTIVATIONV1_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h index 8a0cc9e79a7..680fcf69b9f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h @@ -56,8 +56,7 @@ private: bool m_configured = false; }; -QT_END_NAMESPACE - -} +} // namespace QtWaylandClient +QT_END_NAMESPACE #endif // QWAYLANDXDGDECORATIONV1_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index a12311eff74..43c17672c23 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -201,8 +201,7 @@ private: friend class QWaylandXdgSurface; }; -QT_END_NAMESPACE - -} +} // namespace QtWaylandClient +QT_END_NAMESPACE #endif // QWAYLANDXDGSHELL_H diff --git a/src/plugins/platforms/windows/qwindowswindowclassregistry.cpp b/src/plugins/platforms/windows/qwindowswindowclassregistry.cpp index 9c9ffcfeefa..8bf2fb887f1 100644 --- a/src/plugins/platforms/windows/qwindowswindowclassregistry.cpp +++ b/src/plugins/platforms/windows/qwindowswindowclassregistry.cpp @@ -18,8 +18,8 @@ Q_LOGGING_CATEGORY(lcQpaWindowClass, "qt.qpa.windowclass") QWindowsWindowClassRegistry *QWindowsWindowClassRegistry::m_instance = nullptr; -QWindowsWindowClassRegistry::QWindowsWindowClassRegistry(WNDPROC proc) - : m_proc(proc) +QWindowsWindowClassRegistry::QWindowsWindowClassRegistry(WNDPROC defaultProcedure) + : m_defaultProcedure(defaultProcedure) { m_instance = this; } @@ -69,25 +69,19 @@ QString QWindowsWindowClassRegistry::registerWindowClass(const QWindowsWindowCla // add a UUID. The check needs to be performed for each name // in case new message windows are added (QTBUG-81347). // Note: GetClassInfo() returns != 0 when a class exists. - const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr)); - WNDCLASS wcinfo; - const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(className.utf16()), &wcinfo) != FALSE - && wcinfo.lpfnWndProc != description.procedure; - - if (classExists) + if (shouldDecorateWindowClassName(description)) className += QUuid::createUuid().toString(); if (m_registeredWindowClassNames.contains(className)) // already registered in our list return className; - WNDCLASSEX wc; + const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr)); + + WNDCLASSEX wc{}; wc.cbSize = sizeof(WNDCLASSEX); wc.style = description.style; wc.lpfnWndProc = description.procedure; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; wc.hInstance = appInstance; - wc.hCursor = nullptr; wc.hbrBackground = description.brush; if (description.hasIcon) { wc.hIcon = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE)); @@ -98,20 +92,14 @@ QString QWindowsWindowClassRegistry::registerWindowClass(const QWindowsWindowCla } else { wc.hIcon = static_cast<HICON>(LoadImage(nullptr, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED)); - wc.hIconSm = nullptr; } } - else { - wc.hIcon = nullptr; - wc.hIconSm = nullptr; - } - wc.lpszMenuName = nullptr; wc.lpszClassName = reinterpret_cast<LPCWSTR>(className.utf16()); ATOM atom = RegisterClassEx(&wc); if (!atom) - qErrnoWarning("QApplication::regClass: Registering window class '%s' failed.", - qPrintable(className)); + qCWarning(lcQpaWindowClass) << "Failed to register window class" << className + << "(" << qt_error_string(-1) << ")"; m_registeredWindowClassNames.insert(className); @@ -122,7 +110,7 @@ QString QWindowsWindowClassRegistry::registerWindowClass(const QWindowsWindowCla QString QWindowsWindowClassRegistry::registerWindowClass(const QWindow *window) { - return registerWindowClass(QWindowsWindowClassDescription::fromWindow(window, m_proc)); + return registerWindowClass(QWindowsWindowClassDescription::fromWindow(window, m_defaultProcedure)); } QString QWindowsWindowClassRegistry::registerWindowClass(QString name, WNDPROC procedure) @@ -130,13 +118,29 @@ QString QWindowsWindowClassRegistry::registerWindowClass(QString name, WNDPROC p return registerWindowClass(QWindowsWindowClassDescription::fromName(name, procedure)); } +bool QWindowsWindowClassRegistry::shouldDecorateWindowClassName(const QWindowsWindowClassDescription &description) const +{ + return shouldDecorateWindowClassName(description.name, description.procedure); +} + +bool QWindowsWindowClassRegistry::shouldDecorateWindowClassName(const QString &name, WNDPROC procedure) const +{ + const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr)); + + WNDCLASS wc{}; + + return GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(name.utf16()), &wc) != FALSE + && wc.lpfnWndProc != procedure; +} + void QWindowsWindowClassRegistry::unregisterWindowClasses() { const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr)); for (const QString &name : std::as_const(m_registeredWindowClassNames)) { if (!UnregisterClass(reinterpret_cast<LPCWSTR>(name.utf16()), appInstance) && QWindowsContext::verbose) - qErrnoWarning("UnregisterClass failed for '%s'", qPrintable(name)); + qCWarning(lcQpaWindowClass) << "Failed to unregister window class" << name + << "(" << qt_error_string(-1) << ")"; } m_registeredWindowClassNames.clear(); } diff --git a/src/plugins/platforms/windows/qwindowswindowclassregistry.h b/src/plugins/platforms/windows/qwindowswindowclassregistry.h index c19b4f616fb..c4a36b7f3c4 100644 --- a/src/plugins/platforms/windows/qwindowswindowclassregistry.h +++ b/src/plugins/platforms/windows/qwindowswindowclassregistry.h @@ -22,7 +22,7 @@ class QWindowsWindowClassRegistry { Q_DISABLE_COPY_MOVE(QWindowsWindowClassRegistry) public: - QWindowsWindowClassRegistry(WNDPROC proc); + QWindowsWindowClassRegistry(WNDPROC defaultProcedure); ~QWindowsWindowClassRegistry(); static QWindowsWindowClassRegistry *instance(); @@ -34,11 +34,13 @@ public: private: static QString classNamePrefix(); + bool shouldDecorateWindowClassName(const QWindowsWindowClassDescription &description) const; + bool shouldDecorateWindowClassName(const QString &name, WNDPROC procedure) const; void unregisterWindowClasses(); static QWindowsWindowClassRegistry *m_instance; - WNDPROC m_proc; + WNDPROC m_defaultProcedure; QSet<QString> m_registeredWindowClassNames; }; |
