File indexing completed on 2024-11-10 04:57:06
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org> 0006 SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org> 0007 0008 SPDX-License-Identifier: GPL-2.0-or-later 0009 */ 0010 #pragma once 0011 0012 #include <QPointer> 0013 #include <qpa/qplatformwindow.h> 0014 0015 namespace KWin 0016 { 0017 0018 class InternalWindow; 0019 0020 namespace QPA 0021 { 0022 0023 class Swapchain; 0024 0025 class Window : public QPlatformWindow 0026 { 0027 public: 0028 explicit Window(QWindow *window); 0029 ~Window() override; 0030 0031 void invalidateSurface() override; 0032 QSurfaceFormat format() const override; 0033 void setVisible(bool visible) override; 0034 void setGeometry(const QRect &rect) override; 0035 WId winId() const override; 0036 qreal devicePixelRatio() const override; 0037 void requestActivateWindow() override; 0038 0039 InternalWindow *internalWindow() const; 0040 Swapchain *swapchain(const QHash<uint32_t, QList<uint64_t>> &formats); 0041 0042 private: 0043 void map(); 0044 void unmap(); 0045 0046 QSurfaceFormat m_format; 0047 QPointer<InternalWindow> m_handle; 0048 std::unique_ptr<Swapchain> m_swapchain; 0049 quint32 m_windowId; 0050 qreal m_scale = 1; 0051 }; 0052 0053 } 0054 }