11#include <xcb/xproto.h>
15#include "kxcbevent_p.h"
17#if KWINDOWSYSTEM_HAVE_X11
19#include <QGuiApplication>
22#include <private/qtx11extras_p.h>
24#include <kwindowinfo.h>
25#include <kwindowsystem.h>
26#include <kx11extras.h>
38 int32_t initial_state;
39 xcb_pixmap_t icon_pixmap;
40 xcb_window_t icon_window;
43 xcb_pixmap_t icon_mask;
44 xcb_window_t window_group;
48Q_GLOBAL_STATIC(
AtomHash, s_gAtomsHash)
52 auto it = s_gAtomsHash->constFind(c);
53 if (it == s_gAtomsHash->constEnd()) {
55 s_gAtomsHash->insert(c, atom);
61Atoms::Atoms(xcb_connection_t *c)
65 for (
int i = 0; i < KwsAtomCount; ++i) {
66 m_atoms[i] = XCB_ATOM_NONE;
71static const uint32_t netwm_sendevent_mask = (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY);
73const long MAX_PROP_SIZE = 100000;
75static char *nstrdup(
const char *s1)
78 return (
char *)
nullptr;
81 int l = strlen(s1) + 1;
82 char *s2 =
new char[l];
87static char *nstrndup(
const char *s1,
int l)
90 return (
char *)
nullptr;
93 char *s2 =
new char[l + 1];
99static xcb_window_t *nwindup(
const xcb_window_t *w1,
int n)
102 return (xcb_window_t *)
nullptr;
105 xcb_window_t *w2 =
new xcb_window_t[n];
112static void refdec_nri(NETRootInfoPrivate *p)
115 fprintf(stderr,
"NET: decrementing NETRootInfoPrivate::ref (%d)\n", p->ref - 1);
120 fprintf(stderr,
"NET: \tno more references, deleting\n");
124 delete[] p->stacking;
126 delete[] p->virtual_roots;
127 delete[] p->temp_buf;
130 for (i = 0; i < p->desktop_names.size(); i++) {
131 delete[] p->desktop_names[i];
136static void refdec_nwi(NETWinInfoPrivate *p)
139 fprintf(stderr,
"NET: decrementing NETWinInfoPrivate::ref (%d)\n", p->ref - 1);
144 fprintf(stderr,
"NET: \tno more references, deleting\n");
148 delete[] p->visible_name;
149 delete[] p->window_role;
150 delete[] p->icon_name;
151 delete[] p->visible_icon_name;
152 delete[] p->startup_id;
153 delete[] p->class_class;
154 delete[] p->class_name;
155 delete[] p->activities;
156 delete[] p->client_machine;
157 delete[] p->desktop_file;
158 delete[] p->gtk_application_id;
159 delete[] p->appmenu_object_path;
160 delete[] p->appmenu_service_name;
163 for (i = 0; i < p->icons.size(); i++) {
164 delete[] p->icons[i].data;
166 delete[] p->icon_sizes;
171T get_value_reply(xcb_connection_t *c,
const xcb_get_property_cookie_t cookie, xcb_atom_t type, T def,
bool *success =
nullptr)
175 xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie,
nullptr);
182 if (reply->type == type && reply->value_len == 1 && reply->format ==
sizeof(T) * 8) {
183 value = *
reinterpret_cast<T *
>(xcb_get_property_value(reply));
197QList<T> get_array_reply(xcb_connection_t *c,
const xcb_get_property_cookie_t cookie, xcb_atom_t type)
199 xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie,
nullptr);
206 if (reply->type == type && reply->value_len > 0 && reply->format ==
sizeof(T) * 8) {
207 T *data =
reinterpret_cast<T *
>(xcb_get_property_value(reply));
209 vector.
resize(reply->value_len);
210 memcpy((
void *)&vector.
first(), (
void *)data, reply->value_len *
sizeof(T));
217static QByteArray get_string_reply(xcb_connection_t *c,
const xcb_get_property_cookie_t cookie, xcb_atom_t type)
219 xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie,
nullptr);
226 if (reply->type == type && reply->format == 8 && reply->value_len > 0) {
227 const char *data = (
const char *)xcb_get_property_value(reply);
228 int len = reply->value_len;
231 value =
QByteArray(data, data[len - 1] ? len : len - 1);
239static QList<QByteArray> get_stringlist_reply(xcb_connection_t *c,
const xcb_get_property_cookie_t cookie, xcb_atom_t type)
241 xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie,
nullptr);
248 if (reply->type == type && reply->format == 8 && reply->value_len > 0) {
249 const char *data = (
const char *)xcb_get_property_value(reply);
250 int len = reply->value_len;
263static QByteArray get_atom_name(xcb_connection_t *c, xcb_atom_t atom)
265 const xcb_get_atom_name_cookie_t cookie = xcb_get_atom_name(c, atom);
267 xcb_get_atom_name_reply_t *reply = xcb_get_atom_name_reply(c, cookie, 0);
281#define ENUM_CREATE_CHAR_ARRAY 1
284 xcb_intern_atom_cookie_t cookies[KwsAtomCount];
285 for (
int i = 0; i < KwsAtomCount; ++i) {
286 cookies[i] = xcb_intern_atom(m_connection,
false, strlen(KwsAtomStrings[i]), KwsAtomStrings[i]);
290 for (
int i = 0; i < KwsAtomCount; ++i) {
291 xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(m_connection, cookies[i],
nullptr);
296 m_atoms[i] = reply->atom;
301static void readIcon(xcb_connection_t *c,
const xcb_get_property_cookie_t cookie, NETRArray<NETIcon> &icons,
int &icon_count)
304 fprintf(stderr,
"NET: readIcon\n");
308 for (
int i = 0; i < icons.size(); i++) {
309 delete[] icons[i].data;
315 xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie,
nullptr);
317 if (!reply || reply->value_len < 3 || reply->format != 32 || reply->type != XCB_ATOM_CARDINAL) {
325 uint32_t *data = (uint32_t *)xcb_get_property_value(reply);
327 for (
unsigned int i = 0, j = 0; j < reply->value_len - 2; i++) {
328 uint32_t width = data[j++];
329 uint32_t height = data[j++];
330 uint32_t size = width * height *
sizeof(uint32_t);
331 if (j + width * height > reply->value_len) {
332 fprintf(stderr,
"Ill-encoded icon data; proposed size leads to out of bounds access. Skipping. (%d x %d)\n", width, height);
335 if (width > 1024 || height > 1024) {
336 fprintf(stderr,
"Warning: found huge icon. The icon data may be ill-encoded. (%d x %d)\n", width, height);
341 icons[i].size.width = width;
342 icons[i].size.height = height;
343 icons[i].data =
new unsigned char[size];
345 memcpy((
void *)icons[i].data, (
const void *)&data[j], size);
354 fprintf(stderr,
"NET: readIcon got %d icons\n", icon_count);
358static void send_client_message(xcb_connection_t *c, uint32_t mask, xcb_window_t destination, xcb_window_t window, xcb_atom_t message,
const uint32_t data[])
360 KXcbEvent<xcb_client_message_event_t>
event;
361 event.response_type = XCB_CLIENT_MESSAGE;
365 event.type = message;
367 for (
int i = 0; i < 5; i++) {
368 event.data.data32[i] = data[i];
371 xcb_send_event(c,
false, destination, mask,
event.buffer());
375NETRArray<Z>::NETRArray()
379 d = (Z *)calloc(capacity,
sizeof(Z));
383NETRArray<Z>::~NETRArray()
389void NETRArray<Z>::reset()
393 d = (Z *)realloc(d,
sizeof(Z) * capacity);
394 memset((
void *)d, 0,
sizeof(Z) * capacity);
398Z &NETRArray<Z>::operator[](
int index)
400 if (index >= capacity) {
406 d = (Z *)realloc(d,
sizeof(Z) * newcapacity);
407 memset((
void *)&d[capacity], 0,
sizeof(Z) * (newcapacity - capacity));
430 xcb_window_t supportWindow,
441 fprintf(stderr,
"NETRootInfo::NETRootInfo: using window manager constructor\n");
444 p =
new NETRootInfoPrivate;
446 p->atoms = atomsForConnection(connection);
448 p->name = nstrdup(
wmName);
450 p->conn = connection;
452 p->temp_buf =
nullptr;
453 p->temp_buf_size = 0;
455 const xcb_setup_t *setup = xcb_get_setup(p->conn);
456 xcb_screen_iterator_t it = xcb_setup_roots_iterator(setup);
458 if (screen != -1 && screen < setup->roots_len) {
459 for (
int i = 0; i < screen; i++) {
460 xcb_screen_next(&it);
464 p->root = it.data->root;
466 p->number_of_desktops = p->current_desktop = 0;
467 p->active = XCB_WINDOW_NONE;
468 p->clients = p->stacking = p->virtual_roots = (xcb_window_t *)
nullptr;
469 p->clients_count = p->stacking_count = p->virtual_roots_count = 0;
470 p->showing_desktop =
false;
471 p->desktop_layout_orientation = OrientationHorizontal;
472 p->desktop_layout_corner = DesktopLayoutCornerTopLeft;
473 p->desktop_layout_columns = p->desktop_layout_rows = 0;
474 setDefaultProperties();
475 p->properties = properties;
476 p->properties2 = properties2;
477 p->windowTypes = windowTypes;
479 p->actions = actions;
481 p->properties |= (Supported | SupportingWMCheck);
482 p->clientProperties = DesktopNames
484 p->clientProperties2 = WM2DesktopLayout;
496 fprintf(stderr,
"NETRootInfo::NETRootInfo: using Client constructor\n");
499 p =
new NETRootInfoPrivate;
501 p->atoms = atomsForConnection(connection);
505 p->conn = connection;
507 p->temp_buf =
nullptr;
508 p->temp_buf_size = 0;
510 const xcb_setup_t *setup = xcb_get_setup(p->conn);
511 xcb_screen_iterator_t it = xcb_setup_roots_iterator(setup);
513 if (screen != -1 && screen < setup->roots_len) {
514 for (
int i = 0; i < screen; i++) {
515 xcb_screen_next(&it);
519 p->root = it.data->root;
520 p->rootSize.width = it.data->width_in_pixels;
521 p->rootSize.height = it.data->height_in_pixels;
523 p->supportwindow = XCB_WINDOW_NONE;
524 p->number_of_desktops = p->current_desktop = 0;
525 p->active = XCB_WINDOW_NONE;
526 p->clients = p->stacking = p->virtual_roots = (xcb_window_t *)
nullptr;
527 p->clients_count = p->stacking_count = p->virtual_roots_count = 0;
528 p->showing_desktop =
false;
529 p->desktop_layout_orientation = OrientationHorizontal;
530 p->desktop_layout_corner = DesktopLayoutCornerTopLeft;
531 p->desktop_layout_columns = p->desktop_layout_rows = 0;
532 setDefaultProperties();
533 p->clientProperties = properties;
534 p->clientProperties2 = properties2;
553 fprintf(stderr,
"NETRootInfo::NETRootInfo: using copy constructor\n");
572void NETRootInfo::setDefaultProperties()
574 p->properties = Supported | SupportingWMCheck;
587 fprintf(stderr,
"NETRootInfo::activate: setting supported properties on root\n");
591 update(p->clientProperties, p->clientProperties2);
594 fprintf(stderr,
"NETRootInfo::activate: updating client information\n");
597 update(p->clientProperties, p->clientProperties2);
607 p->clients_count = count;
610 p->clients = nwindup(windows, count);
613 fprintf(stderr,
"NETRootInfo::setClientList: setting list with %ld windows\n", p->clients_count);
616 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_CLIENT_LIST), XCB_ATOM_WINDOW, 32, p->clients_count, (
const void *)windows);
625 p->stacking_count = count;
626 delete[] p->stacking;
627 p->stacking = nwindup(windows, count);
630 fprintf(stderr,
"NETRootInfo::setClientListStacking: setting list with %ld windows\n", p->clients_count);
633 xcb_change_property(p->conn,
634 XCB_PROP_MODE_REPLACE,
636 p->atom(_NET_CLIENT_LIST_STACKING),
640 (
const void *)windows);
646 fprintf(stderr,
"NETRootInfo::setNumberOfDesktops: setting desktop count to %d (%s)\n",
numberOfDesktops, (p->role ==
WindowManager) ?
"WM" :
"Client");
652 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_NUMBER_OF_DESKTOPS), XCB_ATOM_CARDINAL, 32, 1, (
const void *)&d);
656 send_client_message(p->conn, netwm_sendevent_mask, p->root, p->root, p->atom(_NET_NUMBER_OF_DESKTOPS), data);
663 fprintf(stderr,
"NETRootInfo::setCurrentDesktop: setting current desktop = %d (%s)\n", desktop, (p->role ==
WindowManager) ?
"WM" :
"Client");
667 p->current_desktop = desktop;
668 uint32_t d = p->current_desktop - 1;
669 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_CURRENT_DESKTOP), XCB_ATOM_CARDINAL, 32, 1, (
const void *)&d);
676 const uint32_t data[5] = {uint32_t(desktop - 1), 0, 0, 0, 0};
678 send_client_message(p->conn, netwm_sendevent_mask, p->root, p->root, p->atom(_NET_CURRENT_DESKTOP), data);
689 delete[] p->desktop_names[desktop - 1];
690 p->desktop_names[desktop - 1] = nstrdup(
desktopName);
693 unsigned int proplen;
694 unsigned int num = ((p->number_of_desktops > p->desktop_names.size()) ? p->number_of_desktops : p->desktop_names.size());
695 for (i = 0, proplen = 0; i < num; i++) {
696 proplen += (p->desktop_names[i] !=
nullptr ? strlen(p->desktop_names[i]) + 1 : 1);
699 char *prop =
new char[proplen];
702 for (i = 0; i < num; i++) {
703 if (p->desktop_names[i]) {
704 strcpy(propp, p->desktop_names[i]);
705 propp += strlen(p->desktop_names[i]) + 1;
713 "NETRootInfo::setDesktopName(%d, '%s')\n"
714 "NETRootInfo::setDesktopName: total property length = %d",
720 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_DESKTOP_NAMES), p->atom(UTF8_STRING), 8, proplen, (
const void *)prop);
728 fprintf(stderr,
"NETRootInfo::setDesktopGeometry( -- , { %d, %d }) (%s)\n", geometry.
width, geometry.
height, (p->role ==
WindowManager) ?
"WM" :
"Client");
732 p->geometry = geometry;
735 data[0] = p->geometry.width;
736 data[1] = p->geometry.height;
738 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_DESKTOP_GEOMETRY), XCB_ATOM_CARDINAL, 32, 2, (
const void *)data);
740 uint32_t data[5] = {uint32_t(geometry.
width), uint32_t(geometry.
height), 0, 0, 0};
742 send_client_message(p->conn, netwm_sendevent_mask, p->root, p->root, p->atom(_NET_DESKTOP_GEOMETRY), data);
749 fprintf(stderr,
"NETRootInfo::setDesktopViewport(%d, { %d, %d }) (%s)\n", desktop, viewport.
x, viewport.
y, (p->role ==
WindowManager) ?
"WM" :
"Client");
757 p->viewport[desktop - 1] = viewport;
762 l = p->number_of_desktops * 2;
763 uint32_t *data =
new uint32_t[l];
764 for (d = 0, i = 0; d < p->number_of_desktops; d++) {
765 data[i++] = p->viewport[d].x;
766 data[i++] = p->viewport[d].y;
769 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_DESKTOP_VIEWPORT), XCB_ATOM_CARDINAL, 32, l, (
const void *)data);
773 const uint32_t data[5] = {uint32_t(viewport.
x), uint32_t(viewport.
y), 0, 0, 0};
775 send_client_message(p->conn, netwm_sendevent_mask, p->root, p->root, p->atom(_NET_DESKTOP_VIEWPORT), data);
779void NETRootInfo::setSupported()
783 fprintf(stderr,
"NETRootInfo::setSupported - role != WindowManager\n");
789 xcb_atom_t atoms[KwsAtomCount];
793 atoms[0] = p->atom(_NET_SUPPORTED);
794 atoms[1] = p->atom(_NET_SUPPORTING_WM_CHECK);
796 if (p->properties & ClientList) {
797 atoms[pnum++] = p->atom(_NET_CLIENT_LIST);
800 if (p->properties & ClientListStacking) {
801 atoms[pnum++] = p->atom(_NET_CLIENT_LIST_STACKING);
804 if (p->properties & NumberOfDesktops) {
805 atoms[pnum++] = p->atom(_NET_NUMBER_OF_DESKTOPS);
808 if (p->properties & DesktopGeometry) {
809 atoms[pnum++] = p->atom(_NET_DESKTOP_GEOMETRY);
812 if (p->properties & DesktopViewport) {
813 atoms[pnum++] = p->atom(_NET_DESKTOP_VIEWPORT);
816 if (p->properties & CurrentDesktop) {
817 atoms[pnum++] = p->atom(_NET_CURRENT_DESKTOP);
820 if (p->properties & DesktopNames) {
821 atoms[pnum++] = p->atom(_NET_DESKTOP_NAMES);
824 if (p->properties & ActiveWindow) {
825 atoms[pnum++] = p->atom(_NET_ACTIVE_WINDOW);
828 if (p->properties & WorkArea) {
829 atoms[pnum++] = p->atom(_NET_WORKAREA);
832 if (p->properties & VirtualRoots) {
833 atoms[pnum++] = p->atom(_NET_VIRTUAL_ROOTS);
836 if (p->properties2 & WM2DesktopLayout) {
837 atoms[pnum++] = p->atom(_NET_DESKTOP_LAYOUT);
840 if (p->properties & CloseWindow) {
841 atoms[pnum++] = p->atom(_NET_CLOSE_WINDOW);
844 if (p->properties2 & WM2RestackWindow) {
845 atoms[pnum++] = p->atom(_NET_RESTACK_WINDOW);
848 if (p->properties2 & WM2ShowingDesktop) {
849 atoms[pnum++] = p->atom(_NET_SHOWING_DESKTOP);
853 if (p->properties & WMMoveResize) {
854 atoms[pnum++] = p->atom(_NET_WM_MOVERESIZE);
857 if (p->properties2 & WM2MoveResizeWindow) {
858 atoms[pnum++] = p->atom(_NET_MOVERESIZE_WINDOW);
861 if (p->properties & WMName) {
862 atoms[pnum++] = p->atom(_NET_WM_NAME);
865 if (p->properties & WMVisibleName) {
866 atoms[pnum++] = p->atom(_NET_WM_VISIBLE_NAME);
869 if (p->properties & WMIconName) {
870 atoms[pnum++] = p->atom(_NET_WM_ICON_NAME);
873 if (p->properties & WMVisibleIconName) {
874 atoms[pnum++] = p->atom(_NET_WM_VISIBLE_ICON_NAME);
877 if (p->properties & WMDesktop) {
878 atoms[pnum++] = p->atom(_NET_WM_DESKTOP);
881 if (p->properties & WMWindowType) {
882 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE);
886 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_NORMAL);
889 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_DESKTOP);
892 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_DOCK);
895 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_TOOLBAR);
898 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_MENU);
901 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_DIALOG);
904 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_UTILITY);
907 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_SPLASH);
910 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU);
913 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_POPUP_MENU);
916 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_TOOLTIP);
919 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_NOTIFICATION);
922 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_COMBO);
925 atoms[pnum++] = p->atom(_NET_WM_WINDOW_TYPE_DND);
929 atoms[pnum++] = p->atom(_KDE_NET_WM_WINDOW_TYPE_OVERRIDE);
932 atoms[pnum++] = p->atom(_KDE_NET_WM_WINDOW_TYPE_TOPMENU);
935 atoms[pnum++] = p->atom(_KDE_NET_WM_WINDOW_TYPE_ON_SCREEN_DISPLAY);
938 atoms[pnum++] = p->atom(_KDE_NET_WM_WINDOW_TYPE_CRITICAL_NOTIFICATION);
941 atoms[pnum++] = p->atom(_KDE_NET_WM_WINDOW_TYPE_APPLET_POPUP);
945 if (p->properties & WMState) {
946 atoms[pnum++] = p->atom(_NET_WM_STATE);
949 if (p->states &
Modal) {
950 atoms[pnum++] = p->atom(_NET_WM_STATE_MODAL);
953 atoms[pnum++] = p->atom(_NET_WM_STATE_STICKY);
956 atoms[pnum++] = p->atom(_NET_WM_STATE_MAXIMIZED_VERT);
959 atoms[pnum++] = p->atom(_NET_WM_STATE_MAXIMIZED_HORZ);
962 atoms[pnum++] = p->atom(_NET_WM_STATE_SHADED);
965 atoms[pnum++] = p->atom(_NET_WM_STATE_SKIP_TASKBAR);
968 atoms[pnum++] = p->atom(_NET_WM_STATE_SKIP_PAGER);
971 atoms[pnum++] = p->atom(_KDE_NET_WM_STATE_SKIP_SWITCHER);
974 atoms[pnum++] = p->atom(_NET_WM_STATE_HIDDEN);
977 atoms[pnum++] = p->atom(_NET_WM_STATE_FULLSCREEN);
980 atoms[pnum++] = p->atom(_NET_WM_STATE_ABOVE);
982 atoms[pnum++] = p->atom(_NET_WM_STATE_STAYS_ON_TOP);
985 atoms[pnum++] = p->atom(_NET_WM_STATE_BELOW);
988 atoms[pnum++] = p->atom(_NET_WM_STATE_DEMANDS_ATTENTION);
992 atoms[pnum++] = p->atom(_NET_WM_STATE_FOCUSED);
996 if (p->properties & WMStrut) {
997 atoms[pnum++] = p->atom(_NET_WM_STRUT);
1000 if (p->properties2 & WM2ExtendedStrut) {
1001 atoms[pnum++] = p->atom(_NET_WM_STRUT_PARTIAL);
1004 if (p->properties & WMIconGeometry) {
1005 atoms[pnum++] = p->atom(_NET_WM_ICON_GEOMETRY);
1008 if (p->properties & WMIcon) {
1009 atoms[pnum++] = p->atom(_NET_WM_ICON);
1012 if (p->properties & WMPid) {
1013 atoms[pnum++] = p->atom(_NET_WM_PID);
1016 if (p->properties & WMHandledIcons) {
1017 atoms[pnum++] = p->atom(_NET_WM_HANDLED_ICONS);
1020 if (p->properties & WMPing) {
1021 atoms[pnum++] = p->atom(_NET_WM_PING);
1024 if (p->properties2 & WM2UserTime) {
1025 atoms[pnum++] = p->atom(_NET_WM_USER_TIME);
1028 if (p->properties2 & WM2StartupId) {
1029 atoms[pnum++] = p->atom(_NET_STARTUP_ID);
1032 if (p->properties2 & WM2Opacity) {
1033 atoms[pnum++] = p->atom(_NET_WM_WINDOW_OPACITY);
1036 if (p->properties2 & WM2FullscreenMonitors) {
1037 atoms[pnum++] = p->atom(_NET_WM_FULLSCREEN_MONITORS);
1040 if (p->properties2 & WM2AllowedActions) {
1041 atoms[pnum++] = p->atom(_NET_WM_ALLOWED_ACTIONS);
1044 if (p->actions & ActionMove) {
1045 atoms[pnum++] = p->atom(_NET_WM_ACTION_MOVE);
1047 if (p->actions & ActionResize) {
1048 atoms[pnum++] = p->atom(_NET_WM_ACTION_RESIZE);
1050 if (p->actions & ActionMinimize) {
1051 atoms[pnum++] = p->atom(_NET_WM_ACTION_MINIMIZE);
1053 if (p->actions & ActionShade) {
1054 atoms[pnum++] = p->atom(_NET_WM_ACTION_SHADE);
1056 if (p->actions & ActionStick) {
1057 atoms[pnum++] = p->atom(_NET_WM_ACTION_STICK);
1059 if (p->actions & ActionMaxVert) {
1060 atoms[pnum++] = p->atom(_NET_WM_ACTION_MAXIMIZE_VERT);
1062 if (p->actions & ActionMaxHoriz) {
1063 atoms[pnum++] = p->atom(_NET_WM_ACTION_MAXIMIZE_HORZ);
1065 if (p->actions & ActionFullScreen) {
1066 atoms[pnum++] = p->atom(_NET_WM_ACTION_FULLSCREEN);
1068 if (p->actions & ActionChangeDesktop) {
1069 atoms[pnum++] = p->atom(_NET_WM_ACTION_CHANGE_DESKTOP);
1071 if (p->actions & ActionClose) {
1072 atoms[pnum++] = p->atom(_NET_WM_ACTION_CLOSE);
1076 if (p->properties & WMFrameExtents) {
1077 atoms[pnum++] = p->atom(_NET_FRAME_EXTENTS);
1078 atoms[pnum++] = p->atom(_KDE_NET_WM_FRAME_STRUT);
1081 if (p->properties2 & WM2FrameOverlap) {
1082 atoms[pnum++] = p->atom(_NET_WM_FRAME_OVERLAP);
1085 if (p->properties2 & WM2KDETemporaryRules) {
1086 atoms[pnum++] = p->atom(_KDE_NET_WM_TEMPORARY_RULES);
1088 if (p->properties2 & WM2FullPlacement) {
1089 atoms[pnum++] = p->atom(_NET_WM_FULL_PLACEMENT);
1092 if (p->properties2 & WM2Activities) {
1093 atoms[pnum++] = p->atom(_KDE_NET_WM_ACTIVITIES);
1096 if (p->properties2 & WM2BlockCompositing) {
1097 atoms[pnum++] = p->atom(_KDE_NET_WM_BLOCK_COMPOSITING);
1098 atoms[pnum++] = p->atom(_NET_WM_BYPASS_COMPOSITOR);
1101 if (p->properties2 & WM2KDEShadow) {
1102 atoms[pnum++] = p->atom(_KDE_NET_WM_SHADOW);
1105 if (p->properties2 & WM2OpaqueRegion) {
1106 atoms[pnum++] = p->atom(_NET_WM_OPAQUE_REGION);
1109 if (p->properties2 & WM2GTKFrameExtents) {
1110 atoms[pnum++] = p->atom(_GTK_FRAME_EXTENTS);
1113 if (p->properties2 & WM2GTKShowWindowMenu) {
1114 atoms[pnum++] = p->atom(_GTK_SHOW_WINDOW_MENU);
1117 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_SUPPORTED), XCB_ATOM_ATOM, 32, pnum, (
const void *)atoms);
1119 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_SUPPORTING_WM_CHECK), XCB_ATOM_WINDOW, 32, 1, (
const void *)&(p->supportwindow));
1123 "NETRootInfo::setSupported: _NET_SUPPORTING_WM_CHECK = 0x%lx on 0x%lx\n"
1124 " : _NET_WM_NAME = '%s' on 0x%lx\n",
1131 xcb_change_property(p->conn,
1132 XCB_PROP_MODE_REPLACE,
1134 p->atom(_NET_SUPPORTING_WM_CHECK),
1138 (
const void *)&(p->supportwindow));
1140 xcb_change_property(p->conn,
1141 XCB_PROP_MODE_REPLACE,
1143 p->atom(_NET_WM_NAME),
1144 p->atom(UTF8_STRING),
1147 (
const void *)p->name);
1150void NETRootInfo::updateSupportedProperties(xcb_atom_t atom)
1152 if (atom == p->atom(_NET_SUPPORTED)) {
1153 p->properties |= Supported;
1156 else if (atom == p->atom(_NET_SUPPORTING_WM_CHECK)) {
1157 p->properties |= SupportingWMCheck;
1160 else if (atom == p->atom(_NET_CLIENT_LIST)) {
1161 p->properties |= ClientList;
1164 else if (atom == p->atom(_NET_CLIENT_LIST_STACKING)) {
1165 p->properties |= ClientListStacking;
1168 else if (atom == p->atom(_NET_NUMBER_OF_DESKTOPS)) {
1169 p->properties |= NumberOfDesktops;
1172 else if (atom == p->atom(_NET_DESKTOP_GEOMETRY)) {
1173 p->properties |= DesktopGeometry;
1176 else if (atom == p->atom(_NET_DESKTOP_VIEWPORT)) {
1177 p->properties |= DesktopViewport;
1180 else if (atom == p->atom(_NET_CURRENT_DESKTOP)) {
1181 p->properties |= CurrentDesktop;
1184 else if (atom == p->atom(_NET_DESKTOP_NAMES)) {
1185 p->properties |= DesktopNames;
1188 else if (atom == p->atom(_NET_ACTIVE_WINDOW)) {
1189 p->properties |= ActiveWindow;
1192 else if (atom == p->atom(_NET_WORKAREA)) {
1193 p->properties |= WorkArea;
1196 else if (atom == p->atom(_NET_VIRTUAL_ROOTS)) {
1197 p->properties |= VirtualRoots;
1200 else if (atom == p->atom(_NET_DESKTOP_LAYOUT)) {
1201 p->properties2 |= WM2DesktopLayout;
1204 else if (atom == p->atom(_NET_CLOSE_WINDOW)) {
1205 p->properties |= CloseWindow;
1208 else if (atom == p->atom(_NET_RESTACK_WINDOW)) {
1209 p->properties2 |= WM2RestackWindow;
1212 else if (atom == p->atom(_NET_SHOWING_DESKTOP)) {
1213 p->properties2 |= WM2ShowingDesktop;
1217 else if (atom == p->atom(_NET_WM_MOVERESIZE)) {
1218 p->properties |= WMMoveResize;
1221 else if (atom == p->atom(_NET_MOVERESIZE_WINDOW)) {
1222 p->properties2 |= WM2MoveResizeWindow;
1225 else if (atom == p->atom(_NET_WM_NAME)) {
1226 p->properties |= WMName;
1229 else if (atom == p->atom(_NET_WM_VISIBLE_NAME)) {
1230 p->properties |= WMVisibleName;
1233 else if (atom == p->atom(_NET_WM_ICON_NAME)) {
1234 p->properties |= WMIconName;
1237 else if (atom == p->atom(_NET_WM_VISIBLE_ICON_NAME)) {
1238 p->properties |= WMVisibleIconName;
1241 else if (atom == p->atom(_NET_WM_DESKTOP)) {
1242 p->properties |= WMDesktop;
1245 else if (atom == p->atom(_NET_WM_WINDOW_TYPE)) {
1246 p->properties |= WMWindowType;
1250 else if (atom == p->atom(_NET_WM_WINDOW_TYPE_NORMAL)) {
1252 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_DESKTOP)) {
1254 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_DOCK)) {
1256 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_TOOLBAR)) {
1258 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_MENU)) {
1260 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_DIALOG)) {
1262 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_UTILITY)) {
1264 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_SPLASH)) {
1266 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU)) {
1268 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_POPUP_MENU)) {
1270 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_TOOLTIP)) {
1272 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_NOTIFICATION)) {
1274 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_COMBO)) {
1276 }
else if (atom == p->atom(_NET_WM_WINDOW_TYPE_DND)) {
1280 else if (atom == p->atom(_KDE_NET_WM_WINDOW_TYPE_OVERRIDE)) {
1282 }
else if (atom == p->atom(_KDE_NET_WM_WINDOW_TYPE_TOPMENU)) {
1284 }
else if (atom == p->atom(_KDE_NET_WM_WINDOW_TYPE_ON_SCREEN_DISPLAY)) {
1286 }
else if (atom == p->atom(_KDE_NET_WM_WINDOW_TYPE_CRITICAL_NOTIFICATION)) {
1288 }
else if (atom == p->atom(_KDE_NET_WM_WINDOW_TYPE_APPLET_POPUP)) {
1292 else if (atom == p->atom(_NET_WM_STATE)) {
1293 p->properties |= WMState;
1297 else if (atom == p->atom(_NET_WM_STATE_MODAL)) {
1299 }
else if (atom == p->atom(_NET_WM_STATE_STICKY)) {
1301 }
else if (atom == p->atom(_NET_WM_STATE_MAXIMIZED_VERT)) {
1303 }
else if (atom == p->atom(_NET_WM_STATE_MAXIMIZED_HORZ)) {
1305 }
else if (atom == p->atom(_NET_WM_STATE_SHADED)) {
1307 }
else if (atom == p->atom(_NET_WM_STATE_SKIP_TASKBAR)) {
1309 }
else if (atom == p->atom(_NET_WM_STATE_SKIP_PAGER)) {
1311 }
else if (atom == p->atom(_KDE_NET_WM_STATE_SKIP_SWITCHER)) {
1313 }
else if (atom == p->atom(_NET_WM_STATE_HIDDEN)) {
1315 }
else if (atom == p->atom(_NET_WM_STATE_FULLSCREEN)) {
1317 }
else if (atom == p->atom(_NET_WM_STATE_ABOVE)) {
1319 }
else if (atom == p->atom(_NET_WM_STATE_BELOW)) {
1321 }
else if (atom == p->atom(_NET_WM_STATE_DEMANDS_ATTENTION)) {
1323 }
else if (atom == p->atom(_NET_WM_STATE_STAYS_ON_TOP)) {
1325 }
else if (atom == p->atom(_NET_WM_STATE_FOCUSED)) {
1329 else if (atom == p->atom(_NET_WM_STRUT)) {
1330 p->properties |= WMStrut;
1333 else if (atom == p->atom(_NET_WM_STRUT_PARTIAL)) {
1334 p->properties2 |= WM2ExtendedStrut;
1337 else if (atom == p->atom(_NET_WM_ICON_GEOMETRY)) {
1338 p->properties |= WMIconGeometry;
1341 else if (atom == p->atom(_NET_WM_ICON)) {
1342 p->properties |= WMIcon;
1345 else if (atom == p->atom(_NET_WM_PID)) {
1346 p->properties |= WMPid;
1349 else if (atom == p->atom(_NET_WM_HANDLED_ICONS)) {
1350 p->properties |= WMHandledIcons;
1353 else if (atom == p->atom(_NET_WM_PING)) {
1354 p->properties |= WMPing;
1357 else if (atom == p->atom(_NET_WM_USER_TIME)) {
1358 p->properties2 |= WM2UserTime;
1361 else if (atom == p->atom(_NET_STARTUP_ID)) {
1362 p->properties2 |= WM2StartupId;
1365 else if (atom == p->atom(_NET_WM_WINDOW_OPACITY)) {
1366 p->properties2 |= WM2Opacity;
1369 else if (atom == p->atom(_NET_WM_FULLSCREEN_MONITORS)) {
1370 p->properties2 |= WM2FullscreenMonitors;
1373 else if (atom == p->atom(_NET_WM_ALLOWED_ACTIONS)) {
1374 p->properties2 |= WM2AllowedActions;
1378 else if (atom == p->atom(_NET_WM_ACTION_MOVE)) {
1379 p->actions |= ActionMove;
1380 }
else if (atom == p->atom(_NET_WM_ACTION_RESIZE)) {
1381 p->actions |= ActionResize;
1382 }
else if (atom == p->atom(_NET_WM_ACTION_MINIMIZE)) {
1383 p->actions |= ActionMinimize;
1384 }
else if (atom == p->atom(_NET_WM_ACTION_SHADE)) {
1385 p->actions |= ActionShade;
1386 }
else if (atom == p->atom(_NET_WM_ACTION_STICK)) {
1387 p->actions |= ActionStick;
1388 }
else if (atom == p->atom(_NET_WM_ACTION_MAXIMIZE_VERT)) {
1389 p->actions |= ActionMaxVert;
1390 }
else if (atom == p->atom(_NET_WM_ACTION_MAXIMIZE_HORZ)) {
1391 p->actions |= ActionMaxHoriz;
1392 }
else if (atom == p->atom(_NET_WM_ACTION_FULLSCREEN)) {
1393 p->actions |= ActionFullScreen;
1394 }
else if (atom == p->atom(_NET_WM_ACTION_CHANGE_DESKTOP)) {
1395 p->actions |= ActionChangeDesktop;
1396 }
else if (atom == p->atom(_NET_WM_ACTION_CLOSE)) {
1397 p->actions |= ActionClose;
1400 else if (atom == p->atom(_NET_FRAME_EXTENTS)) {
1401 p->properties |= WMFrameExtents;
1402 }
else if (atom == p->atom(_KDE_NET_WM_FRAME_STRUT)) {
1403 p->properties |= WMFrameExtents;
1404 }
else if (atom == p->atom(_NET_WM_FRAME_OVERLAP)) {
1405 p->properties2 |= WM2FrameOverlap;
1408 else if (atom == p->atom(_KDE_NET_WM_TEMPORARY_RULES)) {
1409 p->properties2 |= WM2KDETemporaryRules;
1410 }
else if (atom == p->atom(_NET_WM_FULL_PLACEMENT)) {
1411 p->properties2 |= WM2FullPlacement;
1414 else if (atom == p->atom(_KDE_NET_WM_ACTIVITIES)) {
1415 p->properties2 |= WM2Activities;
1418 else if (atom == p->atom(_KDE_NET_WM_BLOCK_COMPOSITING) || atom == p->atom(_NET_WM_BYPASS_COMPOSITOR)) {
1419 p->properties2 |= WM2BlockCompositing;
1422 else if (atom == p->atom(_KDE_NET_WM_SHADOW)) {
1423 p->properties2 |= WM2KDEShadow;
1426 else if (atom == p->atom(_NET_WM_OPAQUE_REGION)) {
1427 p->properties2 |= WM2OpaqueRegion;
1430 else if (atom == p->atom(_GTK_FRAME_EXTENTS)) {
1431 p->properties2 |= WM2GTKFrameExtents;
1434 else if (atom == p->atom(_GTK_SHOW_WINDOW_MENU)) {
1435 p->properties2 |= WM2GTKShowWindowMenu;
1438 else if (atom == p->atom(_KDE_NET_WM_APPMENU_OBJECT_PATH)) {
1439 p->properties2 |= WM2AppMenuObjectPath;
1442 else if (atom == p->atom(_KDE_NET_WM_APPMENU_SERVICE_NAME)) {
1443 p->properties2 |= WM2AppMenuServiceName;
1455 fprintf(stderr,
"NETRootInfo::setActiveWindow(0x%lx) (%s)\n", window, (p->role ==
WindowManager) ?
"WM" :
"Client");
1461 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_ACTIVE_WINDOW), XCB_ATOM_WINDOW, 32, 1, (
const void *)&(p->active));
1463 const uint32_t data[5] = {src, timestamp, active_window, 0, 0};
1465 send_client_message(p->conn, netwm_sendevent_mask, p->root, window, p->atom(_NET_ACTIVE_WINDOW), data);
1473 "NETRootInfo::setWorkArea(%d, { %d, %d, %d, %d }) (%s)\n",
1486 p->workarea[desktop - 1] = workarea;
1488 uint32_t *wa =
new uint32_t[p->number_of_desktops * 4];
1491 for (i = 0, o = 0; i < p->number_of_desktops; i++) {
1492 wa[o++] = p->workarea[i].pos.x;
1493 wa[o++] = p->workarea[i].pos.y;
1494 wa[o++] = p->workarea[i].size.width;
1495 wa[o++] = p->workarea[i].size.height;
1498 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_WORKAREA), XCB_ATOM_CARDINAL, 32, p->number_of_desktops * 4, (
const void *)wa);
1509 p->virtual_roots_count = count;
1510 delete[] p->virtual_roots;
1511 p->virtual_roots = nwindup(windows, count);
1514 fprintf(stderr,
"NETRootInfo::setVirtualRoots: setting list with %ld windows\n", p->virtual_roots_count);
1517 xcb_change_property(p->conn,
1518 XCB_PROP_MODE_REPLACE,
1520 p->atom(_NET_VIRTUAL_ROOTS),
1523 p->virtual_roots_count,
1524 (
const void *)windows);
1529 p->desktop_layout_orientation = orientation;
1530 p->desktop_layout_columns = columns;
1531 p->desktop_layout_rows = rows;
1532 p->desktop_layout_corner = corner;
1535 fprintf(stderr,
"NETRootInfo::setDesktopLayout: %d %d %d %d\n", orientation, columns, rows, corner);
1539 data[0] = orientation;
1544 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_DESKTOP_LAYOUT), XCB_ATOM_CARDINAL, 32, 4, (
const void *)data);
1550 uint32_t d = p->showing_desktop = showing;
1551 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->root, p->atom(_NET_SHOWING_DESKTOP), XCB_ATOM_CARDINAL, 32, 1, (
const void *)&d);
1553 uint32_t data[5] = {uint32_t(showing ? 1 : 0), 0, 0, 0, 0};
1554 send_client_message(p->conn, netwm_sendevent_mask, p->root, p->root, p->atom(_NET_SHOWING_DESKTOP), data);
1560 return p->showing_desktop;
1566 fprintf(stderr,
"NETRootInfo::closeWindowRequest: requesting close for 0x%lx\n", window);
1569 const uint32_t data[5] = {0, 0, 0, 0, 0};
1570 send_client_message(p->conn, netwm_sendevent_mask, p->root, window, p->atom(_NET_CLOSE_WINDOW), data);
1577 "NETRootInfo::moveResizeRequest: requesting resize/move for 0x%lx (%d, %d, %d, %d, %d)\n",
1586 const uint32_t data[5] = {uint32_t(x_root), uint32_t(y_root), uint32_t(direction), uint32_t(button), uint32_t(source)};
1588 send_client_message(p->conn, netwm_sendevent_mask, p->root, window, p->atom(_NET_WM_MOVERESIZE), data);
1594 fprintf(stderr,
"NETRootInfo::moveResizeWindowRequest: resizing/moving 0x%lx (%d, %d, %d, %d, %d)\n", window, flags, x, y, width, height);
1597 const uint32_t data[5] = {uint32_t(flags), uint32_t(x), uint32_t(y), uint32_t(width), uint32_t(height)};
1599 send_client_message(p->conn, netwm_sendevent_mask, p->root, window, p->atom(_NET_MOVERESIZE_WINDOW), data);
1605 fprintf(stderr,
"NETRootInfo::showWindowMenuRequest: requesting menu for 0x%lx (%d, %d, %d)\n", window, device_id, x_root, y_root);
1608 const uint32_t data[5] = {uint32_t(device_id), uint32_t(x_root), uint32_t(y_root), 0, 0};
1609 send_client_message(p->conn, netwm_sendevent_mask, p->root, window, p->atom(_GTK_SHOW_WINDOW_MENU), data);
1615 fprintf(stderr,
"NETRootInfo::restackRequest: requesting restack for 0x%lx (%lx, %d)\n", window, above, detail);
1618 const uint32_t data[5] = {uint32_t(src), uint32_t(above), uint32_t(detail), uint32_t(timestamp), 0};
1620 send_client_message(p->conn, netwm_sendevent_mask, p->root, window, p->atom(_NET_RESTACK_WINDOW), data);
1630 fprintf(stderr,
"NETRootInfo::setPing: window 0x%lx, timestamp %lu\n", window, timestamp);
1633 const uint32_t data[5] = {p->atom(_NET_WM_PING), timestamp, window, 0, 0};
1635 send_client_message(p->conn, 0, window, window, p->atom(WM_PROTOCOLS), data);
1643 fprintf(stderr,
"NETRootInfo::operator=()\n");
1646 if (p != rootinfo.p) {
1671 bool do_update =
false;
1672 const uint8_t eventType =
event->response_type & ~0x80;
1676 if (p->role ==
WindowManager && eventType == XCB_CLIENT_MESSAGE &&
reinterpret_cast<xcb_client_message_event_t *
>(
event)->format == 32) {
1677 xcb_client_message_event_t *message =
reinterpret_cast<xcb_client_message_event_t *
>(
event);
1679 fprintf(stderr,
"NETRootInfo::event: handling ClientMessage event\n");
1682 if (message->type == p->atom(_NET_NUMBER_OF_DESKTOPS)) {
1683 dirty = NumberOfDesktops;
1686 fprintf(stderr,
"NETRootInfo::event: changeNumberOfDesktops(%ld)\n", message->data.data32[0]);
1690 }
else if (message->type == p->atom(_NET_DESKTOP_GEOMETRY)) {
1691 dirty = DesktopGeometry;
1694 sz.
width = message->data.data32[0];
1695 sz.
height = message->data.data32[1];
1698 fprintf(stderr,
"NETRootInfo::event: changeDesktopGeometry( -- , { %d, %d })\n", sz.
width, sz.
height);
1702 }
else if (message->type == p->atom(_NET_DESKTOP_VIEWPORT)) {
1703 dirty = DesktopViewport;
1706 pt.
x = message->data.data32[0];
1707 pt.
y = message->data.data32[1];
1710 fprintf(stderr,
"NETRootInfo::event: changeDesktopViewport(%d, { %d, %d })\n", p->current_desktop, pt.
x, pt.
y);
1714 }
else if (message->type == p->atom(_NET_CURRENT_DESKTOP)) {
1715 dirty = CurrentDesktop;
1718 fprintf(stderr,
"NETRootInfo::event: changeCurrentDesktop(%ld)\n", message->data.data32[0] + 1);
1722 }
else if (message->type == p->atom(_NET_ACTIVE_WINDOW)) {
1723 dirty = ActiveWindow;
1726 fprintf(stderr,
"NETRootInfo::event: changeActiveWindow(0x%lx)\n", message->window);
1730 xcb_timestamp_t timestamp = XCB_TIME_CURRENT_TIME;
1731 xcb_window_t active_window = XCB_WINDOW_NONE;
1735 timestamp = message->data.data32[1];
1736 active_window = message->data.data32[2];
1739 }
else if (message->type == p->atom(_NET_WM_MOVERESIZE)) {
1742 "NETRootInfo::event: moveResize(%ld, %ld, %ld, %ld, %ld, %ld)\n",
1744 message->data.data32[0],
1745 message->data.data32[1],
1746 message->data.data32[2],
1747 message->data.data32[3],
1748 message->data.data32[4]);
1752 message->data.data32[0],
1753 message->data.data32[1],
1754 message->data.data32[2],
1755 message->data.data32[3],
1757 }
else if (message->type == p->atom(_NET_MOVERESIZE_WINDOW)) {
1760 "NETRootInfo::event: moveResizeWindow(%ld, %ld, %ld, %ld, %ld, %ld)\n",
1762 message->data.data32[0],
1763 message->data.data32[1],
1764 message->data.data32[2],
1765 message->data.data32[3],
1766 message->data.data32[4]);
1770 message->data.data32[0],
1771 message->data.data32[1],
1772 message->data.data32[2],
1773 message->data.data32[3],
1774 message->data.data32[4]);
1775 }
else if (message->type == p->atom(_NET_CLOSE_WINDOW)) {
1777 fprintf(stderr,
"NETRootInfo::event: closeWindow(0x%lx)\n", message->window);
1781 }
else if (message->type == p->atom(_NET_RESTACK_WINDOW)) {
1783 fprintf(stderr,
"NETRootInfo::event: restackWindow(0x%lx)\n", message->window);
1787 xcb_timestamp_t timestamp = XCB_TIME_CURRENT_TIME;
1791 timestamp = message->data.data32[3];
1793 restackWindow(message->window, src, message->data.data32[1], message->data.data32[2], timestamp);
1794 }
else if (message->type == p->atom(WM_PROTOCOLS) && (xcb_atom_t)message->data.data32[0] == p->atom(_NET_WM_PING)) {
1798 fprintf(stderr,
"NETRootInfo::event: gotPing(0x%lx,%lu)\n", message->window, message->data.data32[1]);
1800 gotPing(message->data.data32[2], message->data.data32[1]);
1801 }
else if (message->type == p->atom(_NET_SHOWING_DESKTOP)) {
1802 dirty2 = WM2ShowingDesktop;
1805 fprintf(stderr,
"NETRootInfo::event: changeShowingDesktop(%ld)\n", message->data.data32[0]);
1809 }
else if (message->type == p->atom(_GTK_SHOW_WINDOW_MENU)) {
1812 "NETRootInfo::event: showWindowMenu(%ld, %ld, %ld, %ld)\n",
1814 message->data.data32[0],
1815 message->data.data32[1],
1816 message->data.data32[2]);
1819 showWindowMenu(message->window, message->data.data32[0], message->data.data32[1], message->data.data32[2]);
1823 if (eventType == XCB_PROPERTY_NOTIFY) {
1825 fprintf(stderr,
"NETRootInfo::event: handling PropertyNotify event\n");
1828 xcb_property_notify_event_t *pe =
reinterpret_cast<xcb_property_notify_event_t *
>(
event);
1829 if (pe->atom == p->atom(_NET_CLIENT_LIST)) {
1830 dirty |= ClientList;
1831 }
else if (pe->atom == p->atom(_NET_CLIENT_LIST_STACKING)) {
1832 dirty |= ClientListStacking;
1833 }
else if (pe->atom == p->atom(_NET_DESKTOP_NAMES)) {
1834 dirty |= DesktopNames;
1835 }
else if (pe->atom == p->atom(_NET_WORKAREA)) {
1837 }
else if (pe->atom == p->atom(_NET_NUMBER_OF_DESKTOPS)) {
1838 dirty |= NumberOfDesktops;
1839 }
else if (pe->atom == p->atom(_NET_DESKTOP_GEOMETRY)) {
1840 dirty |= DesktopGeometry;
1841 }
else if (pe->atom == p->atom(_NET_DESKTOP_VIEWPORT)) {
1842 dirty |= DesktopViewport;
1843 }
else if (pe->atom == p->atom(_NET_CURRENT_DESKTOP)) {
1844 dirty |= CurrentDesktop;
1845 }
else if (pe->atom == p->atom(_NET_ACTIVE_WINDOW)) {
1846 dirty |= ActiveWindow;
1847 }
else if (pe->atom == p->atom(_NET_SHOWING_DESKTOP)) {
1848 dirty2 |= WM2ShowingDesktop;
1849 }
else if (pe->atom == p->atom(_NET_SUPPORTED)) {
1851 }
else if (pe->atom == p->atom(_NET_SUPPORTING_WM_CHECK)) {
1852 dirty |= SupportingWMCheck;
1853 }
else if (pe->atom == p->atom(_NET_VIRTUAL_ROOTS)) {
1854 dirty |= VirtualRoots;
1855 }
else if (pe->atom == p->atom(_NET_DESKTOP_LAYOUT)) {
1856 dirty2 |= WM2DesktopLayout;
1863 update(dirty, dirty2);
1867 fprintf(stderr,
"NETRootInfo::event: handled events, returning dirty = 0x%lx, 0x%lx\n", dirty, dirty2);
1871 *properties = dirty;
1874 *properties2 = dirty2;
1885 xcb_get_property_cookie_t cookies[255];
1886 xcb_get_property_cookie_t wm_name_cookie;
1890 if (dirty & Supported) {
1891 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_SUPPORTED), XCB_ATOM_ATOM, 0, MAX_PROP_SIZE);
1894 if (dirty & ClientList) {
1895 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_CLIENT_LIST), XCB_ATOM_WINDOW, 0, MAX_PROP_SIZE);
1898 if (dirty & ClientListStacking) {
1899 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_CLIENT_LIST_STACKING), XCB_ATOM_WINDOW, 0, MAX_PROP_SIZE);
1902 if (dirty & NumberOfDesktops) {
1903 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_NUMBER_OF_DESKTOPS), XCB_ATOM_CARDINAL, 0, 1);
1906 if (dirty & DesktopGeometry) {
1907 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_DESKTOP_GEOMETRY), XCB_ATOM_CARDINAL, 0, 2);
1910 if (dirty & DesktopViewport) {
1911 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_DESKTOP_VIEWPORT), XCB_ATOM_CARDINAL, 0, MAX_PROP_SIZE);
1914 if (dirty & CurrentDesktop) {
1915 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_CURRENT_DESKTOP), XCB_ATOM_CARDINAL, 0, 1);
1918 if (dirty & DesktopNames) {
1919 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_DESKTOP_NAMES), p->atom(UTF8_STRING), 0, MAX_PROP_SIZE);
1922 if (dirty & ActiveWindow) {
1923 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_ACTIVE_WINDOW), XCB_ATOM_WINDOW, 0, 1);
1926 if (dirty & WorkArea) {
1927 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_WORKAREA), XCB_ATOM_CARDINAL, 0, MAX_PROP_SIZE);
1930 if (dirty & SupportingWMCheck) {
1931 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_SUPPORTING_WM_CHECK), XCB_ATOM_WINDOW, 0, 1);
1934 if (dirty & VirtualRoots) {
1935 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_VIRTUAL_ROOTS), XCB_ATOM_WINDOW, 0, 1);
1938 if (dirty2 & WM2DesktopLayout) {
1939 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_DESKTOP_LAYOUT), XCB_ATOM_CARDINAL, 0, MAX_PROP_SIZE);
1942 if (dirty2 & WM2ShowingDesktop) {
1943 cookies[c++] = xcb_get_property(p->conn,
false, p->root, p->atom(_NET_SHOWING_DESKTOP), XCB_ATOM_CARDINAL, 0, 1);
1949 if (dirty & Supported) {
1957 const QList<xcb_atom_t> atoms = get_array_reply<xcb_atom_t>(p->conn, cookies[c++], XCB_ATOM_ATOM);
1958 for (
const xcb_atom_t atom : atoms) {
1959 updateSupportedProperties(atom);
1963 if (dirty & ClientList) {
1967 QList<xcb_window_t> clients = get_array_reply<xcb_window_t>(p->conn, cookies[c++], XCB_ATOM_WINDOW);
1968 std::sort(clients.
begin(), clients.
end());
1974 int old_count = p->clients_count;
1975 int new_count = clients.
count();
1977 while (old_index < old_count || new_index < new_count) {
1978 if (old_index == old_count) {
1979 clientsToAdd.
append(clients[new_index++]);
1980 }
else if (new_index == new_count) {
1981 clientsToRemove.
append(p->clients[old_index++]);
1983 if (p->clients[old_index] < clients[new_index]) {
1984 clientsToRemove.
append(p->clients[old_index++]);
1985 }
else if (clients[new_index] < p->clients[old_index]) {
1986 clientsToAdd.
append(clients[new_index++]);
1995 delete[] p->clients;
1996 p->clients =
nullptr;
1999 fprintf(stderr,
"NETRootInfo::update: client list null, creating\n");
2003 for (
int i = 0; i < clients.
count(); i++) {
2004 clientsToAdd.
append(clients[i]);
2009 p->clients_count = clients.
count();
2010 p->clients =
new xcb_window_t[clients.
count()];
2011 for (
int i = 0; i < clients.
count(); i++) {
2012 p->clients[i] = clients.
at(i);
2017 fprintf(stderr,
"NETRootInfo::update: client list updated (%ld clients)\n", p->clients_count);
2020 for (
int i = 0; i < clientsToRemove.
size(); ++i) {
2024 for (
int i = 0; i < clientsToAdd.
size(); ++i) {
2029 if (dirty & ClientListStacking) {
2030 p->stacking_count = 0;
2032 delete[] p->stacking;
2033 p->stacking =
nullptr;
2035 const QList<xcb_window_t> wins = get_array_reply<xcb_window_t>(p->conn, cookies[c++], XCB_ATOM_WINDOW);
2038 p->stacking_count = wins.
count();
2039 p->stacking =
new xcb_window_t[wins.
count()];
2040 for (
int i = 0; i < wins.
count(); i++) {
2041 p->stacking[i] = wins.
at(i);
2046 fprintf(stderr,
"NETRootInfo::update: client stacking updated (%ld clients)\n", p->stacking_count);
2050 if (dirty & NumberOfDesktops) {
2051 p->number_of_desktops = get_value_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL, 0);
2054 fprintf(stderr,
"NETRootInfo::update: number of desktops = %d\n", p->number_of_desktops);
2058 if (dirty & DesktopGeometry) {
2059 p->geometry = p->rootSize;
2061 const QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
2062 if (data.
count() == 2) {
2063 p->geometry.width = data.
at(0);
2064 p->geometry.height = data.
at(1);
2068 fprintf(stderr,
"NETRootInfo::update: desktop geometry updated\n");
2072 if (dirty & DesktopViewport) {
2073 for (
int i = 0; i < p->viewport.size(); i++) {
2074 p->viewport[i].x = p->viewport[i].y = 0;
2077 const QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
2079 if (data.
count() >= 2) {
2080 int n = data.
count() / 2;
2081 for (
int d = 0, i = 0; d < n; d++) {
2082 p->viewport[d].x = data[i++];
2083 p->viewport[d].y = data[i++];
2087 fprintf(stderr,
"NETRootInfo::update: desktop viewport array updated (%d entries)\n", p->viewport.size());
2089 if (data.
count() % 2 != 0) {
2091 "NETRootInfo::update(): desktop viewport array "
2092 "size not a multiple of 2\n");
2098 if (dirty & CurrentDesktop) {
2099 p->current_desktop = get_value_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL, 0) + 1;
2102 fprintf(stderr,
"NETRootInfo::update: current desktop = %d\n", p->current_desktop);
2106 if (dirty & DesktopNames) {
2107 for (
int i = 0; i < p->desktop_names.size(); ++i) {
2108 delete[] p->desktop_names[i];
2111 p->desktop_names.reset();
2113 const QList<QByteArray> names = get_stringlist_reply(p->conn, cookies[c++], p->atom(UTF8_STRING));
2114 for (
int i = 0; i < names.
count(); i++) {
2115 p->desktop_names[i] = nstrndup(names[i].constData(), names[i].length());
2119 fprintf(stderr,
"NETRootInfo::update: desktop names array updated (%d entries)\n", p->desktop_names.size());
2123 if (dirty & ActiveWindow) {
2124 p->active = get_value_reply<xcb_window_t>(p->conn, cookies[c++], XCB_ATOM_WINDOW, 0);
2127 fprintf(stderr,
"NETRootInfo::update: active window = 0x%lx\n", p->active);
2131 if (dirty & WorkArea) {
2132 p->workarea.reset();
2134 const QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
2135 if (data.
count() == p->number_of_desktops * 4) {
2136 for (
int i = 0, j = 0; i < p->number_of_desktops; i++) {
2137 p->workarea[i].pos.x = data[j++];
2138 p->workarea[i].pos.y = data[j++];
2139 p->workarea[i].
size.width = data[j++];
2140 p->workarea[i].
size.height = data[j++];
2145 fprintf(stderr,
"NETRootInfo::update: work area array updated (%d entries)\n", p->workarea.size());
2149 if (dirty & SupportingWMCheck) {
2153 p->supportwindow = get_value_reply<xcb_window_t>(p->conn, cookies[c++], XCB_ATOM_WINDOW, 0);
2157 if (p->supportwindow) {
2158 wm_name_cookie = xcb_get_property(p->conn,
false, p->supportwindow, p->atom(_NET_WM_NAME), p->atom(UTF8_STRING), 0, MAX_PROP_SIZE);
2162 if (dirty & VirtualRoots) {
2163 p->virtual_roots_count = 0;
2165 delete[] p->virtual_roots;
2166 p->virtual_roots =
nullptr;
2168 const QList<xcb_window_t> wins = get_array_reply<xcb_window_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
2171 p->virtual_roots_count = wins.
count();
2172 p->virtual_roots =
new xcb_window_t[wins.
count()];
2173 for (
int i = 0; i < wins.
count(); i++) {
2174 p->virtual_roots[i] = wins.
at(i);
2179 fprintf(stderr,
"NETRootInfo::updated: virtual roots updated (%ld windows)\n", p->virtual_roots_count);
2183 if (dirty2 & WM2DesktopLayout) {
2184 p->desktop_layout_orientation = OrientationHorizontal;
2185 p->desktop_layout_corner = DesktopLayoutCornerTopLeft;
2186 p->desktop_layout_columns = p->desktop_layout_rows = 0;
2188 const QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
2190 if (data.
count() >= 4 && data[3] <= 3) {
2194 if (data.
count() >= 3) {
2199 p->desktop_layout_columns = data[1];
2200 p->desktop_layout_rows = data[2];
2205 "NETRootInfo::updated: desktop layout updated (%d %d %d %d)\n",
2206 p->desktop_layout_orientation,
2207 p->desktop_layout_columns,
2208 p->desktop_layout_rows,
2209 p->desktop_layout_corner);
2213 if (dirty2 & WM2ShowingDesktop) {
2214 const uint32_t val = get_value_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL, 0);
2215 p->showing_desktop = bool(val);
2218 fprintf(stderr,
"NETRootInfo::update: showing desktop = %d\n", p->showing_desktop);
2222 if ((dirty & SupportingWMCheck) && p->supportwindow) {
2223 const QByteArray ba = get_string_reply(p->conn, wm_name_cookie, p->atom(UTF8_STRING));
2229 fprintf(stderr,
"NETRootInfo::update: supporting window manager = '%s'\n", p->name);
2246 return p->supportwindow;
2256 return p->properties;
2261 return p->properties2;
2271 return p->windowTypes;
2281 return p->role ==
WindowManager ? p->properties : p->clientProperties;
2286 return p->role ==
WindowManager ? p->properties2 : p->clientProperties2;
2311 p->properties |= property;
2314 p->properties &= ~property;
2326 p->properties2 |= property;
2329 p->properties2 &= ~property;
2341 p->windowTypes |= property;
2344 p->windowTypes &= ~property;
2356 p->states |= property;
2359 p->states &= ~property;
2371 p->actions |= property;
2374 p->actions &= ~property;
2381 return p->properties & property;
2386 return p->properties2 & property;
2391 return p->windowTypes & type;
2396 return p->states & state;
2401 return p->actions & action;
2411 return p->clients_count;
2421 return p->stacking_count;
2426 return p->geometry.
width != 0 ? p->geometry : p->rootSize;
2436 return p->viewport[desktop - 1];
2446 return p->workarea[desktop - 1];
2455 return p->desktop_names[desktop - 1];
2460 return p->virtual_roots;
2465 return p->virtual_roots_count;
2470 return p->desktop_layout_orientation;
2475 return QSize(p->desktop_layout_columns, p->desktop_layout_rows);
2480 return p->desktop_layout_corner;
2488 return p->number_of_desktops == 0 ? 1 : p->number_of_desktops;
2496 return p->current_desktop == 0 ? 1 : p->current_desktop;
2509 xcb_window_t window,
2510 xcb_window_t rootWindow,
2516 fprintf(stderr,
"NETWinInfo::NETWinInfo: constructing object with role '%s'\n", (role ==
WindowManager) ?
"WindowManager" :
"Client");
2519 p =
new NETWinInfoPrivate;
2521 p->atoms = atomsForConnection(connection);
2523 p->conn = connection;
2525 p->root = rootWindow;
2527 p->mapping_state_dirty =
true;
2530 p->name = (
char *)
nullptr;
2531 p->visible_name = (
char *)
nullptr;
2532 p->icon_name = (
char *)
nullptr;
2533 p->visible_icon_name = (
char *)
nullptr;
2534 p->desktop = p->pid = 0;
2535 p->handled_icons =
false;
2537 p->startup_id =
nullptr;
2538 p->transient_for = XCB_NONE;
2539 p->opacity = 0xffffffffU;
2540 p->window_group = XCB_NONE;
2541 p->icon_pixmap = XCB_PIXMAP_NONE;
2542 p->icon_mask = XCB_PIXMAP_NONE;
2544 p->has_net_support =
false;
2545 p->class_class = (
char *)
nullptr;
2546 p->class_name = (
char *)
nullptr;
2547 p->window_role = (
char *)
nullptr;
2548 p->client_machine = (
char *)
nullptr;
2549 p->icon_sizes =
nullptr;
2550 p->activities = (
char *)
nullptr;
2551 p->desktop_file =
nullptr;
2552 p->gtk_application_id =
nullptr;
2553 p->appmenu_object_path =
nullptr;
2554 p->appmenu_service_name =
nullptr;
2555 p->blockCompositing =
false;
2559 p->protocols = NET::NoProtocol;
2565 p->properties = properties;
2566 p->properties2 = properties2;
2572 update(p->properties, p->properties2);
2595 fprintf(stderr,
"NETWinInfo::operator=()\n");
2598 if (p != wininfo.p) {
2614 setIconInternal(p->icons, p->icon_count, p->atom(_NET_WM_ICON),
icon, replace);
2617void NETWinInfo::setIconInternal(NETRArray<NETIcon> &icons,
int &icon_count, xcb_atom_t property,
NETIcon icon,
bool replace)
2624 for (
int i = 0; i < icons.size(); i++) {
2625 delete[] icons[i].data;
2627 icons[i].data =
nullptr;
2628 icons[i].size.width = 0;
2629 icons[i].size.height = 0;
2636 icons[icon_count] =
icon;
2640 NETIcon &ni = icons[icon_count - 1];
2642 uint32_t *d =
new uint32_t[sz];
2643 ni.
data = (
unsigned char *)d;
2644 memcpy(d,
icon.
data, sz *
sizeof(uint32_t));
2648 for (
int i = 0; i < icon_count; i++) {
2649 proplen += 2 + (icons[i].size.width * icons[i].size.height);
2652 uint32_t *prop =
new uint32_t[proplen];
2653 uint32_t *pprop = prop;
2654 for (
int i = 0; i < icon_count; i++) {
2656 *pprop++ = icons[i].size.width;
2657 *pprop++ = icons[i].size.height;
2660 sz = (icons[i].size.width * icons[i].size.height);
2661 uint32_t *d32 = (uint32_t *)icons[i].data;
2662 for (
int j = 0; j < sz; j++) {
2667 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, property, XCB_ATOM_CARDINAL, 32, proplen, (
const void *)prop);
2670 delete[] p->icon_sizes;
2671 p->icon_sizes =
nullptr;
2680 const qreal scaleFactor = qApp->devicePixelRatio();
2681 geometry.
pos.
x *= scaleFactor;
2682 geometry.
pos.
y *= scaleFactor;
2686 p->icon_geom = geometry;
2689 xcb_delete_property(p->conn, p->window, p->atom(_NET_WM_ICON_GEOMETRY));
2692 data[0] = geometry.
pos.
x;
2693 data[1] = geometry.
pos.
y;
2697 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_ICON_GEOMETRY), XCB_ATOM_CARDINAL, 32, 4, (
const void *)data);
2707 p->extended_strut = extended_strut;
2714 data[4] = extended_strut.left_start;
2715 data[5] = extended_strut.left_end;
2716 data[6] = extended_strut.right_start;
2717 data[7] = extended_strut.right_end;
2718 data[8] = extended_strut.top_start;
2719 data[9] = extended_strut.top_end;
2720 data[10] = extended_strut.bottom_start;
2721 data[11] = extended_strut.bottom_end;
2723 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_STRUT_PARTIAL), XCB_ATOM_CARDINAL, 32, 12, (
const void *)data);
2740 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_STRUT), XCB_ATOM_CARDINAL, 32, 4, (
const void *)data);
2746 const uint32_t data[5] = {uint32_t(topology.
top), uint32_t(topology.
bottom), uint32_t(topology.
left), uint32_t(topology.
right), 1};
2748 send_client_message(p->conn, netwm_sendevent_mask, p->root, p->window, p->atom(_NET_WM_FULLSCREEN_MONITORS), data);
2750 p->fullscreen_monitors = topology;
2753 data[0] = topology.
top;
2754 data[1] = topology.
bottom;
2755 data[2] = topology.
left;
2756 data[3] = topology.
right;
2758 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_FULLSCREEN_MONITORS), XCB_ATOM_CARDINAL, 32, 4, (
const void *)data);
2764 if (p->mapping_state_dirty) {
2769 if ((p->properties & WMState) == 0) {
2770 p->properties |= WMState;
2774 p->properties &= ~WMState;
2779 fprintf(stderr,
"NETWinInfo::setState (0x%lx, 0x%lx) (Client)\n",
state, mask);
2782 KXcbEvent<xcb_client_message_event_t>
event;
2783 event.response_type = XCB_CLIENT_MESSAGE;
2786 event.window = p->window;
2787 event.type = p->atom(_NET_WM_STATE);
2788 event.data.data32[3] = 0;
2789 event.data.data32[4] = 0;
2792 event.data.data32[0] = (
state &
Modal) ? 1 : 0;
2793 event.data.data32[1] = p->atom(_NET_WM_STATE_MODAL);
2794 event.data.data32[2] = 0l;
2796 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2801 event.data.data32[1] = p->atom(_NET_WM_STATE_STICKY);
2802 event.data.data32[2] = 0l;
2804 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2807 if ((mask &
Max) && (((p->state & mask) &
Max) != (
state &
Max))) {
2810 if ((wishstate &
Max) ==
Max) {
2811 event.data.data32[0] = 1;
2812 event.data.data32[1] = p->atom(_NET_WM_STATE_MAXIMIZED_HORZ);
2813 event.data.data32[2] = p->atom(_NET_WM_STATE_MAXIMIZED_VERT);
2814 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2815 }
else if ((wishstate &
Max) == 0) {
2816 event.data.data32[0] = 0;
2817 event.data.data32[1] = p->atom(_NET_WM_STATE_MAXIMIZED_HORZ);
2818 event.data.data32[2] = p->atom(_NET_WM_STATE_MAXIMIZED_VERT);
2819 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2821 event.data.data32[0] = (wishstate &
MaxHoriz) ? 1 : 0;
2822 event.data.data32[1] = p->atom(_NET_WM_STATE_MAXIMIZED_HORZ);
2823 event.data.data32[2] = 0;
2824 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2826 event.data.data32[0] = (wishstate &
MaxVert) ? 1 : 0;
2827 event.data.data32[1] = p->atom(_NET_WM_STATE_MAXIMIZED_VERT);
2828 event.data.data32[2] = 0;
2829 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2832 event.data.data32[0] = (wishstate &
MaxVert) ? 1 : 0;
2833 event.data.data32[1] = p->atom(_NET_WM_STATE_MAXIMIZED_VERT);
2834 event.data.data32[2] = 0;
2836 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2838 event.data.data32[0] = (wishstate &
MaxHoriz) ? 1 : 0;
2839 event.data.data32[1] = p->atom(_NET_WM_STATE_MAXIMIZED_HORZ);
2840 event.data.data32[2] = 0;
2842 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2848 event.data.data32[1] = p->atom(_NET_WM_STATE_SHADED);
2849 event.data.data32[2] = 0l;
2851 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2856 event.data.data32[1] = p->atom(_NET_WM_STATE_SKIP_TASKBAR);
2857 event.data.data32[2] = 0l;
2859 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2864 event.data.data32[1] = p->atom(_NET_WM_STATE_SKIP_PAGER);
2865 event.data.data32[2] = 0l;
2867 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2872 event.data.data32[1] = p->atom(_KDE_NET_WM_STATE_SKIP_SWITCHER);
2873 event.data.data32[2] = 0l;
2875 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2880 event.data.data32[1] = p->atom(_NET_WM_STATE_HIDDEN);
2881 event.data.data32[2] = 0l;
2883 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2888 event.data.data32[1] = p->atom(_NET_WM_STATE_FULLSCREEN);
2889 event.data.data32[2] = 0l;
2891 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2896 event.data.data32[1] = p->atom(_NET_WM_STATE_ABOVE);
2897 event.data.data32[2] = 0l;
2899 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2903 event.data.data32[1] = p->atom(_NET_WM_STATE_STAYS_ON_TOP);
2904 event.data.data32[2] = 0l;
2906 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2911 event.data.data32[1] = p->atom(_NET_WM_STATE_BELOW);
2912 event.data.data32[2] = 0l;
2914 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2919 event.data.data32[1] = p->atom(_NET_WM_STATE_DEMANDS_ATTENTION);
2920 event.data.data32[2] = 0l;
2922 xcb_send_event(p->conn,
false, p->root, netwm_sendevent_mask,
event.buffer());
2934 if (p->state &
Modal) {
2935 data[count++] = p->atom(_NET_WM_STATE_MODAL);
2938 data[count++] = p->atom(_NET_WM_STATE_MAXIMIZED_VERT);
2941 data[count++] = p->atom(_NET_WM_STATE_MAXIMIZED_HORZ);
2944 data[count++] = p->atom(_NET_WM_STATE_SHADED);
2947 data[count++] = p->atom(_NET_WM_STATE_HIDDEN);
2950 data[count++] = p->atom(_NET_WM_STATE_FULLSCREEN);
2953 data[count++] = p->atom(_NET_WM_STATE_DEMANDS_ATTENTION);
2956 data[count++] = p->atom(_NET_WM_STATE_FOCUSED);
2961 data[count++] = p->atom(_NET_WM_STATE_ABOVE);
2963 data[count++] = p->atom(_NET_WM_STATE_STAYS_ON_TOP);
2966 data[count++] = p->atom(_NET_WM_STATE_BELOW);
2969 data[count++] = p->atom(_NET_WM_STATE_STICKY);
2972 data[count++] = p->atom(_NET_WM_STATE_SKIP_TASKBAR);
2975 data[count++] = p->atom(_NET_WM_STATE_SKIP_PAGER);
2978 data[count++] = p->atom(_KDE_NET_WM_STATE_SKIP_SWITCHER);
2982 fprintf(stderr,
"NETWinInfo::setState: setting state property (%d)\n", count);
2983 for (
int i = 0; i < count; i++) {
2984 const QByteArray ba = get_atom_name(p->conn, data[i]);
2985 fprintf(stderr,
"NETWinInfo::setState: state %ld '%s'\n", data[i], ba.
constData());
2989 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_STATE), XCB_ATOM_ATOM, 32, count, (
const void *)data);
3006 data[0] = p->atom(_KDE_NET_WM_WINDOW_TYPE_OVERRIDE);
3007 data[1] = p->atom(_NET_WM_WINDOW_TYPE_NORMAL);
3012 data[0] = p->atom(_NET_WM_WINDOW_TYPE_DIALOG);
3018 data[0] = p->atom(_NET_WM_WINDOW_TYPE_MENU);
3026 data[0] = p->atom(_KDE_NET_WM_WINDOW_TYPE_TOPMENU);
3027 data[1] = p->atom(_NET_WM_WINDOW_TYPE_DOCK);
3032 data[0] = p->atom(_NET_WM_WINDOW_TYPE_TOOLBAR);
3038 data[0] = p->atom(_NET_WM_WINDOW_TYPE_DOCK);
3044 data[0] = p->atom(_NET_WM_WINDOW_TYPE_DESKTOP);
3050 data[0] = p->atom(_NET_WM_WINDOW_TYPE_UTILITY);
3051 data[1] = p->atom(_NET_WM_WINDOW_TYPE_DIALOG);
3056 data[0] = p->atom(_NET_WM_WINDOW_TYPE_SPLASH);
3057 data[1] = p->atom(_NET_WM_WINDOW_TYPE_DOCK);
3062 data[0] = p->atom(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU);
3063 data[1] = p->atom(_NET_WM_WINDOW_TYPE_MENU);
3068 data[0] = p->atom(_NET_WM_WINDOW_TYPE_POPUP_MENU);
3069 data[1] = p->atom(_NET_WM_WINDOW_TYPE_MENU);
3074 data[0] = p->atom(_NET_WM_WINDOW_TYPE_TOOLTIP);
3080 data[0] = p->atom(_NET_WM_WINDOW_TYPE_NOTIFICATION);
3081 data[1] = p->atom(_NET_WM_WINDOW_TYPE_UTILITY);
3086 data[0] = p->atom(_NET_WM_WINDOW_TYPE_COMBO);
3092 data[0] = p->atom(_NET_WM_WINDOW_TYPE_DND);
3098 data[0] = p->atom(_KDE_NET_WM_WINDOW_TYPE_ON_SCREEN_DISPLAY);
3099 data[1] = p->atom(_NET_WM_WINDOW_TYPE_NOTIFICATION);
3104 data[0] = p->atom(_KDE_NET_WM_WINDOW_TYPE_CRITICAL_NOTIFICATION);
3105 data[1] = p->atom(_NET_WM_WINDOW_TYPE_NOTIFICATION);
3110 data[0] = p->atom(_KDE_NET_WM_WINDOW_TYPE_APPLET_POPUP);
3117 data[0] = p->atom(_NET_WM_WINDOW_TYPE_NORMAL);
3123 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_WINDOW_TYPE), XCB_ATOM_ATOM, 32, len, (
const void *)&data);
3133 p->name = nstrdup(
name);
3135 if (p->name[0] !=
'\0') {
3136 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_NAME), p->atom(UTF8_STRING), 8, strlen(p->name), (
const void *)p->name);
3138 xcb_delete_property(p->conn, p->window, p->atom(_NET_WM_NAME));
3148 delete[] p->visible_name;
3151 if (p->visible_name[0] !=
'\0') {
3152 xcb_change_property(p->conn,
3153 XCB_PROP_MODE_REPLACE,
3155 p->atom(_NET_WM_VISIBLE_NAME),
3156 p->atom(UTF8_STRING),
3158 strlen(p->visible_name),
3159 (
const void *)p->visible_name);
3161 xcb_delete_property(p->conn, p->window, p->atom(_NET_WM_VISIBLE_NAME));
3171 delete[] p->icon_name;
3174 if (p->icon_name[0] !=
'\0') {
3175 xcb_change_property(p->conn,
3176 XCB_PROP_MODE_REPLACE,
3178 p->atom(_NET_WM_ICON_NAME),
3179 p->atom(UTF8_STRING),
3181 strlen(p->icon_name),
3182 (
const void *)p->icon_name);
3184 xcb_delete_property(p->conn, p->window, p->atom(_NET_WM_ICON_NAME));
3194 delete[] p->visible_icon_name;
3197 if (p->visible_icon_name[0] !=
'\0') {
3198 xcb_change_property(p->conn,
3199 XCB_PROP_MODE_REPLACE,
3201 p->atom(_NET_WM_VISIBLE_ICON_NAME),
3202 p->atom(UTF8_STRING),
3204 strlen(p->visible_icon_name),
3205 (
const void *)p->visible_icon_name);
3207 xcb_delete_property(p->conn, p->window, p->atom(_NET_WM_VISIBLE_ICON_NAME));
3213 if (p->mapping_state_dirty) {
3231 send_client_message(p->conn, netwm_sendevent_mask, p->root, p->window, p->atom(_NET_WM_DESKTOP), data);
3237 xcb_delete_property(p->conn, p->window, p->atom(_NET_WM_DESKTOP));
3240 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_DESKTOP), XCB_ATOM_CARDINAL, 32, 1, (
const void *)&d);
3253 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_PID), XCB_ATOM_CARDINAL, 32, 1, (
const void *)&d);
3262 p->handled_icons = handled;
3263 uint32_t d = handled;
3264 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_HANDLED_ICONS), XCB_ATOM_CARDINAL, 32, 1, (
const void *)&d);
3273 delete[] p->startup_id;
3274 p->startup_id = nstrdup(
id);
3276 xcb_change_property(p->conn,
3277 XCB_PROP_MODE_REPLACE,
3279 p->atom(_NET_STARTUP_ID),
3280 p->atom(UTF8_STRING),
3282 strlen(p->startup_id),
3283 (
const void *)p->startup_id);
3291 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_WINDOW_OPACITY), XCB_ATOM_CARDINAL, 32, 1, (
const void *)&p->opacity);
3308 p->allowed_actions = actions;
3309 if (p->allowed_actions & ActionMove) {
3310 data[count++] = p->atom(_NET_WM_ACTION_MOVE);
3312 if (p->allowed_actions & ActionResize) {
3313 data[count++] = p->atom(_NET_WM_ACTION_RESIZE);
3315 if (p->allowed_actions & ActionMinimize) {
3316 data[count++] = p->atom(_NET_WM_ACTION_MINIMIZE);
3318 if (p->allowed_actions & ActionShade) {
3319 data[count++] = p->atom(_NET_WM_ACTION_SHADE);
3321 if (p->allowed_actions & ActionStick) {
3322 data[count++] = p->atom(_NET_WM_ACTION_STICK);
3324 if (p->allowed_actions & ActionMaxVert) {
3325 data[count++] = p->atom(_NET_WM_ACTION_MAXIMIZE_VERT);
3327 if (p->allowed_actions & ActionMaxHoriz) {
3328 data[count++] = p->atom(_NET_WM_ACTION_MAXIMIZE_HORZ);
3330 if (p->allowed_actions & ActionFullScreen) {
3331 data[count++] = p->atom(_NET_WM_ACTION_FULLSCREEN);
3333 if (p->allowed_actions & ActionChangeDesktop) {
3334 data[count++] = p->atom(_NET_WM_ACTION_CHANGE_DESKTOP);
3336 if (p->allowed_actions & ActionClose) {
3337 data[count++] = p->atom(_NET_WM_ACTION_CLOSE);
3341 fprintf(stderr,
"NETWinInfo::setAllowedActions: setting property (%d)\n", count);
3342 for (
int i = 0; i < count; i++) {
3343 const QByteArray ba = get_atom_name(p->conn, data[i]);
3344 fprintf(stderr,
"NETWinInfo::setAllowedActions: action %ld '%s'\n", data[i], ba.
constData());
3348 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_ALLOWED_ACTIONS), XCB_ATOM_ATOM, 32, count, (
const void *)data);
3357 p->frame_strut =
strut;
3365 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_FRAME_EXTENTS), XCB_ATOM_CARDINAL, 32, 4, (
const void *)d);
3366 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_KDE_NET_WM_FRAME_STRUT), XCB_ATOM_CARDINAL, 32, 4, (
const void *)d);
3371 return p->frame_strut;
3383 p->frame_overlap =
strut;
3391 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_FRAME_OVERLAP), XCB_ATOM_CARDINAL, 32, 4, (
const void *)d);
3396 return p->frame_overlap;
3401 p->gtk_frame_extents =
strut;
3409 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_GTK_FRAME_EXTENTS), XCB_ATOM_CARDINAL, 32, 4, (
const void *)d);
3414 return p->gtk_frame_extents;
3423 delete[] p->appmenu_object_path;
3424 p->appmenu_object_path = nstrdup(
name);
3426 xcb_change_property(p->conn,
3427 XCB_PROP_MODE_REPLACE,
3429 p->atom(_KDE_NET_WM_APPMENU_OBJECT_PATH),
3432 strlen(p->appmenu_object_path),
3433 (
const void *)p->appmenu_object_path);
3442 delete[] p->appmenu_service_name;
3443 p->appmenu_service_name = nstrdup(
name);
3445 xcb_change_property(p->conn,
3446 XCB_PROP_MODE_REPLACE,
3448 p->atom(_KDE_NET_WM_APPMENU_SERVICE_NAME),
3451 strlen(p->appmenu_service_name),
3452 (
const void *)p->appmenu_service_name);
3457 return p->appmenu_object_path;
3462 return p->appmenu_service_name;
3467 if (p->win_geom.size.width == 0 || p->win_geom.size.height == 0) {
3468 const xcb_get_geometry_cookie_t geometry_cookie = xcb_get_geometry(p->conn, p->window);
3470 const xcb_translate_coordinates_cookie_t translate_cookie = xcb_translate_coordinates(p->conn, p->window, p->root, 0, 0);
3472 xcb_get_geometry_reply_t *geometry = xcb_get_geometry_reply(p->conn, geometry_cookie,
nullptr);
3473 xcb_translate_coordinates_reply_t *translated = xcb_translate_coordinates_reply(p->conn, translate_cookie,
nullptr);
3475 if (geometry && translated) {
3476 p->win_geom.pos.x = translated->dst_x;
3477 p->win_geom.pos.y = translated->dst_y;
3479 p->win_geom.size.width = geometry->width;
3480 p->win_geom.size.height = geometry->height;
3493 window = p->win_geom;
3495 frame.
pos.
x = window.
pos.x - p->frame_strut.left;
3496 frame.
pos.
y = window.
pos.y - p->frame_strut.top;
3497 frame.
size.
width = window.
size.width + p->frame_strut.left + p->frame_strut.right;
3498 frame.
size.
height = window.
size.height + p->frame_strut.top + p->frame_strut.bottom;
3503 return iconInternal(p->icons, p->icon_count, width, height);
3508 if (p->icon_sizes ==
nullptr) {
3509 p->icon_sizes =
new int[p->icon_count * 2 + 2];
3510 for (
int i = 0; i < p->icon_count; ++i) {
3511 p->icon_sizes[i * 2] = p->icons[i].size.width;
3512 p->icon_sizes[i * 2 + 1] = p->icons[i].size.height;
3514 p->icon_sizes[p->icon_count * 2] = 0;
3515 p->icon_sizes[p->icon_count * 2 + 1] = 0;
3517 return p->icon_sizes;
3520NETIcon NETWinInfo::iconInternal(NETRArray<NETIcon> &icons,
int icon_count,
int width,
int height)
const
3527 result.
data =
nullptr;
3533 for (
int i = 1; i < icons.size(); i++) {
3534 if (icons[i].size.width >= result.
size.
width && icons[i].size.height >= result.
size.
height) {
3540 if (width == -1 && height == -1) {
3545 for (
int i = 0; i < icons.size(); i++) {
3546 if ((icons[i].size.width >= width && icons[i].size.width < result.
size.
width)
3547 && (icons[i].size.height >= height && icons[i].size.height < result.
size.
height)) {
3561 p->user_time = time;
3564 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_USER_TIME), XCB_ATOM_CARDINAL, 32, 1, (
const void *)&d);
3570 event(ev, &properties);
3578 bool do_update =
false;
3579 const uint8_t eventType =
event->response_type & ~0x80;
3581 if (p->role ==
WindowManager && eventType == XCB_CLIENT_MESSAGE &&
reinterpret_cast<xcb_client_message_event_t *
>(
event)->format == 32) {
3582 xcb_client_message_event_t *message =
reinterpret_cast<xcb_client_message_event_t *
>(
event);
3584 fprintf(stderr,
"NETWinInfo::event: handling ClientMessage event\n");
3587 if (message->type == p->atom(_NET_WM_STATE)) {
3593 fprintf(stderr,
"NETWinInfo::event: state client message, getting new state/mask\n");
3600 for (i = 1; i < 3; i++) {
3602 const QByteArray ba = get_atom_name(p->conn, (xcb_atom_t)message->data.data32[i]);
3603 fprintf(stderr,
"NETWinInfo::event: message %ld '%s'\n", message->data.data32[i], ba.
constData());
3606 if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_MODAL)) {
3608 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_STICKY)) {
3610 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_MAXIMIZED_VERT)) {
3612 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_MAXIMIZED_HORZ)) {
3614 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_SHADED)) {
3616 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_SKIP_TASKBAR)) {
3618 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_SKIP_PAGER)) {
3620 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_KDE_NET_WM_STATE_SKIP_SWITCHER)) {
3622 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_HIDDEN)) {
3624 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_FULLSCREEN)) {
3626 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_ABOVE)) {
3628 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_BELOW)) {
3630 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_DEMANDS_ATTENTION)) {
3632 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_STAYS_ON_TOP)) {
3634 }
else if ((xcb_atom_t)message->data.data32[i] == p->atom(_NET_WM_STATE_FOCUSED)) {
3640 switch (message->data.data32[0]) {
3648 state = (p->state & mask) ^ mask;
3657 fprintf(stderr,
"NETWinInfo::event: calling changeState(%lx, %lx)\n",
state, mask);
3661 }
else if (message->type == p->atom(_NET_WM_DESKTOP)) {
3669 }
else if (message->type == p->atom(_NET_WM_FULLSCREEN_MONITORS)) {
3670 dirty2 = WM2FullscreenMonitors;
3673 topology.
top = message->data.data32[0];
3674 topology.
bottom = message->data.data32[1];
3675 topology.
left = message->data.data32[2];
3676 topology.
right = message->data.data32[3];
3680 "NETWinInfo2::event: calling changeFullscreenMonitors"
3681 "(%ld, %ld, %ld, %ld, %ld)\n",
3683 message->data.data32[0],
3684 message->data.data32[1],
3685 message->data.data32[2],
3686 message->data.data32[3]);
3692 if (eventType == XCB_PROPERTY_NOTIFY) {
3694 fprintf(stderr,
"NETWinInfo::event: handling PropertyNotify event\n");
3697 xcb_property_notify_event_t *pe =
reinterpret_cast<xcb_property_notify_event_t *
>(
event);
3699 if (pe->atom == p->atom(_NET_WM_NAME)) {
3701 }
else if (pe->atom == p->atom(_NET_WM_VISIBLE_NAME)) {
3702 dirty |= WMVisibleName;
3703 }
else if (pe->atom == p->atom(_NET_WM_DESKTOP)) {
3705 }
else if (pe->atom == p->atom(_NET_WM_WINDOW_TYPE)) {
3706 dirty |= WMWindowType;
3707 }
else if (pe->atom == p->atom(_NET_WM_STATE)) {
3709 }
else if (pe->atom == p->atom(_NET_WM_STRUT)) {
3711 }
else if (pe->atom == p->atom(_NET_WM_STRUT_PARTIAL)) {
3712 dirty2 |= WM2ExtendedStrut;
3713 }
else if (pe->atom == p->atom(_NET_WM_ICON_GEOMETRY)) {
3714 dirty |= WMIconGeometry;
3715 }
else if (pe->atom == p->atom(_NET_WM_ICON)) {
3717 }
else if (pe->atom == p->atom(_NET_WM_PID)) {
3719 }
else if (pe->atom == p->atom(_NET_WM_HANDLED_ICONS)) {
3720 dirty |= WMHandledIcons;
3721 }
else if (pe->atom == p->atom(_NET_STARTUP_ID)) {
3722 dirty2 |= WM2StartupId;
3723 }
else if (pe->atom == p->atom(_NET_WM_WINDOW_OPACITY)) {
3724 dirty2 |= WM2Opacity;
3725 }
else if (pe->atom == p->atom(_NET_WM_ALLOWED_ACTIONS)) {
3726 dirty2 |= WM2AllowedActions;
3727 }
else if (pe->atom == p->atom(WM_STATE)) {
3729 }
else if (pe->atom == p->atom(_NET_FRAME_EXTENTS)) {
3730 dirty |= WMFrameExtents;
3731 }
else if (pe->atom == p->atom(_KDE_NET_WM_FRAME_STRUT)) {
3732 dirty |= WMFrameExtents;
3733 }
else if (pe->atom == p->atom(_NET_WM_FRAME_OVERLAP)) {
3734 dirty2 |= WM2FrameOverlap;
3735 }
else if (pe->atom == p->atom(_NET_WM_ICON_NAME)) {
3736 dirty |= WMIconName;
3737 }
else if (pe->atom == p->atom(_NET_WM_VISIBLE_ICON_NAME)) {
3738 dirty |= WMVisibleIconName;
3739 }
else if (pe->atom == p->atom(_NET_WM_USER_TIME)) {
3740 dirty2 |= WM2UserTime;
3741 }
else if (pe->atom == XCB_ATOM_WM_HINTS) {
3742 dirty2 |= WM2GroupLeader;
3743 dirty2 |= WM2Urgency;
3745 dirty2 |= WM2InitialMappingState;
3746 dirty2 |= WM2IconPixmap;
3747 }
else if (pe->atom == XCB_ATOM_WM_TRANSIENT_FOR) {
3748 dirty2 |= WM2TransientFor;
3749 }
else if (pe->atom == XCB_ATOM_WM_CLASS) {
3750 dirty2 |= WM2WindowClass;
3751 }
else if (pe->atom == p->atom(WM_WINDOW_ROLE)) {
3752 dirty2 |= WM2WindowRole;
3753 }
else if (pe->atom == XCB_ATOM_WM_CLIENT_MACHINE) {
3754 dirty2 |= WM2ClientMachine;
3755 }
else if (pe->atom == p->atom(_KDE_NET_WM_ACTIVITIES)) {
3756 dirty2 |= WM2Activities;
3757 }
else if (pe->atom == p->atom(_KDE_NET_WM_BLOCK_COMPOSITING) || pe->atom == p->atom(_NET_WM_BYPASS_COMPOSITOR)) {
3758 dirty2 |= WM2BlockCompositing;
3759 }
else if (pe->atom == p->atom(_KDE_NET_WM_SHADOW)) {
3760 dirty2 |= WM2KDEShadow;
3761 }
else if (pe->atom == p->atom(WM_PROTOCOLS)) {
3762 dirty2 |= WM2Protocols;
3763 }
else if (pe->atom == p->atom(_NET_WM_OPAQUE_REGION)) {
3764 dirty2 |= WM2OpaqueRegion;
3765 }
else if (pe->atom == p->atom(_KDE_NET_WM_DESKTOP_FILE)) {
3766 dirty2 = WM2DesktopFileName;
3767 }
else if (pe->atom == p->atom(_GTK_APPLICATION_ID)) {
3768 dirty2 = WM2GTKApplicationId;
3769 }
else if (pe->atom == p->atom(_NET_WM_FULLSCREEN_MONITORS)) {
3770 dirty2 = WM2FullscreenMonitors;
3771 }
else if (pe->atom == p->atom(_GTK_FRAME_EXTENTS)) {
3772 dirty2 |= WM2GTKFrameExtents;
3773 }
else if (pe->atom == p->atom(_GTK_SHOW_WINDOW_MENU)) {
3774 dirty2 |= WM2GTKShowWindowMenu;
3775 }
else if (pe->atom == p->atom(_KDE_NET_WM_APPMENU_SERVICE_NAME)) {
3776 dirty2 |= WM2AppMenuServiceName;
3777 }
else if (pe->atom == p->atom(_KDE_NET_WM_APPMENU_OBJECT_PATH)) {
3778 dirty2 |= WM2AppMenuObjectPath;
3782 }
else if (eventType == XCB_CONFIGURE_NOTIFY) {
3784 fprintf(stderr,
"NETWinInfo::event: handling ConfigureNotify event\n");
3787 dirty |= WMGeometry;
3790 xcb_configure_notify_event_t *configure =
reinterpret_cast<xcb_configure_notify_event_t *
>(
event);
3791 p->win_geom.pos.x = configure->x;
3792 p->win_geom.pos.y = configure->y;
3793 p->win_geom.size.width = configure->width;
3794 p->win_geom.size.height = configure->height;
3798 update(dirty, dirty2);
3802 *properties = dirty;
3805 *properties2 = dirty2;
3809void NETWinInfo::updateWMState()
3816 Properties dirty = dirtyProperties & p->properties;
3817 Properties2 dirty2 = dirtyProperties2 & p->properties2;
3820 if (dirtyProperties & XAWMState) {
3824 xcb_get_property_cookie_t cookies[255];
3827 if (dirty & XAWMState) {
3828 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(WM_STATE), p->atom(WM_STATE), 0, 1);
3831 if (dirty & WMState) {
3832 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_STATE), XCB_ATOM_ATOM, 0, 2048);
3835 if (dirty & WMDesktop) {
3836 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_DESKTOP), XCB_ATOM_CARDINAL, 0, 1);
3839 if (dirty & WMName) {
3840 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_NAME), p->atom(UTF8_STRING), 0, MAX_PROP_SIZE);
3843 if (dirty & WMVisibleName) {
3844 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_VISIBLE_NAME), p->atom(UTF8_STRING), 0, MAX_PROP_SIZE);
3847 if (dirty & WMIconName) {
3848 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_ICON_NAME), p->atom(UTF8_STRING), 0, MAX_PROP_SIZE);
3851 if (dirty & WMVisibleIconName) {
3852 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_VISIBLE_ICON_NAME), p->atom(UTF8_STRING), 0, MAX_PROP_SIZE);
3855 if (dirty & WMWindowType) {
3856 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_WINDOW_TYPE), XCB_ATOM_ATOM, 0, 2048);
3859 if (dirty & WMStrut) {
3860 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_STRUT), XCB_ATOM_CARDINAL, 0, 4);
3863 if (dirty2 & WM2ExtendedStrut) {
3864 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_STRUT_PARTIAL), XCB_ATOM_CARDINAL, 0, 12);
3867 if (dirty2 & WM2FullscreenMonitors) {
3868 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_FULLSCREEN_MONITORS), XCB_ATOM_CARDINAL, 0, 4);
3871 if (dirty & WMIconGeometry) {
3872 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_ICON_GEOMETRY), XCB_ATOM_CARDINAL, 0, 4);
3875 if (dirty & WMIcon) {
3876 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_ICON), XCB_ATOM_CARDINAL, 0, 0xffffffff);
3879 if (dirty & WMFrameExtents) {
3880 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_FRAME_EXTENTS), XCB_ATOM_CARDINAL, 0, 4);
3881 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_KDE_NET_WM_FRAME_STRUT), XCB_ATOM_CARDINAL, 0, 4);
3884 if (dirty2 & WM2FrameOverlap) {
3885 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_FRAME_OVERLAP), XCB_ATOM_CARDINAL, 0, 4);
3888 if (dirty2 & WM2Activities) {
3889 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_KDE_NET_WM_ACTIVITIES), XCB_ATOM_STRING, 0, MAX_PROP_SIZE);
3892 if (dirty2 & WM2BlockCompositing) {
3893 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_KDE_NET_WM_BLOCK_COMPOSITING), XCB_ATOM_CARDINAL, 0, 1);
3894 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_BYPASS_COMPOSITOR), XCB_ATOM_CARDINAL, 0, 1);
3897 if (dirty & WMPid) {
3898 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_PID), XCB_ATOM_CARDINAL, 0, 1);
3901 if (dirty2 & WM2StartupId) {
3902 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_STARTUP_ID), p->atom(UTF8_STRING), 0, MAX_PROP_SIZE);
3905 if (dirty2 & WM2Opacity) {
3906 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_WINDOW_OPACITY), XCB_ATOM_CARDINAL, 0, 1);
3909 if (dirty2 & WM2AllowedActions) {
3910 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_ALLOWED_ACTIONS), XCB_ATOM_ATOM, 0, 2048);
3913 if (dirty2 & WM2UserTime) {
3914 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_USER_TIME), XCB_ATOM_CARDINAL, 0, 1);
3917 if (dirty2 & WM2TransientFor) {
3918 cookies[c++] = xcb_get_property(p->conn,
false, p->window, XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 0, 1);
3921 if (dirty2 & (WM2GroupLeader | WM2Urgency | WM2Input | WM2InitialMappingState | WM2IconPixmap)) {
3922 cookies[c++] = xcb_get_property(p->conn,
false, p->window, XCB_ATOM_WM_HINTS, XCB_ATOM_WM_HINTS, 0, 9);
3925 if (dirty2 & WM2WindowClass) {
3926 cookies[c++] = xcb_get_property(p->conn,
false, p->window, XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 0, MAX_PROP_SIZE);
3929 if (dirty2 & WM2WindowRole) {
3930 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(WM_WINDOW_ROLE), XCB_ATOM_STRING, 0, MAX_PROP_SIZE);
3933 if (dirty2 & WM2ClientMachine) {
3934 cookies[c++] = xcb_get_property(p->conn,
false, p->window, XCB_ATOM_WM_CLIENT_MACHINE, XCB_ATOM_STRING, 0, MAX_PROP_SIZE);
3937 if (dirty2 & WM2Protocols) {
3938 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(WM_PROTOCOLS), XCB_ATOM_ATOM, 0, 2048);
3941 if (dirty2 & WM2OpaqueRegion) {
3942 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_NET_WM_OPAQUE_REGION), XCB_ATOM_CARDINAL, 0, MAX_PROP_SIZE);
3945 if (dirty2 & WM2DesktopFileName) {
3946 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_KDE_NET_WM_DESKTOP_FILE), p->atom(UTF8_STRING), 0, MAX_PROP_SIZE);
3949 if (dirty2 & WM2GTKApplicationId) {
3950 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_GTK_APPLICATION_ID), p->atom(UTF8_STRING), 0, MAX_PROP_SIZE);
3953 if (dirty2 & WM2GTKFrameExtents) {
3954 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_GTK_FRAME_EXTENTS), XCB_ATOM_CARDINAL, 0, 4);
3957 if (dirty2 & WM2AppMenuObjectPath) {
3958 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_KDE_NET_WM_APPMENU_OBJECT_PATH), XCB_ATOM_STRING, 0, MAX_PROP_SIZE);
3961 if (dirty2 & WM2AppMenuServiceName) {
3962 cookies[c++] = xcb_get_property(p->conn,
false, p->window, p->atom(_KDE_NET_WM_APPMENU_SERVICE_NAME), XCB_ATOM_STRING, 0, MAX_PROP_SIZE);
3967 if (dirty & XAWMState) {
3971 uint32_t
state = get_value_reply<uint32_t>(p->conn, cookies[c++], p->atom(WM_STATE), 0, &success);
3976 p->mapping_state =
Iconic;
3989 p->mapping_state_dirty =
false;
3993 if (dirty & WMState) {
3995 const QList<xcb_atom_t> states = get_array_reply<xcb_atom_t>(p->conn, cookies[c++], XCB_ATOM_ATOM);
3998 fprintf(stderr,
"NETWinInfo::update: updating window state (%ld)\n", states.
count());
4001 for (
const xcb_atom_t
state : states) {
4004 fprintf(stderr,
"NETWinInfo::update: adding window state %ld '%s'\n",
state, ba.
constData());
4006 if (
state == p->atom(_NET_WM_STATE_MODAL)) {
4010 else if (
state == p->atom(_NET_WM_STATE_STICKY)) {
4014 else if (
state == p->atom(_NET_WM_STATE_MAXIMIZED_VERT)) {
4018 else if (
state == p->atom(_NET_WM_STATE_MAXIMIZED_HORZ)) {
4022 else if (
state == p->atom(_NET_WM_STATE_SHADED)) {
4026 else if (
state == p->atom(_NET_WM_STATE_SKIP_TASKBAR)) {
4030 else if (
state == p->atom(_NET_WM_STATE_SKIP_PAGER)) {
4034 else if (
state == p->atom(_KDE_NET_WM_STATE_SKIP_SWITCHER)) {
4038 else if (
state == p->atom(_NET_WM_STATE_HIDDEN)) {
4042 else if (
state == p->atom(_NET_WM_STATE_FULLSCREEN)) {
4046 else if (
state == p->atom(_NET_WM_STATE_ABOVE)) {
4050 else if (
state == p->atom(_NET_WM_STATE_BELOW)) {
4054 else if (
state == p->atom(_NET_WM_STATE_DEMANDS_ATTENTION)) {
4058 else if (
state == p->atom(_NET_WM_STATE_STAYS_ON_TOP)) {
4062 else if (
state == p->atom(_NET_WM_STATE_FOCUSED)) {
4068 if (dirty & WMDesktop) {
4072 uint32_t
desktop = get_value_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL, 0, &success);
4083 if (dirty & WMName) {
4087 const QByteArray str = get_string_reply(p->conn, cookies[c++], p->atom(UTF8_STRING));
4093 if (dirty & WMVisibleName) {
4094 delete[] p->visible_name;
4095 p->visible_name =
nullptr;
4097 const QByteArray str = get_string_reply(p->conn, cookies[c++], p->atom(UTF8_STRING));
4103 if (dirty & WMIconName) {
4104 delete[] p->icon_name;
4105 p->icon_name =
nullptr;
4107 const QByteArray str = get_string_reply(p->conn, cookies[c++], p->atom(UTF8_STRING));
4113 if (dirty & WMVisibleIconName) {
4114 delete[] p->visible_icon_name;
4115 p->visible_icon_name =
nullptr;
4117 const QByteArray str = get_string_reply(p->conn, cookies[c++], p->atom(UTF8_STRING));
4123 if (dirty & WMWindowType) {
4126 p->has_net_support =
false;
4128 const QList<xcb_atom_t> types = get_array_reply<xcb_atom_t>(p->conn, cookies[c++], XCB_ATOM_ATOM);
4132 fprintf(stderr,
"NETWinInfo::update: getting window type (%ld)\n", types.
count());
4134 p->has_net_support =
true;
4137 for (
const xcb_atom_t type : types) {
4140 fprintf(stderr,
"NETWinInfo::update: examining window type %ld %s\n", type,
name.constData());
4142 if (type == p->atom(_NET_WM_WINDOW_TYPE_NORMAL)) {
4143 p->types[pos++] =
Normal;
4146 else if (type == p->atom(_NET_WM_WINDOW_TYPE_DESKTOP)) {
4150 else if (type == p->atom(_NET_WM_WINDOW_TYPE_DOCK)) {
4151 p->types[pos++] =
Dock;
4154 else if (type == p->atom(_NET_WM_WINDOW_TYPE_TOOLBAR)) {
4158 else if (type == p->atom(_NET_WM_WINDOW_TYPE_MENU)) {
4159 p->types[pos++] =
Menu;
4162 else if (type == p->atom(_NET_WM_WINDOW_TYPE_DIALOG)) {
4163 p->types[pos++] =
Dialog;
4166 else if (type == p->atom(_NET_WM_WINDOW_TYPE_UTILITY)) {
4170 else if (type == p->atom(_NET_WM_WINDOW_TYPE_SPLASH)) {
4171 p->types[pos++] =
Splash;
4174 else if (type == p->atom(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU)) {
4178 else if (type == p->atom(_NET_WM_WINDOW_TYPE_POPUP_MENU)) {
4182 else if (type == p->atom(_NET_WM_WINDOW_TYPE_TOOLTIP)) {
4186 else if (type == p->atom(_NET_WM_WINDOW_TYPE_NOTIFICATION)) {
4190 else if (type == p->atom(_NET_WM_WINDOW_TYPE_COMBO)) {
4194 else if (type == p->atom(_NET_WM_WINDOW_TYPE_DND)) {
4198 else if (type == p->atom(_KDE_NET_WM_WINDOW_TYPE_OVERRIDE)) {
4202 else if (type == p->atom(_KDE_NET_WM_WINDOW_TYPE_TOPMENU)) {
4206 else if (type == p->atom(_KDE_NET_WM_WINDOW_TYPE_ON_SCREEN_DISPLAY)) {
4210 else if (type == p->atom(_KDE_NET_WM_WINDOW_TYPE_CRITICAL_NOTIFICATION)) {
4214 else if (type == p->atom(_KDE_NET_WM_WINDOW_TYPE_APPLET_POPUP)) {
4221 if (dirty & WMStrut) {
4224 QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
4225 if (data.
count() == 4) {
4226 p->strut.left = data[0];
4227 p->strut.right = data[1];
4228 p->strut.top = data[2];
4229 p->strut.bottom = data[3];
4233 if (dirty2 & WM2ExtendedStrut) {
4236 QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
4237 if (data.
count() == 12) {
4238 p->extended_strut.left_width = data[0];
4239 p->extended_strut.right_width = data[1];
4240 p->extended_strut.top_width = data[2];
4241 p->extended_strut.bottom_width = data[3];
4242 p->extended_strut.left_start = data[4];
4243 p->extended_strut.left_end = data[5];
4244 p->extended_strut.right_start = data[6];
4245 p->extended_strut.right_end = data[7];
4246 p->extended_strut.top_start = data[8];
4247 p->extended_strut.top_end = data[9];
4248 p->extended_strut.bottom_start = data[10];
4249 p->extended_strut.bottom_end = data[11];
4253 if (dirty2 & WM2FullscreenMonitors) {
4256 QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
4257 if (data.
count() == 4) {
4258 p->fullscreen_monitors.top = data[0];
4259 p->fullscreen_monitors.bottom = data[1];
4260 p->fullscreen_monitors.left = data[2];
4261 p->fullscreen_monitors.right = data[3];
4265 if (dirty & WMIconGeometry) {
4268 QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
4269 if (data.
count() == 4) {
4270 p->icon_geom.pos.x = data[0];
4271 p->icon_geom.pos.y = data[1];
4272 p->icon_geom.
size.width = data[2];
4273 p->icon_geom.
size.height = data[3];
4277 if (dirty & WMIcon) {
4278 readIcon(p->conn, cookies[c++], p->icons, p->icon_count);
4279 delete[] p->icon_sizes;
4280 p->icon_sizes =
nullptr;
4283 if (dirty & WMFrameExtents) {
4286 QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
4289 data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
4291 xcb_discard_reply(p->conn, cookies[c++].sequence);
4294 if (data.
count() == 4) {
4295 p->frame_strut.left = data[0];
4296 p->frame_strut.right = data[1];
4297 p->frame_strut.top = data[2];
4298 p->frame_strut.bottom = data[3];
4302 if (dirty2 & WM2FrameOverlap) {
4305 QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
4306 if (data.
count() == 4) {
4307 p->frame_overlap.left = data[0];
4308 p->frame_overlap.right = data[1];
4309 p->frame_overlap.top = data[2];
4310 p->frame_overlap.bottom = data[3];
4314 if (dirty2 & WM2Activities) {
4315 delete[] p->activities;
4316 p->activities =
nullptr;
4324 if (dirty2 & WM2BlockCompositing) {
4326 p->blockCompositing =
false;
4329 uint32_t data = get_value_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL, 0, &success);
4331 p->blockCompositing = bool(data);
4335 data = get_value_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL, 0, &success);
4339 p->blockCompositing =
true;
4342 p->blockCompositing =
false;
4350 if (dirty & WMPid) {
4351 p->pid = get_value_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL, 0);
4354 if (dirty2 & WM2StartupId) {
4355 delete[] p->startup_id;
4356 p->startup_id =
nullptr;
4358 const QByteArray id = get_string_reply(p->conn, cookies[c++], p->atom(UTF8_STRING));
4359 if (
id.length() > 0) {
4360 p->startup_id = nstrndup(
id.constData(),
id.length());
4364 if (dirty2 & WM2Opacity) {
4365 p->opacity = get_value_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL, 0xffffffff);
4368 if (dirty2 & WM2AllowedActions) {
4371 const QList<xcb_atom_t> actions = get_array_reply<xcb_atom_t>(p->conn, cookies[c++], XCB_ATOM_ATOM);
4374 fprintf(stderr,
"NETWinInfo::update: updating allowed actions (%ld)\n", actions.
count());
4377 for (
const xcb_atom_t action : actions) {
4380 fprintf(stderr,
"NETWinInfo::update: adding allowed action %ld '%s'\n", action,
name.constData());
4382 if (action == p->atom(_NET_WM_ACTION_MOVE)) {
4383 p->allowed_actions |= ActionMove;
4386 else if (action == p->atom(_NET_WM_ACTION_RESIZE)) {
4387 p->allowed_actions |= ActionResize;
4390 else if (action == p->atom(_NET_WM_ACTION_MINIMIZE)) {
4391 p->allowed_actions |= ActionMinimize;
4394 else if (action == p->atom(_NET_WM_ACTION_SHADE)) {
4395 p->allowed_actions |= ActionShade;
4398 else if (action == p->atom(_NET_WM_ACTION_STICK)) {
4399 p->allowed_actions |= ActionStick;
4402 else if (action == p->atom(_NET_WM_ACTION_MAXIMIZE_VERT)) {
4403 p->allowed_actions |= ActionMaxVert;
4406 else if (action == p->atom(_NET_WM_ACTION_MAXIMIZE_HORZ)) {
4407 p->allowed_actions |= ActionMaxHoriz;
4410 else if (action == p->atom(_NET_WM_ACTION_FULLSCREEN)) {
4411 p->allowed_actions |= ActionFullScreen;
4414 else if (action == p->atom(_NET_WM_ACTION_CHANGE_DESKTOP)) {
4415 p->allowed_actions |= ActionChangeDesktop;
4418 else if (action == p->atom(_NET_WM_ACTION_CLOSE)) {
4419 p->allowed_actions |= ActionClose;
4425 if (dirty2 & WM2UserTime) {
4429 uint32_t value = get_value_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL, 0, &success);
4432 p->user_time = value;
4436 if (dirty2 & WM2TransientFor) {
4437 p->transient_for = get_value_reply<xcb_window_t>(p->conn, cookies[c++], XCB_ATOM_WINDOW, 0);
4440 if (dirty2 & (WM2GroupLeader | WM2Urgency | WM2Input | WM2InitialMappingState | WM2IconPixmap)) {
4441 xcb_get_property_reply_t *reply = xcb_get_property_reply(p->conn, cookies[c++],
nullptr);
4443 if (reply && reply->format == 32 && reply->value_len == 9 && reply->type == XCB_ATOM_WM_HINTS) {
4444 kde_wm_hints *hints =
reinterpret_cast<kde_wm_hints *
>(xcb_get_property_value(reply));
4446 if (hints->flags & (1 << 0) ) {
4447 p->input = hints->input;
4449 if (hints->flags & (1 << 1) ) {
4450 switch (hints->initial_state) {
4452 p->initialMappingState =
Iconic;
4456 p->initialMappingState =
Visible;
4465 if (hints->flags & (1 << 2) ) {
4466 p->icon_pixmap = hints->icon_pixmap;
4468 if (hints->flags & (1 << 5) ) {
4469 p->icon_mask = hints->icon_mask;
4471 if (hints->flags & (1 << 6) ) {
4472 p->window_group = hints->window_group;
4474 p->urgency = (hints->flags & (1 << 8) );
4482 if (dirty2 & WM2WindowClass) {
4483 delete[] p->class_name;
4484 delete[] p->class_class;
4485 p->class_name =
nullptr;
4486 p->class_class =
nullptr;
4490 p->class_name = nstrdup(
list.
at(0).constData());
4491 p->class_class = nstrdup(
list.
at(1).constData());
4493 p->class_name = nstrdup(
list.
at(0).constData());
4494 p->class_class = nstrdup(
list.
at(0).constData());
4498 if (dirty2 & WM2WindowRole) {
4499 delete[] p->window_role;
4500 p->window_role =
nullptr;
4502 const QByteArray role = get_string_reply(p->conn, cookies[c++], XCB_ATOM_STRING);
4508 if (dirty2 & WM2ClientMachine) {
4509 delete[] p->client_machine;
4510 p->client_machine =
nullptr;
4512 const QByteArray value = get_string_reply(p->conn, cookies[c++], XCB_ATOM_STRING);
4513 if (value.
length() > 0) {
4518 if (dirty2 & WM2Protocols) {
4520 p->protocols = NET::NoProtocol;
4522 if ((*it) == p->atom(WM_TAKE_FOCUS)) {
4524 }
else if ((*it) == p->atom(WM_DELETE_WINDOW)) {
4526 }
else if ((*it) == p->atom(_NET_WM_PING)) {
4528 }
else if ((*it) == p->atom(_NET_WM_SYNC_REQUEST)) {
4530 }
else if ((*it) == p->atom(_NET_WM_CONTEXT_HELP)) {
4536 if (dirty2 & WM2OpaqueRegion) {
4537 const QList<qint32> values = get_array_reply<qint32>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
4538 p->opaqueRegion.clear();
4539 p->opaqueRegion.reserve(values.
count() / 4);
4540 for (
int i = 0; i < values.
count() - 3; i += 4) {
4542 rect.
pos.
x = values.
at(i);
4543 rect.
pos.
y = values.
at(i + 1);
4546 p->opaqueRegion.push_back(rect);
4550 if (dirty2 & WM2DesktopFileName) {
4551 delete[] p->desktop_file;
4552 p->desktop_file =
nullptr;
4554 const QByteArray id = get_string_reply(p->conn, cookies[c++], p->atom(UTF8_STRING));
4555 if (
id.length() > 0) {
4556 p->desktop_file = nstrndup(
id.constData(),
id.length());
4560 if (dirty2 & WM2GTKApplicationId) {
4561 delete[] p->gtk_application_id;
4562 p->gtk_application_id =
nullptr;
4564 const QByteArray id = get_string_reply(p->conn, cookies[c++], p->atom(UTF8_STRING));
4565 if (
id.length() > 0) {
4566 p->gtk_application_id = nstrndup(
id.constData(),
id.length());
4570 if (dirty2 & WM2GTKFrameExtents) {
4573 QList<uint32_t> data = get_array_reply<uint32_t>(p->conn, cookies[c++], XCB_ATOM_CARDINAL);
4574 if (data.
count() == 4) {
4575 p->gtk_frame_extents.left = data[0];
4576 p->gtk_frame_extents.right = data[1];
4577 p->gtk_frame_extents.top = data[2];
4578 p->gtk_frame_extents.bottom = data[3];
4582 if (dirty2 & WM2AppMenuObjectPath) {
4583 delete[] p->appmenu_object_path;
4584 p->appmenu_object_path =
nullptr;
4586 const QByteArray id = get_string_reply(p->conn, cookies[c++], XCB_ATOM_STRING);
4587 if (
id.length() > 0) {
4588 p->appmenu_object_path = nstrndup(
id.constData(),
id.length());
4592 if (dirty2 & WM2AppMenuServiceName) {
4593 delete[] p->appmenu_service_name;
4594 p->appmenu_service_name =
nullptr;
4596 const QByteArray id = get_string_reply(p->conn, cookies[c++], XCB_ATOM_STRING);
4597 if (
id.length() > 0) {
4598 p->appmenu_service_name = nstrndup(
id.constData(),
id.length());
4605 return p->icon_geom;
4620 return p->extended_strut;
4625 return p->fullscreen_monitors;
4632#define CHECK_TYPE_MASK( type ) \
4634 if( mask & type##Mask ) \
4640 CHECK_TYPE_MASK(
Dock)
4642 CHECK_TYPE_MASK(
Menu)
4657#undef CHECK_TYPE_MASK
4666 for (
int i = 0; i < p->types.size(); ++i) {
4677 return p->types.size() > 0;
4687 return p->visible_name;
4692 return p->icon_name;
4697 return p->visible_icon_name;
4703 const KWindowInfo info(p->window, NET::WMDesktop);
4716 return p->user_time;
4721 return p->startup_id;
4731 if (p->opacity == 0xffffffff) {
4734 return p->opacity * 1.0 / 0xffffffff;
4739 return p->allowed_actions;
4744 return p->has_net_support;
4749 return p->transient_for;
4754 return p->window_group;
4769 return p->initialMappingState;
4774 return p->icon_pixmap;
4779 return p->icon_mask;
4784 return p->class_class;
4789 return p->class_name;
4794 return p->window_role;
4799 return p->client_machine;
4804 return p->activities;
4809 delete[] p->activities;
4813 static const char nulluuid[] = KDE_ALL_ACTIVITIES_UUID;
4815 p->activities = nstrdup(nulluuid);
4821 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_KDE_NET_WM_ACTIVITIES), XCB_ATOM_STRING, 8, strlen(p->activities), p->activities);
4830 p->blockCompositing = active;
4833 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_KDE_NET_WM_BLOCK_COMPOSITING), XCB_ATOM_CARDINAL, 32, 1, (
const void *)&d);
4834 xcb_change_property(p->conn, XCB_PROP_MODE_REPLACE, p->window, p->atom(_NET_WM_BYPASS_COMPOSITOR), XCB_ATOM_CARDINAL, 32, 1, (
const void *)&d);
4836 xcb_delete_property(p->conn, p->window, p->atom(_KDE_NET_WM_BLOCK_COMPOSITING));
4837 xcb_delete_property(p->conn, p->window, p->atom(_NET_WM_BYPASS_COMPOSITOR));
4843 return p->blockCompositing;
4848 return p->handled_icons;
4853 return p->properties;
4858 return p->properties2;
4863 return p->mapping_state;
4868 return p->protocols;
4873 return p->protocols.testFlag(protocol);
4878 return p->opaqueRegion;
4892 delete[] p->desktop_file;
4893 p->desktop_file = nstrdup(
name);
4895 xcb_change_property(p->conn,
4896 XCB_PROP_MODE_REPLACE,
4898 p->atom(_KDE_NET_WM_DESKTOP_FILE),
4899 p->atom(UTF8_STRING),
4901 strlen(p->desktop_file),
4902 (
const void *)p->desktop_file);
4907 return p->desktop_file;
4912 return p->gtk_application_id;
4927 return KXUtils::timestampCompare(time1, time2);
4932 return KXUtils::timestampDiff(time1, time2);
This class provides information about a given X11 window.
int desktop() const
Returns the virtual desktop this window is on.
Common API for root window properties/protocols.
virtual void closeWindow(xcb_window_t window)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
virtual void changeDesktopViewport(int desktop, const NETPoint &viewport)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
void setClientList(const xcb_window_t *windows, unsigned int count)
Sets the list of managed windows on the Root/Desktop window.
int clientListCount() const
Returns the number of managed windows in clientList array.
void setDesktopLayout(NET::Orientation orientation, int columns, int rows, NET::DesktopLayoutCorner corner)
Sets the desktop layout.
virtual void addClient(xcb_window_t window)
A Client should subclass NETRootInfo and reimplement this function when it wants to know when a windo...
NET::States passedStates() const
NET::Orientation desktopLayoutOrientation() const
Returns the desktop layout orientation.
virtual void moveResizeWindow(xcb_window_t window, int flags, int x, int y, int width, int height)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
xcb_connection_t * xcbConnection() const
Returns the xcb connection used.
int virtualRootsCount() const
Returns the number of window in the virtualRoots array.
void 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)
Clients (such as pagers/taskbars) that wish to start a WMMoveResize (where the window manager control...
xcb_window_t rootWindow() const
Returns the Window id of the rootWindow.
virtual void gotPing(xcb_window_t window, xcb_timestamp_t timestamp)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to receive r...
void showWindowMenuRequest(xcb_window_t window, int device_id, int x_root, int y_root)
Clients that wish to show the window menu using WM2GTKShowWindowMenu (_GTK_SHOW_WINDOW_MENU) should c...
void setDesktopViewport(int desktop, const NETPoint &viewport)
Sets the viewport for the current desktop to the specified point.
virtual void showWindowMenu(xcb_window_t window, int device_id, int x_root, int y_root)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
virtual void restackWindow(xcb_window_t window, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
int currentDesktop(bool ignore_viewport=false) const
Returns the current desktop.
xcb_window_t activeWindow() const
Returns the active (focused) window.
const xcb_window_t * clientListStacking() const
Returns an array of Window id's, which contain all managed windows in stacking order.
virtual void changeActiveWindow(xcb_window_t window, NET::RequestSource src, xcb_timestamp_t timestamp, xcb_window_t active_window)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
void restackRequest(xcb_window_t window, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp)
Sends the _NET_RESTACK_WINDOW request.
void setDesktopName(int desktop, const char *desktopName)
Sets the name of the specified desktop.
void sendPing(xcb_window_t window, xcb_timestamp_t timestamp)
Sends a ping with the given timestamp to the window, using the _NET_WM_PING protocol.
const xcb_window_t * virtualRoots() const
Returns an array of Window id's, which contain the virtual root windows.
void activate()
Window Managers must call this after creating the NETRootInfo object, and before using any other meth...
NET::Properties2 supportedProperties2() const
In the Window Manager mode, this is equivalent to the properties2 argument passed to the constructor.
int clientListStackingCount() const
Returns the number of managed windows in the clientListStacking array.
NETPoint desktopViewport(int desktop) const
Returns the viewport of the specified desktop.
NET::Properties passedProperties() const
void setWorkArea(int desktop, const NETRect &workArea)
Sets the workarea for the specified desktop.
virtual ~NETRootInfo()
Destroys the NETRootInfo object.
NETRootInfo(xcb_connection_t *connection, xcb_window_t supportWindow, const char *wmName, NET::Properties properties, NET::WindowTypes windowTypes, NET::States states, NET::Properties2 properties2, NET::Actions actions, int screen=-1, bool doActivate=true)
Window Managers should use this constructor to create a NETRootInfo object, which will be used to set...
NET::WindowTypes passedWindowTypes() const
void setSupported(NET::Property property, bool on=true)
Sets the given property if on is true, and clears the property otherwise.
virtual void virtual_hook(int id, void *data)
Virtual hook, used to add new "virtual" functions while maintaining binary compatibility.
virtual void changeDesktopGeometry(int desktop, const NETSize &geom)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
xcb_window_t supportWindow() const
Returns the Window id of the supportWindow.
NET::DesktopLayoutCorner desktopLayoutCorner() const
Returns the desktop layout starting corner.
NETSize desktopGeometry() const
Returns the desktop geometry size.
const char * desktopName(int desktop) const
Returns the name for the specified desktop.
NET::Properties supportedProperties() const
In the Window Manager mode, this is equivalent to the properties argument passed to the constructor.
void closeWindowRequest(xcb_window_t window)
Clients (such as pagers/taskbars) that wish to close a window should call this function.
virtual void removeClient(xcb_window_t window)
A Client should subclass NETRootInfo and reimplement this function when it wants to know when a windo...
void setShowingDesktop(bool showing)
Sets the _NET_SHOWING_DESKTOP status (whether desktop is being shown).
virtual void changeNumberOfDesktops(int numberOfDesktops)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
void setDesktopGeometry(const NETSize &geometry)
Sets the desktop geometry to the specified geometry.
virtual void moveResize(xcb_window_t window, int x_root, int y_root, unsigned long direction, xcb_button_t button, RequestSource source)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
void setCurrentDesktop(int desktop, bool ignore_viewport=false)
Sets the current desktop to the specified desktop.
QSize desktopLayoutColumnsRows() const
Returns the desktop layout number of columns and rows.
const xcb_window_t * clientList() const
Returns an array of Window id's, which contain all managed windows.
void event(xcb_generic_event_t *event, NET::Properties *properties, NET::Properties2 *properties2=nullptr)
This function takes the passed xcb_generic_event_t and returns the updated properties in the passed i...
void setVirtualRoots(const xcb_window_t *windows, unsigned int count)
Sets the list of virtual root windows on the root window.
NET::Properties2 passedProperties2() const
void moveResizeWindowRequest(xcb_window_t window, int flags, int x, int y, int width, int height)
Clients (such as pagers/taskbars) that wish to move/resize a window using WM2MoveResizeWindow (_NET_M...
NET::WindowTypes supportedWindowTypes() const
In the Window Manager mode, this is equivalent to the windowTypes argument passed to the constructor.
void setNumberOfDesktops(int numberOfDesktops)
Sets the number of desktops to the specified number.
NETRect workArea(int desktop) const
Returns the workArea for the specified desktop.
NET::States supportedStates() const
In the Window Manager mode, this is equivalent to the states argument passed to the constructor.
virtual void changeCurrentDesktop(int desktop)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
bool isSupported(NET::Property property) const
Returns true if the given property is supported by the window manager.
NET::Actions passedActions() const
NET::Actions supportedActions() const
In the Window Manager mode, this is equivalent to the actions argument passed to the constructor.
void setActiveWindow(xcb_window_t window, NET::RequestSource src, xcb_timestamp_t timestamp, xcb_window_t active_window)
Requests that the specified window becomes the active (focused) one.
const NETRootInfo & operator=(const NETRootInfo &rootinfo)
Assignment operator.
void setClientListStacking(const xcb_window_t *windows, unsigned int count)
Sets the list of managed windows in stacking order on the Root/Desktop window.
const char * wmName() const
Returns the name of the Window Manager.
virtual void changeShowingDesktop(bool showing)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
int numberOfDesktops(bool ignore_viewport=false) const
Returns the number of desktops.
bool showingDesktop() const
Returns the status of _NET_SHOWING_DESKTOP.
Common API for application window properties/protocols.
bool supportsProtocol(NET::Protocol protocol) const
void setHandledIcons(bool handled)
Set whether this application window handles icons.
void setPid(int pid)
Set the application window's process id.
void setFrameOverlap(NETStrut strut)
Sets the window frame overlap strut, i.e.
bool hasWindowType() const
This function returns false if the window has not window type specified at all.
xcb_connection_t * xcbConnection() const
Returns the xcb connection used.
void event(xcb_generic_event_t *event, NET::Properties *properties, NET::Properties2 *properties2=nullptr)
This function takes the passed in xcb_generic_event_t and returns the updated properties in the passe...
void setOpacityF(qreal opacity)
Sets opacity (0 = transparent, 1 = opaque) on the window.
void setState(NET::States state, NET::States mask)
Set the state for the application window (see the NET base class documentation for a description of w...
const char * gtkApplicationId() const
void setOpacity(unsigned long opacity)
Sets opacity (0 = transparent, 0xffffffff = opaque ) on the window.
NET::Properties2 passedProperties2() const
void kdeGeometry(NETRect &frame, NETRect &window)
Places the window frame geometry in frame, and the application window geometry in window.
virtual void changeDesktop(int desktop)
A Window Manager should subclass NETWinInfo and reimplement this function when it wants to know when ...
const char * activities() const
returns a comma-separated list of the activities the window is associated with.
bool isBlockingCompositing() const
Returns whether the client wishes to block compositing (for better performance)
int desktop(bool ignore_viewport=false) const
Returns the desktop where the window is residing.
MappingState initialMappingState() const
Returns the initial mapping state as set in WM_HINTS.
const char * name() const
Returns the name of the window in UTF-8 format.
xcb_window_t transientFor() const
Returns the WM_TRANSIENT_FOR property for the window, i.e.
void setDesktopFileName(const char *name)
Sets the name as the desktop file name.
bool input() const
Returns whether the Input flag is set in WM_HINTS.
unsigned long opacity() const
Returns the opacity of the window.
MappingState mappingState() const
Returns the mapping state for the window (see the NET base class documentation for a description of m...
void setStrut(NETStrut strut)
virtual void changeState(NET::States state, NET::States mask)
A Window Manager should subclass NETWinInfo and reimplement this function when it wants to know when ...
const char * windowRole() const
Returns the window role for the window (i.e.
NET::Properties passedProperties() const
NETStrut frameExtents() const
Returns the frame decoration strut, i.e.
void setIconName(const char *name)
Sets the iconic name for the application window.
NETIcon icon(int width=-1, int height=-1) const
Returns an icon.
virtual void changeFullscreenMonitors(NETFullscreenMonitors topology)
A Window Manager should subclass NETWinInfo2 and reimplement this function when it wants to know when...
NET::Protocols protocols() const
xcb_pixmap_t icccmIconPixmapMask() const
Returns the mask for the icon pixmap as set in WM_HINTS.
WindowType windowType(WindowTypes supported_types) const
Returns the window type for this client (see the NET base class documentation for a description of th...
void setExtendedStrut(const NETExtendedStrut &extended_strut)
Set the extended (partial) strut for the application window.
void setGtkFrameExtents(NETStrut strut)
Sets the extents of the drop-shadow drawn by the client.
std::vector< NETRect > opaqueRegion() const
NETStrut gtkFrameExtents() const
Returns the extents of the drop-shadow drawn by a GTK client.
void setAppMenuServiceName(const char *name)
Sets the name as the D-BUS service name for the application menu.
NETExtendedStrut extendedStrut() const
Returns the extended (partial) strut specified by this client.
const char * appMenuObjectPath() const
const NETWinInfo & operator=(const NETWinInfo &wintinfo)
Assignment operator.
const char * visibleIconName() const
Returns the visible iconic name as set by the window manager in UTF-8 format.
const char * appMenuServiceName() const
const char * iconName() const
Returns the iconic name of the window in UTF-8 format.
const int * iconSizes() const
Returns a list of provided icon sizes.
void setActivities(const char *activities)
Sets the comma-separated list of activities the window is associated with.
xcb_pixmap_t icccmIconPixmap() const
Returns the icon pixmap as set in WM_HINTS.
const char * desktopFileName() const
NET::States state() const
Returns the state of the window (see the NET base class documentation for a description of the variou...
const char * startupId() const
Returns the startup notification id of the window.
void setFrameExtents(NETStrut strut)
Set the frame decoration strut, i.e.
qreal opacityF() const
Returns the opacity of the window.
void setWindowType(WindowType type)
Sets the window type for this client (see the NET base class documentation for a description of the v...
virtual void virtual_hook(int id, void *data)
Virtual hook, used to add new "virtual" functions while maintaining binary compatibility.
NETStrut frameOverlap() const
Returns the frame overlap strut, i.e.
const char * clientMachine() const
Returns the client machine for the window (i.e.
void setVisibleName(const char *visibleName)
For Window Managers only: set the visible name ( i.e.
void setBlockingCompositing(bool active)
Sets whether the client wishes to block compositing (for better performance)
bool handledIcons() const
Returns whether or not this client handles icons.
void setVisibleIconName(const char *name)
For Window Managers only: set the visible iconic name ( i.e.
void setDesktop(int desktop, bool ignore_viewport=false)
Set which window the desktop is (should be) on.
static const int OnAllDesktops
Sentinel value to indicate that the client wishes to be visible on all desktops.
const char * visibleName() const
Returns the visible name as set by the window manager in UTF-8 format.
xcb_window_t groupLeader() const
Returns the leader window for the group the window is in, if any.
void setStartupId(const char *startup_id)
Sets the startup notification id id on the window.
bool hasNETSupport() const
Returns true if the window has any window type set, even if the type itself is not known to this impl...
xcb_timestamp_t userTime() const
Returns the time of last user action on the window, or -1 if not set.
int pid() const
Returns the process id for the client window.
NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_window_t rootWindow, NET::Properties properties, NET::Properties2 properties2, Role role=Client)
Create a NETWinInfo object, which will be used to set/read/change information stored on an applicatio...
bool urgency() const
Returns whether the UrgencyHint is set in the WM_HINTS.flags.
void setFullscreenMonitors(NETFullscreenMonitors topology)
Sets the desired multiple-monitor topology (4 monitor indices indicating the top, bottom,...
virtual ~NETWinInfo()
Destroys the NETWinInfo object.
void setAppMenuObjectPath(const char *path)
Sets the name as the D-BUS object path for the application menu.
void setUserTime(xcb_timestamp_t time)
Sets user timestamp time on the window (property _NET_WM_USER_TIME).
void setIcon(NETIcon icon, bool replace=true)
Set icons for the application window.
NET::Actions allowedActions() const
Returns actions that the window manager allows for the window.
NETFullscreenMonitors fullscreenMonitors() const
Returns the desired fullscreen monitor topology for this client, should it be in fullscreen state.
const char * windowClassName() const
Returns the name component of the window class for the window (i.e.
void setAllowedActions(NET::Actions actions)
Sets actions that the window manager allows for the window.
const char * windowClassClass() const
Returns the class component of the window class for the window (i.e.
NETRect iconGeometry() const
Returns the icon geometry.
void setIconGeometry(NETRect geometry)
Set the icon geometry for the application window.
void setName(const char *name)
Sets the name for the application window.
Protocol
Protocols supported by the client.
@ DeleteWindowProtocol
WM_DELETE_WINDOW.
@ ContextHelpProtocol
_NET_WM_CONTEXT_HELP, NON STANDARD!
@ TakeFocusProtocol
WM_TAKE_FOCUS.
@ PingProtocol
_NET_WM_PING from EWMH
@ SyncRequestProtocol
_NET_WM_SYNC_REQUEST from EWMH
@ MaxHoriz
indicates that the window is horizontally maximized.
@ Sticky
indicates that the Window Manager SHOULD keep the window's position fixed on the screen,...
@ Shaded
indicates that the window is shaded (rolled-up).
@ MaxVert
indicates that the window is vertically maximized.
@ DemandsAttention
there was an attempt to activate this window, but the window manager prevented this.
@ SkipTaskbar
indicates that a window should not be included on a taskbar.
@ FullScreen
indicates that a window should fill the entire screen and have no window decorations.
@ SkipSwitcher
indicates that a window should not be included on a switcher.
@ Modal
indicates that this is a modal dialog box.
@ KeepAbove
indicates that a window should on top of most windows (but below fullscreen windows).
@ Hidden
indicates that a window should not be visible on the screen (e.g.
@ SkipPager
indicates that a window should not be included on a pager.
@ KeepBelow
indicates that a window should be below most windows (but above any desktop windows).
@ Focused
indicates that a client should render as though it has focus Only the window manager is allowed to ch...
WindowTypeMask
Values for WindowType when they should be OR'ed together, e.g.
@ OnScreenDisplayMask
NON STANDARD.
@ CriticalNotificationMask
NON STANDARD.
@ AppletPopupMask
NON STANDARD.
QFlags< WindowTypeMask > WindowTypes
Stores a combination of WindowTypeMask values.
QFlags< State > States
Stores a combination of State values.
static bool typeMatchesMask(WindowType type, WindowTypes mask)
Returns true if the given window type matches the mask given using WindowTypeMask flags.
QFlags< Property2 > Properties2
Stores a combination of Property2 values.
DesktopLayoutCorner
Starting corner for desktop layout.
@ Splash
indicates that this window is a splash screen window.
@ Notification
indicates a notification window
@ Desktop
indicates a desktop feature.
@ DNDIcon
indicates a window that represents the dragged object during DND operation
@ Normal
indicates that this is a normal, top-level window
@ Unknown
indicates that the window did not define a window type.
@ OnScreenDisplay
indicates an On Screen Display window (such as volume feedback)
@ TopMenu
indicates a toplevel menu (AKA macmenu).
@ AppletPopup
indicates that this window is an applet.
@ Tooltip
indicates a tooltip window
@ Dialog
indicates that this is a dialog window
@ Toolbar
indicates a toolbar window
@ Menu
indicates a pinnable (torn-off) menu window
@ DropdownMenu
indicates a dropdown menu (from a menubar typically)
@ PopupMenu
indicates a popup menu (a context menu typically)
@ CriticalNotification
indicates a critical notification (such as battery is running out)
@ ComboBox
indicates that the window is a list for a combobox
@ Dock
indicates a dock or panel feature
@ Utility
indicates a utility window
@ Client
indicates that the application is a client application.
@ WindowManager
indicates that the application is a window manager application.
Property2
Supported properties.
QFlags< Property > Properties
Stores a combination of Property values.
static int timestampCompare(unsigned long time1, unsigned long time2)
Compares two X timestamps, taking into account wrapping and 64bit architectures.
QFlags< Action > Actions
Stores a combination of Action values.
Property
Supported properties.
RequestSource
Source of the request.
@ FromTool
indicated that the request comes from pager or similar tool
Direction
Direction for WMMoveResize.
static int timestampDiff(unsigned long time1, unsigned long time2)
Returns a difference of two X timestamps, time2 - time1, where time2 must be later than time1,...
Action
Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS).
MappingState
Client window mapping state.
@ Iconic
indicates that the client window is not visible, but its icon is.
@ Withdrawn
indicates that neither the client window nor its icon is visible.
@ Visible
indicates the client window is visible to the user.
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
void init(KXmlGuiWindow *window, KGameDifficulty *difficulty=nullptr)
KIOCORE_EXPORT QStringList list(const QString &fileClass)
const char * constData() const const
qsizetype length() const const
QList< QByteArray > split(char sep) const const
void append(QList< T > &&value)
const_reference at(qsizetype i) const const
qsizetype count() const const
bool isEmpty() const const
void reserve(qsizetype size)
void resize(qsizetype size)
qsizetype size() const const
Partial strut class for NET classes.
int bottom_width
Bottom border of the strut, width and range.
int left_width
Left border of the strut, width and range.
int right_width
Right border of the strut, width and range.
int top_width
Top border of the strut, width and range.
Simple multiple monitor topology class for NET classes.
int right
Monitor index whose right border defines the right edge of the topology.
int top
Monitor index whose top border defines the top edge of the topology.
int left
Monitor index whose left border defines the left edge of the topology.
int bottom
Monitor index whose bottom border defines the bottom edge of the topology.
Simple icon class for NET classes.
NETSize size
Size of the icon.
unsigned char * data
Image data for the icon.
Simple point class for NET classes.
Simple rectangle class for NET classes.
NETPoint pos
Position of the rectangle.
NETSize size
Size of the rectangle.
Simple size class for NET classes.
int bottom
Bottom border of the strut.
int left
Left border of the strut.
int right
Right border of the strut.
int top
Top border of the strut.