1 /* 2 KWin - the KDE window manager 3 This file is part of the KDE project. 4 5 SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org> 6 7 SPDX-License-Identifier: GPL-2.0-or-later 8 */ 9 10 #ifndef KWIN_DELETED_H 11 #define KWIN_DELETED_H 12 13 #include "toplevel.h" 14 15 namespace KWin 16 { 17 18 class AbstractClient; 19 20 class KWIN_EXPORT Deleted : public Toplevel 21 { 22 Q_OBJECT 23 24 public: 25 static Deleted* create(Toplevel* c); 26 // used by effects to keep the window around for e.g. fadeout effects when it's destroyed 27 void refWindow(); 28 void unrefWindow(); 29 void discard(); 30 QMargins frameMargins() const override; 31 qreal bufferScale() const override; 32 int desktop() const override; 33 QStringList activities() const override; 34 QVector<VirtualDesktop *> desktops() const override; 35 QPoint clientPos() const override; 36 bool isDeleted() const override; 37 xcb_window_t frameId() const override; 38 void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const; layer()39 Layer layer() const override { 40 return m_layer; 41 } isShade()42 bool isShade() const override { 43 return m_shade; 44 } isMinimized()45 bool isMinimized() const { 46 return m_minimized; 47 } isModal()48 bool isModal() const { 49 return m_modal; 50 } mainClients()51 QList<AbstractClient*> mainClients() const { 52 return m_mainClients; 53 } 54 NET::WindowType windowType(bool direct = false, int supported_types = 0) const override; wasClient()55 bool wasClient() const { 56 return m_wasClient; 57 } 58 QByteArray windowRole() const override; 59 isFullScreen()60 bool isFullScreen() const { 61 return m_fullscreen; 62 } 63 keepAbove()64 bool keepAbove() const { 65 return m_keepAbove; 66 } keepBelow()67 bool keepBelow() const { 68 return m_keepBelow; 69 } caption()70 QString caption() const { 71 return m_caption; 72 } 73 74 /** 75 * Returns whether the client was a popup. 76 * 77 * @returns @c true if the client was a popup, @c false otherwise. 78 */ isPopupWindow()79 bool isPopupWindow() const override { 80 return m_wasPopupWindow; 81 } 82 83 QVector<uint> x11DesktopIds() const; 84 85 /** 86 * Whether this Deleted represents the outline. 87 */ isOutline()88 bool isOutline() const override { 89 return m_wasOutline; 90 } isLockScreen()91 bool isLockScreen() const override { 92 return m_wasLockScreen; 93 } 94 95 private Q_SLOTS: 96 void mainClientClosed(KWin::Toplevel *client); 97 98 private: 99 Deleted(); // use create() 100 void copyToDeleted(Toplevel* c); 101 ~Deleted() override; // deleted only using unrefWindow() 102 103 QMargins m_frameMargins; 104 105 int delete_refcount; 106 int desk; 107 QStringList activityList; 108 QRect contentsRect; // for clientPos()/clientSize() 109 xcb_window_t m_frame; 110 QVector <VirtualDesktop *> m_desktops; 111 112 QRect decoration_left; 113 QRect decoration_right; 114 QRect decoration_top; 115 QRect decoration_bottom; 116 Layer m_layer; 117 bool m_shade; 118 bool m_minimized; 119 bool m_modal; 120 QList<AbstractClient*> m_mainClients; 121 bool m_wasClient; 122 NET::WindowType m_type = NET::Unknown; 123 QByteArray m_windowRole; 124 bool m_fullscreen; 125 bool m_keepAbove; 126 bool m_keepBelow; 127 QString m_caption; 128 bool m_wasPopupWindow; 129 bool m_wasOutline; 130 bool m_wasLockScreen; 131 qreal m_bufferScale = 1; 132 }; 133 refWindow()134inline void Deleted::refWindow() 135 { 136 ++delete_refcount; 137 } 138 139 } // namespace 140 141 Q_DECLARE_METATYPE(KWin::Deleted*) 142 143 #endif 144