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