1 | /* |
2 | SPDX-FileCopyrightText: 2000 Troll Tech AS |
3 | SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org> |
4 | SPDX-FileCopyrightText: Bradley T. Hughes <bhughes@trolltech.com> |
5 | |
6 | SPDX-License-Identifier: MIT |
7 | */ |
8 | |
9 | #ifndef netwm_def_h |
10 | #define netwm_def_h |
11 | #include <QFlags> |
12 | #include <QRect> |
13 | #include <kwindowsystem_export.h> |
14 | |
15 | /*! |
16 | \class NETPoint |
17 | \inmodule KWindowSystem |
18 | \inheaderfile netwm_def.h |
19 | \brief Simple point class for NET classes. |
20 | |
21 | This class is a convenience class defining a point x, y. The existence of |
22 | this class is to keep the implementation from being dependent on a |
23 | separate framework/library. |
24 | |
25 | NETPoint is only used by the NET API. Usually QPoint is the |
26 | appropriate class for representing a point. |
27 | */ |
28 | struct NETPoint { |
29 | /*! |
30 | Constructor to initialize this point to 0,0. |
31 | */ |
32 | NETPoint() |
33 | : x(0) |
34 | , y(0) |
35 | { |
36 | } |
37 | |
38 | NETPoint(const QPoint &p) |
39 | : x(p.x()) |
40 | , y(p.y()) |
41 | { |
42 | } |
43 | |
44 | QPoint toPoint() const |
45 | { |
46 | return {x, y}; |
47 | } |
48 | |
49 | /*! \brief The point's X coordinate. */ |
50 | int x; |
51 | |
52 | /*! \brief The point's Y coordinate. */ |
53 | int y; |
54 | }; |
55 | |
56 | /*! |
57 | \class NETSize |
58 | \inmodule KWindowSystem |
59 | \brief Simple size class for NET classes. |
60 | |
61 | This class is a convenience class defining a size width by height. The |
62 | existence of this class is to keep the implementation from being dependent |
63 | on a separate framework/library. |
64 | |
65 | NETSize is only used by the NET API. Usually QSize is the |
66 | appropriate class for representing a size. |
67 | */ |
68 | struct NETSize { |
69 | /*! |
70 | Constructor to initialize this size to 0x0 |
71 | */ |
72 | NETSize() |
73 | : width(0) |
74 | , height(0) |
75 | { |
76 | } |
77 | |
78 | NETSize(const QSize &size) |
79 | : width(size.width()) |
80 | , height(size.height()) |
81 | { |
82 | } |
83 | |
84 | QSize toSize() const |
85 | { |
86 | return {width, height}; |
87 | } |
88 | /*! The size's width. */ |
89 | int width; |
90 | /*! The size's height. */ |
91 | int height; |
92 | }; |
93 | |
94 | /*! |
95 | \class NETRect |
96 | \inmodule KWindowSystem |
97 | \brief Simple rectangle class for NET classes. |
98 | |
99 | This class is a convenience class defining a rectangle as a point x,y with a |
100 | size width by height. The existence of this class is to keep the implementation |
101 | from being dependent on a separate framework/library; |
102 | |
103 | NETRect is only used by the NET API. Usually QRect is the |
104 | appropriate class for representing a rectangle. |
105 | */ |
106 | struct NETRect { |
107 | NETRect() |
108 | { |
109 | } |
110 | |
111 | NETRect(const QRect &rect) |
112 | : pos(rect.topLeft()) |
113 | , size(rect.size()) |
114 | { |
115 | } |
116 | |
117 | QRect toRect() const |
118 | { |
119 | return QRect(pos.x, pos.y, size.width, size.height); |
120 | } |
121 | |
122 | /*! |
123 | \brief The position of the rectangle's top left corner. |
124 | \sa NETPoint |
125 | */ |
126 | NETPoint pos; |
127 | |
128 | /*! |
129 | \brief The size of the rectangle. |
130 | \sa NETSize |
131 | */ |
132 | NETSize size; |
133 | }; |
134 | |
135 | /*! |
136 | \class NETIcon |
137 | \inmodule KWindowSystem |
138 | \brief Simple icon class for NET classes. |
139 | |
140 | This class is a convenience class defining an icon of size width by height. |
141 | The existence of this class is to keep the implementation from being |
142 | dependent on a separate framework/library. |
143 | |
144 | NETIcon is only used by the NET API. Usually QIcon is the |
145 | appropriate class for representing an icon. |
146 | */ |
147 | struct NETIcon { |
148 | /*! |
149 | \brief Constructor to initialize this icon to 0x0 with data=0. |
150 | */ |
151 | NETIcon() |
152 | : data(nullptr) |
153 | { |
154 | } |
155 | |
156 | /*! |
157 | \brief The size of the icon. |
158 | \sa NETSize |
159 | */ |
160 | NETSize size; |
161 | |
162 | /*! |
163 | \brief Image data for the icon. |
164 | |
165 | This is an array of 32bit packed CARDINAL ARGB with high byte being A, |
166 | low byte being B. First two bytes are width, height. |
167 | Data is in rows, left to right and top to bottom. |
168 | */ |
169 | unsigned char *data; |
170 | }; |
171 | |
172 | /*! |
173 | \class NETExtendedStrut |
174 | \inmodule KWindowSystem |
175 | \brief Partial strut class for NET classes. |
176 | |
177 | This class is a convenience class defining a strut with left, right, top and |
178 | bottom border values, and ranges for them. The existence of this class is to |
179 | keep the implementation from being dependent on a separate framework/library. |
180 | See the _NET_WM_STRUT_PARTIAL property in the NETWM spec. |
181 | */ |
182 | struct NETExtendedStrut { |
183 | /*! |
184 | \brief Constructor to initialize this struct to 0,0,0,0. |
185 | */ |
186 | NETExtendedStrut() |
187 | : left_width(0) |
188 | , left_start(0) |
189 | , left_end(0) |
190 | , right_width(0) |
191 | , right_start(0) |
192 | , right_end(0) |
193 | , top_width(0) |
194 | , top_start(0) |
195 | , top_end(0) |
196 | , bottom_width(0) |
197 | , bottom_start(0) |
198 | , bottom_end(0) |
199 | { |
200 | } |
201 | |
202 | /*! \brief The width of the left border of the strut. */ |
203 | int left_width; |
204 | /*! \brief The start of the left border of the strut. */ |
205 | int left_start; |
206 | /*! \brief The end of the left border of the strut. */ |
207 | int left_end; |
208 | |
209 | /*! The width of the right border of the strut. */ |
210 | int right_width; |
211 | /*! \brief The start of the right border of the strut. */ |
212 | int right_start; |
213 | /*! \brief The end of the right border of the strut. */ |
214 | int right_end; |
215 | |
216 | /*! \brief The width of the top border of the strut. */ |
217 | int top_width; |
218 | /*! \brief The start of the top border of the strut. */ |
219 | int top_start; |
220 | /*! \brief The end of the top border of the strut. */ |
221 | int top_end; |
222 | |
223 | /*! \brief The width of the bottom border of the strut. */ |
224 | int bottom_width; |
225 | /*! \brief The start of the bottom border of the strut. */ |
226 | int bottom_start; |
227 | /*! \brief The end of the bottom border of the strut. */ |
228 | int bottom_end; |
229 | }; |
230 | |
231 | /*! |
232 | \class NETStrut |
233 | \inmodule KWindowSystem |
234 | \deprecated use NETExtendedStrut |
235 | |
236 | \brief Simple strut class for NET classes. |
237 | |
238 | This class is a convenience class defining a strut with left, right, top and |
239 | bottom border values. The existence of this class is to keep the implementation |
240 | from being dependent on a separate framework/library. See the _NET_WM_STRUT |
241 | property in the NETWM spec. |
242 | */ |
243 | struct NETStrut { |
244 | /*! |
245 | \brief Constructor to initialize this struct to 0,0,0,0. |
246 | */ |
247 | NETStrut() |
248 | : left(0) |
249 | , right(0) |
250 | , top(0) |
251 | , bottom(0) |
252 | { |
253 | } |
254 | |
255 | /*! \brief Left border of the strut. */ |
256 | int left; |
257 | |
258 | /*! \brief Right border of the strut. */ |
259 | int right; |
260 | |
261 | /*! \brief Top border of the strut. */ |
262 | int top; |
263 | |
264 | /*! \brief Bottom border of the strut. */ |
265 | int bottom; |
266 | }; |
267 | |
268 | /*! |
269 | \class NETFullscreenMonitors |
270 | \inmodule KWindowSystem |
271 | \brief Simple multiple monitor topology class for NET classes. |
272 | |
273 | This class is a convenience class, defining a multiple monitor topology |
274 | for fullscreen applications that wish to be present on more than one |
275 | monitor/head. As per the _NET_WM_FULLSCREEN_MONITORS hint in the EWMH spec, |
276 | this topology consists of 4 monitor indices such that the bounding rectangle |
277 | is defined by the top edge of the top monitor, the bottom edge of the bottom |
278 | monitor, the left edge of the left monitor, and the right edge of the right |
279 | monitor. See the _NET_WM_FULLSCREEN_MONITORS hint in the EWMH spec. |
280 | */ |
281 | struct NETFullscreenMonitors { |
282 | /*! |
283 | \brief Constructor to initialize this struct to -1,0,0,0 |
284 | (an initialized, albeit invalid, topology). |
285 | */ |
286 | NETFullscreenMonitors() |
287 | : top(-1) |
288 | , bottom(0) |
289 | , left(0) |
290 | , right(0) |
291 | { |
292 | } |
293 | |
294 | /*! \brief Monitor index whose top border defines the top edge of the topology. */ |
295 | int top; |
296 | |
297 | /*! \brief Monitor index whose bottom border defines the bottom edge of the topology. */ |
298 | int bottom; |
299 | |
300 | /*! \brief Monitor index whose left border defines the left edge of the topology. */ |
301 | int left; |
302 | |
303 | /*! \brief Monitor index whose right border defines the right edge of the topology. */ |
304 | int right; |
305 | |
306 | /*! |
307 | \brief Convenience check to make sure that we don't return |
308 | the initial (invalid) values. |
309 | |
310 | Note that we don't want to call this isValid() because we're not |
311 | actually validating the monitor topology here, but merely that our initial |
312 | values were overwritten at some point by real (non-negative) monitor indices. |
313 | */ |
314 | bool isSet() const |
315 | { |
316 | return (top != -1); |
317 | } |
318 | }; |
319 | |
320 | /*! |
321 | \class NET |
322 | \inmodule KWindowSystem |
323 | \brief Base namespace class. |
324 | |
325 | The NET API is an implementation of the NET Window Manager Specification. |
326 | |
327 | This class is the base class for the NETRootInfo and NETWinInfo classes, which |
328 | are used to retrieve and modify the properties of windows. To keep |
329 | the namespace relatively clean, all enums are defined here. |
330 | |
331 | \sa https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html |
332 | */ |
333 | class KWINDOWSYSTEM_EXPORT NET |
334 | { |
335 | public: |
336 | /*! |
337 | \enum NET::Role |
338 | Application role. This is used internally to determine how several action |
339 | should be performed (if at all). |
340 | \value Client |
341 | Indicates that the application is a client application. |
342 | \value WindowManager |
343 | Indicates that the application is a window manager application. |
344 | */ |
345 | enum Role { |
346 | Client, |
347 | WindowManager, |
348 | }; |
349 | |
350 | /*! |
351 | \enum NET::WindowType |
352 | Window type. |
353 | \sa NET::WindowTypeMask |
354 | \value Unknown |
355 | Indicates that the window did not define a window type. |
356 | \value Normal |
357 | Indicates that this is a normal, top-level window. |
358 | \value Desktop |
359 | Indicates a desktop feature. This can include a single window |
360 | containing desktop icons with the sam*e dimensions as the screen, allowing |
361 | the desktop environment to have full control of the desktop, without the |
362 | need for proxying root window clicks. |
363 | \value Dock |
364 | Indicates a dock or panel feature. |
365 | \value Toolbar |
366 | Indicates a toolbar window. |
367 | \value Menu |
368 | Indicates a pinnable (torn-off) menu window. |
369 | \value Dialog |
370 | Indicates that this is a dialog window. |
371 | \value Override |
372 | Non-standard. Deprecated: has unclear meaning and is KDE-only. |
373 | \value TopMenu |
374 | Non-standard. Indicates a toplevel menu (AKA macmenu). This is a KDE extension to the |
375 | _NET_WM_WINDOW_TYPE mechanism. |
376 | \value Utility |
377 | Indicates a utility window. |
378 | \value Splash |
379 | Indicates that this window is a splash screen window. |
380 | \value DropdownMenu |
381 | Indicates a dropdown menu (from a menubar typically). |
382 | \value PopupMenu |
383 | Indicates a popup menu (a context menu typically). |
384 | \value Tooltip |
385 | Indicates a tooltip window. |
386 | \value Notification |
387 | Indicates a notification window. |
388 | \value ComboBox |
389 | Indicates that the window is a list for a combobox. |
390 | \value DNDIcon |
391 | Indicates a window that represents the dragged object during DND operation. |
392 | \value [since 5.6] OnScreenDisplay |
393 | Non-standard. Indicates an On Screen Display window (such as volume feedback). |
394 | \value [since 5.58] CriticalNotification |
395 | Non-standard. Indicates a critical notification (such as battery is running out). |
396 | \value AppletPopup |
397 | Non-standard. Indicates that this window is an applet. |
398 | */ |
399 | enum WindowType { |
400 | Unknown = -1, |
401 | Normal = 0, |
402 | Desktop = 1, |
403 | Dock = 2, |
404 | Toolbar = 3, |
405 | = 4, |
406 | Dialog = 5, |
407 | // cannot deprecate to compiler: used both by clients & manager, later needs to keep supporting it for now |
408 | // KF6: remove |
409 | Override = 6, |
410 | = 7, |
411 | Utility = 8, |
412 | Splash = 9, |
413 | = 10, |
414 | = 11, |
415 | Tooltip = 12, |
416 | Notification = 13, |
417 | ComboBox = 14, |
418 | DNDIcon = 15, |
419 | OnScreenDisplay = 16, |
420 | CriticalNotification = 17, |
421 | = 18, |
422 | }; |
423 | |
424 | /*! |
425 | \enum NET::WindowTypeMask |
426 | Values for WindowType when they should be OR'ed together, e.g. |
427 | for the properties argument of the NETRootInfo constructor. |
428 | \sa NET::WindowType |
429 | \value NormalMask |
430 | \value DesktopMask |
431 | \value DockMask |
432 | \value ToolbarMask |
433 | \value MenuMask |
434 | \value DialogMask |
435 | \value OverrideMask |
436 | \value TopMenuMask |
437 | \value UtilityMask |
438 | \value SplashMask |
439 | \value DropdownMenuMask |
440 | \value PopupMenuMask |
441 | \value TooltipMask |
442 | \value NotificationMask |
443 | \value ComboBoxMask |
444 | \value DNDIconMask |
445 | \value [since 5.6] OnScreenDisplayMask Non-standard. |
446 | \value [since 5.58] CriticalNotificationMask Non-standard. |
447 | \value AppletPopupMask Non-standard. |
448 | \value AllTypesMask All window types. |
449 | */ |
450 | enum WindowTypeMask { |
451 | NormalMask = 1u << 0, |
452 | DesktopMask = 1u << 1, |
453 | DockMask = 1u << 2, |
454 | ToolbarMask = 1u << 3, |
455 | = 1u << 4, |
456 | DialogMask = 1u << 5, |
457 | OverrideMask = 1u << 6, |
458 | = 1u << 7, |
459 | UtilityMask = 1u << 8, |
460 | SplashMask = 1u << 9, |
461 | = 1u << 10, |
462 | = 1u << 11, |
463 | TooltipMask = 1u << 12, |
464 | NotificationMask = 1u << 13, |
465 | ComboBoxMask = 1u << 14, |
466 | DNDIconMask = 1u << 15, |
467 | OnScreenDisplayMask = 1u << 16, |
468 | CriticalNotificationMask = 1u << 17, |
469 | = 1u << 18, |
470 | AllTypesMask = 0U - 1, |
471 | }; |
472 | Q_DECLARE_FLAGS(WindowTypes, WindowTypeMask) |
473 | |
474 | /*! |
475 | * Returns \c true if the given window \a type matches the \a mask given |
476 | * using WindowTypeMask flags. |
477 | */ |
478 | static bool typeMatchesMask(WindowType type, WindowTypes mask); |
479 | |
480 | /*! |
481 | \enum NET::State |
482 | Window state. |
483 | |
484 | To set the state of a window, you'll typically do something like: |
485 | \code |
486 | KX11Extras::setState( winId(), NET::SkipTaskbar | NET::SkipPager | NET::SkipSwitcher ); |
487 | \endcode |
488 | |
489 | for example to not show the window on the taskbar, desktop pager, or window switcher. |
490 | winId() is a function of QWidget() |
491 | |
492 | Note that KeepAbove (StaysOnTop) and KeepBelow are meant as user preference and |
493 | applications should avoid setting these states themselves. |
494 | |
495 | \value Modal |
496 | Indicates that this is a modal dialog box. The WM_TRANSIENT_FOR hint |
497 | MUST be set to indicate which window the dialog is a modal for, or set to |
498 | the root window if the dialog is a modal for its window group. |
499 | \value Sticky |
500 | Indicates that the Window Manager SHOULD keep the window's position |
501 | fixed on the screen, even when the virtual desktop scrolls. Note that this is |
502 | different from being kept on all desktops. |
503 | \value MaxVert |
504 | Indicates that the window is vertically maximized. |
505 | \value MaxHoriz |
506 | Indicates that the window is horizontally maximized. |
507 | \value Max |
508 | convenience value. Equal to MaxVert | MaxHoriz. |
509 | \value Shaded |
510 | Indicates that the window is shaded (rolled-up). |
511 | \value SkipTaskbar |
512 | Indicates that a window should not be included on a taskbar. |
513 | \value KeepAbove |
514 | Indicates that a window should on top of most windows (but below fullscreen |
515 | windows). |
516 | \value SkipPager |
517 | Indicates that a window should not be included on a pager. |
518 | \value Hidden |
519 | Indicates that a window should not be visible on the screen (e.g. when minimised). |
520 | Only the window manager is allowed to change it. |
521 | \value FullScreen |
522 | Indicates that a window should fill the entire screen and have no window |
523 | decorations. |
524 | \value KeepBelow |
525 | Indicates that a window should be below most windows (but above any desktop windows). |
526 | \value DemandsAttention |
527 | there was an attempt to activate this window, but the window manager prevented |
528 | this. E.g. taskbar should mark such window specially to bring user's attention to |
529 | this window. Only the window manager is allowed to change it. |
530 | \value [since 5.45] SkipSwitcher |
531 | Indicates that a window should not be included on a switcher. |
532 | \value [since 5.58] Focused |
533 | Indicates that a client should render as though it has focus |
534 | Only the window manager is allowed to change it. |
535 | */ |
536 | enum State { |
537 | Modal = 1u << 0, |
538 | Sticky = 1u << 1, |
539 | MaxVert = 1u << 2, |
540 | MaxHoriz = 1u << 3, |
541 | Max = MaxVert | MaxHoriz, |
542 | Shaded = 1u << 4, |
543 | SkipTaskbar = 1u << 5, |
544 | KeepAbove = 1u << 6, |
545 | = 1u << 7, |
546 | Hidden = 1u << 8, |
547 | FullScreen = 1u << 9, |
548 | KeepBelow = 1u << 10, |
549 | DemandsAttention = 1u << 11, |
550 | SkipSwitcher = 1u << 12, |
551 | Focused = 1u << 13, |
552 | }; |
553 | Q_DECLARE_FLAGS(States, State) |
554 | |
555 | /*! |
556 | \enum NET::Direction |
557 | Direction for WMMoveResize. |
558 | |
559 | When a client wants the Window Manager to start a WMMoveResize, it should |
560 | specify one of: |
561 | |
562 | \value TopLeft |
563 | \value Top |
564 | \value TopRight |
565 | \value Right |
566 | \value BottomRight |
567 | \value Bottom |
568 | \value BottomLeft |
569 | \value Left |
570 | \value Move For movement only. |
571 | \value KeyboardSize Resizing via keyboard. |
572 | \value KeyboardMove Movement via keyboard. |
573 | \value MoveResizeCancel To ask the WM to stop moving a window. |
574 | */ |
575 | enum Direction { |
576 | TopLeft = 0, |
577 | Top = 1, |
578 | TopRight = 2, |
579 | Right = 3, |
580 | BottomRight = 4, |
581 | Bottom = 5, |
582 | BottomLeft = 6, |
583 | Left = 7, |
584 | Move = 8, |
585 | KeyboardSize = 9, |
586 | KeyboardMove = 10, |
587 | MoveResizeCancel = 11, |
588 | }; |
589 | |
590 | /*! |
591 | \enum NET::MappingState |
592 | Client window mapping state. The class automatically watches the mapping |
593 | state of the client windows, and uses the mapping state to determine how |
594 | to set/change different properties. Note that this is very lowlevel |
595 | and you most probably don't want to use this state. |
596 | \value Visible |
597 | Indicates the client window is visible to the user. |
598 | \value Withdrawn |
599 | Indicates that neither the client window nor its icon is visible. |
600 | \value Iconic |
601 | Indicates that the client window is not visible, but its icon is. |
602 | This can be when the window is minimized or when it's on a |
603 | different virtual desktop. See also NET::Hidden. |
604 | */ |
605 | enum MappingState { |
606 | Visible = 1, // NormalState, |
607 | Withdrawn = 0, // WithdrawnState, |
608 | Iconic = 3, // IconicState |
609 | }; |
610 | |
611 | /*! |
612 | \enum NET::Action |
613 | Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS). |
614 | \value ActionMove |
615 | \value ActionResize |
616 | \value ActionMinimize |
617 | \value ActionShade |
618 | \value ActionStick |
619 | \value ActionMaxVert |
620 | \value ActionMaxHoriz |
621 | \value ActionMax |
622 | \value ActionFullScreen |
623 | \value ActionChangeDesktop |
624 | \value ActionClose |
625 | */ |
626 | enum Action { |
627 | ActionMove = 1u << 0, |
628 | ActionResize = 1u << 1, |
629 | ActionMinimize = 1u << 2, |
630 | ActionShade = 1u << 3, |
631 | ActionStick = 1u << 4, |
632 | ActionMaxVert = 1u << 5, |
633 | ActionMaxHoriz = 1u << 6, |
634 | ActionMax = ActionMaxVert | ActionMaxHoriz, |
635 | ActionFullScreen = 1u << 7, |
636 | ActionChangeDesktop = 1u << 8, |
637 | ActionClose = 1u << 9, |
638 | }; |
639 | Q_DECLARE_FLAGS(Actions, Action) |
640 | |
641 | /*! |
642 | \enum NET::Property |
643 | Supported properties. Clients and Window Managers must define which |
644 | properties/protocols it wants to support. |
645 | |
646 | \value WMAllProperties |
647 | Root/Desktop window properties and protocols: |
648 | |
649 | \value Supported |
650 | \value ClientList |
651 | \value ClientListStacking |
652 | \value NumberOfDesktops |
653 | \value DesktopGeometry |
654 | \value DesktopViewport |
655 | \value CurrentDesktop |
656 | \value DesktopNames |
657 | \value ActiveWindow |
658 | \value WorkArea |
659 | \value SupportingWMCheck |
660 | \value VirtualRoots |
661 | \value CloseWindow |
662 | \value WMMoveResize |
663 | |
664 | Client window properties and protocols: |
665 | |
666 | \value WMName |
667 | \value WMVisibleName |
668 | \value WMDesktop |
669 | \value WMWindowType |
670 | \value WMState |
671 | \value WMStrut Obsoleted by WM2ExtendedStrut. |
672 | \value WMGeometry |
673 | \value WMFrameExtents |
674 | \value WMIconGeometry |
675 | \value WMIcon |
676 | \value WMIconName |
677 | \value WMVisibleIconName |
678 | \value WMHandledIcons |
679 | \value WMPid |
680 | \value WMPing |
681 | |
682 | ICCCM properties (provided for convenience): |
683 | |
684 | \value XAWMState |
685 | */ |
686 | enum Property { |
687 | // root |
688 | Supported = 1u << 0, |
689 | ClientList = 1u << 1, |
690 | ClientListStacking = 1u << 2, |
691 | NumberOfDesktops = 1u << 3, |
692 | DesktopGeometry = 1u << 4, |
693 | DesktopViewport = 1u << 5, |
694 | CurrentDesktop = 1u << 6, |
695 | DesktopNames = 1u << 7, |
696 | ActiveWindow = 1u << 8, |
697 | WorkArea = 1u << 9, |
698 | SupportingWMCheck = 1u << 10, |
699 | VirtualRoots = 1u << 11, |
700 | // |
701 | CloseWindow = 1u << 13, |
702 | WMMoveResize = 1u << 14, |
703 | |
704 | // window |
705 | WMName = 1u << 15, |
706 | WMVisibleName = 1u << 16, |
707 | WMDesktop = 1u << 17, |
708 | WMWindowType = 1u << 18, |
709 | WMState = 1u << 19, |
710 | WMStrut = 1u << 20, |
711 | WMIconGeometry = 1u << 21, |
712 | WMIcon = 1u << 22, |
713 | WMPid = 1u << 23, |
714 | WMHandledIcons = 1u << 24, |
715 | WMPing = 1u << 25, |
716 | XAWMState = 1u << 27, |
717 | WMFrameExtents = 1u << 28, |
718 | |
719 | // Need to be reordered |
720 | WMIconName = 1u << 29, |
721 | WMVisibleIconName = 1u << 30, |
722 | WMGeometry = 1u << 31, |
723 | WMAllProperties = ~0u, |
724 | }; |
725 | Q_DECLARE_FLAGS(Properties, Property) |
726 | |
727 | /*! |
728 | \enum NET::Property2 |
729 | Supported properties. This enum is an extension to NET::Property, |
730 | because them enum is limited only to 32 bits. |
731 | |
732 | Client window properties and protocols: |
733 | |
734 | \value WM2UserTime |
735 | \value WM2StartupId |
736 | \value WM2TransientFor Main window for the window (WM_TRANSIENT_FOR). |
737 | \value WM2GroupLeader Group leader (window_group in WM_HINTS). |
738 | \value WM2AllowedActions |
739 | \value WM2RestackWindow |
740 | \value WM2MoveResizeWindow |
741 | \value WM2ExtendedStrut |
742 | \value WM2KDETemporaryRules Non-standard. |
743 | \value WM2WindowClass WM_CLASS |
744 | \value WM2WindowRole WM_WINDOW_ROLE |
745 | \value WM2ClientMachine WM_CLIENT_MACHINE |
746 | \value WM2ShowingDesktop |
747 | \value WM2Opacity _NET_WM_WINDOW_OPACITY |
748 | \value WM2DesktopLayout _NET_DESKTOP_LAYOUT |
749 | \value WM2FullPlacement _NET_WM_FULL_PLACEMENT |
750 | \value WM2FullscreenMonitors _NET_WM_FULLSCREEN_MONITORS |
751 | \value WM2FrameOverlap Non-standard. |
752 | \value [since 4.6] WM2Activities Non-standard. |
753 | \value [since 4.7] WM2BlockCompositing Standard since 5.17. |
754 | \value [since 4.7] WM2KDEShadow Non-standard. |
755 | \value [since 5.3] WM2Urgency Urgency hint in WM_HINTS (see ICCCM 4.1.2.4). |
756 | \value [since 5.3] WM2Input Input hint (input in WM_HINTS, see ICCCM 4.1.2.4). |
757 | \value [since 5.3] WM2Protocols See NET::Protocol. |
758 | \value [since 5.5] WM2InitialMappingState Initial state hint of WM_HINTS (see ICCCM 4.1.2.4). |
759 | \value [since 5.7] WM2IconPixmap Icon pixmap and mask in WM_HINTS (see ICCCM 4.1.2.4). |
760 | \value [since 5.7] WM2OpaqueRegion |
761 | \value [since 5.28] WM2DesktopFileName Non-standard. The base name of the desktop file name or the full path to the desktop file. |
762 | \value [since 5.65] WM2GTKFrameExtents Non-standard. Extents of the shadow drawn by the client. |
763 | \value [since 5.69] WM2AppMenuServiceName. Non-standard. |
764 | \value [since 5.69] WM2AppMenuObjectPath. Non-standard. |
765 | \value [since 5.91] WM2GTKApplicationId Non-standard. _GTK_APPLICATION_ID |
766 | \value [since 5.96] WM2GTKShowWindowMenu Non-standard. _GTK_SHOW_WINDOW_MENU |
767 | \value WM2AllProperties |
768 | */ |
769 | enum Property2 { |
770 | WM2UserTime = 1u << 0, |
771 | WM2StartupId = 1u << 1, |
772 | WM2TransientFor = 1u << 2, |
773 | WM2GroupLeader = 1u << 3, |
774 | WM2AllowedActions = 1u << 4, |
775 | WM2RestackWindow = 1u << 5, |
776 | WM2MoveResizeWindow = 1u << 6, |
777 | WM2ExtendedStrut = 1u << 7, |
778 | WM2KDETemporaryRules = 1u << 8, |
779 | WM2WindowClass = 1u << 9, |
780 | WM2WindowRole = 1u << 10, |
781 | WM2ClientMachine = 1u << 11, |
782 | WM2ShowingDesktop = 1u << 12, |
783 | WM2Opacity = 1u << 13, |
784 | WM2DesktopLayout = 1u << 14, |
785 | WM2FullPlacement = 1u << 15, |
786 | WM2FullscreenMonitors = 1u << 16, |
787 | WM2FrameOverlap = 1u << 17, |
788 | WM2Activities = 1u << 18, |
789 | WM2BlockCompositing = 1u << 19, |
790 | WM2KDEShadow = 1u << 20, |
791 | WM2Urgency = 1u << 21, |
792 | WM2Input = 1u << 22, |
793 | WM2Protocols = 1u << 23, |
794 | WM2InitialMappingState = 1u << 24, |
795 | WM2IconPixmap = 1u << 25, |
796 | WM2OpaqueRegion = 1u << 25, |
797 | WM2DesktopFileName = 1u << 26, |
798 | WM2GTKFrameExtents = 1u << 27, |
799 | = 1u << 28, |
800 | = 1u << 29, |
801 | WM2GTKApplicationId = 1u << 30, |
802 | = 1u << 31, |
803 | WM2AllProperties = ~0u, |
804 | }; |
805 | Q_DECLARE_FLAGS(Properties2, Property2) |
806 | |
807 | /* |
808 | Sentinel value to indicate that the client wishes to be visible on |
809 | all desktops. |
810 | */ |
811 | enum { |
812 | OnAllDesktops = -1, |
813 | }; |
814 | |
815 | // must match the values for data.l[0] field in _NET_ACTIVE_WINDOW message |
816 | /*! |
817 | \enum NET::RequestSource |
818 | Source of the request. |
819 | \value FromUnknown |
820 | Indicates that the source of the request is unknown. |
821 | \value FromApplication |
822 | Indicates that the request comes from a normal application. |
823 | \value FromTool |
824 | Indicated that the request comes from pager or similar tool. |
825 | */ |
826 | enum RequestSource { |
827 | FromUnknown = 0, |
828 | FromApplication = 1, |
829 | FromTool = 2, |
830 | }; |
831 | |
832 | /*! |
833 | \enum NET::Orientation |
834 | Orientation. |
835 | \value OrientationHorizontal |
836 | \value OrientationVertical |
837 | */ |
838 | enum Orientation { |
839 | OrientationHorizontal = 0, |
840 | OrientationVertical = 1, |
841 | }; |
842 | |
843 | /*! |
844 | \enum NET::DesktopLayoutCorner |
845 | Starting corner for desktop layout. |
846 | \value DesktopLayoutCornerTopLeft |
847 | \value DesktopLayoutCornerTopRight |
848 | \value DesktopLayoutCornerBottomLeft |
849 | \value DesktopLayoutCornerBottomRight |
850 | */ |
851 | enum DesktopLayoutCorner { |
852 | DesktopLayoutCornerTopLeft = 0, |
853 | DesktopLayoutCornerTopRight = 1, |
854 | DesktopLayoutCornerBottomLeft = 2, |
855 | DesktopLayoutCornerBottomRight = 3, |
856 | }; |
857 | |
858 | /*! |
859 | * \enum NET::Protocol |
860 | * Protocols supported by the client. |
861 | * See ICCCM 4.1.2.7. |
862 | * |
863 | * \since 5.3 |
864 | * \value NoProtocol |
865 | * \value TakeFocusProtocol WM_TAKE_FOCUS |
866 | * \value DeleteWindowProtocol WM_DELETE_WINDOW |
867 | * \value PingProtocol _NET_WM_PING from EWMH |
868 | * \value SyncRequestProtocol _NET_WM_SYNC_REQUEST from EWMH |
869 | * \value ContextHelpProtocol Non-standard. _NET_WM_CONTEXT_HELP |
870 | */ |
871 | enum Protocol { |
872 | NoProtocol = 0, |
873 | TakeFocusProtocol = 1 << 0, |
874 | DeleteWindowProtocol = 1 << 1, |
875 | PingProtocol = 1 << 2, |
876 | SyncRequestProtocol = 1 << 3, |
877 | ContextHelpProtocol = 1 << 4, |
878 | }; |
879 | Q_DECLARE_FLAGS(Protocols, Protocol) |
880 | |
881 | /*! |
882 | \brief Compares two X timestamps, taking into account wrapping and 64bit architectures. |
883 | Return value is like with strcmp(), 0 for equal, -1 for \a time1 < \a time2, 1 for \a time1 > \a time2. |
884 | */ |
885 | static int timestampCompare(unsigned long time1, unsigned long time2); |
886 | /*! |
887 | \brief Returns a difference of two X timestamps, \a time2 - \a time1, where \a time2 must be later than \a time1, |
888 | as returned by timestampCompare(). |
889 | */ |
890 | static int timestampDiff(unsigned long time1, unsigned long time2); |
891 | }; |
892 | |
893 | Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Properties) |
894 | Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Properties2) |
895 | Q_DECLARE_OPERATORS_FOR_FLAGS(NET::WindowTypes) |
896 | Q_DECLARE_OPERATORS_FOR_FLAGS(NET::States) |
897 | Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Actions) |
898 | Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Protocols) |
899 | |
900 | #endif // netwm_def_h |
901 | |