File indexing completed on 2024-04-28 07:48:29
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_h 0009 #define netwm_h 0010 0011 #include <QSize> 0012 #include <config-kwindowsystem.h> 0013 #include <kwindowsystem_export.h> 0014 #if KWINDOWSYSTEM_HAVE_X11 0015 #include <vector> 0016 #include <xcb/xcb.h> 0017 0018 #include "netwm_def.h" 0019 0020 #define KDE_ALL_ACTIVITIES_UUID "00000000-0000-0000-0000-000000000000" 0021 0022 // forward declaration 0023 struct NETRootInfoPrivate; 0024 struct NETWinInfoPrivate; 0025 template<class Z> 0026 class NETRArray; 0027 0028 /** 0029 Common API for root window properties/protocols. 0030 0031 The NETRootInfo class provides a common API for clients and window managers 0032 to set/read/change properties on the root window as defined by the NET Window 0033 Manager Specification.. 0034 0035 @author Bradley T. Hughes <bhughes@trolltech.com> 0036 @see NET 0037 @see NETWinInfo 0038 **/ 0039 0040 class KWINDOWSYSTEM_EXPORT NETRootInfo : public NET 0041 { 0042 public: 0043 /** 0044 Indexes for the properties array. 0045 **/ 0046 // update also NETRootInfoPrivate::properties[] size when extending this 0047 enum { 0048 PROTOCOLS, 0049 WINDOW_TYPES, 0050 STATES, 0051 PROTOCOLS2, 0052 ACTIONS, 0053 PROPERTIES_SIZE, 0054 }; 0055 0056 /** 0057 Window Managers should use this constructor to create a NETRootInfo object, 0058 which will be used to set/update information stored on the rootWindow. 0059 The application role is automatically set to WindowManager 0060 when using this constructor. 0061 0062 @param connection XCB connection 0063 0064 @param supportWindow The Window id of the supportWindow. The supportWindow 0065 must be created by the window manager as a child of the rootWindow. The 0066 supportWindow must not be destroyed until the Window Manager exits. 0067 0068 @param wmName A string which should be the window manager's name (ie. "KWin" 0069 or "Blackbox"). 0070 0071 @param properties The properties the window manager supports 0072 0073 @param windowTypes The window types the window manager supports 0074 0075 @param states The states the window manager supports 0076 0077 @param properties2 The properties2 the window manager supports 0078 0079 @param actions The actions the window manager supports 0080 0081 @param screen For Window Managers that support multiple screen (ie. 0082 "multiheaded") displays, the screen number may be explicitly defined. If 0083 this argument is omitted, the default screen will be used. 0084 0085 @param doActivate true to activate the window 0086 **/ 0087 NETRootInfo(xcb_connection_t *connection, 0088 xcb_window_t supportWindow, 0089 const char *wmName, 0090 NET::Properties properties, 0091 NET::WindowTypes windowTypes, 0092 NET::States states, 0093 NET::Properties2 properties2, 0094 NET::Actions actions, 0095 int screen = -1, 0096 bool doActivate = true); 0097 0098 /** 0099 Clients should use this constructor to create a NETRootInfo object, which 0100 will be used to query information set on the root window. The application 0101 role is automatically set to Client when using this constructor. 0102 0103 @param connection XCB connection 0104 0105 @param properties The properties the client is interested in. 0106 0107 @param properties2 The properties2 the client is interested in. 0108 0109 @param properties_size The number of elements in the properties array. 0110 0111 @param screen For Clients that support multiple screen (ie. "multiheaded") 0112 displays, the screen number may be explicitly defined. If this argument is 0113 omitted, the default screen will be used. 0114 0115 @param doActivate true to call activate() to do an initial data read/update 0116 of the query information. 0117 **/ 0118 NETRootInfo(xcb_connection_t *connection, 0119 NET::Properties properties, 0120 NET::Properties2 properties2 = NET::Properties2(), 0121 int screen = -1, 0122 bool doActivate = true); 0123 0124 /** 0125 Creates a shared copy of the specified NETRootInfo object. 0126 0127 @param rootinfo the NETRootInfo object to copy 0128 **/ 0129 NETRootInfo(const NETRootInfo &rootinfo); 0130 0131 /** 0132 Destroys the NETRootInfo object. 0133 **/ 0134 virtual ~NETRootInfo(); 0135 0136 /** 0137 Returns the xcb connection used. 0138 0139 @return the XCB connection 0140 **/ 0141 xcb_connection_t *xcbConnection() const; 0142 0143 /** 0144 Returns the Window id of the rootWindow. 0145 0146 @return the id of the root window 0147 **/ 0148 xcb_window_t rootWindow() const; 0149 0150 /** 0151 Returns the Window id of the supportWindow. 0152 0153 @return the id of the support window 0154 **/ 0155 xcb_window_t supportWindow() const; 0156 0157 /** 0158 Returns the name of the Window Manager. 0159 0160 @return the name of the window manager 0161 **/ 0162 const char *wmName() const; 0163 0164 /** 0165 Sets the given property if on is true, and clears the property otherwise. 0166 In WindowManager mode this function updates _NET_SUPPORTED. 0167 In Client mode this function does nothing. 0168 0169 @since 4.4 0170 **/ 0171 void setSupported(NET::Property property, bool on = true); 0172 0173 /** 0174 @overload 0175 @since 4.4 0176 **/ 0177 void setSupported(NET::Property2 property, bool on = true); 0178 0179 /** 0180 @overload 0181 @since 4.4 0182 **/ 0183 void setSupported(NET::WindowTypeMask property, bool on = true); 0184 0185 /** 0186 @overload 0187 @since 4.4 0188 **/ 0189 void setSupported(NET::State property, bool on = true); 0190 0191 /** 0192 @overload 0193 @since 4.4 0194 **/ 0195 void setSupported(NET::Action property, bool on = true); 0196 0197 /** 0198 Returns true if the given property is supported by the window 0199 manager. Note that for Client mode, NET::Supported needs 0200 to be passed in the properties argument for this to work. 0201 **/ 0202 bool isSupported(NET::Property property) const; 0203 /** 0204 @overload 0205 **/ 0206 bool isSupported(NET::Property2 property) const; 0207 /** 0208 @overload 0209 **/ 0210 bool isSupported(NET::WindowTypeMask type) const; 0211 /** 0212 @overload 0213 **/ 0214 bool isSupported(NET::State state) const; 0215 0216 /** 0217 @overload 0218 **/ 0219 bool isSupported(NET::Action action) const; 0220 0221 /** 0222 In the Window Manager mode, this is equivalent to the properties 0223 argument passed to the constructor. In the Client mode, if 0224 NET::Supported was passed in the properties argument, the returned 0225 value are all properties supported by the Window Manager. Other supported 0226 protocols and properties are returned by the specific methods. 0227 @see supportedProperties2() 0228 @see supportedStates() 0229 @see supportedWindowTypes() 0230 @see supportedActions() 0231 **/ 0232 NET::Properties supportedProperties() const; 0233 /** 0234 * In the Window Manager mode, this is equivalent to the properties2 0235 * argument passed to the constructor. In the Client mode, if 0236 * NET::Supported was passed in the properties argument, the returned 0237 * value are all properties2 supported by the Window Manager. Other supported 0238 * protocols and properties are returned by the specific methods. 0239 * @see supportedProperties() 0240 * @see supportedStates() 0241 * @see supportedWindowTypes() 0242 * @see supportedActions() 0243 * @since 5.0 0244 **/ 0245 NET::Properties2 supportedProperties2() const; 0246 /** 0247 * In the Window Manager mode, this is equivalent to the states 0248 * argument passed to the constructor. In the Client mode, if 0249 * NET::Supported was passed in the properties argument, the returned 0250 * value are all states supported by the Window Manager. Other supported 0251 * protocols and properties are returned by the specific methods. 0252 * @see supportedProperties() 0253 @see supportedProperties2() 0254 * @see supportedWindowTypes() 0255 * @see supportedActions() 0256 * @since 5.0 0257 **/ 0258 NET::States supportedStates() const; 0259 /** 0260 * In the Window Manager mode, this is equivalent to the windowTypes 0261 * argument passed to the constructor. In the Client mode, if 0262 * NET::Supported was passed in the properties argument, the returned 0263 * value are all window types supported by the Window Manager. Other supported 0264 * protocols and properties are returned by the specific methods. 0265 * @see supportedProperties() 0266 @see supportedProperties2() 0267 * @see supportedStates() 0268 * @see supportedActions() 0269 * @since 5.0 0270 **/ 0271 NET::WindowTypes supportedWindowTypes() const; 0272 /** 0273 * In the Window Manager mode, this is equivalent to the actions 0274 * argument passed to the constructor. In the Client mode, if 0275 * NET::Supported was passed in the properties argument, the returned 0276 * value are all actions supported by the Window Manager. Other supported 0277 * protocols and properties are returned by the specific methods. 0278 * @see supportedProperties() 0279 @see supportedProperties2() 0280 * @see supportedStates() 0281 * @see supportedWindowTypes() 0282 * @since 5.0 0283 **/ 0284 NET::Actions supportedActions() const; 0285 0286 /** 0287 * @returns the properties argument passed to the constructor. 0288 * @see passedProperties2() 0289 * @see passedStates() 0290 * @see passedWindowTypes() 0291 * @see passedActions() 0292 **/ 0293 NET::Properties passedProperties() const; 0294 /** 0295 * @returns the properties2 argument passed to the constructor. 0296 * @see passedProperties() 0297 * @see passedStates() 0298 * @see passedWindowTypes() 0299 * @see passedActions() 0300 * @since 5.0 0301 **/ 0302 NET::Properties2 passedProperties2() const; 0303 /** 0304 * @returns the states argument passed to the constructor. 0305 * @see passedProperties() 0306 * @see passedProperties2() 0307 * @see passedWindowTypes() 0308 * @see passedActions() 0309 * @since 5.0 0310 **/ 0311 NET::States passedStates() const; 0312 /** 0313 * @returns the windowTypes argument passed to the constructor. 0314 * @see passedProperties() 0315 * @see passedProperties2() 0316 * @see passedStates() 0317 * @see passedActions() 0318 * @since 5.0 0319 **/ 0320 NET::WindowTypes passedWindowTypes() const; 0321 /** 0322 * @returns the actions argument passed to the constructor. 0323 * @see passedProperties() 0324 * @see passedProperties2() 0325 * @see passedStates() 0326 * @see passedWindowTypes() 0327 * @since 5.0 0328 **/ 0329 NET::Actions passedActions() const; 0330 0331 /** 0332 Returns an array of Window id's, which contain all managed windows. 0333 0334 @return the array of Window id's 0335 0336 @see clientListCount() 0337 **/ 0338 const xcb_window_t *clientList() const; 0339 0340 /** 0341 Returns the number of managed windows in clientList array. 0342 0343 @return the number of managed windows in the clientList array 0344 0345 @see clientList() 0346 **/ 0347 int clientListCount() const; 0348 0349 /** 0350 Returns an array of Window id's, which contain all managed windows in 0351 stacking order. 0352 0353 @return the array of Window id's in stacking order 0354 0355 @see clientListStackingCount() 0356 **/ 0357 const xcb_window_t *clientListStacking() const; 0358 0359 /** 0360 Returns the number of managed windows in the clientListStacking array. 0361 0362 @return the number of Window id's in the client list 0363 0364 @see clientListStacking() 0365 **/ 0366 int clientListStackingCount() const; 0367 0368 /** 0369 Returns the desktop geometry size. 0370 0371 NOTE: KDE uses virtual desktops and does not directly support 0372 viewport in any way. You should use calls for virtual desktops, 0373 viewport is mapped to them if needed. 0374 0375 @return the size of the desktop 0376 **/ 0377 NETSize desktopGeometry() const; 0378 0379 /** 0380 Returns the viewport of the specified desktop. 0381 0382 NOTE: KDE uses virtual desktops and does not directly support 0383 viewport in any way. You should use calls for virtual desktops, 0384 viewport is mapped to them if needed. 0385 0386 @param desktop the number of the desktop 0387 0388 @return the position of the desktop's viewport 0389 **/ 0390 NETPoint desktopViewport(int desktop) const; 0391 0392 /** 0393 Returns the workArea for the specified desktop. 0394 0395 @param desktop the number of the desktop 0396 0397 @return the size of the work area 0398 **/ 0399 NETRect workArea(int desktop) const; 0400 0401 /** 0402 Returns the name for the specified desktop. 0403 0404 @param desktop the number of the desktop 0405 0406 @return the name of the desktop 0407 **/ 0408 const char *desktopName(int desktop) const; 0409 0410 /** 0411 Returns an array of Window id's, which contain the virtual root windows. 0412 0413 @return the array of Window id's 0414 0415 @see virtualRootsCount() 0416 **/ 0417 const xcb_window_t *virtualRoots() const; 0418 0419 /** 0420 Returns the number of window in the virtualRoots array. 0421 0422 @return the number of Window id's in the virtual root array 0423 0424 @see virtualRoots() 0425 **/ 0426 int virtualRootsCount() const; 0427 0428 /** 0429 Returns the desktop layout orientation. 0430 **/ 0431 NET::Orientation desktopLayoutOrientation() const; 0432 0433 /** 0434 Returns the desktop layout number of columns and rows. Note that 0435 either may be 0 (see _NET_DESKTOP_LAYOUT). 0436 **/ 0437 QSize desktopLayoutColumnsRows() const; 0438 0439 /** 0440 Returns the desktop layout starting corner. 0441 **/ 0442 NET::DesktopLayoutCorner desktopLayoutCorner() const; 0443 0444 /** 0445 Returns the number of desktops. 0446 0447 NOTE: KDE uses virtual desktops and does not directly support 0448 viewport in any way. They are however mapped to virtual desktops 0449 if needed. 0450 0451 @param ignore_viewport if false, viewport is mapped to virtual desktops 0452 0453 @return the number of desktops 0454 **/ 0455 int numberOfDesktops(bool ignore_viewport = false) const; 0456 0457 /** 0458 Returns the current desktop. 0459 0460 NOTE: KDE uses virtual desktops and does not directly support 0461 viewport in any way. They are however mapped to virtual desktops 0462 if needed. 0463 0464 @param ignore_viewport if false, viewport is mapped to virtual desktops 0465 0466 @return the number of the current desktop 0467 **/ 0468 int currentDesktop(bool ignore_viewport = false) const; 0469 0470 /** 0471 Returns the active (focused) window. 0472 0473 @return the id of the active window 0474 **/ 0475 xcb_window_t activeWindow() const; 0476 0477 /** 0478 Window Managers must call this after creating the NETRootInfo object, and 0479 before using any other method in the class. This method sets initial data 0480 on the root window and does other post-construction duties. 0481 0482 Clients must also call this after creating the object to do an initial 0483 data read/update. 0484 **/ 0485 void activate(); 0486 0487 /** 0488 Sets the list of managed windows on the Root/Desktop window. 0489 0490 @param windows The array of Window id's 0491 0492 @param count The number of windows in the array 0493 **/ 0494 void setClientList(const xcb_window_t *windows, unsigned int count); 0495 0496 /** 0497 Sets the list of managed windows in stacking order on the Root/Desktop 0498 window. 0499 0500 @param windows The array of Window id's 0501 0502 @param count The number of windows in the array. 0503 **/ 0504 void setClientListStacking(const xcb_window_t *windows, unsigned int count); 0505 0506 /** 0507 Sets the current desktop to the specified desktop. 0508 0509 NOTE: KDE uses virtual desktops and does not directly support 0510 viewport in any way. It is however mapped to virtual desktops 0511 if needed. 0512 0513 @param desktop the number of the desktop 0514 @param ignore_viewport if false, viewport is mapped to virtual desktops 0515 **/ 0516 void setCurrentDesktop(int desktop, bool ignore_viewport = false); 0517 0518 /** 0519 Sets the desktop geometry to the specified geometry. 0520 0521 NOTE: KDE uses virtual desktops and does not directly support 0522 viewport in any way. You should use calls for virtual desktops, 0523 viewport is mapped to them if needed. 0524 0525 @param geometry the new size of the desktop 0526 **/ 0527 void setDesktopGeometry(const NETSize &geometry); 0528 0529 /** 0530 Sets the viewport for the current desktop to the specified point. 0531 0532 NOTE: KDE uses virtual desktops and does not directly support 0533 viewport in any way. You should use calls for virtual desktops, 0534 viewport is mapped to them if needed. 0535 0536 @param desktop the number of the desktop 0537 0538 @param viewport the new position of the desktop's viewport 0539 **/ 0540 void setDesktopViewport(int desktop, const NETPoint &viewport); 0541 0542 /** 0543 Sets the number of desktops to the specified number. 0544 0545 NOTE: KDE uses virtual desktops and does not directly support 0546 viewport in any way. Viewport is mapped to virtual desktops 0547 if needed, but not for this call. 0548 0549 @param numberOfDesktops the number of desktops 0550 **/ 0551 void setNumberOfDesktops(int numberOfDesktops); 0552 0553 /** 0554 Sets the name of the specified desktop. 0555 0556 NOTE: KDE uses virtual desktops and does not directly support 0557 viewport in any way. Viewport is mapped to virtual desktops 0558 if needed, but not for this call. 0559 0560 @param desktop the number of the desktop 0561 0562 @param desktopName the new name of the desktop 0563 **/ 0564 void setDesktopName(int desktop, const char *desktopName); 0565 0566 /** 0567 Requests that the specified window becomes the active (focused) one. 0568 0569 @param window the id of the new active window 0570 @param src whether the request comes from normal application 0571 or from a pager or similar tool 0572 @param timestamp X server timestamp of the user action that 0573 caused the request 0574 @param active_window active window of the requesting application, if any 0575 **/ 0576 void setActiveWindow(xcb_window_t window, NET::RequestSource src, xcb_timestamp_t timestamp, xcb_window_t active_window); 0577 0578 /** 0579 Sets the active (focused) window the specified window. This should 0580 be used only in the window manager mode. 0581 0582 @param window the if of the new active window 0583 **/ 0584 void setActiveWindow(xcb_window_t window); 0585 0586 /** 0587 Sets the workarea for the specified desktop 0588 0589 @param desktop the number of the desktop 0590 0591 @param workArea the new work area of the desktop 0592 **/ 0593 void setWorkArea(int desktop, const NETRect &workArea); 0594 0595 /** 0596 Sets the list of virtual root windows on the root window. 0597 0598 @param windows The array of Window id's 0599 0600 @param count The number of windows in the array. 0601 **/ 0602 void setVirtualRoots(const xcb_window_t *windows, unsigned int count); 0603 0604 /** 0605 Sets the desktop layout. This is set by the pager. When setting, the pager must 0606 own the _NET_DESKTOP_LAYOUT_Sn manager selection. See _NET_DESKTOP_LAYOUT for details. 0607 **/ 0608 void setDesktopLayout(NET::Orientation orientation, int columns, int rows, NET::DesktopLayoutCorner corner); 0609 0610 /** 0611 * Sets the _NET_SHOWING_DESKTOP status (whether desktop is being shown). 0612 */ 0613 void setShowingDesktop(bool showing); 0614 /** 0615 * Returns the status of _NET_SHOWING_DESKTOP. 0616 */ 0617 bool showingDesktop() const; 0618 0619 /** 0620 Assignment operator. Ensures that the shared data reference counts are 0621 correct. 0622 **/ 0623 const NETRootInfo &operator=(const NETRootInfo &rootinfo); 0624 0625 /** 0626 Clients (such as pagers/taskbars) that wish to close a window should call 0627 this function. This will send a request to the Window Manager, which 0628 usually can usually decide how to react to such requests. 0629 0630 @param window the id of the window to close 0631 **/ 0632 void closeWindowRequest(xcb_window_t window); 0633 0634 /** 0635 Clients (such as pagers/taskbars) that wish to start a WMMoveResize 0636 (where the window manager controls the resize/movement, 0637 i.e. _NET_WM_MOVERESIZE) should call this function. 0638 This will send a request to the Window Manager. 0639 0640 @param window The client window that would be resized/moved. 0641 0642 @param x_root X position of the cursor relative to the root window. 0643 0644 @param y_root Y position of the cursor relative to the root window. 0645 0646 @param direction One of NET::Direction (see base class documentation for 0647 a description of the different directions). 0648 **/ 0649 void moveResizeRequest(xcb_window_t window, int x_root, int y_root, Direction direction); 0650 0651 /** 0652 Clients (such as pagers/taskbars) that wish to move/resize a window 0653 using WM2MoveResizeWindow (_NET_MOVERESIZE_WINDOW) should call this function. 0654 This will send a request to the Window Manager. See _NET_MOVERESIZE_WINDOW 0655 description for details. 0656 0657 @param window The client window that would be resized/moved. 0658 @param flags Flags specifying the operation (see _NET_MOVERESIZE_WINDOW description) 0659 @param x Requested X position for the window 0660 @param y Requested Y position for the window 0661 @param width Requested width for the window 0662 @param height Requested height for the window 0663 **/ 0664 void moveResizeWindowRequest(xcb_window_t window, int flags, int x, int y, int width, int height); 0665 0666 /** 0667 Clients that wish to show the window menu using WM2GTKShowWindowMenu 0668 (_GTK_SHOW_WINDOW_MENU) should call this function. 0669 This will send a request to the Window Manager. See _GTK_SHOW_WINDOW_MENU 0670 description for details. 0671 0672 @param window The client window that would be resized/moved. 0673 @param device_id GTK device id 0674 @param x Requested X position for the menu relative to the root window 0675 @param y Requested Y position for the menu relative to the root window 0676 **/ 0677 void showWindowMenuRequest(xcb_window_t window, int device_id, int x_root, int y_root); 0678 0679 /** 0680 Sends the _NET_RESTACK_WINDOW request. 0681 **/ 0682 void restackRequest(xcb_window_t window, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp); 0683 0684 /** 0685 Sends a ping with the given timestamp to the window, using 0686 the _NET_WM_PING protocol. 0687 */ 0688 void sendPing(xcb_window_t window, xcb_timestamp_t timestamp); 0689 0690 /** 0691 * This function takes the passed xcb_generic_event_t and returns the updated properties in the passed in arguments. 0692 * 0693 * The new information will be read immediately by the class. It is possible to pass in a 0694 * null pointer in the arguments. In that case the passed in argument will obviously not 0695 * be updated, but the class will process the information nevertheless. 0696 * 0697 * @param event the event 0698 * @param properties The NET::Properties that changed 0699 * @param properties2 The NET::Properties2 that changed 0700 * @since 5.0 0701 **/ 0702 void event(xcb_generic_event_t *event, NET::Properties *properties, NET::Properties2 *properties2 = nullptr); 0703 0704 /** 0705 This function takes the passed XEvent and returns an OR'ed list of 0706 NETRootInfo properties that have changed. The new information will be 0707 read immediately by the class. This overloaded version returns 0708 only a single mask, and therefore cannot check state of all properties 0709 like the other variant. 0710 0711 @param event the event 0712 0713 @return the properties 0714 **/ 0715 NET::Properties event(xcb_generic_event_t *event); 0716 0717 protected: 0718 /** 0719 A Client should subclass NETRootInfo and reimplement this function when 0720 it wants to know when a window has been added. 0721 0722 @param window the id of the window to add 0723 **/ 0724 virtual void addClient(xcb_window_t window) 0725 { 0726 Q_UNUSED(window); 0727 } 0728 0729 /** 0730 A Client should subclass NETRootInfo and reimplement this function when 0731 it wants to know when a window has been removed. 0732 0733 @param window the id of the window to remove 0734 **/ 0735 virtual void removeClient(xcb_window_t window) 0736 { 0737 Q_UNUSED(window); 0738 } 0739 0740 /** 0741 A Window Manager should subclass NETRootInfo and reimplement this function 0742 when it wants to know when a Client made a request to change the number 0743 of desktops. 0744 0745 @param numberOfDesktops the new number of desktops 0746 **/ 0747 virtual void changeNumberOfDesktops(int numberOfDesktops) 0748 { 0749 Q_UNUSED(numberOfDesktops); 0750 } 0751 0752 /** 0753 A Window Manager should subclass NETRootInfo and reimplement this function 0754 when it wants to know when a Client made a request to change the specified 0755 desktop geometry. 0756 0757 @param desktop the number of the desktop 0758 0759 @param geom the new size 0760 **/ 0761 virtual void changeDesktopGeometry(int desktop, const NETSize &geom) 0762 { 0763 Q_UNUSED(desktop); 0764 Q_UNUSED(geom); 0765 } 0766 0767 /** 0768 A Window Manager should subclass NETRootInfo and reimplement this function 0769 when it wants to know when a Client made a request to change the specified 0770 desktop viewport. 0771 0772 @param desktop the number of the desktop 0773 0774 @param viewport the new position of the viewport 0775 **/ 0776 virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) 0777 { 0778 Q_UNUSED(desktop); 0779 Q_UNUSED(viewport); 0780 } 0781 0782 /** 0783 A Window Manager should subclass NETRootInfo and reimplement this function 0784 when it wants to know when a Client made a request to change the current 0785 desktop. 0786 0787 @param desktop the number of the desktop 0788 **/ 0789 virtual void changeCurrentDesktop(int desktop) 0790 { 0791 Q_UNUSED(desktop); 0792 } 0793 0794 /** 0795 A Window Manager should subclass NETRootInfo and reimplement this function 0796 when it wants to know when a Client made a request to close a window. 0797 0798 @param window the id of the window to close 0799 **/ 0800 virtual void closeWindow(xcb_window_t window) 0801 { 0802 Q_UNUSED(window); 0803 } 0804 0805 /** 0806 A Window Manager should subclass NETRootInfo and reimplement this function 0807 when it wants to know when a Client made a request to start a move/resize. 0808 0809 @param window The window that wants to move/resize 0810 0811 @param x_root X position of the cursor relative to the root window. 0812 0813 @param y_root Y position of the cursor relative to the root window. 0814 0815 @param direction One of NET::Direction (see base class documentation for 0816 a description of the different directions). 0817 **/ 0818 virtual void moveResize(xcb_window_t window, int x_root, int y_root, unsigned long direction) 0819 { 0820 Q_UNUSED(window); 0821 Q_UNUSED(x_root); 0822 Q_UNUSED(y_root); 0823 Q_UNUSED(direction); 0824 } 0825 0826 /** 0827 A Window Manager should subclass NETRootInfo and reimplement this function 0828 when it wants to receive replies to the _NET_WM_PING protocol. 0829 @param window the window from which the reply came 0830 @param timestamp timestamp of the ping 0831 */ 0832 virtual void gotPing(xcb_window_t window, xcb_timestamp_t timestamp) 0833 { 0834 Q_UNUSED(window); 0835 Q_UNUSED(timestamp); 0836 } 0837 /** 0838 A Window Manager should subclass NETRootInfo and reimplement this function 0839 when it wants to know when a Client made a request to change the active 0840 (focused) window. 0841 0842 @param window the id of the window to activate 0843 @param src the source from which the request came 0844 @param timestamp the timestamp of the user action causing this request 0845 @param active_window active window of the requesting application, if any 0846 **/ 0847 virtual void changeActiveWindow(xcb_window_t window, NET::RequestSource src, xcb_timestamp_t timestamp, xcb_window_t active_window) 0848 { 0849 Q_UNUSED(window); 0850 Q_UNUSED(src); 0851 Q_UNUSED(timestamp); 0852 Q_UNUSED(active_window); 0853 } 0854 0855 /** 0856 A Window Manager should subclass NETRootInfo and reimplement this function 0857 when it wants to know when a pager made a request to move/resize a window. 0858 See _NET_MOVERESIZE_WINDOW for details. 0859 0860 @param window the id of the window to more/resize 0861 @param flags Flags specifying the operation (see _NET_MOVERESIZE_WINDOW description) 0862 @param x Requested X position for the window 0863 @param y Requested Y position for the window 0864 @param width Requested width for the window 0865 @param height Requested height for the window 0866 **/ 0867 virtual void moveResizeWindow(xcb_window_t window, int flags, int x, int y, int width, int height) 0868 { 0869 Q_UNUSED(window); 0870 Q_UNUSED(flags); 0871 Q_UNUSED(x); 0872 Q_UNUSED(y); 0873 Q_UNUSED(width); 0874 Q_UNUSED(height); 0875 } 0876 0877 /** 0878 A Window Manager should subclass NETRootInfo and reimplement this function 0879 when it wants to know when a Client made a request to restack a window. 0880 See _NET_RESTACK_WINDOW for details. 0881 0882 @param window the id of the window to restack 0883 @param source the source of the request 0884 @param above other window in the restack request 0885 @param detail restack detail 0886 @param timestamp the timestamp of the request 0887 **/ 0888 virtual void restackWindow(xcb_window_t window, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp) 0889 { 0890 Q_UNUSED(window); 0891 Q_UNUSED(source); 0892 Q_UNUSED(above); 0893 Q_UNUSED(detail); 0894 Q_UNUSED(timestamp); 0895 } 0896 0897 /** 0898 A Window Manager should subclass NETRootInfo and reimplement this function 0899 when it wants to know when a pager made a request to change showing the desktop. 0900 See _NET_SHOWING_DESKTOP for details. 0901 0902 @param showing whether to activate the showing desktop mode 0903 **/ 0904 virtual void changeShowingDesktop(bool showing) 0905 { 0906 Q_UNUSED(showing); 0907 } 0908 0909 /** 0910 A Window Manager should subclass NETRootInfo and reimplement this function 0911 when it wants to know when a Client made a request to show a window menu. 0912 0913 @param window The window that wants to move/resize 0914 @param device_id GTK device id. 0915 @param x_root X position of the cursor relative to the root window. 0916 @param y_root Y position of the cursor relative to the root window. 0917 **/ 0918 virtual void showWindowMenu(xcb_window_t window, int device_id, int x_root, int y_root) 0919 { 0920 Q_UNUSED(window); 0921 Q_UNUSED(device_id); 0922 Q_UNUSED(x_root); 0923 Q_UNUSED(y_root); 0924 } 0925 0926 private: 0927 void update(NET::Properties properties, NET::Properties2 properties2); 0928 void setSupported(); 0929 void setDefaultProperties(); 0930 void updateSupportedProperties(xcb_atom_t atom); 0931 0932 protected: 0933 /** Virtual hook, used to add new "virtual" functions while maintaining 0934 binary compatibility. Unused in this class. 0935 */ 0936 virtual void virtual_hook(int id, void *data); 0937 0938 private: 0939 NETRootInfoPrivate *p; // krazy:exclude=dpointer (implicitly shared) 0940 }; 0941 0942 /** 0943 Common API for application window properties/protocols. 0944 0945 The NETWinInfo class provides a common API for clients and window managers to 0946 set/read/change properties on an application window as defined by the NET 0947 Window Manager Specification. 0948 0949 @author Bradley T. Hughes <bhughes@trolltech.com> 0950 @see NET 0951 @see NETRootInfo 0952 @see http://www.freedesktop.org/standards/wm-spec/ 0953 **/ 0954 0955 class KWINDOWSYSTEM_EXPORT NETWinInfo : public NET 0956 { 0957 public: 0958 /** 0959 Indexes for the properties array. 0960 **/ 0961 // update also NETWinInfoPrivate::properties[] size when extending this 0962 enum { 0963 PROTOCOLS, 0964 PROTOCOLS2, 0965 PROPERTIES_SIZE, 0966 }; 0967 /** 0968 Create a NETWinInfo object, which will be used to set/read/change 0969 information stored on an application window. 0970 0971 @param connection XCB connection 0972 0973 @param window The Window id of the application window. 0974 0975 @param rootWindow The Window id of the root window. 0976 0977 @param properties The NET::Properties flags 0978 0979 @param properties2 The NET::Properties2 flags 0980 0981 @param role Select the application role. If this argument is omitted, 0982 the role will default to Client. 0983 **/ 0984 NETWinInfo(xcb_connection_t *connection, 0985 xcb_window_t window, 0986 xcb_window_t rootWindow, 0987 NET::Properties properties, 0988 NET::Properties2 properties2, 0989 Role role = Client); 0990 0991 /** 0992 Creates a shared copy of the specified NETWinInfo object. 0993 0994 @param wininfo the NETWinInfo to copy 0995 **/ 0996 NETWinInfo(const NETWinInfo &wininfo); 0997 0998 /** 0999 Destroys the NETWinInfo object. 1000 **/ 1001 virtual ~NETWinInfo(); 1002 1003 /** 1004 Assignment operator. Ensures that the shared data reference counts are 1005 correct. 1006 **/ 1007 const NETWinInfo &operator=(const NETWinInfo &wintinfo); 1008 1009 /** 1010 Returns the xcb connection used. 1011 1012 @return the XCB connection 1013 **/ 1014 xcb_connection_t *xcbConnection() const; 1015 1016 /** 1017 Returns true if the window has any window type set, even if the type 1018 itself is not known to this implementation. Presence of a window type 1019 as specified by the NETWM spec is considered as the window supporting 1020 this specification. 1021 @return true if the window has support for the NETWM spec 1022 **/ 1023 bool hasNETSupport() const; 1024 1025 /** 1026 @returns the properties argument passed to the constructor. 1027 @see passedProperties2() 1028 **/ 1029 NET::Properties passedProperties() const; 1030 /** 1031 * @returns the properties2 argument passed to the constructor. 1032 * @see passedProperties() 1033 * @since 5.0 1034 **/ 1035 NET::Properties2 passedProperties2() const; 1036 1037 /** 1038 Returns the icon geometry. 1039 1040 @return the geometry of the icon 1041 **/ 1042 NETRect iconGeometry() const; 1043 1044 /** 1045 Returns the state of the window (see the NET base class documentation for a 1046 description of the various states). 1047 1048 @return the state of the window 1049 **/ 1050 NET::States state() const; 1051 1052 /** 1053 Returns the extended (partial) strut specified by this client. 1054 See _NET_WM_STRUT_PARTIAL in the spec. 1055 **/ 1056 NETExtendedStrut extendedStrut() const; 1057 1058 // Still used internally, e.g. by KWindowSystem::strutChanged() logic 1059 /** 1060 @deprecated use strutPartial() 1061 Returns the strut specified by this client. 1062 1063 @return the strut of the window 1064 **/ 1065 NETStrut strut() const; 1066 1067 /** 1068 Returns the window type for this client (see the NET base class 1069 documentation for a description of the various window types). 1070 Since clients may specify several windows types for a window 1071 in order to support backwards compatibility and extensions 1072 not available in the NETWM spec, you should specify all 1073 window types you application supports (see the NET::WindowTypeMask 1074 mask values for various window types). This method will 1075 return the first window type that is listed in the supported types, 1076 or NET::Unknown if none of the window types is supported. 1077 1078 @return the type of the window 1079 **/ 1080 WindowType windowType(WindowTypes supported_types) const; 1081 1082 /** 1083 This function returns false if the window has not window type 1084 specified at all. Used by KWindowInfo::windowType() to return either 1085 NET::Normal or NET::Dialog as appropriate as a fallback. 1086 **/ 1087 bool hasWindowType() const; 1088 1089 /** 1090 Returns the name of the window in UTF-8 format. 1091 1092 @return the name of the window 1093 **/ 1094 const char *name() const; 1095 1096 /** 1097 Returns the visible name as set by the window manager in UTF-8 format. 1098 1099 @return the visible name of the window 1100 **/ 1101 const char *visibleName() const; 1102 1103 /** 1104 Returns the iconic name of the window in UTF-8 format. Note that this has 1105 nothing to do with icons, but it's for "iconic" 1106 representations of the window (taskbars etc.), that should be shown 1107 when the window is in iconic state. See description of _NET_WM_ICON_NAME 1108 for details. 1109 1110 @return the iconic name 1111 **/ 1112 const char *iconName() const; 1113 1114 /** 1115 Returns the visible iconic name as set by the window manager in UTF-8 format. 1116 Note that this has nothing to do with icons, but it's for "iconic" 1117 representations of the window (taskbars etc.), that should be shown 1118 when the window is in iconic state. See description of _NET_WM_VISIBLE_ICON_NAME 1119 for details. 1120 1121 @return the visible iconic name 1122 **/ 1123 const char *visibleIconName() const; 1124 1125 /** 1126 Returns the desktop where the window is residing. 1127 1128 NOTE: KDE uses virtual desktops and does not directly support 1129 viewport in any way. It is however mapped to virtual desktops 1130 if needed. 1131 1132 @param ignore_viewport if false, viewport is mapped to virtual desktops 1133 1134 @return the number of the window's desktop 1135 1136 @see OnAllDesktops() 1137 **/ 1138 int desktop(bool ignore_viewport = false) const; 1139 1140 /** 1141 Returns the process id for the client window. 1142 1143 @return the process id of the window 1144 **/ 1145 int pid() const; 1146 1147 /** 1148 Returns whether or not this client handles icons. 1149 1150 @return true if this client handles icons, false otherwise 1151 **/ 1152 bool handledIcons() const; 1153 1154 /** 1155 Returns the mapping state for the window (see the NET base class 1156 documentation for a description of mapping state). 1157 1158 @return the mapping state 1159 **/ 1160 MappingState mappingState() const; 1161 1162 /** 1163 Set icons for the application window. If replace is True, then 1164 the specified icon is defined to be the only icon. If replace is False, 1165 then the specified icon is added to a list of icons. 1166 1167 @param icon the new icon 1168 1169 @param replace true to replace, false to append to the list of icons 1170 **/ 1171 void setIcon(NETIcon icon, bool replace = true); 1172 1173 /** 1174 Set the icon geometry for the application window. 1175 1176 @param geometry the new icon geometry 1177 **/ 1178 void setIconGeometry(NETRect geometry); 1179 1180 /** 1181 Set the extended (partial) strut for the application window. 1182 1183 @param extended_strut the new strut 1184 **/ 1185 void setExtendedStrut(const NETExtendedStrut &extended_strut); 1186 1187 // Still used internally, e.g. by KWindowSystem::strutChanged() logic 1188 /** 1189 @deprecated use setExtendedStrut() 1190 Set the strut for the application window. 1191 1192 @param strut the new strut 1193 **/ 1194 void setStrut(NETStrut strut); 1195 1196 /** 1197 Set the state for the application window (see the NET base class documentation 1198 for a description of window state). 1199 1200 @param state the name state 1201 1202 @param mask the mask for the state 1203 **/ 1204 void setState(NET::States state, NET::States mask); 1205 1206 /** 1207 Sets the window type for this client (see the NET base class 1208 documentation for a description of the various window types). 1209 1210 @param type the window type 1211 **/ 1212 void setWindowType(WindowType type); 1213 1214 /** 1215 Sets the name for the application window. 1216 1217 @param name the new name of the window 1218 **/ 1219 void setName(const char *name); 1220 1221 /** 1222 For Window Managers only: set the visible name ( i.e. xterm, xterm <2>, 1223 xterm <3>, ... ) 1224 1225 @param visibleName the new visible name 1226 **/ 1227 void setVisibleName(const char *visibleName); 1228 1229 /** 1230 Sets the iconic name for the application window. 1231 1232 @param name the new iconic name 1233 **/ 1234 void setIconName(const char *name); 1235 1236 /** 1237 For Window Managers only: set the visible iconic name ( i.e. xterm, xterm <2>, 1238 xterm <3>, ... ) 1239 1240 @param name the new visible iconic name 1241 **/ 1242 void setVisibleIconName(const char *name); 1243 1244 /** 1245 Set which window the desktop is (should be) on. 1246 1247 NOTE: KDE uses virtual desktops and does not directly support 1248 viewport in any way. It is however mapped to virtual desktops 1249 if needed. 1250 1251 @param desktop the number of the new desktop 1252 @param ignore_viewport if false, viewport is mapped to virtual desktops 1253 1254 @see OnAllDesktops() 1255 **/ 1256 void setDesktop(int desktop, bool ignore_viewport = false); 1257 1258 /** 1259 Set the application window's process id. 1260 1261 @param pid the window's process id 1262 **/ 1263 void setPid(int pid); 1264 1265 /** 1266 Set whether this application window handles icons. 1267 1268 @param handled true if the window handles icons, false otherwise 1269 **/ 1270 void setHandledIcons(bool handled); 1271 1272 /** 1273 Set the frame decoration strut, i.e. the width of the decoration borders. 1274 1275 @param strut the new strut 1276 **/ 1277 void setFrameExtents(NETStrut strut); 1278 1279 /** 1280 Returns the frame decoration strut, i.e. the width of the decoration borders. 1281 1282 @since 4.3 1283 **/ 1284 NETStrut frameExtents() const; 1285 1286 /** 1287 Sets the window frame overlap strut, i.e. how far the window frame extends 1288 behind the client area on each side. 1289 1290 Set the strut values to -1 if you want the window frame to cover the whole 1291 client area. 1292 1293 The default values are 0. 1294 1295 @since 4.4 1296 **/ 1297 void setFrameOverlap(NETStrut strut); 1298 1299 /** 1300 Returns the frame overlap strut, i.e. how far the window frame extends 1301 behind the client area on each side. 1302 1303 @since 4.4 1304 **/ 1305 NETStrut frameOverlap() const; 1306 1307 /** 1308 Sets the extents of the drop-shadow drawn by the client. 1309 1310 @since 5.65 1311 **/ 1312 void setGtkFrameExtents(NETStrut strut); 1313 1314 /** 1315 Returns the extents of the drop-shadow drawn by a GTK client. 1316 1317 @since 5.65 1318 **/ 1319 NETStrut gtkFrameExtents() const; 1320 1321 /** 1322 Returns an icon. If width and height are passed, the icon returned will be 1323 the closest it can find (the next biggest). If width and height are omitted, 1324 then the largest icon in the list is returned. 1325 1326 @param width the preferred width for the icon, -1 to ignore 1327 1328 @param height the preferred height for the icon, -1 to ignore 1329 1330 @return the icon 1331 **/ 1332 NETIcon icon(int width = -1, int height = -1) const; 1333 1334 /** 1335 Returns a list of provided icon sizes. Each size is pair width,height, terminated 1336 with pair 0,0. 1337 @since 4.3 1338 **/ 1339 const int *iconSizes() const; 1340 1341 /** 1342 * Sets user timestamp @p time on the window (property _NET_WM_USER_TIME). 1343 * The timestamp is expressed as XServer time. If a window 1344 * is shown with user timestamp older than the time of the last 1345 * user action, it won't be activated after being shown, with the special 1346 * value 0 meaning not to activate the window after being shown. 1347 */ 1348 void setUserTime(xcb_timestamp_t time); 1349 1350 /** 1351 * Returns the time of last user action on the window, or -1 if not set. 1352 */ 1353 xcb_timestamp_t userTime() const; 1354 1355 /** 1356 * Sets the startup notification id @p id on the window. 1357 */ 1358 void setStartupId(const char *startup_id); 1359 1360 /** 1361 * Returns the startup notification id of the window. 1362 */ 1363 const char *startupId() const; 1364 1365 /** 1366 * Sets opacity (0 = transparent, 0xffffffff = opaque ) on the window. 1367 */ 1368 void setOpacity(unsigned long opacity); 1369 /** 1370 * Sets opacity (0 = transparent, 1 = opaque) on the window. 1371 */ 1372 void setOpacityF(qreal opacity); 1373 1374 /** 1375 * Returns the opacity of the window. 1376 */ 1377 unsigned long opacity() const; 1378 /** 1379 * Returns the opacity of the window. 1380 */ 1381 qreal opacityF() const; 1382 1383 /** 1384 * Sets actions that the window manager allows for the window. 1385 */ 1386 void setAllowedActions(NET::Actions actions); 1387 1388 /** 1389 * Returns actions that the window manager allows for the window. 1390 */ 1391 NET::Actions allowedActions() const; 1392 1393 /** 1394 * Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow 1395 * for this window. 1396 */ 1397 xcb_window_t transientFor() const; 1398 1399 /** 1400 * Returns the leader window for the group the window is in, if any. 1401 */ 1402 xcb_window_t groupLeader() const; 1403 1404 /** 1405 * Returns whether the UrgencyHint is set in the WM_HINTS.flags. 1406 * See ICCCM 4.1.2.4. 1407 * 1408 * @since 5.3 1409 **/ 1410 bool urgency() const; 1411 1412 /** 1413 * Returns whether the Input flag is set in WM_HINTS. 1414 * See ICCCM 4.1.2.4 and 4.1.7. 1415 * 1416 * The default value is @c true in case the Client is mapped without a WM_HINTS property. 1417 * 1418 * @since 5.3 1419 **/ 1420 bool input() const; 1421 1422 /** 1423 * Returns the initial mapping state as set in WM_HINTS. 1424 * See ICCCM 4.1.2.4 and 4.1.4. 1425 * 1426 * The default value if @c Withdrawn in case the Client is mapped without 1427 * a WM_HINTS property or without the initial state hint set. 1428 * 1429 * @since 5.5 1430 **/ 1431 MappingState initialMappingState() const; 1432 1433 /** 1434 * Returns the icon pixmap as set in WM_HINTS. 1435 * See ICCCM 4.1.2.4. 1436 * 1437 * The default value is @c XCB_PIXMAP_NONE. 1438 * 1439 * Using the ICCCM variant for the icon is deprecated and only 1440 * offers a limited functionality compared to {@link icon}. 1441 * Only use this variant as a fallback. 1442 * 1443 * @see icccmIconPixmapMask 1444 * @see icon 1445 * @since 5.7 1446 **/ 1447 xcb_pixmap_t icccmIconPixmap() const; 1448 1449 /** 1450 * Returns the mask for the icon pixmap as set in WM_HINTS. 1451 * See ICCCM 4.1.2.4. 1452 * 1453 * The default value is @c XCB_PIXMAP_NONE. 1454 * 1455 * @see icccmIconPixmap 1456 * @since 5.7 1457 **/ 1458 xcb_pixmap_t icccmIconPixmapMask() const; 1459 1460 /** 1461 * Returns the class component of the window class for the window 1462 * (i.e. WM_CLASS property). 1463 */ 1464 const char *windowClassClass() const; 1465 1466 /** 1467 * Returns the name component of the window class for the window 1468 * (i.e. WM_CLASS property). 1469 */ 1470 const char *windowClassName() const; 1471 1472 /** 1473 * Returns the window role for the window (i.e. WM_WINDOW_ROLE property). 1474 */ 1475 const char *windowRole() const; 1476 1477 /** 1478 * Returns the client machine for the window (i.e. WM_CLIENT_MACHINE property). 1479 */ 1480 const char *clientMachine() const; 1481 1482 /** 1483 * returns a comma-separated list of the activities the window is associated with. 1484 * FIXME this might be better as a NETRArray ? 1485 * @since 4.6 1486 */ 1487 const char *activities() const; 1488 1489 /** 1490 * Sets the comma-separated list of activities the window is associated with. 1491 * @since 5.1 1492 */ 1493 void setActivities(const char *activities); 1494 1495 /** 1496 * Sets whether the client wishes to block compositing (for better performance) 1497 * @since 4.7 1498 */ 1499 void setBlockingCompositing(bool active); 1500 1501 /** 1502 * Returns whether the client wishes to block compositing (for better performance) 1503 * @since 4.7 1504 */ 1505 bool isBlockingCompositing() const; 1506 1507 /** 1508 Places the window frame geometry in frame, and the application window 1509 geometry in window. Both geometries are relative to the root window. 1510 1511 @param frame the geometry for the frame 1512 1513 @param window the geometry for the window 1514 **/ 1515 void kdeGeometry(NETRect &frame, NETRect &window); 1516 1517 /** 1518 Sets the desired multiple-monitor topology (4 monitor indices indicating 1519 the top, bottom, left, and right edges of the window) when the fullscreen 1520 state is enabled. The indices are from the set returned by the Xinerama 1521 extension. 1522 See _NET_WM_FULLSCREEN_MONITORS for details. 1523 1524 @param topology A struct that models the desired monitor topology, namely: 1525 top is the monitor whose top edge defines the top edge of the 1526 fullscreen window, bottom is the monitor whose bottom edge defines 1527 the bottom edge of the fullscreen window, left is the monitor whose 1528 left edge defines the left edge of the fullscreen window, and right 1529 is the monitor whose right edge defines the right edge of the fullscreen 1530 window. 1531 1532 **/ 1533 void setFullscreenMonitors(NETFullscreenMonitors topology); 1534 1535 /** 1536 Returns the desired fullscreen monitor topology for this client, should 1537 it be in fullscreen state. 1538 See _NET_WM_FULLSCREEN_MONITORS in the spec. 1539 **/ 1540 NETFullscreenMonitors fullscreenMonitors() const; 1541 1542 /** 1543 * This function takes the passed in xcb_generic_event_t and returns the updated properties 1544 * in the passed in arguments. 1545 * 1546 * The new information will be read immediately by the class. It is possible to pass in a 1547 * null pointer in the arguments. In that case the passed in 1548 * argument will obviously not be updated, but the class will process the information 1549 * nevertheless. 1550 * 1551 * @param event the event 1552 * @param properties The NET::Properties that changed 1553 * @param properties2 The NET::Properties2 that changed 1554 * @since 5.0 1555 **/ 1556 void event(xcb_generic_event_t *event, NET::Properties *properties, NET::Properties2 *properties2 = nullptr); 1557 1558 /** 1559 This function takes the pass XEvent and returns an OR'ed list of NETWinInfo 1560 properties that have changed. The new information will be read 1561 immediately by the class. This overloaded version returns 1562 only a single mask, and therefore cannot check state of all properties 1563 like the other variant. 1564 1565 @param event the event 1566 1567 @return the properties 1568 **/ 1569 NET::Properties event(xcb_generic_event_t *event); 1570 1571 /** 1572 * @returns The window manager protocols this Client supports. 1573 * @since 5.3 1574 **/ 1575 NET::Protocols protocols() const; 1576 1577 /** 1578 * @returns @c true if the Client supports the @p protocol. 1579 * @param protocol The window manager protocol to test for 1580 * @since 5.3 1581 **/ 1582 bool supportsProtocol(NET::Protocol protocol) const; 1583 1584 /** 1585 * @returns The opaque region as specified by the Client. 1586 * @since 5.7 1587 **/ 1588 std::vector<NETRect> opaqueRegion() const; 1589 1590 /** 1591 * Sets the @p name as the desktop file name. 1592 * 1593 * This is either the base name without full path and without file extension of the 1594 * desktop file for the window's application (e.g. "org.kde.foo"). 1595 * 1596 * If the application's desktop file name is not at a standard location it should be 1597 * the full path to the desktop file name (e.g. "/opt/kde/share/org.kde.foo.desktop"). 1598 * 1599 * If the window does not know the desktop file name, it should not set the name at all. 1600 * 1601 * @since 5.28 1602 **/ 1603 void setDesktopFileName(const char *name); 1604 1605 /** 1606 * @returns The desktop file name of the window's application if present. 1607 * @since 5.28 1608 * @see setDesktopFileName 1609 **/ 1610 const char *desktopFileName() const; 1611 1612 /** 1613 * @returns The GTK application id of the window if present. 1614 * @since 5.91 1615 **/ 1616 const char *gtkApplicationId() const; 1617 1618 /** 1619 * Sets the @p name as the D-BUS service name for the application menu. 1620 * @since 5.69 1621 **/ 1622 void setAppMenuServiceName(const char *name); 1623 1624 /** 1625 * Sets the @p name as the D-BUS object path for the application menu. 1626 * @since 5.69 1627 **/ 1628 void setAppMenuObjectPath(const char *path); 1629 1630 /** 1631 * @returns The menu service name of the window's application if present. 1632 * @since 5.69 1633 **/ 1634 const char *appMenuServiceName() const; 1635 1636 /** 1637 * @returns The menu object path of the window's application if present. 1638 * @since 5.69 1639 **/ 1640 const char *appMenuObjectPath() const; 1641 1642 /** 1643 Sentinel value to indicate that the client wishes to be visible on 1644 all desktops. 1645 1646 @return the value to be on all desktops 1647 **/ 1648 static const int OnAllDesktops; 1649 1650 protected: 1651 /** 1652 A Window Manager should subclass NETWinInfo and reimplement this function when 1653 it wants to know when a Client made a request to change desktops (ie. move to 1654 another desktop). 1655 1656 @param desktop the number of the desktop 1657 **/ 1658 virtual void changeDesktop(int desktop) 1659 { 1660 Q_UNUSED(desktop); 1661 } 1662 1663 /** 1664 A Window Manager should subclass NETWinInfo and reimplement this function when 1665 it wants to know when a Client made a request to change state (ie. to 1666 Shade / Unshade). 1667 1668 @param state the new state 1669 1670 @param mask the mask for the state 1671 **/ 1672 virtual void changeState(NET::States state, NET::States mask) 1673 { 1674 Q_UNUSED(state); 1675 Q_UNUSED(mask); 1676 } 1677 1678 /** 1679 A Window Manager should subclass NETWinInfo2 and reimplement this function 1680 when it wants to know when a Client made a request to change the 1681 fullscreen monitor topology for its fullscreen state. 1682 1683 @param topology A structure (top, bottom, left, right) representing the 1684 fullscreen monitor topology. 1685 **/ 1686 virtual void changeFullscreenMonitors(NETFullscreenMonitors topology) 1687 { 1688 Q_UNUSED(topology); 1689 } 1690 1691 private: 1692 void update(NET::Properties dirtyProperties, NET::Properties2 dirtyProperties2 = NET::Properties2()); 1693 void updateWMState(); 1694 void setIconInternal(NETRArray<NETIcon> &icons, int &icon_count, xcb_atom_t property, NETIcon icon, bool replace); 1695 NETIcon iconInternal(NETRArray<NETIcon> &icons, int icon_count, int width, int height) const; 1696 1697 protected: 1698 /** Virtual hook, used to add new "virtual" functions while maintaining 1699 binary compatibility. Unused in this class. 1700 */ 1701 virtual void virtual_hook(int id, void *data); 1702 1703 private: 1704 NETWinInfoPrivate *p; // krazy:exclude=dpointer (implicitly shared) 1705 }; 1706 1707 //#define KWIN_FOCUS 1708 1709 #endif 1710 #endif // netwm_h