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  Sends the _NET_RESTACK_WINDOW request.
668  **/
669  void restackRequest(xcb_window_t window, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp);
670 
671  /**
672  Sends a ping with the given timestamp to the window, using
673  the _NET_WM_PING protocol.
674  */
675  void sendPing(xcb_window_t window, xcb_timestamp_t timestamp);
676 
677 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
678  /**
679  This function takes the passed XEvent and returns an OR'ed list of
680  NETRootInfo properties that have changed in the properties argument.
681  The new information will be read immediately by the class.
682  The elements of the properties argument are as they would be passed
683  to the constructor, if the array is not large enough,
684  changed properties that don't fit in it won't be listed there
685  (they'll be updated in the class though).
686 
687  @param event the event
688  @param properties properties that changed
689  @param properties_size size of the passed properties array
690  @deprecated since 5.0 use event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*)
691 
692  **/
693  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use NETRootInfo::event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*)")
694  void event(xcb_generic_event_t *event, unsigned long *properties, int properties_size);
695 #endif
696  /**
697  * This function takes the passed xcb_generic_event_t and returns the updated properties in the passed in arguments.
698  *
699  * The new information will be read immediately by the class. It is possible to pass in a
700  * null pointer in the arguments. In that case the passed in argument will obviously not
701  * be updated, but the class will process the information nevertheless.
702  *
703  * @param event the event
704  * @param properties The NET::Properties that changed
705  * @param properties2 The NET::Properties2 that changed
706  * @since 5.0
707  **/
708  void event(xcb_generic_event_t *event, NET::Properties *properties, NET::Properties2 *properties2 = nullptr);
709 
710  /**
711  This function takes the passed XEvent and returns an OR'ed list of
712  NETRootInfo properties that have changed. The new information will be
713  read immediately by the class. This overloaded version returns
714  only a single mask, and therefore cannot check state of all properties
715  like the other variant.
716 
717  @param event the event
718 
719  @return the properties
720  **/
721  NET::Properties event(xcb_generic_event_t *event);
722 
723 protected:
724  /**
725  A Client should subclass NETRootInfo and reimplement this function when
726  it wants to know when a window has been added.
727 
728  @param window the id of the window to add
729  **/
730  virtual void addClient(xcb_window_t window)
731  {
732  Q_UNUSED(window);
733  }
734 
735  /**
736  A Client should subclass NETRootInfo and reimplement this function when
737  it wants to know when a window has been removed.
738 
739  @param window the id of the window to remove
740  **/
741  virtual void removeClient(xcb_window_t window)
742  {
743  Q_UNUSED(window);
744  }
745 
746  /**
747  A Window Manager should subclass NETRootInfo and reimplement this function
748  when it wants to know when a Client made a request to change the number
749  of desktops.
750 
751  @param numberOfDesktops the new number of desktops
752  **/
753  virtual void changeNumberOfDesktops(int numberOfDesktops)
754  {
755  Q_UNUSED(numberOfDesktops);
756  }
757 
758  /**
759  A Window Manager should subclass NETRootInfo and reimplement this function
760  when it wants to know when a Client made a request to change the specified
761  desktop geometry.
762 
763  @param desktop the number of the desktop
764 
765  @param geom the new size
766  **/
767  virtual void changeDesktopGeometry(int desktop, const NETSize &geom)
768  {
769  Q_UNUSED(desktop);
770  Q_UNUSED(geom);
771  }
772 
773  /**
774  A Window Manager should subclass NETRootInfo and reimplement this function
775  when it wants to know when a Client made a request to change the specified
776  desktop viewport.
777 
778  @param desktop the number of the desktop
779 
780  @param viewport the new position of the viewport
781  **/
782  virtual void changeDesktopViewport(int desktop, const NETPoint &viewport)
783  {
784  Q_UNUSED(desktop);
785  Q_UNUSED(viewport);
786  }
787 
788  /**
789  A Window Manager should subclass NETRootInfo and reimplement this function
790  when it wants to know when a Client made a request to change the current
791  desktop.
792 
793  @param desktop the number of the desktop
794  **/
795  virtual void changeCurrentDesktop(int desktop)
796  {
797  Q_UNUSED(desktop);
798  }
799 
800  /**
801  A Window Manager should subclass NETRootInfo and reimplement this function
802  when it wants to know when a Client made a request to close a window.
803 
804  @param window the id of the window to close
805  **/
806  virtual void closeWindow(xcb_window_t window)
807  {
808  Q_UNUSED(window);
809  }
810 
811  /**
812  A Window Manager should subclass NETRootInfo and reimplement this function
813  when it wants to know when a Client made a request to start a move/resize.
814 
815  @param window The window that wants to move/resize
816 
817  @param x_root X position of the cursor relative to the root window.
818 
819  @param y_root Y position of the cursor relative to the root window.
820 
821  @param direction One of NET::Direction (see base class documentation for
822  a description of the different directions).
823  **/
824  virtual void moveResize(xcb_window_t window, int x_root, int y_root, unsigned long direction)
825  {
826  Q_UNUSED(window);
827  Q_UNUSED(x_root);
828  Q_UNUSED(y_root);
829  Q_UNUSED(direction);
830  }
831 
832  /**
833  A Window Manager should subclass NETRootInfo and reimplement this function
834  when it wants to receive replies to the _NET_WM_PING protocol.
835  @param window the window from which the reply came
836  @param timestamp timestamp of the ping
837  */
838  virtual void gotPing(xcb_window_t window, xcb_timestamp_t timestamp)
839  {
840  Q_UNUSED(window);
841  Q_UNUSED(timestamp);
842  }
843  /**
844  A Window Manager should subclass NETRootInfo and reimplement this function
845  when it wants to know when a Client made a request to change the active
846  (focused) window.
847 
848  @param window the id of the window to activate
849  @param src the source from which the request came
850  @param timestamp the timestamp of the user action causing this request
851  @param active_window active window of the requesting application, if any
852  **/
853  virtual void changeActiveWindow(xcb_window_t window, NET::RequestSource src, xcb_timestamp_t timestamp, xcb_window_t active_window)
854  {
855  Q_UNUSED(window);
856  Q_UNUSED(src);
857  Q_UNUSED(timestamp);
858  Q_UNUSED(active_window);
859  }
860 
861  /**
862  A Window Manager should subclass NETRootInfo and reimplement this function
863  when it wants to know when a pager made a request to move/resize a window.
864  See _NET_MOVERESIZE_WINDOW for details.
865 
866  @param window the id of the window to more/resize
867  @param flags Flags specifying the operation (see _NET_MOVERESIZE_WINDOW description)
868  @param x Requested X position for the window
869  @param y Requested Y position for the window
870  @param width Requested width for the window
871  @param height Requested height for the window
872  **/
873  virtual void moveResizeWindow(xcb_window_t window, int flags, int x, int y, int width, int height)
874  {
875  Q_UNUSED(window);
876  Q_UNUSED(flags);
877  Q_UNUSED(x);
878  Q_UNUSED(y);
879  Q_UNUSED(width);
880  Q_UNUSED(height);
881  }
882 
883  /**
884  A Window Manager should subclass NETRootInfo and reimplement this function
885  when it wants to know when a Client made a request to restack a window.
886  See _NET_RESTACK_WINDOW for details.
887 
888  @param window the id of the window to restack
889  @param source the source of the request
890  @param above other window in the restack request
891  @param detail restack detail
892  @param timestamp the timestamp of the request
893  **/
894  virtual void restackWindow(xcb_window_t window, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp)
895  {
896  Q_UNUSED(window);
897  Q_UNUSED(source);
898  Q_UNUSED(above);
899  Q_UNUSED(detail);
900  Q_UNUSED(timestamp);
901  }
902 
903  /**
904  A Window Manager should subclass NETRootInfo and reimplement this function
905  when it wants to know when a pager made a request to change showing the desktop.
906  See _NET_SHOWING_DESKTOP for details.
907 
908  @param showing whether to activate the showing desktop mode
909  **/
910  virtual void changeShowingDesktop(bool showing)
911  {
912  Q_UNUSED(showing);
913  }
914 
915 private:
916  void update(NET::Properties properties, NET::Properties2 properties2);
917  void setSupported();
918  void setDefaultProperties();
919  void updateSupportedProperties(xcb_atom_t atom);
920 
921 protected:
922  /** Virtual hook, used to add new "virtual" functions while maintaining
923  binary compatibility. Unused in this class.
924  */
925  virtual void virtual_hook(int id, void *data);
926 
927 private:
928  NETRootInfoPrivate *p; // krazy:exclude=dpointer (implicitly shared)
929 };
930 
931 /**
932  Common API for application window properties/protocols.
933 
934  The NETWinInfo class provides a common API for clients and window managers to
935  set/read/change properties on an application window as defined by the NET
936  Window Manager Specification.
937 
938  @author Bradley T. Hughes <[email protected]>
939  @see NET
940  @see NETRootInfo
941  @see http://www.freedesktop.org/standards/wm-spec/
942  **/
943 
944 class KWINDOWSYSTEM_EXPORT NETWinInfo : public NET
945 {
946 public:
947  /**
948  Indexes for the properties array.
949  **/
950  // update also NETWinInfoPrivate::properties[] size when extending this
951  enum {
952  PROTOCOLS,
953  PROTOCOLS2,
954  PROPERTIES_SIZE,
955  };
956  /**
957  Create a NETWinInfo object, which will be used to set/read/change
958  information stored on an application window.
959 
960  @param connection XCB connection
961 
962  @param window The Window id of the application window.
963 
964  @param rootWindow The Window id of the root window.
965 
966  @param properties The NET::Properties flags
967 
968  @param properties2 The NET::Properties2 flags
969 
970  @param role Select the application role. If this argument is omitted,
971  the role will default to Client.
972  **/
973  NETWinInfo(xcb_connection_t *connection,
974  xcb_window_t window,
975  xcb_window_t rootWindow,
976  NET::Properties properties,
977  NET::Properties2 properties2,
978  Role role = Client);
979 
980 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
981  /**
982  This constructor differs from the above one only in the way it accepts
983  the list of properties the client is interested in.
984  @deprecated since 5.0 use above ctor
985  **/
986  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use NETWinInfo(xcb_connection_t *, xcb_window_t, xcb_window_t, NET::Properties, NET::Properties2, Role")
987  NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_window_t rootWindow, NET::Properties properties, Role role = Client);
988 #endif
989 
990  /**
991  Creates a shared copy of the specified NETWinInfo object.
992 
993  @param wininfo the NETWinInfo to copy
994  **/
995  NETWinInfo(const NETWinInfo &wininfo);
996 
997  /**
998  Destroys the NETWinInfo object.
999  **/
1000  virtual ~NETWinInfo();
1001 
1002  /**
1003  Assignment operator. Ensures that the shared data reference counts are
1004  correct.
1005  **/
1006  const NETWinInfo &operator=(const NETWinInfo &wintinfo);
1007 
1008  /**
1009  Returns the xcb connection used.
1010 
1011  @return the XCB connection
1012  **/
1013  xcb_connection_t *xcbConnection() const;
1014 
1015  /**
1016  Returns true if the window has any window type set, even if the type
1017  itself is not known to this implementation. Presence of a window type
1018  as specified by the NETWM spec is considered as the window supporting
1019  this specification.
1020  @return true if the window has support for the NETWM spec
1021  **/
1022  bool hasNETSupport() const;
1023 
1024  /**
1025  @returns the properties argument passed to the constructor.
1026  @see passedProperties2()
1027  **/
1028  NET::Properties passedProperties() const;
1029  /**
1030  * @returns the properties2 argument passed to the constructor.
1031  * @see passedProperties()
1032  * @since 5.0
1033  **/
1034  NET::Properties2 passedProperties2() const;
1035 
1036  /**
1037  Returns the icon geometry.
1038 
1039  @return the geometry of the icon
1040  **/
1041  NETRect iconGeometry() const;
1042 
1043  /**
1044  Returns the state of the window (see the NET base class documentation for a
1045  description of the various states).
1046 
1047  @return the state of the window
1048  **/
1049  NET::States state() const;
1050 
1051  /**
1052  Returns the extended (partial) strut specified by this client.
1053  See _NET_WM_STRUT_PARTIAL in the spec.
1054  **/
1055  NETExtendedStrut extendedStrut() const;
1056 
1057  // Still used internally, e.g. by KWindowSystem::strutChanged() logic
1058  /**
1059  @deprecated use strutPartial()
1060  Returns the strut specified by this client.
1061 
1062  @return the strut of the window
1063  **/
1064  NETStrut strut() const;
1065 
1066  /**
1067  Returns the window type for this client (see the NET base class
1068  documentation for a description of the various window types).
1069  Since clients may specify several windows types for a window
1070  in order to support backwards compatibility and extensions
1071  not available in the NETWM spec, you should specify all
1072  window types you application supports (see the NET::WindowTypeMask
1073  mask values for various window types). This method will
1074  return the first window type that is listed in the supported types,
1075  or NET::Unknown if none of the window types is supported.
1076 
1077  @return the type of the window
1078  **/
1079  WindowType windowType(WindowTypes supported_types) const;
1080 
1081  /**
1082  This function returns false if the window has not window type
1083  specified at all. Used by KWindowInfo::windowType() to return either
1084  NET::Normal or NET::Dialog as appropriate as a fallback.
1085  **/
1086  bool hasWindowType() const;
1087 
1088  /**
1089  Returns the name of the window in UTF-8 format.
1090 
1091  @return the name of the window
1092  **/
1093  const char *name() const;
1094 
1095  /**
1096  Returns the visible name as set by the window manager in UTF-8 format.
1097 
1098  @return the visible name of the window
1099  **/
1100  const char *visibleName() const;
1101 
1102  /**
1103  Returns the iconic name of the window in UTF-8 format. Note that this has
1104  nothing to do with icons, but it's for "iconic"
1105  representations of the window (taskbars etc.), that should be shown
1106  when the window is in iconic state. See description of _NET_WM_ICON_NAME
1107  for details.
1108 
1109  @return the iconic name
1110  **/
1111  const char *iconName() const;
1112 
1113  /**
1114  Returns the visible iconic name as set by the window manager in UTF-8 format.
1115  Note that this has nothing to do with icons, but it's for "iconic"
1116  representations of the window (taskbars etc.), that should be shown
1117  when the window is in iconic state. See description of _NET_WM_VISIBLE_ICON_NAME
1118  for details.
1119 
1120  @return the visible iconic name
1121  **/
1122  const char *visibleIconName() const;
1123 
1124  /**
1125  Returns the desktop where the window is residing.
1126 
1127  NOTE: KDE uses virtual desktops and does not directly support
1128  viewport in any way. It is however mapped to virtual desktops
1129  if needed.
1130 
1131  @param ignore_viewport if false, viewport is mapped to virtual desktops
1132 
1133  @return the number of the window's desktop
1134 
1135  @see OnAllDesktops()
1136  **/
1137  int desktop(bool ignore_viewport = false) const;
1138 
1139  /**
1140  Returns the process id for the client window.
1141 
1142  @return the process id of the window
1143  **/
1144  int pid() const;
1145 
1146  /**
1147  Returns whether or not this client handles icons.
1148 
1149  @return true if this client handles icons, false otherwise
1150  **/
1151  bool handledIcons() const;
1152 
1153  /**
1154  Returns the mapping state for the window (see the NET base class
1155  documentation for a description of mapping state).
1156 
1157  @return the mapping state
1158  **/
1159  MappingState mappingState() const;
1160 
1161  /**
1162  Set icons for the application window. If replace is True, then
1163  the specified icon is defined to be the only icon. If replace is False,
1164  then the specified icon is added to a list of icons.
1165 
1166  @param icon the new icon
1167 
1168  @param replace true to replace, false to append to the list of icons
1169  **/
1170  void setIcon(NETIcon icon, bool replace = true);
1171 
1172  /**
1173  Set the icon geometry for the application window.
1174 
1175  @param geometry the new icon geometry
1176  **/
1177  void setIconGeometry(NETRect geometry);
1178 
1179  /**
1180  Set the extended (partial) strut for the application window.
1181 
1182  @param extended_strut the new strut
1183  **/
1184  void setExtendedStrut(const NETExtendedStrut &extended_strut);
1185 
1186  // Still used internally, e.g. by KWindowSystem::strutChanged() logic
1187  /**
1188  @deprecated use setExtendedStrut()
1189  Set the strut for the application window.
1190 
1191  @param strut the new strut
1192  **/
1193  void setStrut(NETStrut strut);
1194 
1195  /**
1196  Set the state for the application window (see the NET base class documentation
1197  for a description of window state).
1198 
1199  @param state the name state
1200 
1201  @param mask the mask for the state
1202  **/
1203  void setState(NET::States state, NET::States mask);
1204 
1205  /**
1206  Sets the window type for this client (see the NET base class
1207  documentation for a description of the various window types).
1208 
1209  @param type the window type
1210  **/
1211  void setWindowType(WindowType type);
1212 
1213  /**
1214  Sets the name for the application window.
1215 
1216  @param name the new name of the window
1217  **/
1218  void setName(const char *name);
1219 
1220  /**
1221  For Window Managers only: set the visible name ( i.e. xterm, xterm <2>,
1222  xterm <3>, ... )
1223 
1224  @param visibleName the new visible name
1225  **/
1226  void setVisibleName(const char *visibleName);
1227 
1228  /**
1229  Sets the iconic name for the application window.
1230 
1231  @param name the new iconic name
1232  **/
1233  void setIconName(const char *name);
1234 
1235  /**
1236  For Window Managers only: set the visible iconic name ( i.e. xterm, xterm <2>,
1237  xterm <3>, ... )
1238 
1239  @param name the new visible iconic name
1240  **/
1241  void setVisibleIconName(const char *name);
1242 
1243  /**
1244  Set which window the desktop is (should be) on.
1245 
1246  NOTE: KDE uses virtual desktops and does not directly support
1247  viewport in any way. It is however mapped to virtual desktops
1248  if needed.
1249 
1250  @param desktop the number of the new desktop
1251  @param ignore_viewport if false, viewport is mapped to virtual desktops
1252 
1253  @see OnAllDesktops()
1254  **/
1255  void setDesktop(int desktop, bool ignore_viewport = false);
1256 
1257  /**
1258  Set the application window's process id.
1259 
1260  @param pid the window's process id
1261  **/
1262  void setPid(int pid);
1263 
1264  /**
1265  Set whether this application window handles icons.
1266 
1267  @param handled true if the window handles icons, false otherwise
1268  **/
1269  void setHandledIcons(bool handled);
1270 
1271  /**
1272  Set the frame decoration strut, i.e. the width of the decoration borders.
1273 
1274  @param strut the new strut
1275  **/
1276  void setFrameExtents(NETStrut strut);
1277 
1278  /**
1279  Returns the frame decoration strut, i.e. the width of the decoration borders.
1280 
1281  @since 4.3
1282  **/
1283  NETStrut frameExtents() const;
1284 
1285  /**
1286  Sets the window frame overlap strut, i.e. how far the window frame extends
1287  behind the client area on each side.
1288 
1289  Set the strut values to -1 if you want the window frame to cover the whole
1290  client area.
1291 
1292  The default values are 0.
1293 
1294  @since 4.4
1295  **/
1296  void setFrameOverlap(NETStrut strut);
1297 
1298  /**
1299  Returns the frame overlap strut, i.e. how far the window frame extends
1300  behind the client area on each side.
1301 
1302  @since 4.4
1303  **/
1304  NETStrut frameOverlap() const;
1305 
1306  /**
1307  Sets the extents of the drop-shadow drawn by the client.
1308 
1309  @since 5.65
1310  **/
1311  void setGtkFrameExtents(NETStrut strut);
1312 
1313  /**
1314  Returns the extents of the drop-shadow drawn by a GTK client.
1315 
1316  @since 5.65
1317  **/
1318  NETStrut gtkFrameExtents() const;
1319 
1320  /**
1321  Returns an icon. If width and height are passed, the icon returned will be
1322  the closest it can find (the next biggest). If width and height are omitted,
1323  then the largest icon in the list is returned.
1324 
1325  @param width the preferred width for the icon, -1 to ignore
1326 
1327  @param height the preferred height for the icon, -1 to ignore
1328 
1329  @return the icon
1330  **/
1331  NETIcon icon(int width = -1, int height = -1) const;
1332 
1333  /**
1334  Returns a list of provided icon sizes. Each size is pair width,height, terminated
1335  with pair 0,0.
1336  @since 4.3
1337  **/
1338  const int *iconSizes() const;
1339 
1340  /**
1341  * Sets user timestamp @p time on the window (property _NET_WM_USER_TIME).
1342  * The timestamp is expressed as XServer time. If a window
1343  * is shown with user timestamp older than the time of the last
1344  * user action, it won't be activated after being shown, with the special
1345  * value 0 meaning not to activate the window after being shown.
1346  */
1347  void setUserTime(xcb_timestamp_t time);
1348 
1349  /**
1350  * Returns the time of last user action on the window, or -1 if not set.
1351  */
1352  xcb_timestamp_t userTime() const;
1353 
1354  /**
1355  * Sets the startup notification id @p id on the window.
1356  */
1357  void setStartupId(const char *startup_id);
1358 
1359  /**
1360  * Returns the startup notification id of the window.
1361  */
1362  const char *startupId() const;
1363 
1364  /**
1365  * Sets opacity (0 = transparent, 0xffffffff = opaque ) on the window.
1366  */
1367  void setOpacity(unsigned long opacity);
1368  /**
1369  * Sets opacity (0 = transparent, 1 = opaque) on the window.
1370  */
1371  void setOpacityF(qreal opacity);
1372 
1373  /**
1374  * Returns the opacity of the window.
1375  */
1376  unsigned long opacity() const;
1377  /**
1378  * Returns the opacity of the window.
1379  */
1380  qreal opacityF() const;
1381 
1382  /**
1383  * Sets actions that the window manager allows for the window.
1384  */
1385  void setAllowedActions(NET::Actions actions);
1386 
1387  /**
1388  * Returns actions that the window manager allows for the window.
1389  */
1390  NET::Actions allowedActions() const;
1391 
1392  /**
1393  * Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow
1394  * for this window.
1395  */
1396  xcb_window_t transientFor() const;
1397 
1398  /**
1399  * Returns the leader window for the group the window is in, if any.
1400  */
1401  xcb_window_t groupLeader() const;
1402 
1403  /**
1404  * Returns whether the UrgencyHint is set in the WM_HINTS.flags.
1405  * See ICCCM 4.1.2.4.
1406  *
1407  * @since 5.3
1408  **/
1409  bool urgency() const;
1410 
1411  /**
1412  * Returns whether the Input flag is set in WM_HINTS.
1413  * See ICCCM 4.1.2.4 and 4.1.7.
1414  *
1415  * The default value is @c true in case the Client is mapped without a WM_HINTS property.
1416  *
1417  * @since 5.3
1418  **/
1419  bool input() const;
1420 
1421  /**
1422  * Returns the initial mapping state as set in WM_HINTS.
1423  * See ICCCM 4.1.2.4 and 4.1.4.
1424  *
1425  * The default value if @c Withdrawn in case the Client is mapped without
1426  * a WM_HINTS property or without the initial state hint set.
1427  *
1428  * @since 5.5
1429  **/
1430  MappingState initialMappingState() const;
1431 
1432  /**
1433  * Returns the icon pixmap as set in WM_HINTS.
1434  * See ICCCM 4.1.2.4.
1435  *
1436  * The default value is @c XCB_PIXMAP_NONE.
1437  *
1438  * Using the ICCCM variant for the icon is deprecated and only
1439  * offers a limited functionality compared to {@link icon}.
1440  * Only use this variant as a fallback.
1441  *
1442  * @see icccmIconPixmapMask
1443  * @see icon
1444  * @since 5.7
1445  **/
1446  xcb_pixmap_t icccmIconPixmap() const;
1447 
1448  /**
1449  * Returns the mask for the icon pixmap as set in WM_HINTS.
1450  * See ICCCM 4.1.2.4.
1451  *
1452  * The default value is @c XCB_PIXMAP_NONE.
1453  *
1454  * @see icccmIconPixmap
1455  * @since 5.7
1456  **/
1457  xcb_pixmap_t icccmIconPixmapMask() const;
1458 
1459  /**
1460  * Returns the class component of the window class for the window
1461  * (i.e. WM_CLASS property).
1462  */
1463  const char *windowClassClass() const;
1464 
1465  /**
1466  * Returns the name component of the window class for the window
1467  * (i.e. WM_CLASS property).
1468  */
1469  const char *windowClassName() const;
1470 
1471  /**
1472  * Returns the window role for the window (i.e. WM_WINDOW_ROLE property).
1473  */
1474  const char *windowRole() const;
1475 
1476  /**
1477  * Returns the client machine for the window (i.e. WM_CLIENT_MACHINE property).
1478  */
1479  const char *clientMachine() const;
1480 
1481  /**
1482  * returns a comma-separated list of the activities the window is associated with.
1483  * FIXME this might be better as a NETRArray ?
1484  * @since 4.6
1485  */
1486  const char *activities() const;
1487 
1488  /**
1489  * Sets the comma-separated list of activities the window is associated with.
1490  * @since 5.1
1491  */
1492  void setActivities(const char *activities);
1493 
1494  /**
1495  * Sets whether the client wishes to block compositing (for better performance)
1496  * @since 4.7
1497  */
1498  void setBlockingCompositing(bool active);
1499 
1500  /**
1501  * Returns whether the client wishes to block compositing (for better performance)
1502  * @since 4.7
1503  */
1504  bool isBlockingCompositing() const;
1505 
1506  /**
1507  Places the window frame geometry in frame, and the application window
1508  geometry in window. Both geometries are relative to the root window.
1509 
1510  @param frame the geometry for the frame
1511 
1512  @param window the geometry for the window
1513  **/
1514  void kdeGeometry(NETRect &frame, NETRect &window);
1515 
1516  /**
1517  Sets the desired multiple-monitor topology (4 monitor indices indicating
1518  the top, bottom, left, and right edges of the window) when the fullscreen
1519  state is enabled. The indices are from the set returned by the Xinerama
1520  extension.
1521  See _NET_WM_FULLSCREEN_MONITORS for details.
1522 
1523  @param topology A struct that models the desired monitor topology, namely:
1524  top is the monitor whose top edge defines the top edge of the
1525  fullscreen window, bottom is the monitor whose bottom edge defines
1526  the bottom edge of the fullscreen window, left is the monitor whose
1527  left edge defines the left edge of the fullscreen window, and right
1528  is the monitor whose right edge defines the right edge of the fullscreen
1529  window.
1530 
1531  **/
1532  void setFullscreenMonitors(NETFullscreenMonitors topology);
1533 
1534  /**
1535  Returns the desired fullscreen monitor topology for this client, should
1536  it be in fullscreen state.
1537  See _NET_WM_FULLSCREEN_MONITORS in the spec.
1538  **/
1539  NETFullscreenMonitors fullscreenMonitors() const;
1540 
1541 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
1542  /**
1543  This function takes the passed XEvent and returns an OR'ed list of
1544  NETWinInfo properties that have changed in the properties argument.
1545  The new information will be read immediately by the class.
1546  The elements of the properties argument are as they would be passed
1547  to the constructor, if the array is not large enough,
1548  changed properties that don't fit in it won't be listed there
1549  (they'll be updated in the class though).
1550 
1551  @param event the event
1552  @param properties properties that changed
1553  @param properties_size size of the passed properties array
1554  @deprecated since 5.0 use event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*)
1555  **/
1556  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use NETWinInfo::event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*)")
1557  void event(xcb_generic_event_t *event, unsigned long *properties, int properties_size);
1558 #endif
1559  /**
1560  * This function takes the passed in xcb_generic_event_t and returns the updated properties
1561  * in the passed in arguments.
1562  *
1563  * The new information will be read immediately by the class. It is possible to pass in a
1564  * null pointer in the arguments. In that case the passed in
1565  * argument will obviously not be updated, but the class will process the information
1566  * nevertheless.
1567  *
1568  * @param event the event
1569  * @param properties The NET::Properties that changed
1570  * @param properties2 The NET::Properties2 that changed
1571  * @since 5.0
1572  **/
1573  void event(xcb_generic_event_t *event, NET::Properties *properties, NET::Properties2 *properties2 = nullptr);
1574 
1575  /**
1576  This function takes the pass XEvent and returns an OR'ed list of NETWinInfo
1577  properties that have changed. The new information will be read
1578  immediately by the class. This overloaded version returns
1579  only a single mask, and therefore cannot check state of all properties
1580  like the other variant.
1581 
1582  @param event the event
1583 
1584  @return the properties
1585  **/
1586  NET::Properties event(xcb_generic_event_t *event);
1587 
1588  /**
1589  * @returns The window manager protocols this Client supports.
1590  * @since 5.3
1591  **/
1592  NET::Protocols protocols() const;
1593 
1594  /**
1595  * @returns @c true if the Client supports the @p protocol.
1596  * @param protocol The window manager protocol to test for
1597  * @since 5.3
1598  **/
1599  bool supportsProtocol(NET::Protocol protocol) const;
1600 
1601  /**
1602  * @returns The opaque region as specified by the Client.
1603  * @since 5.7
1604  **/
1605  std::vector<NETRect> opaqueRegion() const;
1606 
1607  /**
1608  * Sets the @p name as the desktop file name.
1609  *
1610  * This is either the base name without full path and without file extension of the
1611  * desktop file for the window's application (e.g. "org.kde.foo").
1612  *
1613  * If the application's desktop file name is not at a standard location it should be
1614  * the full path to the desktop file name (e.g. "/opt/kde/share/org.kde.foo.desktop").
1615  *
1616  * If the window does not know the desktop file name, it should not set the name at all.
1617  *
1618  * @since 5.28
1619  **/
1620  void setDesktopFileName(const char *name);
1621 
1622  /**
1623  * @returns The desktop file name of the window's application if present.
1624  * @since 5.28
1625  * @see setDesktopFileName
1626  **/
1627  const char *desktopFileName() const;
1628 
1629  /**
1630  * Sets the @p name as the D-BUS service name for the application menu.
1631  * @since 5.69
1632  **/
1633  void setAppMenuServiceName(const char *name);
1634 
1635  /**
1636  * Sets the @p name as the D-BUS object path for the application menu.
1637  * @since 5.69
1638  **/
1639  void setAppMenuObjectPath(const char *path);
1640 
1641  /**
1642  * @returns The menu service name of the window's application if present.
1643  * @since 5.69
1644  **/
1645  const char *appMenuServiceName() const;
1646 
1647  /**
1648  * @returns The menu object path of the window's application if present.
1649  * @since 5.69
1650  **/
1651  const char *appMenuObjectPath() const;
1652 
1653  /**
1654  Sentinel value to indicate that the client wishes to be visible on
1655  all desktops.
1656 
1657  @return the value to be on all desktops
1658  **/
1659  static const int OnAllDesktops;
1660 
1661 protected:
1662  /**
1663  A Window Manager should subclass NETWinInfo and reimplement this function when
1664  it wants to know when a Client made a request to change desktops (ie. move to
1665  another desktop).
1666 
1667  @param desktop the number of the desktop
1668  **/
1669  virtual void changeDesktop(int desktop)
1670  {
1671  Q_UNUSED(desktop);
1672  }
1673 
1674  /**
1675  A Window Manager should subclass NETWinInfo and reimplement this function when
1676  it wants to know when a Client made a request to change state (ie. to
1677  Shade / Unshade).
1678 
1679  @param state the new state
1680 
1681  @param mask the mask for the state
1682  **/
1683  virtual void changeState(NET::States state, NET::States mask)
1684  {
1685  Q_UNUSED(state);
1686  Q_UNUSED(mask);
1687  }
1688 
1689  /**
1690  A Window Manager should subclass NETWinInfo2 and reimplement this function
1691  when it wants to know when a Client made a request to change the
1692  fullscreen monitor topology for its fullscreen state.
1693 
1694  @param topology A structure (top, bottom, left, right) representing the
1695  fullscreen monitor topology.
1696  **/
1698  {
1699  Q_UNUSED(topology);
1700  }
1701 
1702 private:
1703  void update(NET::Properties dirtyProperties, NET::Properties2 dirtyProperties2 = NET::Properties2());
1704  void updateWMState();
1705  void setIconInternal(NETRArray<NETIcon> &icons, int &icon_count, xcb_atom_t property, NETIcon icon, bool replace);
1706  NETIcon iconInternal(NETRArray<NETIcon> &icons, int icon_count, int width, int height) const;
1707 
1708 protected:
1709  /** Virtual hook, used to add new "virtual" functions while maintaining
1710  binary compatibility. Unused in this class.
1711  */
1712  virtual void virtual_hook(int id, void *data);
1713 
1714 private:
1715  NETWinInfoPrivate *p; // krazy:exclude=dpointer (implicitly shared)
1716 };
1717 
1718 //#define KWIN_FOCUS
1719 
1720 #endif
1721 #endif // netwm_h
Simple icon class for NET classes.
Definition: netwm_def.h:147
Protocol
Protocols supported by the client.
Definition: netwm_def.h:878
virtual void changeFullscreenMonitors(NETFullscreenMonitors topology)
A Window Manager should subclass NETWinInfo2 and reimplement this function when it wants to know when...
Definition: netwm.h:1697
Property2
Supported properties.
Definition: netwm_def.h:787
Simple multiple monitor topology class for NET classes.
Definition: netwm_def.h:277
State
Window state.
Definition: netwm_def.h:498
Partial strut class for NET classes.
Definition: netwm_def.h:180
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:824
Common API for root window properties/protocols.
Definition: netwm.h:40
Orientation
Orientation.
Definition: netwm_def.h:856
Direction
Direction for WMMoveResize.
Definition: netwm_def.h:603
MappingState
Client window mapping state.
Definition: netwm_def.h:624
Role
Application role.
Definition: netwm_def.h:342
WindowType
Window type.
Definition: netwm_def.h:357
QCA_EXPORT bool isSupported(const char *features, const QString &provider=QString())
Property
Supported properties.
Definition: netwm_def.h:709
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:767
Simple point class for NET classes.
Definition: netwm_def.h:27
virtual void changeDesktop(int desktop)
A Window Manager should subclass NETWinInfo and reimplement this function when it wants to know when ...
Definition: netwm.h:1669
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:782
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:838
virtual void changeNumberOfDesktops(int numberOfDesktops)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:753
Simple rectangle class for NET classes.
Definition: netwm_def.h:105
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:1683
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:806
Base namespace class.
Definition: netwm_def.h:334
virtual void changeCurrentDesktop(int desktop)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:795
static const int OnAllDesktops
Sentinel value to indicate that the client wishes to be visible on all desktops.
Definition: netwm.h:1659
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:894
Action
Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS).
Definition: netwm_def.h:645
Common API for application window properties/protocols.
Definition: netwm.h:944
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:741
WindowTypeMask
Values for WindowType when they should be OR&#39;ed together, e.g.
Definition: netwm_def.h:449
DesktopLayoutCorner
Starting corner for desktop layout.
Definition: netwm_def.h:864
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:730
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:853
RequestSource
Source of the request.
Definition: netwm_def.h:838
Simple size class for NET classes.
Definition: netwm_def.h:68
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:873
virtual void changeShowingDesktop(bool showing)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
Definition: netwm.h:910
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Oct 26 2021 22:41:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.