File indexing completed on 2024-04-14 03:57:04

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          KX11Extras::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         /**
0542            indicates that a window should not be included on a pager.
0543         **/
0544         SkipPager = 1u << 7,
0545         /**
0546            indicates that a window should not be visible on the screen (e.g. when minimised).
0547            Only the window manager is allowed to change it.
0548         **/
0549         Hidden = 1u << 8,
0550         /**
0551            indicates that a window should fill the entire screen and have no window
0552            decorations.
0553         **/
0554         FullScreen = 1u << 9,
0555         /**
0556            indicates that a window should be below most windows (but above any desktop windows).
0557         **/
0558         KeepBelow = 1u << 10,
0559         /**
0560            there was an attempt to activate this window, but the window manager prevented
0561            this. E.g. taskbar should mark such window specially to bring user's attention to
0562            this window. Only the window manager is allowed to change it.
0563         **/
0564         DemandsAttention = 1u << 11,
0565         /**
0566            indicates that a window should not be included on a switcher.
0567 
0568            @since 5.45
0569         **/
0570         SkipSwitcher = 1u << 12,
0571         /**
0572           indicates that a client should render as though it has focus
0573           Only the window manager is allowed to change it.
0574           @since 5.58
0575          **/
0576         Focused = 1u << 13,
0577     };
0578     /**
0579      * Stores a combination of #State values.
0580      */
0581     Q_DECLARE_FLAGS(States, State)
0582 
0583     /**
0584        Direction for WMMoveResize.
0585 
0586        When a client wants the Window Manager to start a WMMoveResize, it should
0587        specify one of:
0588 
0589        @li TopLeft
0590        @li Top
0591        @li TopRight
0592        @li Right
0593        @li BottomRight
0594        @li Bottom
0595        @li BottomLeft
0596        @li Left
0597        @li Move (for movement only)
0598        @li KeyboardSize (resizing via keyboard)
0599        @li KeyboardMove (movement via keyboard)
0600     **/
0601 
0602     enum Direction {
0603         TopLeft = 0,
0604         Top = 1,
0605         TopRight = 2,
0606         Right = 3,
0607         BottomRight = 4,
0608         Bottom = 5,
0609         BottomLeft = 6,
0610         Left = 7,
0611         Move = 8, // movement only
0612         KeyboardSize = 9, // size via keyboard
0613         KeyboardMove = 10, // move via keyboard
0614         MoveResizeCancel = 11, // to ask the WM to stop moving a window
0615     };
0616 
0617     /**
0618        Client window mapping state.  The class automatically watches the mapping
0619        state of the client windows, and uses the mapping state to determine how
0620        to set/change different properties. Note that this is very lowlevel
0621        and you most probably don't want to use this state.
0622     **/
0623     enum MappingState {
0624         /**
0625            indicates the client window is visible to the user.
0626         **/
0627         Visible = 1, // NormalState,
0628         /**
0629            indicates that neither the client window nor its icon is visible.
0630         **/
0631         Withdrawn = 0, // WithdrawnState,
0632         /**
0633            indicates that the client window is not visible, but its icon is.
0634            This can be when the window is minimized or when it's on a
0635            different virtual desktop. See also NET::Hidden.
0636         **/
0637         Iconic = 3, // IconicState
0638     };
0639 
0640     /**
0641       Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS).
0642       @see Actions
0643     **/
0644     enum Action {
0645         ActionMove = 1u << 0,
0646         ActionResize = 1u << 1,
0647         ActionMinimize = 1u << 2,
0648         ActionShade = 1u << 3,
0649         ActionStick = 1u << 4,
0650         ActionMaxVert = 1u << 5,
0651         ActionMaxHoriz = 1u << 6,
0652         ActionMax = ActionMaxVert | ActionMaxHoriz,
0653         ActionFullScreen = 1u << 7,
0654         ActionChangeDesktop = 1u << 8,
0655         ActionClose = 1u << 9,
0656     };
0657     /**
0658      * Stores a combination of #Action values.
0659      */
0660     Q_DECLARE_FLAGS(Actions, Action)
0661 
0662     /**
0663        Supported properties.  Clients and Window Managers must define which
0664        properties/protocols it wants to support.
0665 
0666        Root/Desktop window properties and protocols:
0667 
0668        @li Supported
0669        @li ClientList
0670        @li ClientListStacking
0671        @li NumberOfDesktops
0672        @li DesktopGeometry
0673        @li DesktopViewport
0674        @li CurrentDesktop
0675        @li DesktopNames
0676        @li ActiveWindow
0677        @li WorkArea
0678        @li SupportingWMCheck
0679        @li VirtualRoots
0680        @li CloseWindow
0681        @li WMMoveResize
0682 
0683        Client window properties and protocols:
0684 
0685        @li WMName
0686        @li WMVisibleName
0687        @li WMDesktop
0688        @li WMWindowType
0689        @li WMState
0690        @li WMStrut  (obsoleted by WM2ExtendedStrut)
0691        @li WMGeometry
0692        @li WMFrameExtents
0693        @li WMIconGeometry
0694        @li WMIcon
0695        @li WMIconName
0696        @li WMVisibleIconName
0697        @li WMHandledIcons
0698        @li WMPid
0699        @li WMPing
0700 
0701        ICCCM properties (provided for convenience):
0702 
0703        @li XAWMState
0704 
0705        @see Properties
0706     **/
0707 
0708     enum Property {
0709         // root
0710         Supported = 1u << 0,
0711         ClientList = 1u << 1,
0712         ClientListStacking = 1u << 2,
0713         NumberOfDesktops = 1u << 3,
0714         DesktopGeometry = 1u << 4,
0715         DesktopViewport = 1u << 5,
0716         CurrentDesktop = 1u << 6,
0717         DesktopNames = 1u << 7,
0718         ActiveWindow = 1u << 8,
0719         WorkArea = 1u << 9,
0720         SupportingWMCheck = 1u << 10,
0721         VirtualRoots = 1u << 11,
0722         //
0723         CloseWindow = 1u << 13,
0724         WMMoveResize = 1u << 14,
0725 
0726         // window
0727         WMName = 1u << 15,
0728         WMVisibleName = 1u << 16,
0729         WMDesktop = 1u << 17,
0730         WMWindowType = 1u << 18,
0731         WMState = 1u << 19,
0732         WMStrut = 1u << 20,
0733         WMIconGeometry = 1u << 21,
0734         WMIcon = 1u << 22,
0735         WMPid = 1u << 23,
0736         WMHandledIcons = 1u << 24,
0737         WMPing = 1u << 25,
0738         XAWMState = 1u << 27,
0739         WMFrameExtents = 1u << 28,
0740 
0741         // Need to be reordered
0742         WMIconName = 1u << 29,
0743         WMVisibleIconName = 1u << 30,
0744         WMGeometry = 1u << 31,
0745         WMAllProperties = ~0u,
0746     };
0747     /**
0748      * Stores a combination of #Property values.
0749      */
0750     Q_DECLARE_FLAGS(Properties, Property)
0751 
0752     /**
0753         Supported properties. This enum is an extension to NET::Property,
0754         because them enum is limited only to 32 bits.
0755 
0756         Client window properties and protocols:
0757 
0758         @li WM2UserTime
0759         @li WM2StartupId
0760         @li WM2TransientFor mainwindow for the window (WM_TRANSIENT_FOR)
0761         @li WM2GroupLeader  group leader (window_group in WM_HINTS)
0762         @li WM2AllowedActions
0763         @li WM2RestackWindow
0764         @li WM2MoveResizeWindow
0765         @li WM2ExtendedStrut
0766         @li WM2TemporaryRules internal, for kstart
0767         @li WM2WindowClass  WM_CLASS
0768         @li WM2WindowRole   WM_WINDOW_ROLE
0769         @li WM2ClientMachine WM_CLIENT_MACHINE
0770         @li WM2ShowingDesktop
0771         @li WM2Opacity _NET_WM_WINDOW_OPACITY
0772         @li WM2DesktopLayout _NET_DESKTOP_LAYOUT
0773         @li WM2FullPlacement _NET_WM_FULL_PLACEMENT
0774         @li WM2FullscreenMonitors _NET_WM_FULLSCREEN_MONITORS
0775         @li WM2Urgency urgency hint in WM_HINTS (see ICCCM 4.1.2.4)
0776         @li WM2Input input hint (input in WM_HINTS, see ICCCM 4.1.2.4)
0777         @li WM2Protocols see NET::Protocol
0778         @li WM2InitialMappingState initial state hint of WM_HINTS (see ICCCM 4.1.2.4)
0779         @li WM2IconPixmap icon pixmap and mask in WM_HINTS (see ICCCM 4.1.2.4)
0780         @li WM2OpaqueRegion
0781         @li WM2DesktopFileName the base name of the desktop file name or the full path to the desktop file
0782         @li WM2GTKFrameExtents extents of the shadow drawn by the client
0783         @li WM2GTKApplicationId _GTK_APPLICATION_ID
0784         @li WM2GTKShowWindowMenu _GTK_SHOW_WINDOW_MENU
0785 
0786         @see Properties2
0787     **/
0788     enum Property2 {
0789         WM2UserTime = 1u << 0,
0790         WM2StartupId = 1u << 1,
0791         WM2TransientFor = 1u << 2,
0792         WM2GroupLeader = 1u << 3,
0793         WM2AllowedActions = 1u << 4,
0794         WM2RestackWindow = 1u << 5,
0795         WM2MoveResizeWindow = 1u << 6,
0796         WM2ExtendedStrut = 1u << 7,
0797         WM2KDETemporaryRules = 1u << 8, // NOT STANDARD
0798         WM2WindowClass = 1u << 9,
0799         WM2WindowRole = 1u << 10,
0800         WM2ClientMachine = 1u << 11,
0801         WM2ShowingDesktop = 1u << 12,
0802         WM2Opacity = 1u << 13,
0803         WM2DesktopLayout = 1u << 14,
0804         WM2FullPlacement = 1u << 15,
0805         WM2FullscreenMonitors = 1u << 16,
0806         WM2FrameOverlap = 1u << 17, // NOT STANDARD
0807         WM2Activities = 1u << 18, // NOT STANDARD @since 4.6
0808         WM2BlockCompositing = 1u << 19, // NOT STANDARD @since 4.7, STANDARD @since 5.17
0809         WM2KDEShadow = 1u << 20, // NOT Standard @since 4.7
0810         WM2Urgency = 1u << 21, // @since 5.3
0811         WM2Input = 1u << 22, // @since 5.3
0812         WM2Protocols = 1u << 23, // @since 5.3
0813         WM2InitialMappingState = 1u << 24, // @since 5.5
0814         WM2IconPixmap = 1u << 25, // @since 5.7
0815         WM2OpaqueRegion = 1u << 25, // @since 5.7
0816         WM2DesktopFileName = 1u << 26, // NOT STANDARD @since 5.28
0817         WM2GTKFrameExtents = 1u << 27, // NOT STANDARD @since 5.65
0818         WM2AppMenuServiceName = 1u << 28, // NOT STANDARD @since 5.69
0819         WM2AppMenuObjectPath = 1u << 29, // NOT STANDARD @since 5.69
0820         WM2GTKApplicationId = 1u << 30, // NOT STANDARD @since 5.91
0821         WM2GTKShowWindowMenu = 1u << 31, // NOT STANDARD @since 5.96
0822         WM2AllProperties = ~0u,
0823     };
0824     /**
0825      * Stores a combination of #Property2 values.
0826      */
0827     Q_DECLARE_FLAGS(Properties2, Property2)
0828 
0829     /**
0830        Sentinel value to indicate that the client wishes to be visible on
0831        all desktops.
0832      **/
0833     enum {
0834         OnAllDesktops = -1,
0835     };
0836 
0837     /**
0838        Source of the request.
0839     **/
0840     // must match the values for data.l[0] field in _NET_ACTIVE_WINDOW message
0841     enum RequestSource {
0842         /**
0843           @internal indicates that the source of the request is unknown
0844         **/
0845         FromUnknown = 0, // internal
0846         /**
0847            indicates that the request comes from a normal application
0848         **/
0849         FromApplication = 1,
0850         /**
0851            indicated that the request comes from pager or similar tool
0852         **/
0853         FromTool = 2,
0854     };
0855 
0856     /**
0857       Orientation.
0858     **/
0859     enum Orientation {
0860         OrientationHorizontal = 0,
0861         OrientationVertical = 1,
0862     };
0863 
0864     /**
0865      Starting corner for desktop layout.
0866     **/
0867     enum DesktopLayoutCorner {
0868         DesktopLayoutCornerTopLeft = 0,
0869         DesktopLayoutCornerTopRight = 1,
0870         DesktopLayoutCornerBottomLeft = 2,
0871         DesktopLayoutCornerBottomRight = 3,
0872     };
0873 
0874     /**
0875      * Protocols supported by the client.
0876      * See ICCCM 4.1.2.7.
0877      *
0878      * @see Protocols
0879      * @since 5.3
0880      **/
0881     enum Protocol {
0882         NoProtocol = 0,
0883         TakeFocusProtocol = 1 << 0, ///< WM_TAKE_FOCUS
0884         DeleteWindowProtocol = 1 << 1, ///< WM_DELETE_WINDOW
0885         PingProtocol = 1 << 2, ///< _NET_WM_PING from EWMH
0886         SyncRequestProtocol = 1 << 3, ///< _NET_WM_SYNC_REQUEST from EWMH
0887         ContextHelpProtocol = 1 << 4, ///< _NET_WM_CONTEXT_HELP, NON STANDARD!
0888     };
0889     /**
0890      * Stores a combination of #Protocol values.
0891      */
0892     Q_DECLARE_FLAGS(Protocols, Protocol)
0893 
0894     /**
0895      Compares two X timestamps, taking into account wrapping and 64bit architectures.
0896      Return value is like with strcmp(), 0 for equal, -1 for time1 < time2, 1 for time1 > time2.
0897     */
0898     static int timestampCompare(unsigned long time1, unsigned long time2);
0899     /**
0900      Returns a difference of two X timestamps, time2 - time1, where time2 must be later than time1,
0901      as returned by timestampCompare().
0902     */
0903     static int timestampDiff(unsigned long time1, unsigned long time2);
0904 };
0905 
0906 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Properties)
0907 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Properties2)
0908 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::WindowTypes)
0909 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::States)
0910 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Actions)
0911 Q_DECLARE_OPERATORS_FOR_FLAGS(NET::Protocols)
0912 
0913 #endif // netwm_def_h