Changeset View
Changeset View
Standalone View
Standalone View
toplevel.h
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | |||||
57 | { | 57 | { | ||
58 | 58 | | |||
59 | class ClientMachine; | 59 | class ClientMachine; | ||
60 | class EffectWindowImpl; | 60 | class EffectWindowImpl; | ||
61 | class Shadow; | 61 | class Shadow; | ||
62 | 62 | | |||
63 | /** | 63 | /** | ||
64 | * Enum to describe the reason why a Toplevel has to be released. | 64 | * Enum to describe the reason why a Toplevel has to be released. | ||
65 | */ | 65 | **/ | ||
66 | enum class ReleaseReason { | 66 | enum class ReleaseReason { | ||
67 | Release, ///< Normal Release after e.g. an Unmap notify event (window still valid) | 67 | Release, ///< Normal Release after e.g. an Unmap notify event (window still valid) | ||
68 | Destroyed, ///< Release after an Destroy notify event (window no longer valid) | 68 | Destroyed, ///< Release after an Destroy notify event (window no longer valid) | ||
69 | KWinShutsDown ///< Release on KWin Shutdown (window still valid) | 69 | KWinShutsDown ///< Release on KWin Shutdown (window still valid) | ||
70 | }; | 70 | }; | ||
71 | 71 | | |||
72 | class KWIN_EXPORT Toplevel | 72 | class KWIN_EXPORT Toplevel | ||
73 | : public QObject | 73 | : public QObject | ||
Show All 21 Lines | 74 | { | |||
95 | Q_PROPERTY(QPoint clientPos READ clientPos) | 95 | Q_PROPERTY(QPoint clientPos READ clientPos) | ||
96 | Q_PROPERTY(QSize clientSize READ clientSize) | 96 | Q_PROPERTY(QSize clientSize READ clientSize) | ||
97 | Q_PROPERTY(QByteArray resourceName READ resourceName NOTIFY windowClassChanged) | 97 | Q_PROPERTY(QByteArray resourceName READ resourceName NOTIFY windowClassChanged) | ||
98 | Q_PROPERTY(QByteArray resourceClass READ resourceClass NOTIFY windowClassChanged) | 98 | Q_PROPERTY(QByteArray resourceClass READ resourceClass NOTIFY windowClassChanged) | ||
99 | Q_PROPERTY(QByteArray windowRole READ windowRole NOTIFY windowRoleChanged) | 99 | Q_PROPERTY(QByteArray windowRole READ windowRole NOTIFY windowRoleChanged) | ||
100 | /** | 100 | /** | ||
101 | * Returns whether the window is a desktop background window (the one with wallpaper). | 101 | * Returns whether the window is a desktop background window (the one with wallpaper). | ||
102 | * See _NET_WM_WINDOW_TYPE_DESKTOP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 102 | * See _NET_WM_WINDOW_TYPE_DESKTOP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
103 | */ | 103 | **/ | ||
104 | Q_PROPERTY(bool desktopWindow READ isDesktop) | 104 | Q_PROPERTY(bool desktopWindow READ isDesktop) | ||
105 | /** | 105 | /** | ||
106 | * Returns whether the window is a dock (i.e. a panel). | 106 | * Returns whether the window is a dock (i.e. a panel). | ||
107 | * See _NET_WM_WINDOW_TYPE_DOCK at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 107 | * See _NET_WM_WINDOW_TYPE_DOCK at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
108 | */ | 108 | **/ | ||
109 | Q_PROPERTY(bool dock READ isDock) | 109 | Q_PROPERTY(bool dock READ isDock) | ||
110 | /** | 110 | /** | ||
111 | * Returns whether the window is a standalone (detached) toolbar window. | 111 | * Returns whether the window is a standalone (detached) toolbar window. | ||
112 | * See _NET_WM_WINDOW_TYPE_TOOLBAR at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 112 | * See _NET_WM_WINDOW_TYPE_TOOLBAR at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
113 | */ | 113 | **/ | ||
114 | Q_PROPERTY(bool toolbar READ isToolbar) | 114 | Q_PROPERTY(bool toolbar READ isToolbar) | ||
115 | /** | 115 | /** | ||
116 | * Returns whether the window is a torn-off menu. | 116 | * Returns whether the window is a torn-off menu. | ||
117 | * See _NET_WM_WINDOW_TYPE_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 117 | * See _NET_WM_WINDOW_TYPE_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
118 | */ | 118 | **/ | ||
119 | Q_PROPERTY(bool menu READ isMenu) | 119 | Q_PROPERTY(bool menu READ isMenu) | ||
120 | /** | 120 | /** | ||
121 | * Returns whether the window is a "normal" window, i.e. an application or any other window | 121 | * Returns whether the window is a "normal" window, i.e. an application or any other window | ||
122 | * for which none of the specialized window types fit. | 122 | * for which none of the specialized window types fit. | ||
123 | * See _NET_WM_WINDOW_TYPE_NORMAL at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 123 | * See _NET_WM_WINDOW_TYPE_NORMAL at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
124 | */ | 124 | **/ | ||
125 | Q_PROPERTY(bool normalWindow READ isNormalWindow) | 125 | Q_PROPERTY(bool normalWindow READ isNormalWindow) | ||
126 | /** | 126 | /** | ||
127 | * Returns whether the window is a dialog window. | 127 | * Returns whether the window is a dialog window. | ||
128 | * See _NET_WM_WINDOW_TYPE_DIALOG at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 128 | * See _NET_WM_WINDOW_TYPE_DIALOG at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
129 | */ | 129 | **/ | ||
130 | Q_PROPERTY(bool dialog READ isDialog) | 130 | Q_PROPERTY(bool dialog READ isDialog) | ||
131 | /** | 131 | /** | ||
132 | * Returns whether the window is a splashscreen. Note that many (especially older) applications | 132 | * Returns whether the window is a splashscreen. Note that many (especially older) applications | ||
133 | * do not support marking their splash windows with this type. | 133 | * do not support marking their splash windows with this type. | ||
134 | * See _NET_WM_WINDOW_TYPE_SPLASH at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 134 | * See _NET_WM_WINDOW_TYPE_SPLASH at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
135 | */ | 135 | **/ | ||
136 | Q_PROPERTY(bool splash READ isSplash) | 136 | Q_PROPERTY(bool splash READ isSplash) | ||
137 | /** | 137 | /** | ||
138 | * Returns whether the window is a utility window, such as a tool window. | 138 | * Returns whether the window is a utility window, such as a tool window. | ||
139 | * See _NET_WM_WINDOW_TYPE_UTILITY at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 139 | * See _NET_WM_WINDOW_TYPE_UTILITY at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
140 | */ | 140 | **/ | ||
141 | Q_PROPERTY(bool utility READ isUtility) | 141 | Q_PROPERTY(bool utility READ isUtility) | ||
142 | /** | 142 | /** | ||
143 | * Returns whether the window is a dropdown menu (i.e. a popup directly or indirectly open | 143 | * Returns whether the window is a dropdown menu (i.e. a popup directly or indirectly open | ||
144 | * from the applications menubar). | 144 | * from the applications menubar). | ||
145 | * See _NET_WM_WINDOW_TYPE_DROPDOWN_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 145 | * See _NET_WM_WINDOW_TYPE_DROPDOWN_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
146 | */ | 146 | **/ | ||
147 | Q_PROPERTY(bool dropdownMenu READ isDropdownMenu) | 147 | Q_PROPERTY(bool dropdownMenu READ isDropdownMenu) | ||
148 | /** | 148 | /** | ||
149 | * Returns whether the window is a popup menu (that is not a torn-off or dropdown menu). | 149 | * Returns whether the window is a popup menu (that is not a torn-off or dropdown menu). | ||
150 | * See _NET_WM_WINDOW_TYPE_POPUP_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 150 | * See _NET_WM_WINDOW_TYPE_POPUP_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
151 | */ | 151 | **/ | ||
152 | Q_PROPERTY(bool popupMenu READ isPopupMenu) | 152 | Q_PROPERTY(bool popupMenu READ isPopupMenu) | ||
153 | /** | 153 | /** | ||
154 | * Returns whether the window is a tooltip. | 154 | * Returns whether the window is a tooltip. | ||
155 | * See _NET_WM_WINDOW_TYPE_TOOLTIP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 155 | * See _NET_WM_WINDOW_TYPE_TOOLTIP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
156 | */ | 156 | **/ | ||
157 | Q_PROPERTY(bool tooltip READ isTooltip) | 157 | Q_PROPERTY(bool tooltip READ isTooltip) | ||
158 | /** | 158 | /** | ||
159 | * Returns whether the window is a window with a notification. | 159 | * Returns whether the window is a window with a notification. | ||
160 | * See _NET_WM_WINDOW_TYPE_NOTIFICATION at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 160 | * See _NET_WM_WINDOW_TYPE_NOTIFICATION at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
161 | */ | 161 | **/ | ||
162 | Q_PROPERTY(bool notification READ isNotification) | 162 | Q_PROPERTY(bool notification READ isNotification) | ||
163 | /** | 163 | /** | ||
164 | * Returns whether the window is an On Screen Display. | 164 | * Returns whether the window is an On Screen Display. | ||
165 | */ | 165 | **/ | ||
166 | Q_PROPERTY(bool onScreenDisplay READ isOnScreenDisplay) | 166 | Q_PROPERTY(bool onScreenDisplay READ isOnScreenDisplay) | ||
167 | /** | 167 | /** | ||
168 | * Returns whether the window is a combobox popup. | 168 | * Returns whether the window is a combobox popup. | ||
169 | * See _NET_WM_WINDOW_TYPE_COMBO at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 169 | * See _NET_WM_WINDOW_TYPE_COMBO at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
170 | */ | 170 | **/ | ||
171 | Q_PROPERTY(bool comboBox READ isComboBox) | 171 | Q_PROPERTY(bool comboBox READ isComboBox) | ||
172 | /** | 172 | /** | ||
173 | * Returns whether the window is a Drag&Drop icon. | 173 | * Returns whether the window is a Drag&Drop icon. | ||
174 | * See _NET_WM_WINDOW_TYPE_DND at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 174 | * See _NET_WM_WINDOW_TYPE_DND at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
175 | */ | 175 | **/ | ||
176 | Q_PROPERTY(bool dndIcon READ isDNDIcon) | 176 | Q_PROPERTY(bool dndIcon READ isDNDIcon) | ||
177 | /** | 177 | /** | ||
178 | * Returns the NETWM window type | 178 | * Returns the NETWM window type | ||
179 | * See http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | 179 | * See http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . | ||
180 | */ | 180 | **/ | ||
181 | Q_PROPERTY(int windowType READ windowType) | 181 | Q_PROPERTY(int windowType READ windowType) | ||
182 | Q_PROPERTY(QStringList activities READ activities NOTIFY activitiesChanged) | 182 | Q_PROPERTY(QStringList activities READ activities NOTIFY activitiesChanged) | ||
183 | /** | 183 | /** | ||
184 | * Whether this Toplevel is managed by KWin (it has control over its placement and other | 184 | * Whether this Toplevel is managed by KWin (it has control over its placement and other | ||
185 | * aspects, as opposed to override-redirect windows that are entirely handled by the application). | 185 | * aspects, as opposed to override-redirect windows that are entirely handled by the application). | ||
186 | **/ | 186 | **/ | ||
187 | Q_PROPERTY(bool managed READ isClient CONSTANT) | 187 | Q_PROPERTY(bool managed READ isClient CONSTANT) | ||
188 | /** | 188 | /** | ||
Show All 14 Lines | |||||
203 | * The Id of the Wayland Surface associated with this Toplevel. | 203 | * The Id of the Wayland Surface associated with this Toplevel. | ||
204 | * On X11 only setups the value is @c 0. | 204 | * On X11 only setups the value is @c 0. | ||
205 | **/ | 205 | **/ | ||
206 | Q_PROPERTY(quint32 surfaceId READ surfaceId NOTIFY surfaceIdChanged) | 206 | Q_PROPERTY(quint32 surfaceId READ surfaceId NOTIFY surfaceIdChanged) | ||
207 | 207 | | |||
208 | /** | 208 | /** | ||
209 | * Interface to the Wayland Surface. | 209 | * Interface to the Wayland Surface. | ||
210 | * Relevant only in Wayland, in X11 it will be nullptr | 210 | * Relevant only in Wayland, in X11 it will be nullptr | ||
211 | */ | 211 | **/ | ||
212 | Q_PROPERTY(KWayland::Server::SurfaceInterface *surface READ surface) | 212 | Q_PROPERTY(KWayland::Server::SurfaceInterface *surface READ surface) | ||
213 | 213 | | |||
214 | /** | 214 | /** | ||
215 | * Whether the window is a popup. | 215 | * Whether the window is a popup. | ||
216 | **/ | 216 | **/ | ||
217 | Q_PROPERTY(bool popupWindow READ isPopupWindow) | 217 | Q_PROPERTY(bool popupWindow READ isPopupWindow) | ||
218 | 218 | | |||
219 | public: | 219 | public: | ||
Show All 21 Lines | |||||
241 | int height() const; | 241 | int height() const; | ||
242 | bool isOnScreen(int screen) const; // true if it's at least partially there | 242 | bool isOnScreen(int screen) const; // true if it's at least partially there | ||
243 | bool isOnActiveScreen() const; | 243 | bool isOnActiveScreen() const; | ||
244 | int screen() const; // the screen where the center is | 244 | int screen() const; // the screen where the center is | ||
245 | /** | 245 | /** | ||
246 | * The scale of the screen this window is currently on | 246 | * The scale of the screen this window is currently on | ||
247 | * @note The buffer scale can be different. | 247 | * @note The buffer scale can be different. | ||
248 | * @since 5.12 | 248 | * @since 5.12 | ||
249 | */ | 249 | **/ | ||
250 | qreal screenScale() const; // | 250 | qreal screenScale() const; // | ||
251 | virtual QPoint clientPos() const = 0; // inside of geometry() | 251 | virtual QPoint clientPos() const = 0; // inside of geometry() | ||
252 | /** | 252 | /** | ||
253 | * Describes how the client's content maps to the window geometry including the frame. | 253 | * Describes how the client's content maps to the window geometry including the frame. | ||
254 | * The default implementation is a 1:1 mapping meaning the frame is part of the content. | 254 | * The default implementation is a 1:1 mapping meaning the frame is part of the content. | ||
255 | **/ | 255 | **/ | ||
256 | virtual QPoint clientContentPos() const; | 256 | virtual QPoint clientContentPos() const; | ||
257 | virtual QSize clientSize() const = 0; | 257 | virtual QSize clientSize() const = 0; | ||
Show All 26 Lines | |||||
284 | virtual bool isLockScreen() const; | 284 | virtual bool isLockScreen() const; | ||
285 | virtual bool isInputMethod() const; | 285 | virtual bool isInputMethod() const; | ||
286 | 286 | | |||
287 | /** | 287 | /** | ||
288 | * Returns the virtual desktop within the workspace() the client window | 288 | * Returns the virtual desktop within the workspace() the client window | ||
289 | * is located in, 0 if it isn't located on any special desktop (not mapped yet), | 289 | * is located in, 0 if it isn't located on any special desktop (not mapped yet), | ||
290 | * or NET::OnAllDesktops. Do not use desktop() directly, use | 290 | * or NET::OnAllDesktops. Do not use desktop() directly, use | ||
291 | * isOnDesktop() instead. | 291 | * isOnDesktop() instead. | ||
292 | */ | 292 | **/ | ||
293 | virtual int desktop() const = 0; | 293 | virtual int desktop() const = 0; | ||
294 | virtual QVector<VirtualDesktop *> desktops() const = 0; | 294 | virtual QVector<VirtualDesktop *> desktops() const = 0; | ||
295 | virtual QStringList activities() const = 0; | 295 | virtual QStringList activities() const = 0; | ||
296 | bool isOnDesktop(int d) const; | 296 | bool isOnDesktop(int d) const; | ||
297 | bool isOnActivity(const QString &activity) const; | 297 | bool isOnActivity(const QString &activity) const; | ||
298 | bool isOnCurrentDesktop() const; | 298 | bool isOnCurrentDesktop() const; | ||
299 | bool isOnCurrentActivity() const; | 299 | bool isOnCurrentActivity() const; | ||
300 | bool isOnAllDesktops() const; | 300 | bool isOnAllDesktops() const; | ||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | |||||
380 | virtual Layer layer() const = 0; | 380 | virtual Layer layer() const = 0; | ||
381 | 381 | | |||
382 | /** | 382 | /** | ||
383 | * Resets the damage state and sends a request for the damage region. | 383 | * Resets the damage state and sends a request for the damage region. | ||
384 | * A call to this function must be followed by a call to getDamageRegionReply(), | 384 | * A call to this function must be followed by a call to getDamageRegionReply(), | ||
385 | * or the reply will be leaked. | 385 | * or the reply will be leaked. | ||
386 | * | 386 | * | ||
387 | * Returns true if the window was damaged, and false otherwise. | 387 | * Returns true if the window was damaged, and false otherwise. | ||
388 | */ | 388 | **/ | ||
389 | bool resetAndFetchDamage(); | 389 | bool resetAndFetchDamage(); | ||
390 | 390 | | |||
391 | /** | 391 | /** | ||
392 | * Gets the reply from a previous call to resetAndFetchDamage(). | 392 | * Gets the reply from a previous call to resetAndFetchDamage(). | ||
393 | * Calling this function is a no-op if there is no pending reply. | 393 | * Calling this function is a no-op if there is no pending reply. | ||
394 | * Call damage() to return the fetched region. | 394 | * Call damage() to return the fetched region. | ||
395 | */ | 395 | **/ | ||
396 | void getDamageRegionReply(); | 396 | void getDamageRegionReply(); | ||
397 | 397 | | |||
398 | bool skipsCloseAnimation() const; | 398 | bool skipsCloseAnimation() const; | ||
399 | void setSkipCloseAnimation(bool set); | 399 | void setSkipCloseAnimation(bool set); | ||
400 | 400 | | |||
401 | quint32 surfaceId() const; | 401 | quint32 surfaceId() const; | ||
402 | KWayland::Server::SurfaceInterface *surface() const; | 402 | KWayland::Server::SurfaceInterface *surface() const; | ||
403 | void setSurface(KWayland::Server::SurfaceInterface *surface); | 403 | void setSurface(KWayland::Server::SurfaceInterface *surface); | ||
Show All 38 Lines | |||||
442 | /** | 442 | /** | ||
443 | * @brief Finds the Toplevel matching the condition expressed in @p func in @p list. | 443 | * @brief Finds the Toplevel matching the condition expressed in @p func in @p list. | ||
444 | * | 444 | * | ||
445 | * The method is templated to operate on either a list of Toplevels or on a list of | 445 | * The method is templated to operate on either a list of Toplevels or on a list of | ||
446 | * a subclass type of Toplevel. | 446 | * a subclass type of Toplevel. | ||
447 | * @param list The list to search in | 447 | * @param list The list to search in | ||
448 | * @param func The condition function (compare std::find_if) | 448 | * @param func The condition function (compare std::find_if) | ||
449 | * @return T* The found Toplevel or @c null if there is no matching Toplevel | 449 | * @return T* The found Toplevel or @c null if there is no matching Toplevel | ||
450 | */ | 450 | **/ | ||
451 | template <class T, class U> | 451 | template <class T, class U> | ||
452 | static T *findInList(const QList<T*> &list, std::function<bool (const U*)> func); | 452 | static T *findInList(const QList<T*> &list, std::function<bool (const U*)> func); | ||
453 | 453 | | |||
454 | /** | 454 | /** | ||
455 | * Whether the window is a popup. | 455 | * Whether the window is a popup. | ||
456 | * | 456 | * | ||
457 | * Popups can be used to implement popup menus, tooltips, combo boxes, etc. | 457 | * Popups can be used to implement popup menus, tooltips, combo boxes, etc. | ||
458 | * | 458 | * | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 471 | Q_SIGNALS: | |||
520 | * Emitted whenever the Surface for this Toplevel changes. | 520 | * Emitted whenever the Surface for this Toplevel changes. | ||
521 | **/ | 521 | **/ | ||
522 | void surfaceChanged(); | 522 | void surfaceChanged(); | ||
523 | 523 | | |||
524 | /* | 524 | /* | ||
525 | * Emitted when the client's screen changes onto a screen of a different scale | 525 | * Emitted when the client's screen changes onto a screen of a different scale | ||
526 | * or the screen we're on changes | 526 | * or the screen we're on changes | ||
527 | * @since 5.12 | 527 | * @since 5.12 | ||
528 | */ | 528 | **/ | ||
529 | void screenScaleChanged(); | 529 | void screenScaleChanged(); | ||
530 | 530 | | |||
531 | /** | 531 | /** | ||
532 | * Emitted whenever the client's shadow changes. | 532 | * Emitted whenever the client's shadow changes. | ||
533 | * @since 5.15 | 533 | * @since 5.15 | ||
534 | **/ | 534 | **/ | ||
535 | void shadowChanged(); | 535 | void shadowChanged(); | ||
536 | 536 | | |||
▲ Show 20 Lines • Show All 374 Lines • Show Last 20 Lines |