File indexing completed on 2024-04-21 15:05:42

0001 /*
0002   SPDX-FileCopyrightText: 2000 Troll Tech AS
0003   SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
0004 
0005   SPDX-License-Identifier: MIT
0006 */
0007 
0008 #ifndef netwm_def_h
0009 #define netwm_def_h
0010 #include <QFlags>
0011 #include <QRect>
0012 #include <kwindowsystem_export.h>
0013 
0014 /**
0015   Simple point class for NET classes.
0016 
0017   This class is a convenience class defining a point x, y.  The existence of
0018   this class is to keep the implementation from being dependent on a
0019   separate framework/library.
0020 
0021   NETPoint is only used by the NET API. Usually QPoint is the
0022   appropriate class for representing a point.
0023 
0024   @author Bradley T. Hughes <bhughes@trolltech.com>
0025 **/
0026 
0027 struct NETPoint {
0028     /**
0029        Constructor to initialize this point to 0,0.
0030     **/
0031     NETPoint()
0032         : x(0)
0033         , y(0)
0034     {
0035     }
0036 
0037     NETPoint(const QPoint &p)
0038         : x(p.x())
0039         , y(p.y())
0040     {
0041     }
0042 
0043     QPoint toPoint() const
0044     {
0045         return {x, y};
0046     }
0047 
0048     /*
0049        Public data member.
0050     **/
0051     int x, ///< x coordinate.
0052         y; ///< y coordinate
0053 };
0054 
0055 /**
0056   Simple size class for NET classes.
0057 
0058   This class is a convenience class defining a size width by height.  The
0059   existence of this class is to keep the implementation from being dependent
0060   on a separate framework/library.
0061 
0062   NETSize is only used by the NET API. Usually QSize is the
0063   appropriate class for representing a size.
0064 
0065   @author Bradley T. Hughes <bhughes@trolltech.com>
0066 **/
0067 
0068 struct NETSize {
0069     /**
0070        Constructor to initialize this size to 0x0
0071     **/
0072     NETSize()
0073         : width(0)
0074         , height(0)
0075     {
0076     }
0077 
0078     NETSize(const QSize &size)
0079         : width(size.width())
0080         , height(size.height())
0081     {
0082     }
0083 
0084     QSize toSize() const
0085     {
0086         return {width, height};
0087     }
0088     /*
0089        Public data member.
0090     **/
0091     int width; ///< Width.
0092     int height; ///< Height.
0093 };
0094 
0095 /**
0096    Simple rectangle class for NET classes.
0097 
0098    This class is a convenience class defining a rectangle as a point x,y with a
0099    size width by height.  The existence of this class is to keep the implementation
0100    from being dependent on a separate framework/library;
0101 
0102    NETRect is only used by the NET API. Usually QRect is the
0103    appropriate class for representing a rectangle.
0104 **/
0105 struct NETRect {
0106     NETRect()
0107     {
0108     }
0109 
0110     NETRect(const QRect &rect)
0111         : pos(rect.topLeft())
0112         , size(rect.size())
0113     {
0114     }
0115 
0116     QRect toRect() const
0117     {
0118         return QRect(pos.x, pos.y, size.width, size.height);
0119     }
0120 
0121     /**
0122        Position of the rectangle.
0123 
0124        @see NETPoint
0125     **/
0126     NETPoint pos;
0127 
0128     /**
0129        Size of the rectangle.
0130 
0131        @see NETSize
0132     **/
0133     NETSize size;
0134 };
0135 
0136 /**
0137    Simple icon class for NET classes.
0138 
0139    This class is a convenience class defining an icon of size width by height.
0140    The existence of this class is to keep the implementation from being
0141    dependent on a separate framework/library.
0142 
0143    NETIcon is only used by the NET API. Usually QIcon is the
0144    appropriate class for representing an icon.
0145 **/
0146 
0147 struct NETIcon {
0148     /**
0149        Constructor to initialize this icon to 0x0 with data=0
0150     **/
0151     NETIcon()
0152         : data(nullptr)
0153     {
0154     }
0155 
0156     /**
0157        Size of the icon.
0158 
0159        @see NETSize
0160     **/
0161     NETSize size;
0162 
0163     /**
0164        Image data for the icon.  This is an array of 32bit packed CARDINAL ARGB
0165        with high byte being A, low byte being B. First two bytes are width, height.
0166        Data is in rows, left to right and top to bottom.
0167     **/
0168     unsigned char *data;
0169 };
0170 
0171 /**
0172    Partial strut class for NET classes.
0173 
0174    This class is a convenience class defining a strut with left, right, top and
0175    bottom border values, and ranges for them.  The existence of this class is to
0176    keep the implementation from being dependent on a separate framework/library.
0177    See the _NET_WM_STRUT_PARTIAL property in the NETWM spec.
0178 **/
0179 
0180 struct NETExtendedStrut {
0181     /**
0182        Constructor to initialize this struct to 0,0,0,0
0183     **/
0184     NETExtendedStrut()
0185         : left_width(0)
0186         , left_start(0)
0187         , left_end(0)
0188         , right_width(0)
0189         , right_start(0)
0190         , right_end(0)
0191         , top_width(0)
0192         , top_start(0)
0193         , top_end(0)
0194         , bottom_width(0)
0195         , bottom_start(0)
0196         , bottom_end(0)
0197     {
0198     }
0199 
0200     /**
0201        Left border of the strut, width and range.
0202            **/
0203     int left_width, left_start, left_end;
0204 
0205     /**
0206        Right border of the strut, width and range.
0207     **/
0208     int right_width, right_start, right_end;
0209 
0210     /**
0211        Top border of the strut, width and range.
0212            **/
0213     int top_width, top_start, top_end;
0214 
0215     /**
0216        Bottom border of the strut, width and range.
0217            **/
0218     int bottom_width, bottom_start, bottom_end;
0219 };
0220 
0221 /**
0222    @deprecated use NETExtendedStrut
0223 
0224    Simple strut class for NET classes.
0225 
0226    This class is a convenience class defining a strut with left, right, top and
0227    bottom border values.  The existence of this class is to keep the implementation
0228    from being dependent on a separate framework/library. See the _NET_WM_STRUT
0229    property in the NETWM spec.
0230 **/
0231 
0232 struct NETStrut {
0233     /**
0234        Constructor to initialize this struct to 0,0,0,0
0235     **/
0236     NETStrut()
0237         : left(0)
0238         , right(0)
0239         , top(0)
0240         , bottom(0)
0241     {
0242     }
0243 
0244     /**
0245        Left border of the strut.
0246            **/
0247     int left;
0248 
0249     /**
0250        Right border of the strut.
0251     **/
0252     int right;
0253 
0254     /**
0255        Top border of the strut.
0256            **/
0257     int top;
0258 
0259     /**
0260        Bottom border of the strut.
0261            **/
0262     int bottom;
0263 };
0264 
0265 /**
0266    Simple multiple monitor topology class for NET classes.
0267 
0268    This class is a convenience class, defining a multiple monitor topology
0269    for fullscreen applications that wish to be present on more than one
0270    monitor/head. As per the _NET_WM_FULLSCREEN_MONITORS hint in the EWMH spec,
0271    this topology consists of 4 monitor indices such that the bounding rectangle
0272    is defined by the top edge of the top monitor, the bottom edge of the bottom
0273    monitor, the left edge of the left monitor, and the right edge of the right
0274    monitor. See the _NET_WM_FULLSCREEN_MONITORS hint in the EWMH spec.
0275 **/
0276 
0277 struct NETFullscreenMonitors {
0278     /**
0279        Constructor to initialize this struct to -1,0,0,0 (an initialized,
0280        albeit invalid, topology).
0281     **/
0282     NETFullscreenMonitors()
0283         : top(-1)
0284         , bottom(0)
0285         , left(0)
0286         , right(0)
0287     {
0288     }
0289 
0290     /**
0291        Monitor index whose top border defines the top edge of the topology.
0292     **/
0293     int top;
0294 
0295     /**
0296        Monitor index whose bottom border defines the bottom edge of the topology.
0297     **/
0298     int bottom;
0299 
0300     /**
0301        Monitor index whose left border defines the left edge of the topology.
0302     **/
0303     int left;
0304 
0305     /**
0306        Monitor index whose right border defines the right edge of the topology.
0307     **/
0308     int right;
0309 
0310     /**
0311        Convenience check to make sure that we are not holding the initial (invalid)
0312        values. Note that we don't want to call this isValid() because we're not
0313        actually validating the monitor topology here, but merely that our initial
0314        values were overwritten at some point by real (non-negative) monitor indices.
0315     **/
0316     bool isSet() const
0317     {
0318         return (top != -1);
0319     }
0320 };
0321 
0322 /**
0323   Base namespace class.
0324 
0325   The NET API is an implementation of the NET Window Manager Specification.
0326 
0327   This class is the base class for the NETRootInfo and NETWinInfo classes, which
0328   are used to retrieve and modify the properties of windows. To keep
0329   the namespace relatively clean, all enums are defined here.
0330 
0331   @see https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html
0332  **/
0333 
0334 class KWINDOWSYSTEM_EXPORT NET
0335 {
0336 public:
0337     /**
0338        Application role.  This is used internally to determine how several action
0339        should be performed (if at all).
0340     **/
0341 
0342     enum Role {
0343         /**
0344            indicates that the application is a client application.
0345         **/
0346         Client,
0347         /**
0348            indicates that the application is a window manager application.
0349         **/
0350         WindowManager,
0351     };
0352 
0353     /**
0354        Window type.
0355     **/
0356 
0357     enum WindowType {
0358         /**
0359            indicates that the window did not define a window type.
0360         **/
0361         Unknown = -1,
0362         /**
0363            indicates that this is a normal, top-level window
0364         **/
0365         Normal = 0,
0366         /**
0367            indicates a desktop feature. This can include a single window
0368            containing desktop icons with the same dimensions as the screen, allowing
0369            the desktop environment to have full control of the desktop, without the
0370            need for proxying root window clicks.
0371         **/
0372         Desktop = 1,
0373         /**
0374            indicates a dock or panel feature
0375         **/
0376         Dock = 2,
0377         /**
0378            indicates a toolbar window
0379         **/
0380         Toolbar = 3,
0381         /**
0382            indicates a pinnable (torn-off) menu window
0383         **/
0384         Menu = 4,
0385         /**
0386            indicates that this is a dialog window
0387         **/
0388         Dialog = 5,
0389         // cannot deprecate to compiler: used both by clients & manager, later needs to keep supporting it for now
0390         // KF6: remove
0391         /**
0392                @deprecated has unclear meaning and is KDE-only
0393         **/
0394         Override = 6, // NON STANDARD
0395         /**
0396            indicates a toplevel menu (AKA macmenu). This is a KDE extension to the
0397            _NET_WM_WINDOW_TYPE mechanism.
0398         **/
0399         TopMenu = 7, // NON STANDARD
0400         /**
0401            indicates a utility window
0402         **/
0403         Utility = 8,
0404         /**
0405            indicates that this window is a splash screen window.
0406         **/
0407         Splash = 9,
0408         /**
0409            indicates a dropdown menu (from a menubar typically)
0410         **/
0411         DropdownMenu = 10,
0412         /**
0413            indicates a popup menu (a context menu typically)
0414         **/
0415         PopupMenu = 11,
0416         /**
0417            indicates a tooltip window
0418         **/
0419         Tooltip = 12,
0420         /**
0421            indicates a notification window
0422         **/
0423         Notification = 13,
0424         /**
0425            indicates that the window is a list for a combobox
0426         **/
0427         ComboBox = 14,
0428         /**
0429            indicates a window that represents the dragged object during DND operation
0430         **/
0431         DNDIcon = 15,
0432         /**
0433             indicates an On Screen Display window (such as volume feedback)
0434             @since 5.6
0435         **/
0436         OnScreenDisplay = 16, // NON STANDARD
0437         /**
0438             indicates a critical notification (such as battery is running out)
0439             @since 5.58
0440         **/
0441         CriticalNotification = 17, // NON STANDARD
0442         /**
0443          * indicates that this window is an applet.
0444          */
0445         AppletPopup = 18, // NON STANDARD
0446     };
0447 
0448     /**
0449         Values for WindowType when they should be OR'ed together, e.g.
0450         for the properties argument of the NETRootInfo constructor.
0451         @see WindowTypes
0452     **/
0453     enum WindowTypeMask {
0454         NormalMask = 1u << 0, ///< @see Normal
0455         DesktopMask = 1u << 1, ///< @see Desktop
0456         DockMask = 1u << 2, ///< @see Dock
0457         ToolbarMask = 1u << 3, ///< @see Toolbar
0458         MenuMask = 1u << 4, ///< @see Menu
0459         DialogMask = 1u << 5, ///< @see Dialog
0460         OverrideMask = 1u << 6, ///< @see Override
0461         TopMenuMask = 1u << 7, ///< @see TopMenu
0462         UtilityMask = 1u << 8, ///< @see Utility
0463         SplashMask = 1u << 9, ///< @see Splash
0464         DropdownMenuMask = 1u << 10, ///< @see DropdownMenu
0465         PopupMenuMask = 1u << 11, ///< @see PopupMenu
0466         TooltipMask = 1u << 12, ///< @see Tooltip
0467         NotificationMask = 1u << 13, ///< @see Notification
0468         ComboBoxMask = 1u << 14, ///< @see ComboBox
0469         DNDIconMask = 1u << 15, ///< @see DNDIcon
0470         OnScreenDisplayMask = 1u << 16, ///< NON STANDARD @see OnScreenDisplay @since 5.6
0471         CriticalNotificationMask = 1u << 17, ///< NON STANDARD @see CriticalNotification @since 5.58
0472         AppletPopupMask = 1u << 18, ///< NON STANDARD @see AppletPopup
0473         AllTypesMask = 0U - 1, ///< All window types.
0474     };
0475     /**
0476      * Stores a combination of #WindowTypeMask values.
0477      */
0478     Q_DECLARE_FLAGS(WindowTypes, WindowTypeMask)
0479 
0480     /**
0481      * Returns true if the given window type matches the mask given
0482      * using WindowTypeMask flags.
0483      */
0484     static bool typeMatchesMask(WindowType type, WindowTypes mask);
0485 
0486     /**
0487        Window state.
0488 
0489        To set the state of a window, you'll typically do something like:
0490        \code
0491          KWindowSystem::setState( winId(), NET::SkipTaskbar | NET::SkipPager | NET::SkipSwitcher );
0492        \endcode
0493 
0494        for example to not show the window on the taskbar, desktop pager, or window switcher.
0495        winId() is a function of QWidget()
0496 
0497        Note that KeepAbove (StaysOnTop) and KeepBelow are meant as user preference and
0498        applications should avoid setting these states themselves.
0499 
0500        @see States
0501     **/
0502 
0503     enum State {
0504         /**
0505            indicates that this is a modal dialog box. The WM_TRANSIENT_FOR hint
0506            MUST be set to indicate which window the dialog is a modal for, or set to
0507            the root window if the dialog is a modal for its window group.
0508         **/
0509         Modal = 1u << 0,
0510         /**
0511            indicates that the Window Manager SHOULD keep the window's position
0512            fixed on the screen, even when the virtual desktop scrolls. Note that this is
0513            different from being kept on all desktops.
0514         **/
0515         Sticky = 1u << 1,
0516         /**
0517            indicates that the window is vertically maximized.
0518         **/
0519         MaxVert = 1u << 2,
0520         /**
0521            indicates that the window is horizontally maximized.
0522         **/
0523         MaxHoriz = 1u << 3,
0524         /**
0525            convenience value. Equal to MaxVert | MaxHoriz.
0526         **/
0527         Max = MaxVert | MaxHoriz,
0528         /**
0529            indicates that the window is shaded (rolled-up).
0530         **/
0531         Shaded = 1u << 4,
0532         /**
0533            indicates that a window should not be included on a taskbar.
0534         **/
0535         SkipTaskbar = 1u << 5,
0536         /**
0537            indicates that a window should on top of most windows (but below fullscreen
0538            windows).
0539         **/
0540         KeepAbove = 1u << 6,
0541 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
0542         /**
0543            @deprecated Since 5.0. This is an obsolete name for KeepAbove.
0544         **/
0545         StaysOnTop KWINDOWSYSTEM_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use KeepAbove") = KeepAbove, // NOT STANDARD
0546 #endif
0547         /**
0548            indicates that a window should not be included on a pager.
0549         **/
0550         SkipPager = 1u << 7,
0551         /**
0552            indicates that a window should not be visible on the screen (e.g. when minimised).
0553            Only the window manager is allowed to change it.
0554         **/
0555         Hidden = 1u << 8,
0556         /**
0557            indicates that a window should fill the entire screen and have no window
0558            decorations.
0559         **/
0560         FullScreen = 1u << 9,
0561         /**
0562            indicates that a window should be below most windows (but above any desktop windows).
0563         **/
0564         KeepBelow = 1u << 10,
0565         /**
0566            there was an attempt to activate this window, but the window manager prevented
0567            this. E.g. taskbar should mark such window specially to bring user's attention to
0568            this window. Only the window manager is allowed to change it.
0569         **/
0570         DemandsAttention = 1u << 11,
0571         /**
0572            indicates that a window should not be included on a switcher.
0573 
0574            @since 5.45
0575         **/
0576         SkipSwitcher = 1u << 12,
0577         /**
0578           indicates that a client should render as though it has focus
0579           Only the window manager is allowed to change it.
0580           @since 5.58
0581          **/
0582         Focused = 1u << 13,
0583     };
0584     /**
0585      * Stores a combination of #State values.
0586      */
0587     Q_DECLARE_FLAGS(States, State)
0588 
0589     /**
0590        Direction for WMMoveResize.
0591 
0592        When a client wants the Window Manager to start a WMMoveResize, it should
0593        specify one of:
0594 
0595        @li TopLeft
0596        @li Top
0597        @li TopRight
0598        @li Right
0599        @li BottomRight
0600        @li Bottom
0601        @li BottomLeft
0602        @li Left
0603        @li Move (for movement only)
0604        @li KeyboardSize (resizing via keyboard)
0605        @li KeyboardMove (movement via keyboard)
0606     **/
0607 
0608     enum Direction {
0609         TopLeft = 0,
0610         Top = 1,
0611         TopRight = 2,
0612         Right = 3,
0613         BottomRight = 4,
0614         Bottom = 5,
0615         BottomLeft = 6,
0616         Left = 7,
0617         Move = 8, // movement only
0618         KeyboardSize = 9, // size via keyboard
0619         KeyboardMove = 10, // move via keyboard
0620         MoveResizeCancel = 11, // to ask the WM to stop moving a window
0621     };
0622 
0623     /**
0624        Client window mapping state.  The class automatically watches the mapping
0625        state of the client windows, and uses the mapping state to determine how
0626        to set/change different properties. Note that this is very lowlevel
0627        and you most probably don't want to use this state.
0628     **/
0629     enum MappingState {
0630         /**
0631            indicates the client window is visible to the user.
0632         **/
0633         Visible = 1, // NormalState,
0634         /**
0635            indicates that neither the client window nor its icon is visible.
0636         **/
0637         Withdrawn = 0, // WithdrawnState,
0638         /**
0639            indicates that the client window is not visible, but its icon is.
0640            This can be when the window is minimized or when it's on a
0641            different virtual desktop. See also NET::Hidden.
0642         **/
0643         Iconic = 3, // IconicState
0644     };
0645 
0646     /**
0647       Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS).
0648       @see Actions
0649     **/
0650     enum Action {
0651         ActionMove = 1u << 0,
0652         ActionResize = 1u << 1,
0653         ActionMinimize = 1u << 2,
0654         ActionShade = 1u << 3,
0655         ActionStick = 1u << 4,
0656         ActionMaxVert = 1u << 5,
0657         ActionMaxHoriz = 1u << 6,
0658         ActionMax = ActionMaxVert | ActionMaxHoriz,
0659         ActionFullScreen = 1u << 7,
0660         ActionChangeDesktop = 1u << 8,
0661         ActionClose = 1u << 9,
0662     };
0663     /**
0664      * Stores a combination of #Action values.
0665      */
0666     Q_DECLARE_FLAGS(Actions, Action)
0667 
0668     /**
0669        Supported properties.  Clients and Window Managers must define which
0670        properties/protocols it wants to support.
0671 
0672        Root/Desktop window properties and protocols:
0673 
0674        @li Supported
0675        @li ClientList
0676        @li ClientListStacking
0677        @li NumberOfDesktops
0678        @li DesktopGeometry
0679        @li DesktopViewport
0680        @li CurrentDesktop
0681        @li DesktopNames
0682        @li ActiveWindow
0683        @li WorkArea
0684        @li SupportingWMCheck
0685        @li VirtualRoots
0686        @li CloseWindow
0687        @li WMMoveResize
0688 
0689        Client window properties and protocols:
0690 
0691        @li WMName
0692        @li WMVisibleName
0693        @li WMDesktop
0694        @li WMWindowType
0695        @li WMState
0696        @li WMStrut  (obsoleted by WM2ExtendedStrut)
0697        @li WMGeometry
0698        @li WMFrameExtents
0699        @li WMIconGeometry
0700        @li WMIcon
0701        @li WMIconName
0702        @li WMVisibleIconName
0703        @li WMHandledIcons
0704        @li WMPid
0705        @li WMPing
0706 
0707        ICCCM properties (provided for convenience):
0708 
0709        @li XAWMState
0710 
0711        @see Properties
0712     **/
0713 
0714     enum Property {
0715         // root
0716         Supported = 1u << 0,
0717         ClientList = 1u << 1,
0718         ClientListStacking = 1u << 2,
0719         NumberOfDesktops = 1u << 3,
0720         DesktopGeometry = 1u << 4,
0721         DesktopViewport = 1u << 5,
0722         CurrentDesktop = 1u << 6,
0723         DesktopNames = 1u << 7,
0724         ActiveWindow = 1u << 8,
0725         WorkArea = 1u << 9,
0726         SupportingWMCheck = 1u << 10,
0727         VirtualRoots = 1u << 11,
0728         //
0729         CloseWindow = 1u << 13,
0730         WMMoveResize = 1u << 14,
0731 
0732         // window
0733         WMName = 1u << 15,
0734         WMVisibleName = 1u << 16,
0735         WMDesktop = 1u << 17,
0736         WMWindowType = 1u << 18,
0737         WMState = 1u << 19,
0738         WMStrut = 1u << 20,
0739         WMIconGeometry = 1u << 21,
0740         WMIcon = 1u << 22,
0741         WMPid = 1u << 23,
0742         WMHandledIcons = 1u << 24,
0743         WMPing = 1u << 25,
0744         XAWMState = 1u << 27,
0745         WMFrameExtents = 1u << 28,
0746 
0747         // Need to be reordered
0748         WMIconName = 1u << 29,
0749         WMVisibleIconName = 1u << 30,
0750         WMGeometry = 1u << 31,
0751         WMAllProperties = ~0u,
0752     };
0753     /**
0754      * Stores a combination of #Property values.
0755      */
0756     Q_DECLARE_FLAGS(Properties, Property)
0757 
0758     /**
0759         Supported properties. This enum is an extension to NET::Property,
0760         because them enum is limited only to 32 bits.
0761 
0762         Client window properties and protocols:
0763 
0764         @li WM2UserTime
0765         @li WM2StartupId
0766         @li WM2TransientFor mainwindow for the window (WM_TRANSIENT_FOR)
0767         @li WM2GroupLeader  group leader (window_group in WM_HINTS)
0768         @li WM2AllowedActions
0769         @li WM2RestackWindow
0770         @li WM2MoveResizeWindow
0771         @li WM2ExtendedStrut
0772         @li WM2TemporaryRules internal, for kstart
0773         @li WM2WindowClass  WM_CLASS
0774         @li WM2WindowRole   WM_WINDOW_ROLE
0775         @li WM2ClientMachine WM_CLIENT_MACHINE
0776         @li WM2ShowingDesktop
0777         @li WM2Opacity _NET_WM_WINDOW_OPACITY
0778         @li WM2DesktopLayout _NET_DESKTOP_LAYOUT
0779         @li WM2FullPlacement _NET_WM_FULL_PLACEMENT
0780         @li WM2FullscreenMonitors _NET_WM_FULLSCREEN_MONITORS
0781         @li WM2Urgency urgency hint in WM_HINTS (see ICCCM 4.1.2.4)
0782         @li WM2Input input hint (input in WM_HINTS, see ICCCM 4.1.2.4)
0783         @li WM2Protocols see NET::Protocol
0784         @li WM2InitialMappingState initial state hint of WM_HINTS (see ICCCM 4.1.2.4)
0785         @li WM2IconPixmap icon pixmap and mask in WM_HINTS (see ICCCM 4.1.2.4)
0786         @li WM2OpaqueRegion
0787         @li WM2DesktopFileName the base name of the desktop file name or the full path to the desktop file
0788         @li WM2GTKFrameExtents extents of the shadow drawn by the client
0789         @li WM2GTKApplicationId _GTK_APPLICATION_ID
0790         @li WM2GTKShowWindowMenu _GTK_SHOW_WINDOW_MENU
0791 
0792         @see Properties2
0793     **/
0794     enum Property2 {
0795         WM2UserTime = 1u << 0,
0796         WM2StartupId = 1u << 1,
0797         WM2TransientFor = 1u << 2,
0798         WM2GroupLeader = 1u << 3,
0799         WM2AllowedActions = 1u << 4,
0800         WM2RestackWindow = 1u << 5,
0801         WM2MoveResizeWindow = 1u << 6,
0802         WM2ExtendedStrut = 1u << 7,
0803         WM2KDETemporaryRules = 1u << 8, // NOT STANDARD
0804         WM2WindowClass = 1u << 9,
0805         WM2WindowRole = 1u << 10,
0806         WM2ClientMachine = 1u << 11,
0807         WM2ShowingDesktop = 1u << 12,
0808         WM2Opacity = 1u << 13,
0809         WM2DesktopLayout = 1u << 14,
0810         WM2FullPlacement = 1u << 15,
0811         WM2FullscreenMonitors = 1u << 16,
0812         WM2FrameOverlap = 1u << 17, // NOT STANDARD
0813         WM2Activities = 1u << 18, // NOT STANDARD @since 4.6
0814         WM2BlockCompositing = 1u << 19, // NOT STANDARD @since 4.7, STANDARD @since 5.17
0815         WM2KDEShadow = 1u << 20, // NOT Standard @since 4.7
0816         WM2Urgency = 1u << 21, // @since 5.3
0817         WM2Input = 1u << 22, // @since 5.3
0818         WM2Protocols = 1u << 23, // @since 5.3
0819         WM2InitialMappingState = 1u << 24, // @since 5.5
0820         WM2IconPixmap = 1u << 25, // @since 5.7
0821         WM2OpaqueRegion = 1u << 25, // @since 5.7
0822         WM2DesktopFileName = 1u << 26, // NOT STANDARD @since 5.28
0823         WM2GTKFrameExtents = 1u << 27, // NOT STANDARD @since 5.65
0824         WM2AppMenuServiceName = 1u << 28, // NOT STANDARD @since 5.69
0825         WM2AppMenuObjectPath = 1u << 29, // NOT STANDARD @since 5.69
0826         WM2GTKApplicationId = 1u << 30, // NOT STANDARD @since 5.91
0827         WM2GTKShowWindowMenu = 1u << 31, // NOT STANDARD @since 5.96
0828         WM2AllProperties = ~0u,
0829     };
0830     /**
0831      * Stores a combination of #Property2 values.
0832      */
0833     Q_DECLARE_FLAGS(Properties2, Property2)
0834 
0835     /**
0836        Sentinel value to indicate that the client wishes to be visible on
0837        all desktops.
0838      **/
0839     enum {
0840         OnAllDesktops = -1,
0841     };
0842 
0843     /**
0844        Source of the request.
0845     **/
0846     // must match the values for data.l[0] field in _NET_ACTIVE_WINDOW message
0847     enum RequestSource {
0848         /**
0849           @internal indicates that the source of the request is unknown
0850         **/
0851         FromUnknown = 0, // internal
0852         /**
0853            indicates that the request comes from a normal application
0854         **/
0855         FromApplication = 1,
0856         /**
0857            indicated that the request comes from pager or similar tool
0858         **/
0859         FromTool = 2,
0860     };
0861 
0862     /**
0863       Orientation.
0864     **/
0865     enum Orientation {
0866         OrientationHorizontal = 0,
0867         OrientationVertical = 1,
0868     };
0869 
0870     /**
0871      Starting corner for desktop layout.
0872     **/
0873     enum DesktopLayoutCorner {
0874         DesktopLayoutCornerTopLeft = 0,
0875         DesktopLayoutCornerTopRight = 1,
0876         DesktopLayoutCornerBottomLeft = 2,
0877         DesktopLayoutCornerBottomRight = 3,
0878     };
0879 
0880     /**
0881      * Protocols supported by the client.
0882      * See ICCCM 4.1.2.7.
0883      *
0884      * @see Protocols
0885      * @since 5.3
0886      **/
0887     enum Protocol {
0888         NoProtocol = 0,
0889         TakeFocusProtocol = 1 << 0, ///< WM_TAKE_FOCUS
0890         DeleteWindowProtocol = 1 << 1, ///< WM_DELETE_WINDOW
0891         PingProtocol = 1 << 2, ///< _NET_WM_PING from EWMH
0892         SyncRequestProtocol = 1 << 3, ///< _NET_WM_SYNC_REQUEST from EWMH
0893         ContextHelpProtocol = 1 << 4, ///< _NET_WM_CONTEXT_HELP, NON STANDARD!
0894     };
0895     /**
0896      * Stores a combination of #Protocol values.
0897      */
0898     Q_DECLARE_FLAGS(Protocols, Protocol)
0899 
0900     /**
0901      Compares two X timestamps, taking into account wrapping and 64bit architectures.
0902      Return value is like with strcmp(), 0 for equal, -1 for time1 < time2, 1 for time1 > time2.
0903     */
0904     static int timestampCompare(unsigned long time1, unsigned long time2);
0905     /**
0906      Returns a difference of two X timestamps, time2 - time1, where time2 must be later than time1,
0907      as returned by timestampCompare().
0908     */
0909     static int timestampDiff(unsigned long time1, unsigned long time2);
0910 };
0911 
0912 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Properties)
0913 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Properties2)
0914 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::WindowTypes)
0915 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::States)
0916 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Actions)
0917 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Protocols)
0918 
0919 #endif // netwm_def_h