Changeset View
Changeset View
Standalone View
Standalone View
internal_client.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) 2019 Martin Flöser <mgraesslin@kde.org> | 5 | Copyright (C) 2019 Martin Flöser <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 | #pragma once | 21 | #pragma once | ||
21 | 22 | | |||
22 | #include "shell_client.h" | 23 | #include "abstract_client.h" | ||
23 | | ||||
24 | 24 | | |||
25 | namespace KWin | 25 | namespace KWin | ||
26 | { | 26 | { | ||
27 | 27 | | |||
28 | class KWIN_EXPORT InternalClient : public ShellClient | 28 | class KWIN_EXPORT InternalClient : public AbstractClient | ||
29 | { | 29 | { | ||
30 | Q_OBJECT | 30 | Q_OBJECT | ||
31 | | ||||
31 | public: | 32 | public: | ||
32 | InternalClient(KWayland::Server::ShellSurfaceInterface *surface); | 33 | explicit InternalClient(QWindow *window); | ||
33 | // needed for template <class T> void WaylandServer::createSurface(T *surface) | | |||
34 | InternalClient(KWayland::Server::XdgShellSurfaceInterface *surface); | | |||
35 | // needed for template <class T> void WaylandServer::createSurface(T *surface) | | |||
36 | InternalClient(KWayland::Server::XdgShellPopupInterface *surface); | | |||
37 | ~InternalClient() override; | 34 | ~InternalClient() override; | ||
38 | 35 | | |||
39 | bool eventFilter(QObject *watched, QEvent *event) override; | 36 | bool eventFilter(QObject *watched, QEvent *event) override; | ||
40 | 37 | | |||
38 | QStringList activities() const override; | ||||
39 | void blockActivityUpdates(bool b = true) override; | ||||
40 | qreal bufferScale() const override; | ||||
41 | QString captionNormal() const override; | ||||
42 | QString captionSuffix() const override; | ||||
43 | QPoint clientContentPos() const override; | ||||
44 | QSize clientSize() const override; | ||||
45 | void debug(QDebug &stream) const override; | ||||
46 | QRect transparentRect() const override; | ||||
41 | NET::WindowType windowType(bool direct = false, int supported_types = 0) const override; | 47 | NET::WindowType windowType(bool direct = false, int supported_types = 0) const override; | ||
48 | double opacity() const override; | ||||
49 | void setOpacity(double opacity) override; | ||||
42 | void killWindow() override; | 50 | void killWindow() override; | ||
43 | bool isPopupWindow() const override; | 51 | bool isPopupWindow() const override; | ||
44 | void setInternalFramebufferObject(const QSharedPointer<QOpenGLFramebufferObject> &fbo) override; | 52 | QByteArray windowRole() const override; | ||
45 | void closeWindow() override; | 53 | void closeWindow() override; | ||
46 | bool isCloseable() const override; | 54 | bool isCloseable() const override; | ||
55 | bool isFullScreenable() const override; | ||||
56 | bool isFullScreen() const override; | ||||
47 | bool isMaximizable() const override; | 57 | bool isMaximizable() const override; | ||
48 | bool isMinimizable() const override; | 58 | bool isMinimizable() const override; | ||
49 | bool isMovable() const override; | 59 | bool isMovable() const override; | ||
50 | bool isMovableAcrossScreens() const override; | 60 | bool isMovableAcrossScreens() const override; | ||
51 | bool isResizable() const override; | 61 | bool isResizable() const override; | ||
52 | bool noBorder() const override; | 62 | bool noBorder() const override; | ||
53 | bool userCanSetNoBorder() const override; | 63 | bool userCanSetNoBorder() const override; | ||
54 | bool wantsInput() const override; | 64 | bool wantsInput() const override; | ||
55 | bool isInternal() const override; | 65 | bool isInternal() const override; | ||
56 | bool isLockScreen() const override; | 66 | bool isLockScreen() const override; | ||
57 | bool isInputMethod() const override; | 67 | bool isInputMethod() const override; | ||
58 | bool isOutline() const override; | 68 | bool isOutline() const override; | ||
59 | quint32 windowId() const override; | 69 | quint32 windowId() const override; | ||
70 | MaximizeMode maximizeMode() const override; | ||||
71 | QRect geometryRestore() const override; | ||||
72 | bool isShown(bool shaded_is_shown) const override; | ||||
73 | bool isHiddenInternal() const override; | ||||
74 | void hideClient(bool hide) override; | ||||
60 | using AbstractClient::resizeWithChecks; | 75 | using AbstractClient::resizeWithChecks; | ||
61 | void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override; | 76 | void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override; | ||
62 | QWindow *internalWindow() const override; | 77 | using AbstractClient::setGeometry; | ||
78 | void setGeometry(int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet) override; | ||||
79 | void setGeometryRestore(const QRect &rect) override; | ||||
63 | bool supportsWindowRules() const override; | 80 | bool supportsWindowRules() const override; | ||
81 | AbstractClient *findModal(bool allow_itself = false) override; | ||||
82 | void setOnAllActivities(bool set) override; | ||||
83 | void takeFocus() override; | ||||
84 | bool userCanSetFullScreen() const override; | ||||
85 | void setFullScreen(bool set, bool user = true) override; | ||||
86 | void setNoBorder(bool set) override; | ||||
87 | void updateDecoration(bool check_workspace_pos, bool force = false) override; | ||||
88 | void updateColorScheme() override; | ||||
89 | void showOnScreenEdge() override; | ||||
90 | | ||||
91 | void destroyClient(); | ||||
92 | void present(const QSharedPointer<QOpenGLFramebufferObject> fbo); | ||||
93 | void present(const QImage &image, const QRegion &damage); | ||||
94 | QWindow *internalWindow() const; | ||||
64 | 95 | | |||
65 | protected: | 96 | protected: | ||
66 | bool acceptsFocus() const override; | 97 | bool acceptsFocus() const override; | ||
98 | bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override; | ||||
99 | void changeMaximize(bool horizontal, bool vertical, bool adjust) override; | ||||
100 | void destroyDecoration() override; | ||||
67 | void doMove(int x, int y) override; | 101 | void doMove(int x, int y) override; | ||
68 | void doResizeSync() override; | 102 | void doResizeSync() override; | ||
69 | bool requestGeometry(const QRect &rect) override; | 103 | void updateCaption() override; | ||
70 | void doSetGeometry(const QRect &rect) override; | | |||
71 | 104 | | |||
72 | private: | 105 | private: | ||
73 | void findInternalWindow(); | 106 | QRect mapFromClient(const QRect &rect) const; | ||
74 | void updateInternalWindowGeometry(); | 107 | QRect mapToClient(const QRect &rect) const; | ||
108 | void createDecoration(const QRect &rect); | ||||
109 | void requestGeometry(const QRect &rect); | ||||
110 | void commitGeometry(const QRect &rect); | ||||
111 | void setCaption(const QString &caption); | ||||
112 | void markAsMapped(); | ||||
75 | void syncGeometryToInternalWindow(); | 113 | void syncGeometryToInternalWindow(); | ||
114 | void updateInternalWindowGeometry(); | ||||
76 | 115 | | |||
116 | QWindow *m_internalWindow = nullptr; | ||||
117 | QRect m_maximizeRestoreGeometry; | ||||
118 | QSize m_clientSize = QSize(0, 0); | ||||
119 | QString m_captionNormal; | ||||
120 | QString m_captionSuffix; | ||||
121 | double m_opacity = 1.0; | ||||
77 | NET::WindowType m_windowType = NET::Normal; | 122 | NET::WindowType m_windowType = NET::Normal; | ||
78 | quint32 m_windowId = 0; | 123 | quint32 m_windowId = 0; | ||
79 | QWindow *m_internalWindow = nullptr; | | |||
80 | Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags(); | 124 | Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags(); | ||
125 | bool m_userNoBorder = false; | ||||
126 | | ||||
127 | Q_DISABLE_COPY(InternalClient) | ||||
81 | }; | 128 | }; | ||
82 | 129 | | |||
83 | } | 130 | } |