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 
27 struct NETPoint {
28     /**
29        Constructor to initialize this point to 0,0.
30     **/
NETPointNETPoint31     NETPoint()
32         : x(0)
33         , y(0)
34     {
35     }
36 
NETPointNETPoint37     NETPoint(const QPoint &p)
38         : x(p.x())
39         , y(p.y())
40     {
41     }
42 
toPointNETPoint43     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 
68 struct NETSize {
69     /**
70        Constructor to initialize this size to 0x0
71     **/
NETSizeNETSize72     NETSize()
73         : width(0)
74         , height(0)
75     {
76     }
77 
NETSizeNETSize78     NETSize(const QSize &size)
79         : width(size.width())
80         , height(size.height())
81     {
82     }
83 
toSizeNETSize84     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 **/
105 struct NETRect {
NETRectNETRect106     NETRect()
107     {
108     }
109 
NETRectNETRect110     NETRect(const QRect &rect)
111         : pos(rect.topLeft())
112         , size(rect.size())
113     {
114     }
115 
toRectNETRect116     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 
147 struct NETIcon {
148     /**
149        Constructor to initialize this icon to 0x0 with data=0
150     **/
NETIconNETIcon151     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 
180 struct NETExtendedStrut {
181     /**
182        Constructor to initialize this struct to 0,0,0,0
183     **/
NETExtendedStrutNETExtendedStrut184     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 
232 struct NETStrut {
233     /**
234        Constructor to initialize this struct to 0,0,0,0
235     **/
NETStrutNETStrut236     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 
277 struct NETFullscreenMonitors {
278     /**
279        Constructor to initialize this struct to -1,0,0,0 (an initialized,
280        albeit invalid, topology).
281     **/
NETFullscreenMonitorsNETFullscreenMonitors282     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     **/
isSetNETFullscreenMonitors316     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 http://www.freedesktop.org/standards/wm-spec/
332  **/
333 
334 class KWINDOWSYSTEM_EXPORT NET
335 {
336 public:
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 
444     /**
445         Values for WindowType when they should be OR'ed together, e.g.
446         for the properties argument of the NETRootInfo constructor.
447         @see WindowTypes
448     **/
449     enum WindowTypeMask {
450         NormalMask = 1u << 0, ///< @see Normal
451         DesktopMask = 1u << 1, ///< @see Desktop
452         DockMask = 1u << 2, ///< @see Dock
453         ToolbarMask = 1u << 3, ///< @see Toolbar
454         MenuMask = 1u << 4, ///< @see Menu
455         DialogMask = 1u << 5, ///< @see Dialog
456         OverrideMask = 1u << 6, ///< @see Override
457         TopMenuMask = 1u << 7, ///< @see TopMenu
458         UtilityMask = 1u << 8, ///< @see Utility
459         SplashMask = 1u << 9, ///< @see Splash
460         DropdownMenuMask = 1u << 10, ///< @see DropdownMenu
461         PopupMenuMask = 1u << 11, ///< @see PopupMenu
462         TooltipMask = 1u << 12, ///< @see Tooltip
463         NotificationMask = 1u << 13, ///< @see Notification
464         ComboBoxMask = 1u << 14, ///< @see ComboBox
465         DNDIconMask = 1u << 15, ///< @see DNDIcon
466         OnScreenDisplayMask = 1u << 16, ///< NON STANDARD @see OnScreenDisplay @since 5.6
467         CriticalNotificationMask = 1u << 17, ///< NON STANDARD @see CriticalNotification @since 5.58
468         AllTypesMask = 0U - 1, ///< All window types.
469     };
470     /**
471      * Stores a combination of #WindowTypeMask values.
472      */
473     Q_DECLARE_FLAGS(WindowTypes, WindowTypeMask)
474 
475     /**
476      * Returns true if the given window type matches the mask given
477      * using WindowTypeMask flags.
478      */
479     static bool typeMatchesMask(WindowType type, WindowTypes mask);
480 
481     /**
482        Window state.
483 
484        To set the state of a window, you'll typically do something like:
485        \code
486          KWindowSystem::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        @see States
496     **/
497 
498     enum State {
499         /**
500            indicates that this is a modal dialog box. The WM_TRANSIENT_FOR hint
501            MUST be set to indicate which window the dialog is a modal for, or set to
502            the root window if the dialog is a modal for its window group.
503         **/
504         Modal = 1u << 0,
505         /**
506            indicates that the Window Manager SHOULD keep the window's position
507            fixed on the screen, even when the virtual desktop scrolls. Note that this is
508            different from being kept on all desktops.
509         **/
510         Sticky = 1u << 1,
511         /**
512            indicates that the window is vertically maximized.
513         **/
514         MaxVert = 1u << 2,
515         /**
516            indicates that the window is horizontally maximized.
517         **/
518         MaxHoriz = 1u << 3,
519         /**
520            convenience value. Equal to MaxVert | MaxHoriz.
521         **/
522         Max = MaxVert | MaxHoriz,
523         /**
524            indicates that the window is shaded (rolled-up).
525         **/
526         Shaded = 1u << 4,
527         /**
528            indicates that a window should not be included on a taskbar.
529         **/
530         SkipTaskbar = 1u << 5,
531         /**
532            indicates that a window should on top of most windows (but below fullscreen
533            windows).
534         **/
535         KeepAbove = 1u << 6,
536 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
537         /**
538            @deprecated Since 5.0. This is an obsolete name for KeepAbove.
539         **/
540         StaysOnTop KWINDOWSYSTEM_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use KeepAbove") = KeepAbove, // NOT STANDARD
541 #endif
542         /**
543            indicates that a window should not be included on a pager.
544         **/
545         SkipPager = 1u << 7,
546         /**
547            indicates that a window should not be visible on the screen (e.g. when minimised).
548            Only the window manager is allowed to change it.
549         **/
550         Hidden = 1u << 8,
551         /**
552            indicates that a window should fill the entire screen and have no window
553            decorations.
554         **/
555         FullScreen = 1u << 9,
556         /**
557            indicates that a window should be below most windows (but above any desktop windows).
558         **/
559         KeepBelow = 1u << 10,
560         /**
561            there was an attempt to activate this window, but the window manager prevented
562            this. E.g. taskbar should mark such window specially to bring user's attention to
563            this window. Only the window manager is allowed to change it.
564         **/
565         DemandsAttention = 1u << 11,
566         /**
567            indicates that a window should not be included on a switcher.
568 
569            @since 5.45
570         **/
571         SkipSwitcher = 1u << 12,
572         /**
573           indicates that a client should render as though it has focus
574           Only the window manager is allowed to change it.
575           @since 5.58
576          **/
577         Focused = 1u << 13,
578     };
579     /**
580      * Stores a combination of #State values.
581      */
582     Q_DECLARE_FLAGS(States, State)
583 
584     /**
585        Direction for WMMoveResize.
586 
587        When a client wants the Window Manager to start a WMMoveResize, it should
588        specify one of:
589 
590        @li TopLeft
591        @li Top
592        @li TopRight
593        @li Right
594        @li BottomRight
595        @li Bottom
596        @li BottomLeft
597        @li Left
598        @li Move (for movement only)
599        @li KeyboardSize (resizing via keyboard)
600        @li KeyboardMove (movement via keyboard)
601     **/
602 
603     enum Direction {
604         TopLeft = 0,
605         Top = 1,
606         TopRight = 2,
607         Right = 3,
608         BottomRight = 4,
609         Bottom = 5,
610         BottomLeft = 6,
611         Left = 7,
612         Move = 8, // movement only
613         KeyboardSize = 9, // size via keyboard
614         KeyboardMove = 10, // move via keyboard
615         MoveResizeCancel = 11, // to ask the WM to stop moving a window
616     };
617 
618     /**
619        Client window mapping state.  The class automatically watches the mapping
620        state of the client windows, and uses the mapping state to determine how
621        to set/change different properties. Note that this is very lowlevel
622        and you most probably don't want to use this state.
623     **/
624     enum MappingState {
625         /**
626            indicates the client window is visible to the user.
627         **/
628         Visible = 1, // NormalState,
629         /**
630            indicates that neither the client window nor its icon is visible.
631         **/
632         Withdrawn = 0, // WithdrawnState,
633         /**
634            indicates that the client window is not visible, but its icon is.
635            This can be when the window is minimized or when it's on a
636            different virtual desktop. See also NET::Hidden.
637         **/
638         Iconic = 3, // IconicState
639     };
640 
641     /**
642       Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS).
643       @see Actions
644     **/
645     enum Action {
646         ActionMove = 1u << 0,
647         ActionResize = 1u << 1,
648         ActionMinimize = 1u << 2,
649         ActionShade = 1u << 3,
650         ActionStick = 1u << 4,
651         ActionMaxVert = 1u << 5,
652         ActionMaxHoriz = 1u << 6,
653         ActionMax = ActionMaxVert | ActionMaxHoriz,
654         ActionFullScreen = 1u << 7,
655         ActionChangeDesktop = 1u << 8,
656         ActionClose = 1u << 9,
657     };
658     /**
659      * Stores a combination of #Action values.
660      */
661     Q_DECLARE_FLAGS(Actions, Action)
662 
663     /**
664        Supported properties.  Clients and Window Managers must define which
665        properties/protocols it wants to support.
666 
667        Root/Desktop window properties and protocols:
668 
669        @li Supported
670        @li ClientList
671        @li ClientListStacking
672        @li NumberOfDesktops
673        @li DesktopGeometry
674        @li DesktopViewport
675        @li CurrentDesktop
676        @li DesktopNames
677        @li ActiveWindow
678        @li WorkArea
679        @li SupportingWMCheck
680        @li VirtualRoots
681        @li CloseWindow
682        @li WMMoveResize
683 
684        Client window properties and protocols:
685 
686        @li WMName
687        @li WMVisibleName
688        @li WMDesktop
689        @li WMWindowType
690        @li WMState
691        @li WMStrut  (obsoleted by WM2ExtendedStrut)
692        @li WMGeometry
693        @li WMFrameExtents
694        @li WMIconGeometry
695        @li WMIcon
696        @li WMIconName
697        @li WMVisibleIconName
698        @li WMHandledIcons
699        @li WMPid
700        @li WMPing
701 
702        ICCCM properties (provided for convenience):
703 
704        @li XAWMState
705 
706        @see Properties
707     **/
708 
709     enum Property {
710         // root
711         Supported = 1u << 0,
712         ClientList = 1u << 1,
713         ClientListStacking = 1u << 2,
714         NumberOfDesktops = 1u << 3,
715         DesktopGeometry = 1u << 4,
716         DesktopViewport = 1u << 5,
717         CurrentDesktop = 1u << 6,
718         DesktopNames = 1u << 7,
719         ActiveWindow = 1u << 8,
720         WorkArea = 1u << 9,
721         SupportingWMCheck = 1u << 10,
722         VirtualRoots = 1u << 11,
723         //
724         CloseWindow = 1u << 13,
725         WMMoveResize = 1u << 14,
726 
727         // window
728         WMName = 1u << 15,
729         WMVisibleName = 1u << 16,
730         WMDesktop = 1u << 17,
731         WMWindowType = 1u << 18,
732         WMState = 1u << 19,
733         WMStrut = 1u << 20,
734         WMIconGeometry = 1u << 21,
735         WMIcon = 1u << 22,
736         WMPid = 1u << 23,
737         WMHandledIcons = 1u << 24,
738         WMPing = 1u << 25,
739         XAWMState = 1u << 27,
740         WMFrameExtents = 1u << 28,
741 
742         // Need to be reordered
743         WMIconName = 1u << 29,
744         WMVisibleIconName = 1u << 30,
745         WMGeometry = 1u << 31,
746         WMAllProperties = ~0u,
747     };
748     /**
749      * Stores a combination of #Property values.
750      */
751     Q_DECLARE_FLAGS(Properties, Property)
752 
753     /**
754         Supported properties. This enum is an extension to NET::Property,
755         because them enum is limited only to 32 bits.
756 
757         Client window properties and protocols:
758 
759         @li WM2UserTime
760         @li WM2StartupId
761         @li WM2TransientFor mainwindow for the window (WM_TRANSIENT_FOR)
762         @li WM2GroupLeader  group leader (window_group in WM_HINTS)
763         @li WM2AllowedActions
764         @li WM2RestackWindow
765         @li WM2MoveResizeWindow
766         @li WM2ExtendedStrut
767         @li WM2TemporaryRules internal, for kstart
768         @li WM2WindowClass  WM_CLASS
769         @li WM2WindowRole   WM_WINDOW_ROLE
770         @li WM2ClientMachine WM_CLIENT_MACHINE
771         @li WM2ShowingDesktop
772         @li WM2Opacity _NET_WM_WINDOW_OPACITY
773         @li WM2DesktopLayout _NET_DESKTOP_LAYOUT
774         @li WM2FullPlacement _NET_WM_FULL_PLACEMENT
775         @li WM2FullscreenMonitors _NET_WM_FULLSCREEN_MONITORS
776         @li WM2Urgency urgency hint in WM_HINTS (see ICCCM 4.1.2.4)
777         @li WM2Input input hint (input in WM_HINTS, see ICCCM 4.1.2.4)
778         @li WM2Protocols see NET::Protocol
779         @li WM2InitialMappingState initial state hint of WM_HINTS (see ICCCM 4.1.2.4)
780         @li WM2IconPixmap icon pixmap and mask in WM_HINTS (see ICCCM 4.1.2.4)
781         @li WM2OpaqueRegion
782         @li WM2DesktopFileName the base name of the desktop file name or the full path to the desktop file
783         @li WM2GTKFrameExtents extents of the shadow drawn by the client
784 
785         @see Properties2
786     **/
787     enum Property2 {
788         WM2UserTime = 1u << 0,
789         WM2StartupId = 1u << 1,
790         WM2TransientFor = 1u << 2,
791         WM2GroupLeader = 1u << 3,
792         WM2AllowedActions = 1u << 4,
793         WM2RestackWindow = 1u << 5,
794         WM2MoveResizeWindow = 1u << 6,
795         WM2ExtendedStrut = 1u << 7,
796         WM2KDETemporaryRules = 1u << 8, // NOT STANDARD
797         WM2WindowClass = 1u << 9,
798         WM2WindowRole = 1u << 10,
799         WM2ClientMachine = 1u << 11,
800         WM2ShowingDesktop = 1u << 12,
801         WM2Opacity = 1u << 13,
802         WM2DesktopLayout = 1u << 14,
803         WM2FullPlacement = 1u << 15,
804         WM2FullscreenMonitors = 1u << 16,
805         WM2FrameOverlap = 1u << 17, // NOT STANDARD
806         WM2Activities = 1u << 18, // NOT STANDARD @since 4.6
807         WM2BlockCompositing = 1u << 19, // NOT STANDARD @since 4.7, STANDARD @since 5.17
808         WM2KDEShadow = 1u << 20, // NOT Standard @since 4.7
809         WM2Urgency = 1u << 21, // @since 5.3
810         WM2Input = 1u << 22, // @since 5.3
811         WM2Protocols = 1u << 23, // @since 5.3
812         WM2InitialMappingState = 1u << 24, // @since 5.5
813         WM2IconPixmap = 1u << 25, // @since 5.7
814         WM2OpaqueRegion = 1u << 25, // @since 5.7
815         WM2DesktopFileName = 1u << 26, // NOT STANDARD @since 5.28
816         WM2GTKFrameExtents = 1u << 27, // NOT STANDARD @since 5.65
817         WM2AppMenuServiceName = 1u << 28, // NOT STANDARD @since 5.69
818         WM2AppMenuObjectPath = 1u << 29, // NOT STANDARD @since 5.69
819         WM2AllProperties = ~0u,
820     };
821     /**
822      * Stores a combination of #Property2 values.
823      */
824     Q_DECLARE_FLAGS(Properties2, Property2)
825 
826     /**
827        Sentinel value to indicate that the client wishes to be visible on
828        all desktops.
829      **/
830     enum {
831         OnAllDesktops = -1,
832     };
833 
834     /**
835        Source of the request.
836     **/
837     // must match the values for data.l[0] field in _NET_ACTIVE_WINDOW message
838     enum RequestSource {
839         /**
840           @internal indicates that the source of the request is unknown
841         **/
842         FromUnknown = 0, // internal
843         /**
844            indicates that the request comes from a normal application
845         **/
846         FromApplication = 1,
847         /**
848            indicated that the request comes from pager or similar tool
849         **/
850         FromTool = 2,
851     };
852 
853     /**
854       Orientation.
855     **/
856     enum Orientation {
857         OrientationHorizontal = 0,
858         OrientationVertical = 1,
859     };
860 
861     /**
862      Starting corner for desktop layout.
863     **/
864     enum DesktopLayoutCorner {
865         DesktopLayoutCornerTopLeft = 0,
866         DesktopLayoutCornerTopRight = 1,
867         DesktopLayoutCornerBottomLeft = 2,
868         DesktopLayoutCornerBottomRight = 3,
869     };
870 
871     /**
872      * Protocols supported by the client.
873      * See ICCCM 4.1.2.7.
874      *
875      * @see Protocols
876      * @since 5.3
877      **/
878     enum Protocol {
879         NoProtocol = 0,
880         TakeFocusProtocol = 1 << 0, ///< WM_TAKE_FOCUS
881         DeleteWindowProtocol = 1 << 1, ///< WM_DELETE_WINDOW
882         PingProtocol = 1 << 2, ///< _NET_WM_PING from EWMH
883         SyncRequestProtocol = 1 << 3, ///< _NET_WM_SYNC_REQUEST from EWMH
884         ContextHelpProtocol = 1 << 4, ///< _NET_WM_CONTEXT_HELP, NON STANDARD!
885     };
886     /**
887      * Stores a combination of #Protocol values.
888      */
889     Q_DECLARE_FLAGS(Protocols, Protocol)
890 
891     /**
892      Compares two X timestamps, taking into account wrapping and 64bit architectures.
893      Return value is like with strcmp(), 0 for equal, -1 for time1 < time2, 1 for time1 > time2.
894     */
895     static int timestampCompare(unsigned long time1, unsigned long time2);
896     /**
897      Returns a difference of two X timestamps, time2 - time1, where time2 must be later than time1,
898      as returned by timestampCompare().
899     */
900     static int timestampDiff(unsigned long time1, unsigned long time2);
901 };
902 
903 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Properties)
904 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Properties2)
905 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::WindowTypes)
906 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::States)
907 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Actions)
908 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Protocols)
909 
910 #endif // netwm_def_h
911