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