diff options
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.h')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.h | 96 |
1 files changed, 38 insertions, 58 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index d6f370eebe..0c047d569b 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -1,46 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QXCBWINDOW_H #define QXCBWINDOW_H #include <qpa/qplatformwindow.h> +#include <qpa/qplatformwindow_p.h> +#include <QtCore/QObject> +#include <QtCore/QPointer> #include <QtGui/QSurfaceFormat> #include <QtGui/QImage> @@ -49,16 +16,16 @@ #include "qxcbobject.h" -#include <QtPlatformHeaders/qxcbwindowfunctions.h> - QT_BEGIN_NAMESPACE class QXcbScreen; class QXcbSyncWindowRequest; class QIcon; -class Q_XCB_EXPORT QXcbWindow : public QXcbObject, public QXcbWindowEventListener, public QPlatformWindow +class Q_XCB_EXPORT QXcbWindow : public QObject, public QXcbObject, public QXcbWindowEventListener, public QPlatformWindow + , public QNativeInterface::Private::QXcbWindow { + Q_OBJECT public: enum NetWmState { NetWmStateAbove = 0x1, @@ -68,11 +35,19 @@ public: NetWmStateMaximizedVert = 0x10, NetWmStateModal = 0x20, NetWmStateStaysOnTop = 0x40, - NetWmStateDemandsAttention = 0x80 + NetWmStateDemandsAttention = 0x80, + NetWmStateHidden = 0x100 }; Q_DECLARE_FLAGS(NetWmStates, NetWmState) + enum RecreationReason { + RecreationNotNeeded = 0, + WindowStaysOnTopHintChanged = 0x1, + WindowStaysOnBottomHintChanged = 0x2 + }; + Q_DECLARE_FLAGS(RecreationReasons, RecreationReason) + QXcbWindow(QWindow *window); ~QXcbWindow(); @@ -92,7 +67,7 @@ public: QPoint mapFromGlobal(const QPoint &pos) const override; void setWindowTitle(const QString &title) override; - void setWindowIconText(const QString &title); + void setWindowIconText(const QString &title) override; void setWindowIcon(const QIcon &icon) override; void raise() override; void lower() override; @@ -146,20 +121,17 @@ public: Qt::KeyboardModifiers modifiers, QEvent::Type type, Qt::MouseEventSource source); void updateNetWmUserTime(xcb_timestamp_t timestamp); + void updateWmTransientFor(); + void registerWmTransientForChild(QXcbWindow *); - static void setWmWindowTypeStatic(QWindow *window, QXcbWindowFunctions::WmWindowTypes windowTypes); - static void setWmWindowRoleStatic(QWindow *window, const QByteArray &role); - static uint visualIdStatic(QWindow *window); - - QXcbWindowFunctions::WmWindowTypes wmWindowTypes() const; - void setWmWindowType(QXcbWindowFunctions::WmWindowTypes types, Qt::WindowFlags flags); - void setWmWindowRole(const QByteArray &role); - - static void setWindowIconTextStatic(QWindow *window, const QString &text); + WindowTypes wmWindowTypes() const; + void setWmWindowType(WindowTypes types, Qt::WindowFlags flags); + void setWindowType(WindowTypes windowTypes) override { setWmWindowType(windowTypes, window()->flags()); } + void setWindowRole(const QString &role) override; void setParentRelativeBackPixmap(); bool requestSystemTrayWindowDock(); - uint visualId() const; + uint visualId() const override; bool needsSync() const; @@ -168,12 +140,15 @@ public: QXcbScreen *xcbScreen() const; + QPoint lastPointerPosition() const { return m_lastPointerPosition; } + QPoint lastPointerGlobalPosition() const { return m_lastPointerGlobalPosition; } + bool startSystemMoveResize(const QPoint &pos, int edges); void doStartSystemMoveResize(const QPoint &globalPos, int edges); static bool isTrayIconWindow(QWindow *window) { - return window->objectName() == QLatin1String("QSystemTrayIconSysWindow"); + return window->objectName() == QLatin1StringView("QSystemTrayIconSysWindow"); } virtual void create(); @@ -237,7 +212,6 @@ protected: quint8 mode, quint8 detail, xcb_timestamp_t timestamp); xcb_window_t m_window = 0; - xcb_colormap_t m_cmap = 0; uint m_depth = 0; QImage::Format m_imageFormat = QImage::Format_ARGB32_Premultiplied; @@ -248,6 +222,7 @@ protected: Qt::WindowStates m_windowState = Qt::WindowNoState; + QMutex m_mappedMutex; bool m_mapped = false; bool m_transparent = false; bool m_deferredActivation = false; @@ -255,6 +230,7 @@ protected: bool m_alertState = false; bool m_minimized = false; bool m_trayIconWindow = false; + bool m_ignorePressedWindowOnMouseLeave = false; xcb_window_t m_netWmUserTimeWindow = XCB_NONE; QSurfaceFormat m_format; @@ -265,6 +241,7 @@ protected: QRegion m_exposeRegion; QSize m_oldWindowSize; QPoint m_lastPointerPosition; + QPoint m_lastPointerGlobalPosition; xcb_visualid_t m_visualId = 0; // Last sent state. Initialized to an invalid state, on purpose. @@ -281,13 +258,16 @@ protected: int m_swapInterval = -1; qreal m_sizeHintsScaleFactor = 1.0; + + RecreationReasons m_recreationReasons = RecreationNotNeeded; + + QList<QPointer<QXcbWindow>> m_wmTransientForChildren; }; class QXcbForeignWindow : public QXcbWindow { public: - QXcbForeignWindow(QWindow *window, WId nativeHandle) - : QXcbWindow(window) { m_window = nativeHandle; } + QXcbForeignWindow(QWindow *window, WId nativeHandle); ~QXcbForeignWindow(); bool isForeignWindow() const override { return true; } @@ -295,7 +275,7 @@ protected: void create() override {} // No-op }; -QVector<xcb_rectangle_t> qRegionToXcbRectangleList(const QRegion ®ion); +QList<xcb_rectangle_t> qRegionToXcbRectangleList(const QRegion ®ion); QT_END_NAMESPACE |