diff options
Diffstat (limited to 'src/gui/kernel/qguiapplication_p.h')
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 63 |
1 files changed, 53 insertions, 10 deletions
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 72a3fc78d0..ac531ef28f 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -34,10 +34,14 @@ # include "private/qshortcutmap_p.h" #endif +#include <QtCore/qpointer.h> + #include <memory> QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcPopup) + class QColorTrcLut; class QPlatformIntegration; class QPlatformTheme; @@ -113,9 +117,11 @@ public: static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e); static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e); - static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e); + static void processFocusWindowEvent(QWindowSystemInterfacePrivate::FocusWindowEvent *e); + static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e); static void processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e); + static void processWindowDevicePixelRatioChangedEvent(QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent *e); static void processSafeAreaMarginsChangedEvent(QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *e); @@ -188,9 +194,15 @@ public: static void showModalWindow(QWindow *window); static void hideModalWindow(QWindow *window); static void updateBlockedStatus(QWindow *window); - virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = nullptr) const; - virtual bool popupActive() { return false; } - virtual bool closeAllPopups() { return false; } + + virtual Qt::WindowModality defaultModality() const; + virtual bool windowNeverBlocked(QWindow *window) const; + bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = nullptr) const; + static qsizetype popupCount() { return QGuiApplicationPrivate::popup_list.size(); } + static QWindow *activePopupWindow(); + static void activatePopup(QWindow *popup); + static bool closePopup(QWindow *popup); + static bool closeAllPopups(); static Qt::MouseButton mousePressButton; static struct QLastCursorPosition { @@ -203,6 +215,28 @@ public: constexpr void reset() noexcept { *this = QLastCursorPosition{}; } + // QGuiApplicationPrivate::lastCursorPosition is used for mouse-move detection + // but even QPointF's qFuzzCompare on doubles is too precise, and causes move-noise + // e.g. on macOS (see QTBUG-111170). So we specialize the equality operators here + // to use single-point precision. + friend constexpr bool operator==(const QLastCursorPosition &p1, const QPointF &p2) noexcept + { + return qFuzzyCompare(float(p1.x()), float(p2.x())) + && qFuzzyCompare(float(p1.y()), float(p2.y())); + } + friend constexpr bool operator!=(const QLastCursorPosition &p1, const QPointF &p2) noexcept + { + return !(p1 == p2); + } + friend constexpr bool operator==(const QPointF &p1, const QLastCursorPosition &p2) noexcept + { + return p2 == p1; + } + friend constexpr bool operator!=(const QPointF &p1, const QLastCursorPosition &p2) noexcept + { + return !(p2 == p1); + } + private: QPointF thePoint; } lastCursorPosition; @@ -229,6 +263,8 @@ public: static QPalette *app_pal; static QWindowList window_list; + static QWindowList popup_list; + static const QWindow *active_popup_on_press; static QWindow *focus_window; #ifndef QT_NO_CURSOR @@ -241,6 +277,7 @@ public: static QString styleOverride; static QStyleHints *styleHints; static bool obey_desktop_settings; + static bool popup_closed_on_press; QInputMethod *inputMethod; QString firstWindowTitle; @@ -294,6 +331,8 @@ public: static void updatePalette(); + static QEvent::Type contextMenuEventType(); + protected: virtual void handleThemeChanged(); @@ -309,6 +348,7 @@ private: static void clearPalette(); friend class QDragManager; + friend class QWindowPrivate; static QGuiApplicationPrivate *self; static int m_fakeMouseSourcePointId; @@ -328,11 +368,12 @@ private: // ----------------- QNativeInterface ----------------- +class QWindowsMimeConverter; + namespace QNativeInterface::Private { -#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC) +#if defined(Q_OS_WIN) || defined(Q_QDOC) -class QWindowsMime; struct Q_GUI_EXPORT QWindowsApplication { @@ -364,18 +405,18 @@ struct Q_GUI_EXPORT QWindowsApplication virtual WindowActivationBehavior windowActivationBehavior() const = 0; virtual void setWindowActivationBehavior(WindowActivationBehavior behavior) = 0; + virtual void setHasBorderInFullScreenDefault(bool border) = 0; + virtual bool isTabletMode() const = 0; virtual bool isWinTabEnabled() const = 0; virtual bool setWinTabEnabled(bool enabled) = 0; - virtual bool isDarkMode() const = 0; - virtual DarkModeHandling darkModeHandling() const = 0; virtual void setDarkModeHandling(DarkModeHandling handling) = 0; - virtual void registerMime(QWindowsMime *mime) = 0; - virtual void unregisterMime(QWindowsMime *mime) = 0; + virtual void registerMime(QWindowsMimeConverter *mime) = 0; + virtual void unregisterMime(QWindowsMimeConverter *mime) = 0; virtual int registerMimeType(const QString &mime) = 0; @@ -388,6 +429,8 @@ struct Q_GUI_EXPORT QWindowsApplication virtual QVariant gpu() const = 0; // internal, used by qtdiag virtual QVariant gpuList() const = 0; + + virtual void populateLightSystemPalette(QPalette &pal) const = 0; }; #endif // Q_OS_WIN |