Changeset View
Changeset View
Standalone View
Standalone View
virtualdesktops.h
Show All 15 Lines | |||||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | 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/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #ifndef KWIN_VIRTUAL_DESKTOPS_H | 20 | #ifndef KWIN_VIRTUAL_DESKTOPS_H | ||
21 | #define KWIN_VIRTUAL_DESKTOPS_H | 21 | #define KWIN_VIRTUAL_DESKTOPS_H | ||
22 | // KWin | 22 | // KWin | ||
23 | #include <kwinglobals.h> | 23 | #include <kwinglobals.h> | ||
24 | #include <kwin_export.h> | ||||
24 | // Qt includes | 25 | // Qt includes | ||
25 | #include <QObject> | 26 | #include <QObject> | ||
26 | #include <QPoint> | 27 | #include <QPoint> | ||
27 | #include <QPointer> | 28 | #include <QPointer> | ||
28 | #include <QSize> | 29 | #include <QSize> | ||
29 | // KDE includes | 30 | // KDE includes | ||
30 | #include <KConfig> | 31 | #include <KConfig> | ||
31 | #include <KSharedConfig> | 32 | #include <KSharedConfig> | ||
32 | 33 | | |||
33 | class KLocalizedString; | 34 | class KLocalizedString; | ||
34 | class NETRootInfo; | 35 | class NETRootInfo; | ||
35 | class QAction; | 36 | class QAction; | ||
36 | 37 | | |||
37 | namespace KWin { | 38 | namespace KWin { | ||
38 | 39 | | |||
39 | class VirtualDesktop : public QObject | 40 | class KWIN_EXPORT VirtualDesktop : public QObject | ||
40 | { | 41 | { | ||
41 | Q_OBJECT | 42 | Q_OBJECT | ||
42 | Q_PROPERTY(QByteArray id READ id CONSTANT) | 43 | Q_PROPERTY(QByteArray id READ id CONSTANT) | ||
43 | Q_PROPERTY(uint x11DesktopNumber READ x11DesktopNumber CONSTANT) | 44 | Q_PROPERTY(uint x11DesktopNumber READ x11DesktopNumber CONSTANT) | ||
44 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) | 45 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) | ||
45 | public: | 46 | public: | ||
46 | explicit VirtualDesktop(QObject *parent = nullptr); | 47 | explicit VirtualDesktop(QObject *parent = nullptr); | ||
47 | virtual ~VirtualDesktop(); | 48 | virtual ~VirtualDesktop(); | ||
Show All 10 Lines | |||||
58 | 59 | | |||
59 | void setX11DesktopNumber(uint number); | 60 | void setX11DesktopNumber(uint number); | ||
60 | uint x11DesktopNumber() const { | 61 | uint x11DesktopNumber() const { | ||
61 | return m_x11DesktopNumber; | 62 | return m_x11DesktopNumber; | ||
62 | } | 63 | } | ||
63 | 64 | | |||
64 | Q_SIGNALS: | 65 | Q_SIGNALS: | ||
65 | void nameChanged(); | 66 | void nameChanged(); | ||
67 | /** | ||||
68 | * Emitted just before the desktop gets destroyed. | ||||
69 | **/ | ||||
70 | void aboutToBeDestroyed(); | ||||
66 | 71 | | |||
67 | private: | 72 | private: | ||
68 | QByteArray m_id; | 73 | QByteArray m_id; | ||
69 | QString m_name; | 74 | QString m_name; | ||
70 | int m_x11DesktopNumber = 0; | 75 | int m_x11DesktopNumber = 0; | ||
71 | 76 | | |||
72 | }; | 77 | }; | ||
73 | 78 | | |||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
119 | * itself does not interact with other parts of the system. E.g. it does not hide/show windows of | 124 | * itself does not interact with other parts of the system. E.g. it does not hide/show windows of | ||
120 | * desktop changes. This is outside the scope of this manager. | 125 | * desktop changes. This is outside the scope of this manager. | ||
121 | * | 126 | * | ||
122 | * Internally the manager organizes the virtual desktops in a grid allowing to navigate over the | 127 | * Internally the manager organizes the virtual desktops in a grid allowing to navigate over the | ||
123 | * virtual desktops. For this a set of convenient methods are available which allow to get the id | 128 | * virtual desktops. For this a set of convenient methods are available which allow to get the id | ||
124 | * of an adjacent desktop or to switch to an adjacent desktop. Interested parties should make use of | 129 | * of an adjacent desktop or to switch to an adjacent desktop. Interested parties should make use of | ||
125 | * these methods and not replicate the logic to switch to the next desktop. | 130 | * these methods and not replicate the logic to switch to the next desktop. | ||
126 | **/ | 131 | **/ | ||
127 | class VirtualDesktopManager : public QObject | 132 | class KWIN_EXPORT VirtualDesktopManager : public QObject | ||
128 | { | 133 | { | ||
129 | Q_OBJECT | 134 | Q_OBJECT | ||
130 | /** | 135 | /** | ||
131 | * The number of virtual desktops currently available. | 136 | * The number of virtual desktops currently available. | ||
132 | * The ids of the virtual desktops are in the range [1, VirtualDesktopManager::maximum()]. | 137 | * The ids of the virtual desktops are in the range [1, VirtualDesktopManager::maximum()]. | ||
133 | **/ | 138 | **/ | ||
134 | Q_PROPERTY(uint count READ count WRITE setCount NOTIFY countChanged) | 139 | Q_PROPERTY(uint count READ count WRITE setCount NOTIFY countChanged) | ||
135 | /** | 140 | /** | ||
Show All 22 Lines | 148 | public: | |||
158 | uint count() const; | 163 | uint count() const; | ||
159 | /** | 164 | /** | ||
160 | * @returns The ID of the current desktop. | 165 | * @returns The ID of the current desktop. | ||
161 | * @see setCurrent | 166 | * @see setCurrent | ||
162 | * @see currentChanged | 167 | * @see currentChanged | ||
163 | */ | 168 | */ | ||
164 | uint current() const; | 169 | uint current() const; | ||
165 | /** | 170 | /** | ||
171 | * @returns The current desktop | ||||
172 | * @see setCurrent | ||||
173 | * @see currentChanged | ||||
174 | **/ | ||||
175 | VirtualDesktop *currentDesktop() const; | ||||
176 | /** | ||||
166 | * Moves to the desktop through the algorithm described by Direction. | 177 | * Moves to the desktop through the algorithm described by Direction. | ||
167 | * @param wrap If @c true wraps around to the other side of the layout | 178 | * @param wrap If @c true wraps around to the other side of the layout | ||
168 | * @see setCurrent | 179 | * @see setCurrent | ||
169 | **/ | 180 | **/ | ||
170 | template <typename Direction> | 181 | template <typename Direction> | ||
171 | void moveTo(bool wrap = false); | 182 | void moveTo(bool wrap = false); | ||
172 | 183 | | |||
173 | /** | 184 | /** | ||
▲ Show 20 Lines • Show All 508 Lines • Show Last 20 Lines |