Changeset View
Changeset View
Standalone View
Standalone View
plugins/qpa/window.h
1 | /******************************************************************** | 1 | /******************************************************************** | ||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | 2 | KWin - the KDE window manager | ||
3 | This file is part of the KDE project. | 3 | This file is part of the KDE project. | ||
4 | 4 | | |||
5 | Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org> | 5 | Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org> | ||
6 | Copyright (C) 2019 Vlad Zagorodniy <vladzzag@gmail.com> | ||||
6 | 7 | | |||
7 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | 11 | (at your option) any later version. | ||
11 | 12 | | |||
12 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 16 | GNU General Public License for more details. | ||
16 | 17 | | |||
17 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 20 | *********************************************************************/ | ||
20 | #ifndef KWIN_QPA_WINDOW_H | 21 | #ifndef KWIN_QPA_WINDOW_H | ||
21 | #define KWIN_QPA_WINDOW_H | 22 | #define KWIN_QPA_WINDOW_H | ||
22 | 23 | | |||
23 | #include <epoxy/egl.h> | | |||
24 | #include "fixqopengl.h" | | |||
25 | | ||||
26 | #include <fixx11h.h> | | |||
27 | #include <qpa/qplatformwindow.h> | 24 | #include <qpa/qplatformwindow.h> | ||
28 | 25 | | |||
29 | class QOpenGLFramebufferObject; | 26 | class QOpenGLFramebufferObject; | ||
30 | 27 | | |||
31 | | ||||
32 | namespace KWayland | | |||
33 | { | | |||
34 | namespace Client | | |||
35 | { | | |||
36 | class Surface; | | |||
37 | class ShellSurface; | | |||
38 | } | | |||
39 | } | | |||
40 | | ||||
41 | namespace KWin | 28 | namespace KWin | ||
42 | { | 29 | { | ||
43 | 30 | | |||
44 | class ShellClient; | 31 | class InternalClient; | ||
45 | 32 | | |||
46 | namespace QPA | 33 | namespace QPA | ||
47 | { | 34 | { | ||
48 | 35 | | |||
49 | class Integration; | | |||
50 | | ||||
51 | class Window : public QPlatformWindow | 36 | class Window : public QPlatformWindow | ||
52 | { | 37 | { | ||
53 | public: | 38 | public: | ||
54 | explicit Window(QWindow *window, KWayland::Client::Surface *surface, KWayland::Client::ShellSurface *shellSurface, const Integration *integration); | 39 | explicit Window(QWindow *window); | ||
55 | ~Window() override; | 40 | ~Window() override; | ||
56 | 41 | | |||
57 | void setVisible(bool visible) override; | 42 | void setVisible(bool visible) override; | ||
58 | void setGeometry(const QRect &rect) override; | 43 | void setGeometry(const QRect &rect) override; | ||
59 | WId winId() const override; | 44 | WId winId() const override; | ||
60 | | ||||
61 | KWayland::Client::Surface *surface() const { | | |||
62 | return m_surface; | | |||
63 | } | | |||
64 | | ||||
65 | int scale() const; | | |||
66 | qreal devicePixelRatio() const override; | 45 | qreal devicePixelRatio() const override; | ||
67 | 46 | | |||
68 | void bindContentFBO(); | 47 | void bindContentFBO(); | ||
69 | const QSharedPointer<QOpenGLFramebufferObject> &contentFBO() const { | 48 | const QSharedPointer<QOpenGLFramebufferObject> &contentFBO() const; | ||
70 | return m_contentFBO; | | |||
71 | } | | |||
72 | QSharedPointer<QOpenGLFramebufferObject> swapFBO(); | 49 | QSharedPointer<QOpenGLFramebufferObject> swapFBO(); | ||
73 | ShellClient *shellClient(); | 50 | | ||
51 | InternalClient *client() const; | ||||
74 | 52 | | |||
75 | private: | 53 | private: | ||
76 | void unmap(); | | |||
77 | void createFBO(); | 54 | void createFBO(); | ||
55 | void map(); | ||||
56 | void unmap(); | ||||
78 | 57 | | |||
79 | KWayland::Client::Surface *m_surface; | 58 | InternalClient *m_handle = nullptr; | ||
80 | KWayland::Client::ShellSurface *m_shellSurface; | | |||
81 | QSharedPointer<QOpenGLFramebufferObject> m_contentFBO; | 59 | QSharedPointer<QOpenGLFramebufferObject> m_contentFBO; | ||
82 | bool m_resized = false; | | |||
83 | ShellClient *m_shellClient = nullptr; | | |||
84 | quint32 m_windowId; | 60 | quint32 m_windowId; | ||
85 | const Integration *m_integration; | 61 | bool m_resized = false; | ||
86 | int m_scale = 1; | 62 | int m_scale = 1; | ||
87 | }; | 63 | }; | ||
88 | 64 | | |||
89 | } | 65 | } | ||
90 | } | 66 | } | ||
91 | 67 | | |||
92 | #endif | 68 | #endif |