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

source code of kwindowsystem/src/netwm_def.h