KWindowSystem

netwm.h
1 /*
2  SPDX-FileCopyrightText: 2000 Troll Tech AS
3  SPDX-FileCopyrightText: 2003 Lubos Lunak <[email protected]>
4 
5  SPDX-License-Identifier: MIT
6 */
7 
8 #ifndef netwm_h
9 #define netwm_h
10 
11 #include <QSize>
12 #include <config-kwindowsystem.h>
13 #include <kwindowsystem_export.h>
14 #if KWINDOWSYSTEM_HAVE_X11
15 #include <vector>
16 #include <xcb/xcb.h>
17 
18 #include "netwm_def.h"
19 
20 #define KDE_ALL_ACTIVITIES_UUID "00000000-0000-0000-0000-000000000000"
21 
22 // forward declaration
23 struct NETRootInfoPrivate;
24 struct NETWinInfoPrivate;
25 template<class Z>
26 class NETRArray;
27 
28 /**
29  Common API for root window properties/protocols.
30 
31  The NETRootInfo class provides a common API for clients and window managers
32  to set/read/change properties on the root window as defined by the NET Window
33  Manager Specification..
34 
35  @author Bradley T. Hughes <[email protected]>
36  @see NET
37  @see NETWinInfo
38  **/
39 
40 class KWINDOWSYSTEM_EXPORT NETRootInfo : public NET
41 {
42 public:
43  /**
44  Indexes for the properties array.
45  **/
46  // update also NETRootInfoPrivate::properties[] size when extending this
47  enum {
48  PROTOCOLS,
49  WINDOW_TYPES,
50  STATES,
51  PROTOCOLS2,
52  ACTIONS,
53  PROPERTIES_SIZE,
54  };
55 
56  /**
57  Window Managers should use this constructor to create a NETRootInfo object,
58  which will be used to set/update information stored on the rootWindow.
59  The application role is automatically set to WindowManager
60  when using this constructor.
61 
62  @param connection XCB connection
63 
64  @param supportWindow The Window id of the supportWindow. The supportWindow
65  must be created by the window manager as a child of the rootWindow. The
66  supportWindow must not be destroyed until the Window Manager exits.
67 
68  @param wmName A string which should be the window manager's name (ie. "KWin"
69  or "Blackbox").
70 
71  @param properties The properties the window manager supports
72 
73  @param windowTypes The window types the window manager supports
74 
75  @param states The states the window manager supports
76 
77  @param properties2 The properties2 the window manager supports
78 
79  @param actions The actions the window manager supports
80 
81  @param screen For Window Managers that support multiple screen (ie.
82  "multiheaded") displays, the screen number may be explicitly defined. If
83  this argument is omitted, the default screen will be used.
84 
85  @param doActivate true to activate the window
86  **/
87  NETRootInfo(xcb_connection_t *connection,
88  xcb_window_t supportWindow,
89  const char *wmName,
90  NET::Properties properties,
91  NET::WindowTypes windowTypes,
92  NET::States states,
93  NET::Properties2 properties2,
94  NET::Actions actions,
95  int screen = -1,
96  bool doActivate = true);
97 
98  /**
99  Clients should use this constructor to create a NETRootInfo object, which
100  will be used to query information set on the root window. The application
101  role is automatically set to Client when using this constructor.
102 
103  @param connection XCB connection
104 
105  @param properties The properties the client is interested in.
106 
107  @param properties2 The properties2 the client is interested in.
108 
109  @param properties_size The number of elements in the properties array.
110 
111  @param screen For Clients that support multiple screen (ie. "multiheaded")
112  displays, the screen number may be explicitly defined. If this argument is
113  omitted, the default screen will be used.
114 
115  @param doActivate true to call activate() to do an initial data read/update
116  of the query information.
117  **/
118  NETRootInfo(xcb_connection_t *connection,
119  NET::Properties properties,
120  NET::Properties2 properties2 = NET::Properties2(),
121  int screen = -1,
122  bool doActivate = true);
123 
124  /**
125  Creates a shared copy of the specified NETRootInfo object.
126 
127  @param rootinfo the NETRootInfo object to copy
128  **/
129  NETRootInfo(const NETRootInfo &rootinfo);
130 
131  /**
132  Destroys the NETRootInfo object.
133  **/
134  virtual ~NETRootInfo();
135 
136  /**
137  Returns the xcb connection used.
138 
139  @return the XCB connection
140  **/
141  xcb_connection_t *xcbConnection() const;
142 
143  /**
144  Returns the Window id of the rootWindow.
145 
146  @return the id of the root window
147  **/
148  xcb_window_t rootWindow() const;
149 
150  /**
151  Returns the Window id of the supportWindow.
152 
153  @return the id of the support window
154  **/
155  xcb_window_t supportWindow() const;
156 
157  /**
158  Returns the name of the Window Manager.
159 
160  @return the name of the window manager
161  **/
162  const char *wmName() const;
163 
164  /**
165  Sets the given property if on is true, and clears the property otherwise.
166  In WindowManager mode this function updates _NET_SUPPORTED.
167  In Client mode this function does nothing.
168 
169  @since 4.4
170  **/
171  void setSupported(NET::Property property, bool on = true);
172 
173  /**
174  @overload
175  @since 4.4
176  **/
177  void setSupported(NET::Property2 property, bool on = true);
178 
179  /**
180  @overload
181  @since 4.4
182  **/
183  void setSupported(NET::WindowTypeMask property, bool on = true);
184 
185  /**
186  @overload
187  @since 4.4
188  **/
189  void setSupported(NET::State property, bool on = true);
190 
191  /**
192  @overload
193  @since 4.4
194  **/
195  void setSupported(NET::Action property, bool on = true);
196 
197  /**
198  Returns true if the given property is supported by the window
199  manager. Note that for Client mode, NET::Supported needs
200  to be passed in the properties argument for this to work.
201  **/
202  bool isSupported(NET::Property property) const;
203  /**
204  @overload
205  **/
206  bool isSupported(NET::Property2 property) const;
207  /**
208  @overload
209  **/
210  bool isSupported(NET::WindowTypeMask type) const;
211  /**
212  @overload
213  **/
214  bool isSupported(NET::State state) const;
215 
216  /**
217  @overload
218  **/
219  bool isSupported(NET::Action action) const;
220 
221  /**
222  In the Window Manager mode, this is equivalent to the properties
223  argument passed to the constructor. In the Client mode, if
224  NET::Supported was passed in the properties argument, the returned
225  value are all properties supported by the Window Manager. Other supported
226  protocols and properties are returned by the specific methods.
227  @see supportedProperties2()
228  @see supportedStates()
229  @see supportedWindowTypes()
230  @see supportedActions()
231  **/
232  NET::Properties supportedProperties() const;
233  /**
234  * In the Window Manager mode, this is equivalent to the properties2
235  * argument passed to the constructor. In the Client mode, if
236  * NET::Supported was passed in the properties argument, the returned
237  * value are all properties2 supported by the Window Manager. Other supported
238  * protocols and properties are returned by the specific methods.
239  * @see supportedProperties()
240  * @see supportedStates()
241  * @see supportedWindowTypes()
242  * @see supportedActions()
243  * @since 5.0
244  **/
245  NET::Properties2 supportedProperties2() const;
246  /**
247  * In the Window Manager mode, this is equivalent to the states
248  * argument passed to the constructor. In the Client mode, if
249  * NET::Supported was passed in the properties argument, the returned
250  * value are all states supported by the Window Manager. Other supported
251  * protocols and properties are returned by the specific methods.
252  * @see supportedProperties()
253  @see supportedProperties2()
254  * @see supportedWindowTypes()
255  * @see supportedActions()
256  * @since 5.0
257  **/
258  NET::States supportedStates() const;
259  /**
260  * In the Window Manager mode, this is equivalent to the windowTypes
261  * argument passed to the constructor. In the Client mode, if
262  * NET::Supported was passed in the properties argument, the returned
263  * value are all window types supported by the Window Manager. Other supported
264  * protocols and properties are returned by the specific methods.
265  * @see supportedProperties()
266  @see supportedProperties2()
267  * @see supportedStates()
268  * @see supportedActions()
269  * @since 5.0
270  **/
271  NET::WindowTypes supportedWindowTypes() const;
272  /**
273  * In the Window Manager mode, this is equivalent to the actions
274  * argument passed to the constructor. In the Client mode, if
275  * NET::Supported was passed in the properties argument, the returned
276  * value are all actions supported by the Window Manager. Other supported
277  * protocols and properties are returned by the specific methods.
278  * @see supportedProperties()
279  @see supportedProperties2()
280  * @see supportedStates()
281  * @see supportedWindowTypes()
282  * @since 5.0
283  **/
284  NET::Actions supportedActions() const;
285 
286  /**
287  * @returns the properties argument passed to the constructor.
288  * @see passedProperties2()
289  * @see passedStates()
290  * @see passedWindowTypes()
291  * @see passedActions()
292  **/
293  NET::Properties passedProperties() const;
294  /**
295  * @returns the properties2 argument passed to the constructor.
296  * @see passedProperties()
297  * @see passedStates()
298  * @see passedWindowTypes()
299  * @see passedActions()
300  * @since 5.0
301  **/
302  NET::Properties2 passedProperties2() const;
303  /**
304  * @returns the states argument passed to the constructor.
305  * @see passedProperties()
306  * @see passedProperties2()
307  * @see passedWindowTypes()
308  * @see passedActions()
309  * @since 5.0
310  **/
311  NET::States passedStates() const;
312  /**
313  * @returns the windowTypes argument passed to the constructor.
314  * @see passedProperties()
315  * @see passedProperties2()
316  * @see passedStates()
317  * @see passedActions()
318  * @since 5.0
319  **/
320  NET::WindowTypes passedWindowTypes() const;
321  /**
322  * @returns the actions argument passed to the constructor.
323  * @see passedProperties()
324  * @see passedProperties2()
325  * @see passedStates()
326  * @see passedWindowTypes()
327  * @since 5.0
328  **/
329  NET::Actions passedActions() const;
330 
331  /**
332  Returns an array of Window id's, which contain all managed windows.
333 
334  @return the array of Window id's
335 
336  @see clientListCount()
337  **/
338  const xcb_window_t *clientList() const;
339 
340  /**
341  Returns the number of managed windows in clientList array.
342 
343  @return the number of managed windows in the clientList array
344 
345  @see clientList()
346  **/
347  int clientListCount() const;
348 
349  /**
350  Returns an array of Window id's, which contain all managed windows in
351  stacking order.
352 
353  @return the array of Window id's in stacking order
354 
355  @see clientListStackingCount()
356  **/
357  const xcb_window_t *clientListStacking() const;
358 
359  /**
360  Returns the number of managed windows in the clientListStacking array.
361 
362  @return the number of Window id's in the client list
363 
364  @see clientListStacking()
365  **/
366  int clientListStackingCount() const;
367 
368  /**
369  Returns the desktop geometry size.
370 
371  NOTE: KDE uses virtual desktops and does not directly support
372  viewport in any way. You should use calls for virtual desktops,
373  viewport is mapped to them if needed.
374 
375  @return the size of the desktop
376  **/
377  NETSize desktopGeometry() const;
378 
379  /**
380  Returns the viewport of the specified desktop.
381 
382  NOTE: KDE uses virtual desktops and does not directly support
383  viewport in any way. You should use calls for virtual desktops,
384  viewport is mapped to them if needed.
385 
386  @param desktop the number of the desktop
387 
388  @return the position of the desktop's viewport
389  **/
390  NETPoint desktopViewport(int desktop) const;
391 
392  /**
393  Returns the workArea for the specified desktop.
394 
395  @param desktop the number of the desktop
396 
397  @return the size of the work area
398  **/
399  NETRect workArea(int desktop) const;
400 
401  /**
402  Returns the name for the specified desktop.
403 
404  @param desktop the number of the desktop
405 
406  @return the name of the desktop
407  **/
408  const char *desktopName(int desktop) const;
409 
410  /**
411  Returns an array of Window id's, which contain the virtual root windows.
412 
413  @return the array of Window id's
414 
415  @see virtualRootsCount()
416  **/
417  const xcb_window_t *virtualRoots() const;
418 
419  /**
420  Returns the number of window in the virtualRoots array.
421 
422  @return the number of Window id's in the virtual root array
423 
424  @see virtualRoots()
425  **/
426  int virtualRootsCount() const;
427 
428  /**
429  Returns the desktop layout orientation.
430  **/
431  NET::Orientation desktopLayoutOrientation() const;
432 
433  /**
434  Returns the desktop layout number of columns and rows. Note that
435  either may be 0 (see _NET_DESKTOP_LAYOUT).
436  **/
437  QSize desktopLayoutColumnsRows() const;
438 
439  /**
440  Returns the desktop layout starting corner.
441  **/
442  NET::DesktopLayoutCorner desktopLayoutCorner() const;
443 
444  /**
445  Returns the number of desktops.
446 
447  NOTE: KDE uses virtual desktops and does not directly support
448  viewport in any way. They are however mapped to virtual desktops
449  if needed.
450 
451  @param ignore_viewport if false, viewport is mapped to virtual desktops
452 
453  @return the number of desktops
454  **/
455  int numberOfDesktops(bool ignore_viewport = false) const;
456 
457  /**
458  Returns the current desktop.
459 
460  NOTE: KDE uses virtual desktops and does not directly support
461  viewport in any way. They are however mapped to virtual desktops
462  if needed.
463 
464  @param ignore_viewport if false, viewport is mapped to virtual desktops
465 
466  @return the number of the current desktop
467  **/
468  int currentDesktop(bool ignore_viewport = false) const;
469 
470  /**
471  Returns the active (focused) window.
472 
473  @return the id of the active window
474  **/
475  xcb_window_t activeWindow() const;
476 
477  /**
478  Window Managers must call this after creating the NETRootInfo object, and
479  before using any other method in the class. This method sets initial data
480  on the root window and does other post-construction duties.
481 
482  Clients must also call this after creating the object to do an initial
483  data read/update.
484  **/
485  void activate();
486 
487  /**
488  Sets the list of managed windows on the Root/Desktop window.
489 
490  @param windows The array of Window id's
491 
492  @param count The number of windows in the array
493  **/
494  void setClientList(const xcb_window_t *windows, unsigned int count);
495 
496  /**
497  Sets the list of managed windows in stacking order on the Root/Desktop
498  window.
499 
500  @param windows The array of Window id's
501 
502  @param count The number of windows in the array.
503  **/
504  void setClientListStacking(const xcb_window_t *windows, unsigned int count);
505 
506  /**
507  Sets the current desktop to the specified desktop.
508 
509  NOTE: KDE uses virtual desktops and does not directly support
510  viewport in any way. It is however mapped to virtual desktops
511  if needed.
512 
513  @param desktop the number of the desktop
514  @param ignore_viewport if false, viewport is mapped to virtual desktops
515  **/
516  void setCurrentDesktop(int desktop, bool ignore_viewport = false);
517 
518  /**
519  Sets the desktop geometry to the specified geometry.
520 
521  NOTE: KDE uses virtual desktops and does not directly support
522  viewport in any way. You should use calls for virtual desktops,
523  viewport is mapped to them if needed.
524 
525  @param geometry the new size of the desktop
526  **/
527  void setDesktopGeometry(const NETSize &geometry);
528 
529  /**
530  Sets the viewport for the current desktop to the specified point.
531 
532  NOTE: KDE uses virtual desktops and does not directly support
533  viewport in any way. You should use calls for virtual desktops,
534  viewport is mapped to them if needed.
535 
536  @param desktop the number of the desktop
537 
538  @param viewport the new position of the desktop's viewport
539  **/
540  void setDesktopViewport(int desktop, const NETPoint &viewport);
541 
542  /**
543  Sets the number of desktops to the specified number.
544 
545  NOTE: KDE uses virtual desktops and does not directly support
546  viewport in any way. Viewport is mapped to virtual desktops
547  if needed, but not for this call.
548 
549  @param numberOfDesktops the number of desktops
550  **/
551  void setNumberOfDesktops(int numberOfDesktops);
552 
553  /**
554  Sets the name of the specified desktop.
555 
556  NOTE: KDE uses virtual desktops and does not directly support
557  viewport in any way. Viewport is mapped to virtual desktops
558  if needed, but not for this call.
559 
560  @param desktop the number of the desktop
561 
562  @param desktopName the new name of the desktop
563  **/
564  void setDesktopName(int desktop, const char *desktopName);
565 
566  /**
567  Requests that the specified window becomes the active (focused) one.
568 
569  @param window the id of the new active window
570  @param src whether the request comes from normal application
571  or from a pager or similar tool
572  @param timestamp X server timestamp of the user action that
573  caused the request
574  @param active_window active window of the requesting application, if any
575  **/
576  void setActiveWindow(xcb_window_t window, NET::RequestSource src, xcb_timestamp_t timestamp, xcb_window_t active_window);
577 
578  /**
579  Sets the active (focused) window the specified window. This should
580  be used only in the window manager mode.
581 
582  @param window the if of the new active window
583  **/
584  void setActiveWindow(xcb_window_t window);
585 
586  /**
587  Sets the workarea for the specified desktop
588 
589  @param desktop the number of the desktop
590 
591  @param workArea the new work area of the desktop
592  **/
593  void setWorkArea(int desktop, const NETRect &workArea);
594 
595  /**
596  Sets the list of virtual root windows on the root window.
597 
598  @param windows The array of Window id's
599 
600  @param count The number of windows in the array.
601  **/
602  void setVirtualRoots(const xcb_window_t *windows, unsigned int count);
603 
604  /**
605  Sets the desktop layout. This is set by the pager. When setting, the pager must
606  own the _NET_DESKTOP_LAYOUT_Sn manager selection. See _NET_DESKTOP_LAYOUT for details.
607  **/
608  void setDesktopLayout(NET::Orientation orientation, int columns, int rows, NET::DesktopLayoutCorner corner);
609 
610  /**
611  * Sets the _NET_SHOWING_DESKTOP status (whether desktop is being shown).
612  */
613  void setShowingDesktop(bool showing);
614  /**
615  * Returns the status of _NET_SHOWING_DESKTOP.
616  */
617  bool showingDesktop() const;
618 
619  /**
620  Assignment operator. Ensures that the shared data reference counts are
621  correct.
622  **/
623  const NETRootInfo &operator=(const NETRootInfo &rootinfo);
624 
625  /**
626  Clients (such as pagers/taskbars) that wish to close a window should call
627  this function. This will send a request to the Window Manager, which
628  usually can usually decide how to react to such requests.
629 
630  @param window the id of the window to close
631  **/
632  void closeWindowRequest(xcb_window_t window);
633 
634  /**
635  Clients (such as pagers/taskbars) that wish to start a WMMoveResize
636  (where the window manager controls the resize/movement,
637  i.e. _NET_WM_MOVERESIZE) should call this function.
638  This will send a request to the Window Manager.
639 
640  @param window The client window that would be resized/moved.
641 
642  @param x_root X position of the cursor relative to the root window.
643 
644  @param y_root Y position of the cursor relative to the root window.
645 
646  @param direction One of NET::Direction (see base class documentation for
647  a description of the different directions).
648  **/
649  void moveResizeRequest(xcb_window_t window, int x_root, int y_root, Direction direction);
650 
651  /**
652  Clients (such as pagers/taskbars) that wish to move/resize a window
653  using WM2MoveResizeWindow (_NET_MOVERESIZE_WINDOW) should call this function.
654  This will send a request to the Window Manager. See _NET_MOVERESIZE_WINDOW
655  description for details.
656 
657  @param window The client window that would be resized/moved.
658  @param flags Flags specifying the operation (see _NET_MOVERESIZE_WINDOW description)
659  @param x Requested X position for the window
660  @param y Requested Y position for the window
661  @param width Requested width for the window
662  @param height Requested height for the window
663  **/
664  void moveResizeWindowRequest(xcb_window_t window, int flags, int x, int y, int width, int height);
665 
666  /**
667  Clients that wish to show the window menu using WM2GTKShowWindowMenu
668  (_GTK_SHOW_WINDOW_MENU) should call this function.
669  This will send a request to the Window Manager. See _GTK_SHOW_WINDOW_MENU
670  description for details.
671 
672  @param window The client window that would be resized/moved.
673  @param device_id GTK device id
674  @param x Requested X position for the menu relative to the root window
675  @param y Requested Y position for the menu relative to the root window
676  **/
677  void showWindowMenuRequest(xcb_window_t window, int device_id, int x_root, int y_root);
678 
679  /**
680  Sends the _NET_RESTACK_WINDOW request.
681  **/
682  void restackRequest(xcb_window_t window, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp);
683 
684  /**
685  Sends a ping with the given timestamp to the window, using
686  the _NET_WM_PING protocol.
687  */
688  void sendPing(xcb_window_t window, xcb_timestamp_t timestamp);
689 
690 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
691  /**
692  This function takes the passed XEvent and returns an OR'ed list of
693  NETRootInfo properties that have changed in the properties argument.
694  The new information will be read immediately by the class.
695  The elements of the properties argument are as they would be passed
696  to the constructor, if the array is not large enough,
697  changed properties that don't fit in it won't be listed there
698  (they'll be updated in the class though).
699 
700  @param event the event
701  @param properties properties that changed
702  @param properties_size size of the passed properties array
703  @deprecated since 5.0 use event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*)
704 
705  **/
706  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use NETRootInfo::event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*)")
707  void event(xcb_generic_event_t *event, unsigned long *properties, int properties_size);
708 #endif
709  /**
710  * This function takes the passed xcb_generic_event_t and returns the updated properties in the passed in arguments.
711  *
712  * The new information will be read immediately by the class. It is possible to pass in a
713  * null pointer in the arguments. In that case the passed in argument will obviously not
714  * be updated, but the class will process the information nevertheless.
715  *
716  * @param event the event
717  * @param properties The NET::Properties that changed
718  * @param properties2 The NET::Properties2 that changed
719  * @since 5.0
720  **/
721  void event(xcb_generic_event_t *event, NET::Properties *properties, NET::Properties2 *properties2 = nullptr);
722 
723  /**
724  This function takes the passed XEvent and returns an OR'ed list of
725  NETRootInfo properties that have changed. The new information will be
726  read immediately by the class. This overloaded version returns
727  only a single mask, and therefore cannot check state of all properties
728  like the other variant.
729 
730  @param event the event
731 
732  @return the properties
733  **/
734  NET::Properties event(xcb_generic_event_t *event);
735 
736 protected:
737  /**
738  A Client should subclass NETRootInfo and reimplement this function when
739  it wants to know when a window has been added.
740 
741  @param window the id of the window to add
742  **/
743  virtual void addClient(xcb_window_t window)
744  {
745  Q_UNUSED(window);
746  }
747 
748  /**
749  A Client should subclass NETRootInfo and reimplement this function when
750  it wants to know when a window has been removed.
751 
752  @param window the id of the window to remove
753  **/
754  virtual void removeClient(xcb_window_t window)
755  {
756  Q_UNUSED(window);
757  }
758 
759  /**
760  A Window Manager should subclass NETRootInfo and reimplement this function
761  when it wants to know when a Client made a request to change the number
762  of desktops.
763 
764  @param numberOfDesktops the new number of desktops
765  **/
766  virtual void changeNumberOfDesktops(int numberOfDesktops)
767  {
768  Q_UNUSED(numberOfDesktops);
769  }
770 
771  /**
772  A Window Manager should subclass NETRootInfo and reimplement this function
773  when it wants to know when a Client made a request to change the specified
774  desktop geometry.
775 
776  @param desktop the number of the desktop
777 
778  @param geom the new size
779  **/
780  virtual void changeDesktopGeometry(int desktop, const NETSize &geom)
781  {
782  Q_UNUSED(desktop);
783  Q_UNUSED(geom);
784  }
785 
786  /**
787  A Window Manager should subclass NETRootInfo and reimplement this function
788  when it wants to know when a Client made a request to change the specified
789  desktop viewport.
790 
791  @param desktop the number of the desktop
792 
793  @param viewport the new position of the viewport
794  **/
795  virtual void changeDesktopViewport(int desktop, const NETPoint &viewport)
796  {
797  Q_UNUSED(desktop);
798  Q_UNUSED(viewport);
799  }
800 
801  /**
802  A Window Manager should subclass NETRootInfo and reimplement this function
803  when it wants to know when a Client made a request to change the current
804  desktop.
805 
806  @param desktop the number of the desktop
807  **/
808  virtual void changeCurrentDesktop(int desktop)
809  {
810  Q_UNUSED(desktop);
811  }
812 
813  /**
814  A Window Manager should subclass NETRootInfo and reimplement this function
815  when it wants to know when a Client made a request to close a window.
816 
817  @param window the id of the window to close
818  **/
819  virtual void closeWindow(xcb_window_t window)
820  {
821  Q_UNUSED(window);
822  }
823 
824  /**
825  A Window Manager should subclass NETRootInfo and reimplement this function
826  when it wants to know when a Client made a request to start a move/resize.
827 
828  @param window The window that wants to move/resize
829 
830  @param x_root X position of the cursor relative to the root window.
831 
832  @param y_root Y position of the cursor relative to the root window.
833 
834  @param direction One of NET::Direction (see base class documentation for
835  a description of the different directions).
836  **/
837  virtual void moveResize(xcb_window_t window, int x_root, int y_root, unsigned long direction)
838  {
839  Q_UNUSED(window);
840  Q_UNUSED(x_root);
841  Q_UNUSED(y_root);
842  Q_UNUSED(direction);
843  }
844 
845  /**
846  A Window Manager should subclass NETRootInfo and reimplement this function
847  when it wants to receive replies to the _NET_WM_PING protocol.
848  @param window the window from which the reply came
849  @param timestamp timestamp of the ping
850  */
851  virtual void gotPing(xcb_window_t window, xcb_timestamp_t timestamp)
852  {
853  Q_UNUSED(window);
854  Q_UNUSED(timestamp);
855  }
856  /**
857  A Window Manager should subclass NETRootInfo and reimplement this function
858  when it wants to know when a Client made a request to change the active
859  (focused) window.
860 
861  @param window the id of the window to activate
862  @param src the source from which the request came
863  @param timestamp the timestamp of the user action causing this request
864  @param active_window active window of the requesting application, if any
865  **/
866  virtual void changeActiveWindow(xcb_window_t window, NET::RequestSource src, xcb_timestamp_t timestamp, xcb_window_t active_window)
867  {
868  Q_UNUSED(window);
869  Q_UNUSED(src);
870  Q_UNUSED(timestamp);
871  Q_UNUSED(active_window);
872  }
873 
874  /**
875  A Window Manager should subclass NETRootInfo and reimplement this function
876  when it wants to know when a pager made a request to move/resize a window.
877  See _NET_MOVERESIZE_WINDOW for details.
878 
879  @param window the id of the window to more/resize
880  @param flags Flags specifying the operation (see _NET_MOVERESIZE_WINDOW description)
881  @param x Requested X position for the window
882  @param y Requested Y position for the window
883  @param width Requested width for the window
884  @param height Requested height for the window
885  **/
886  virtual void moveResizeWindow(xcb_window_t window, int flags, int x, int y, int width, int height)
887  {
888  Q_UNUSED(window);
889  Q_UNUSED(flags);
890  Q_UNUSED(x);
891  Q_UNUSED(y);
892  Q_UNUSED(width);
893  Q_UNUSED(height);
894  }
895 
896  /**
897  A Window Manager should subclass NETRootInfo and reimplement this function
898  when it wants to know when a Client made a request to restack a window.
899  See _NET_RESTACK_WINDOW for details.
900 
901  @param window the id of the window to restack
902  @param source the source of the request
903  @param above other window in the restack request
904  @param detail restack detail
905  @param timestamp the timestamp of the request
906  **/
907  virtual void restackWindow(xcb_window_t window, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp)
908  {
909  Q_UNUSED(window);
910  Q_UNUSED(source);
911  Q_UNUSED(above);
912  Q_UNUSED(detail);
913  Q_UNUSED(timestamp);
914  }
915 
916  /**
917  A Window Manager should subclass NETRootInfo and reimplement this function
918  when it wants to know when a pager made a request to change showing the desktop.
919  See _NET_SHOWING_DESKTOP for details.
920 
921  @param showing whether to activate the showing desktop mode
922  **/
923  virtual void changeShowingDesktop(bool showing)
924  {
925  Q_UNUSED(showing);
926  }
927 
928  /**
929  A Window Manager should subclass NETRootInfo and reimplement this function
930  when it wants to know when a Client made a request to show a window menu.
931 
932  @param window The window that wants to move/resize
933  @param device_id GTK device id.
934  @param x_root X position of the cursor relative to the root window.
935  @param y_root Y position of the cursor relative to the root window.
936  **/
937  virtual void showWindowMenu(xcb_window_t window, int device_id, int x_root, int y_root)
938  {
939  Q_UNUSED(window);
940  Q_UNUSED(device_id);
941  Q_UNUSED(x_root);
942  Q_UNUSED(y_root);
943  }
944 
945 private:
946  void update(NET::Properties properties, NET::Properties2 properties2);
947  void setSupported();
948  void setDefaultProperties();
949  void updateSupportedProperties(xcb_atom_t atom);
950 
951 protected:
952  /** Virtual hook, used to add new "virtual" functions while maintaining
953  binary compatibility. Unused in this class.
954  */
955  virtual void virtual_hook(int id, void *data);
956 
957 private:
958  NETRootInfoPrivate *p; // krazy:exclude=dpointer (implicitly shared)
959 };
960 
961 /**
962  Common API for application window properties/protocols.
963 
964  The NETWinInfo class provides a common API for clients and window managers to
965  set/read/change properties on an application window as defined by the NET
966  Window Manager Specification.
967 
968  @author Bradley T. Hughes <[email protected]>
969  @see NET
970  @see NETRootInfo
971  @see http://www.freedesktop.org/standards/wm-spec/
972  **/
973 
974 class KWINDOWSYSTEM_EXPORT NETWinInfo : public NET
975 {
976 public:
977  /**
978  Indexes for the properties array.
979  **/
980  // update also NETWinInfoPrivate::properties[] size when extending this
981  enum {
982  PROTOCOLS,
983  PROTOCOLS2,
984  PROPERTIES_SIZE,
985  };
986  /**
987  Create a NETWinInfo object, which will be used to set/read/change
988  information stored on an application window.
989 
990  @param connection XCB connection
991 
992  @param window The Window id of the application window.
993 
994  @param rootWindow The Window id of the root window.
995 
996  @param properties The NET::Properties flags
997 
998  @param properties2 The NET::Properties2 flags
999 
1000  @param role Select the application role. If this argument is omitted,
1001  the role will default to Client.
1002  **/
1003  NETWinInfo(xcb_connection_t *connection,
1004  xcb_window_t window,
1005  xcb_window_t rootWindow,
1006  NET::Properties properties,
1007  NET::Properties2 properties2,
1008  Role role = Client);
1009 
1010 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
1011  /**
1012  This constructor differs from the above one only in the way it accepts
1013  the list of properties the client is interested in.
1014  @deprecated since 5.0 use above ctor
1015  **/
1016  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use NETWinInfo(xcb_connection_t *, xcb_window_t, xcb_window_t, NET::Properties, NET::Properties2, Role")
1017  NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_window_t rootWindow, NET::Properties properties, Role role = Client);
1018 #endif
1019 
1020  /**
1021  Creates a shared copy of the specified NETWinInfo object.
1022 
1023  @param wininfo the NETWinInfo to copy
1024  **/
1025  NETWinInfo(const NETWinInfo &wininfo);
1026 
1027  /**
1028  Destroys the NETWinInfo object.
1029  **/
1030  virtual ~NETWinInfo();
1031 
1032  /**
1033  Assignment operator. Ensures that the shared data reference counts are
1034  correct.
1035  **/
1036  const NETWinInfo &operator=(const NETWinInfo &wintinfo);
1037 
1038  /**
1039  Returns the xcb connection used.
1040 
1041  @return the XCB connection
1042  **/
1043  xcb_connection_t *xcbConnection() const;
1044 
1045  /**
1046  Returns true if the window has any window type set, even if the type
1047  itself is not known to this implementation. Presence of a window type
1048  as specified by the NETWM spec is considered as the window supporting
1049  this specification.
1050  @return true if the window has support for the NETWM spec
1051  **/
1052  bool hasNETSupport() const;
1053 
1054  /**
1055  @returns the properties argument passed to the constructor.
1056  @see passedProperties2()
1057  **/
1058  NET::Properties passedProperties() const;
1059  /**
1060  * @returns the properties2 argument passed to the constructor.
1061  * @see passedProperties()
1062  * @since 5.0
1063  **/
1064  NET::Properties2 passedProperties2() const;
1065 
1066  /**
1067  Returns the icon geometry.
1068 
1069  @return the geometry of the icon
1070  **/
1071  NETRect iconGeometry() const;
1072 
1073  /**
1074  Returns the state of the window (see the NET base class documentation for a
1075  description of the various states).
1076 
1077  @return the state of the window
1078  **/
1079  NET::States state() const;
1080 
1081  /**
1082  Returns the extended (partial) strut specified by this client.
1083  See _NET_WM_STRUT_PARTIAL in the spec.
1084  **/
1085  NETExtendedStrut extendedStrut() const;
1086 
1087  // Still used internally, e.g. by KWindowSystem::strutChanged() logic
1088  /**
1089  @deprecated use strutPartial()
1090  Returns the strut specified by this client.
1091 
1092  @return the strut of the window
1093  **/
1094  NETStrut strut() const;
1095 
1096  /**
1097  Returns the window type for this client (see the NET base class
1098  documentation for a description of the various window types).
1099  Since clients may specify several windows types for a window
1100  in order to support backwards compatibility and extensions
1101  not available in the NETWM spec, you should specify all
1102  window types you application supports (see the NET::WindowTypeMask
1103  mask values for various window types). This method will
1104  return the first window type that is listed in the supported types,
1105  or NET::Unknown if none of the window types is supported.
1106 
1107  @return the type of the window
1108  **/
1109  WindowType windowType(WindowTypes supported_types) const;
1110 
1111  /**
1112  This function returns false if the window has not window type
1113  specified at all. Used by KWindowInfo::windowType() to return either
1114  NET::Normal or NET::Dialog as appropriate as a fallback.
1115  **/
1116  bool hasWindowType() const;
1117 
1118  /**
1119  Returns the name of the window in UTF-8 format.
1120 
1121  @return the name of the window
1122  **/
1123  const char *name() const;
1124 
1125  /**
1126  Returns the visible name as set by the window manager in UTF-8 format.
1127 
1128  @return the visible name of the window
1129  **/
1130  const char *visibleName() const;
1131 
1132  /**
1133  Returns the iconic name of the window in UTF-8 format. Note that this has
1134  nothing to do with icons, but it's for "iconic"
1135  representations of the window (taskbars etc.), that should be shown
1136  when the window is in iconic state. See description of _NET_WM_ICON_NAME
1137  for details.
1138 
1139  @return the iconic name
1140  **/
1141  const char *iconName() const;
1142 
1143  /**
1144  Returns the visible iconic name as set by the window manager in UTF-8 format.
1145  Note that this has nothing to do with icons, but it's for "iconic"
1146  representations of the window (taskbars etc.), that should be shown
1147  when the window is in iconic state. See description of _NET_WM_VISIBLE_ICON_NAME
1148  for details.
1149 
1150  @return the visible iconic name
1151  **/
1152  const char *visibleIconName() const;
1153 
1154  /**
1155  Returns the desktop where the window is residing.
1156 
1157  NOTE: KDE uses virtual desktops and does not directly support
1158  viewport in any way. It is however mapped to virtual desktops
1159  if needed.
1160 
1161  @param ignore_viewport if false, viewport is mapped to virtual desktops
1162 
1163  @return the number of the window's desktop
1164 
1165  @see OnAllDesktops()
1166  **/
1167  int desktop(bool ignore_viewport = false) const;
1168 
1169  /**
1170  Returns the process id for the client window.
1171 
1172  @return the process id of the window
1173  **/
1174  int pid() const;
1175 
1176  /**
1177  Returns whether or not this client handles icons.
1178 
1179  @return true if this client handles icons, false otherwise
1180  **/
1181  bool handledIcons() const;
1182 
1183  /**
1184  Returns the mapping state for the window (see the NET base class
1185  documentation for a description of mapping state).
1186 
1187  @return the mapping state
1188  **/
1189  MappingState mappingState() const;
1190 
1191  /**
1192  Set icons for the application window. If replace is True, then
1193  the specified icon is defined to be the only icon. If replace is False,
1194  then the specified icon is added to a list of icons.
1195 
1196  @param icon the new icon
1197 
1198  @param replace true to replace, false to append to the list of icons
1199  **/
1200  void setIcon(NETIcon icon, bool replace = true);
1201 
1202  /**
1203  Set the icon geometry for the application window.
1204 
1205  @param geometry the new icon geometry
1206  **/
1207  void setIconGeometry(NETRect geometry);
1208 
1209  /**
1210  Set the extended (partial) strut for the application window.
1211 
1212  @param extended_strut the new strut
1213  **/
1214  void setExtendedStrut(const NETExtendedStrut &extended_strut);
1215 
1216  // Still used internally, e.g. by KWindowSystem::strutChanged() logic
1217  /**
1218  @deprecated use setExtendedStrut()
1219  Set the strut for the application window.
1220 
1221  @param strut the new strut
1222  **/
1223  void setStrut(NETStrut strut);
1224 
1225  /**
1226  Set the state for the application window (see the NET base class documentation
1227  for a description of window state).
1228 
1229  @param state the name state
1230 
1231  @param mask the mask for the state
1232  **/
1233  void setState(NET::States state, NET::States mask);
1234 
1235  /**
1236  Sets the window type for this client (see the NET base class
1237  documentation for a description of the various window types).
1238 
1239  @param type the window type
1240  **/
1241  void setWindowType(WindowType type);
1242 
1243  /**
1244  Sets the name for the application window.
1245 
1246  @param name the new name of the window
1247  **/
1248  void setName(const char *name);
1249 
1250  /**
1251  For Window Managers only: set the visible name ( i.e. xterm, xterm <2>,
1252  xterm <3>, ... )
1253 
1254  @param visibleName the new visible name
1255  **/
1256  void setVisibleName(const char *visibleName);
1257 
1258  /**
1259  Sets the iconic name for the application window.
1260 
1261  @param name the new iconic name
1262  **/
1263  void setIconName(const char *name);
1264 
1265  /**
1266  For Window Managers only: set the visible iconic name ( i.e. xterm, xterm <2>,
1267  xterm <3>, ... )
1268 
1269  @param name the new visible iconic name
1270  **/
1271  void setVisibleIconName(const char *name);
1272 
1273  /**
1274  Set which window the desktop is (should be) on.
1275 
1276  NOTE: KDE uses virtual desktops and does not directly support
1277  viewport in any way. It is however mapped to virtual desktops
1278  if needed.
1279 
1280  @param desktop the number of the new desktop
1281  @param ignore_viewport if false, viewport is mapped to virtual desktops
1282 
1283  @see OnAllDesktops()
1284  **/
1285  void setDesktop(int desktop, bool ignore_viewport = false);
1286 
1287  /**
1288  Set the application window's process id.
1289 
1290  @param pid the window's process id
1291  **/
1292  void setPid(int pid);
1293 
1294  /**
1295  Set whether this application window handles icons.
1296 
1297  @param handled true if the window handles icons, false otherwise
1298  **/
1299  void setHandledIcons(bool handled);
1300 
1301  /**
1302  Set the frame decoration strut, i.e. the width of the decoration borders.
1303 
1304  @param strut the new strut
1305  **/
1306  void setFrameExtents(NETStrut strut);
1307 
1308  /**
1309  Returns the frame decoration strut, i.e. the width of the decoration borders.
1310 
1311  @since 4.3
1312  **/
1313  NETStrut frameExtents() const;
1314 
1315  /**
1316  Sets the window frame overlap strut, i.e. how far the window frame extends
1317  behind the client area on each side.
1318 
1319  Set the strut values to -1 if you want the window frame to cover the whole
1320  client area.
1321 
1322  The default values are 0.
1323 
1324  @since 4.4
1325  **/
1326  void setFrameOverlap(NETStrut strut);
1327 
1328  /**
1329  Returns the frame overlap strut, i.e. how far the window frame extends
1330  behind the client area on each side.
1331 
1332  @since 4.4
1333  **/
1334  NETStrut frameOverlap() const;
1335 
1336  /**
1337  Sets the extents of the drop-shadow drawn by the client.
1338 
1339  @since 5.65
1340  **/
1341  void setGtkFrameExtents(NETStrut strut);
1342 
1343  /**
1344  Returns the extents of the drop-shadow drawn by a GTK client.
1345 
1346  @since 5.65
1347  **/
1348  NETStrut gtkFrameExtents() const;
1349 
1350  /**
1351  Returns an icon. If width and height are passed, the icon returned will be
1352  the closest it can find (the next biggest). If width and height are omitted,
1353  then the largest icon in the list is returned.
1354 
1355  @param width the preferred width for the icon, -1 to ignore
1356 
1357  @param height the preferred height for the icon, -1 to ignore
1358 
1359  @return the icon
1360  **/
1361  NETIcon icon(int width = -1, int height = -1) const;
1362 
1363  /**
1364  Returns a list of provided icon sizes. Each size is pair width,height, terminated
1365  with pair 0,0.
1366  @since 4.3
1367  **/
1368  const int *iconSizes() const;
1369 
1370  /**
1371  * Sets user timestamp @p time on the window (property _NET_WM_USER_TIME).
1372  * The timestamp is expressed as XServer time. If a window
1373  * is shown with user timestamp older than the time of the last
1374  * user action, it won't be activated after being shown, with the special
1375  * value 0 meaning not to activate the window after being shown.
1376  */
1377  void setUserTime(xcb_timestamp_t time);
1378 
1379  /**
1380  * Returns the time of last user action on the window, or -1 if not set.
1381  */
1382  xcb_timestamp_t userTime() const;
1383 
1384  /**
1385  * Sets the startup notification id @p id on the window.
1386  */
1387  void setStartupId(const char *startup_id);
1388 
1389  /**
1390  * Returns the startup notification id of the window.
1391  */
1392  const char *startupId() const;
1393 
1394  /**
1395  * Sets opacity (0 = transparent, 0xffffffff = opaque ) on the window.
1396  */
1397  void setOpacity(unsigned long opacity);
1398  /**
1399  * Sets opacity (0 = transparent, 1 = opaque) on the window.
1400  */
1401  void setOpacityF(qreal opacity);
1402 
1403  /**
1404  * Returns the opacity of the window.
1405  */
1406  unsigned long opacity() const;
1407  /**
1408  * Returns the opacity of the window.
1409  */
1410  qreal opacityF() const;
1411 
1412  /**
1413  * Sets actions that the window manager allows for the window.
1414  */
1415  void setAllowedActions(NET::Actions actions);
1416 
1417  /**
1418  * Returns actions that the window manager allows for the window.
1419  */
1420  NET::Actions allowedActions() const;
1421 
1422  /**
1423  * Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow
1424  * for this window.
1425  */
1426  xcb_window_t transientFor() const;
1427 
1428  /**
1429  * Returns the leader window for the group the window is in, if any.
1430  */
1431  xcb_window_t groupLeader() const;
1432 
1433  /**
1434  * Returns whether the UrgencyHint is set in the WM_HINTS.flags.
1435  * See ICCCM 4.1.2.4.
1436  *
1437  * @since 5.3
1438  **/
1439  bool urgency() const;
1440 
1441  /**
1442  * Returns whether the Input flag is set in WM_HINTS.
1443  * See ICCCM 4.1.2.4 and 4.1.7.
1444  *
1445  * The default value is @c true in case the Client is mapped without a WM_HINTS property.
1446  *
1447  * @since 5.3
1448  **/
1449  bool input() const;
1450 
1451  /**
1452  * Returns the initial mapping state as set in WM_HINTS.
1453  * See ICCCM 4.1.2.4 and 4.1.4.
1454  *
1455  * The default value if @c Withdrawn in case the Client is mapped without
1456  * a WM_HINTS property or without the initial state hint set.
1457  *
1458  * @since 5.5
1459  **/
1460  MappingState initialMappingState() const;
1461 
1462  /**
1463  * Returns the icon pixmap as set in WM_HINTS.
1464  * See ICCCM 4.1.2.4.
1465  *
1466  * The default value is @c XCB_PIXMAP_NONE.
1467  *
1468  * Using the ICCCM variant for the icon is deprecated and only
1469  * offers a limited functionality compared to {@link icon}.
1470  * Only use this variant as a fallback.
1471  *
1472  * @see icccmIconPixmapMask
1473  * @see icon
1474  * @since 5.7
1475  **/
1476  xcb_pixmap_t icccmIconPixmap() const;
1477 
1478  /**
1479  * Returns the mask for the icon pixmap as set in WM_HINTS.
1480  * See ICCCM 4.1.2.4.
1481  *
1482  * The default value is @c XCB_PIXMAP_NONE.
1483  *
1484  * @see icccmIconPixmap
1485  * @since 5.7
1486  **/
1487  xcb_pixmap_t icccmIconPixmapMask() const;
1488 
1489  /**
1490  * Returns the class component of the window class for the window
1491  * (i.e. WM_CLASS property).
1492  */
1493  const char *windowClassClass() const;
1494 
1495  /**
1496  * Returns the name component of the window class for the window
1497  * (i.e. WM_CLASS property).
1498  */
1499  const char *windowClassName() const;
1500 
1501  /**
1502  * Returns the window role for the window (i.e. WM_WINDOW_ROLE property).
1503  */
1504  const char *windowRole() const;
1505 
1506  /**
1507  * Returns the client machine for the window (i.e. WM_CLIENT_MACHINE property).
1508  */
1509  const char *clientMachine() const;
1510 
1511  /**
1512  * returns a comma-separated list of the activities the window is associated with.
1513  * FIXME this might be better as a NETRArray ?
1514  * @since 4.6
1515  */
1516  const char *activities() const;
1517 
1518  /**
1519  * Sets the comma-separated list of activities the window is associated with.
1520  * @since 5.1
1521  */
1522  void setActivities(const char *activities);
1523 
1524  /**
1525  * Sets whether the client wishes to block compositing (for better performance)
1526  * @since 4.7
1527  */
1528  void setBlockingCompositing(bool active);
1529 
1530  /**
1531  * Returns whether the client wishes to block compositing (for better performance)
1532  * @since 4.7
1533  */
1534  bool isBlockingCompositing() const;
1535 
1536  /**
1537  Places the window frame geometry in frame, and the application window
1538  geometry in window. Both geometries are relative to the root window.
1539 
1540  @param frame the geometry for the frame
1541 
1542  @param window the geometry for the window
1543  **/
1544  void kdeGeometry(NETRect &frame, NETRect &window);
1545 
1546  /**
1547  Sets the desired multiple-monitor topology (4 monitor indices indicating
1548  the top, bottom, left, and right edges of the window) when the fullscreen
1549  state is enabled. The indices are from the set returned by the Xinerama
1550  extension.
1551  See _NET_WM_FULLSCREEN_MONITORS for details.
1552 
1553  @param topology A struct that models the desired monitor topology, namely:
1554  top is the monitor whose top edge defines the top edge of the
1555  fullscreen window, bottom is the monitor whose bottom edge defines
1556  the bottom edge of the fullscreen window, left is the monitor whose
1557  left edge defines the left edge of the fullscreen window, and right
1558  is the monitor whose right edge defines the right edge of the fullscreen
1559  window.
1560 
1561  **/
1562  void setFullscreenMonitors(NETFullscreenMonitors topology);
1563 
1564  /**
1565  Returns the desired fullscreen monitor topology for this client, should
1566  it be in fullscreen state.
1567  See _NET_WM_FULLSCREEN_MONITORS in the spec.
1568  **/
1569  NETFullscreenMonitors fullscreenMonitors() const;
1570 
1571 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
1572  /**
1573  This function takes the passed XEvent and returns an OR'ed list of
1574  NETWinInfo properties that have changed in the properties argument.
1575  The new information will be read immediately by the class.
1576  The elements of the properties argument are as they would be passed
1577  to the constructor, if the array is not large enough,
1578  changed properties that don't fit in it won't be listed there
1579  (they'll be updated in the class though).
1580 
1581  @param event the event
1582  @param properties properties that changed
1583  @param properties_size size of the passed properties array
1584  @deprecated since 5.0 use event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*)
1585  **/
1586  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use NETWinInfo::event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*)")
1587  void event(xcb_generic_event_t *event, unsigned long *properties, int properties_size);
1588 #endif
1589  /**
1590  * This function takes the passed in xcb_generic_event_t and returns the updated properties
1591  * in the passed in arguments.
1592  *
1593  * The new information will be read immediately by the class. It is possible to pass in a
1594  * null pointer in the arguments. In that case the passed in
1595  * argument will obviously not be updated, but the class will process the information
1596  * nevertheless.
1597  *
1598  * @param event the event
1599  * @param properties The NET::Properties that changed
1600  * @param properties2 The NET::Properties2 that changed
1601  * @since 5.0
1602  **/
1603  void event(xcb_generic_event_t *event, NET::Properties *properties, NET::Properties2 *properties2 = nullptr);
1604 
1605  /**
1606  This function takes the pass XEvent and returns an OR'ed list of NETWinInfo
1607  properties that have changed. The new information will be read
1608  immediately by the class. This overloaded version returns
1609  only a single mask, and therefore cannot check state of all properties
1610  like the other variant.
1611 
1612  @param event the event
1613 
1614  @return the properties
1615  **/
1616  NET::Properties event(xcb_generic_event_t *event);
1617 
1618  /**
1619  * @returns The window manager protocols this Client supports.
1620  * @since 5.3
1621  **/
1622  NET::Protocols protocols() const;
1623 
1624  /**
1625  * @returns @c true if the Client supports the @p protocol.
1626  * @param protocol The window manager protocol to test for
1627  * @since 5.3
1628  **/
1629  bool supportsProtocol(NET::Protocol protocol) const;
1630 
1631  /**
1632  * @returns The opaque region as specified by the Client.
1633  * @since 5.7
1634  **/
1635  std::vector<NETRect> opaqueRegion() const;
1636 
1637  /**
1638  * Sets the @p name as the desktop file name.
1639  *
1640  * This is either the base name without full path and without file extension of the
1641  * desktop file for the window's application (e.g. "org.kde.foo").
1642  *
1643  * If the application's desktop file name is not at a standard location it should be
1644  * the full path to the desktop file name (e.g. "/opt/kde/share/org.kde.foo.desktop").
1645  *
1646  * If the window does not know the desktop file name, it should not set the name at all.
1647  *
1648  * @since 5.28
1649  **/
1650  void setDesktopFileName(const char *name);
1651 
1652  /**
1653  * @returns The desktop file name of the window's application if present.
1654  * @since 5.28
1655  * @see setDesktopFileName
1656  **/
1657  const char *desktopFileName() const;
1658 
1659  /**
1660  * @returns The GTK application id of the window if present.
1661  * @since 5.91
1662  **/
1663  const char *gtkApplicationId() const;
1664 
1665  /**
1666  * Sets the @p name as the D-BUS service name for the application menu.
1667  * @since 5.69
1668  **/
1669  void setAppMenuServiceName(const char *name);
1670 
1671  /**
1672  * Sets the @p name as the D-BUS object path for the application menu.
1673  * @since 5.69
1674  **/
1675  void setAppMenuObjectPath(const char *path);
1676 
1677  /**
1678  * @returns The menu service name of the window's application if present.
1679  * @since 5.69
1680  **/
1681  const char *appMenuServiceName() const;
1682 
1683  /**
1684  * @returns The menu object path of the window's application if present.
1685  * @since 5.69
1686  **/
1687  const char *appMenuObjectPath() const;
1688 
1689  /**
1690  Sentinel value to indicate that the client wishes to be visible on
1691  all desktops.
1692 
1693  @return the value to be on all desktops
1694  **/
1695  static const int OnAllDesktops;
1696 
1697 protected:
1698  /**
1699  A Window Manager should subclass NETWinInfo and reimplement this function when
1700  it wants to know when a Client made a request to change desktops (ie. move to
1701  another desktop).
1702 
1703  @param desktop the number of the desktop
1704  **/
1705  virtual void changeDesktop(int desktop)
1706  {
1707  Q_UNUSED(desktop);
1708  }
1709 
1710  /**
1711  A Window Manager should subclass NETWinInfo and reimplement this function when
1712  it wants to know when a Client made a request to change state (ie. to
1713  Shade / Unshade).
1714 
1715  @param state the new state
1716 
1717  @param mask the mask for the state
1718  **/
1719  virtual void changeState(NET::States state, NET::States mask)
1720  {
1721  Q_UNUSED(state);
1722  Q_UNUSED(mask);
1723  }
1724 
1725  /**
1726  A Window Manager should subclass NETWinInfo2 and reimplement this function
1727  when it wants to know when a Client made a request to change the
1728  fullscreen monitor topology for its fullscreen state.
1729 
1730  @param topology A structure (top, bottom, left, right) representing the
1731  fullscreen monitor topology.
1732  **/
1734  {
1735  Q_UNUSED(topology);
1736  }
1737 
1738 private:
1739  void update(NET::Properties dirtyProperties, NET::Properties2 dirtyProperties2 = NET::Properties2());
1740  void updateWMState();
1741  void setIconInternal(NETRArray<NETIcon> &icons, int &icon_count, xcb_atom_t property, NETIcon icon, bool replace);
1742  NETIcon iconInternal(NETRArray<NETIcon> &icons, int icon_count, int width, int height) const;
1743 
1744 protected:
1745  /** Virtual hook, used to add new "virtual" functions while maintaining
1746  binary compatibility. Unused in this class.
1747  */
1748  virtual void virtual_hook(int id, void *data);
1749 
1750 private:
1751  NETWinInfoPrivate *p; // krazy:exclude=dpointer (implicitly shared)
1752 };
1753 
1754 //#define KWIN_FOCUS
1755 
1756 #endif
1757 #endif // netwm_h
virtual void changeState(NET::States state, NET::States mask)
A Window Manager should subclass NETWinInfo and reimplement this function when it wants to know when ...
Definition: netwm.h:1719
Property2
Supported properties.
Definition: netwm_def.h:794
virtual void changeActiveWindow(xcb_window_t window, NET::RequestSource src, xcb_timestamp_t timestamp, xcb_window_t active_window)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:866
virtual void removeClient(xcb_window_t window)
A Client should subclass NETRootInfo and reimplement this function when it wants to know when a windo...
Definition: netwm.h:754
virtual void moveResize(xcb_window_t window, int x_root, int y_root, unsigned long direction)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:837
RequestSource
Source of the request.
Definition: netwm_def.h:847
Simple rectangle class for NET classes.
Definition: netwm_def.h:105
MappingState
Client window mapping state.
Definition: netwm_def.h:629
virtual void changeDesktopGeometry(int desktop, const NETSize &geom)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:780
Simple multiple monitor topology class for NET classes.
Definition: netwm_def.h:277
virtual void changeDesktopViewport(int desktop, const NETPoint &viewport)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:795
virtual void gotPing(xcb_window_t window, xcb_timestamp_t timestamp)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to receive r...
Definition: netwm.h:851
Common API for root window properties/protocols.
Definition: netwm.h:40
virtual void showWindowMenu(xcb_window_t window, int device_id, int x_root, int y_root)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:937
Protocol
Protocols supported by the client.
Definition: netwm_def.h:887
Simple point class for NET classes.
Definition: netwm_def.h:27
static const int OnAllDesktops
Sentinel value to indicate that the client wishes to be visible on all desktops.
Definition: netwm.h:1695
Simple icon class for NET classes.
Definition: netwm_def.h:147
virtual void changeCurrentDesktop(int desktop)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:808
Simple size class for NET classes.
Definition: netwm_def.h:68
virtual void restackWindow(xcb_window_t window, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:907
State
Window state.
Definition: netwm_def.h:503
Partial strut class for NET classes.
Definition: netwm_def.h:180
virtual void changeFullscreenMonitors(NETFullscreenMonitors topology)
A Window Manager should subclass NETWinInfo2 and reimplement this function when it wants to know when...
Definition: netwm.h:1733
virtual void addClient(xcb_window_t window)
A Client should subclass NETRootInfo and reimplement this function when it wants to know when a windo...
Definition: netwm.h:743
Action
Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS).
Definition: netwm_def.h:650
Role
Application role.
Definition: netwm_def.h:342
virtual void changeShowingDesktop(bool showing)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:923
virtual void changeNumberOfDesktops(int numberOfDesktops)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:766
Common API for application window properties/protocols.
Definition: netwm.h:974
Property
Supported properties.
Definition: netwm_def.h:714
virtual void moveResizeWindow(xcb_window_t window, int flags, int x, int y, int width, int height)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:886
Orientation
Orientation.
Definition: netwm_def.h:865
Base namespace class.
Definition: netwm_def.h:334
DesktopLayoutCorner
Starting corner for desktop layout.
Definition: netwm_def.h:873
virtual void changeDesktop(int desktop)
A Window Manager should subclass NETWinInfo and reimplement this function when it wants to know when ...
Definition: netwm.h:1705
virtual void closeWindow(xcb_window_t window)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:819
WindowType
Window type.
Definition: netwm_def.h:357
WindowTypeMask
Values for WindowType when they should be OR'ed together, e.g.
Definition: netwm_def.h:453
Direction
Direction for WMMoveResize.
Definition: netwm_def.h:608
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 03:59:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.