31#include <QtGui/QWidget>
34#include <QtGui/qx11info_x11.h>
161 SubstructureNotifyMask);
167 if (! s1)
return (
char *) 0;
169 int l = strlen(s1) + 1;
170 char *s2 =
new char[l];
177 if (! s1 || l == 0)
return (
char *) 0;
179 char *s2 =
new char[l+1];
187 if (! w1 || n == 0)
return (
Window *) 0;
190 while (n--) w2[n] = w1[n];
198 fprintf(stderr,
"NET: decrementing NETRootInfoPrivate::ref (%d)\n", p->ref - 1);
204 fprintf(stderr,
"NET: \tno more references, deleting\n");
208 delete [] p->stacking;
209 delete [] p->clients;
210 delete [] p->virtual_roots;
213 for (i = 0; i < p->desktop_names.size(); i++)
214 delete [] p->desktop_names[i];
222 fprintf(stderr,
"NET: decrementing NETWinInfoPrivate::ref (%d)\n", p->ref - 1);
228 fprintf(stderr,
"NET: \tno more references, deleting\n");
232 delete [] p->visible_name;
233 delete [] p->window_role;
234 delete [] p->icon_name;
235 delete [] p->visible_icon_name;
236 delete [] p->startup_id;
237 delete [] p->class_class;
238 delete [] p->class_name;
239 delete [] p->activities;
242 for (i = 0; i < p->icons.size(); i++)
243 delete [] p->icons[i].data;
244 delete [] p->icon_sizes;
249static int wcmp(
const void *a,
const void *b) {
265 "_NET_SUPPORTING_WM_CHECK",
267 "_NET_CLIENT_LIST_STACKING",
268 "_NET_NUMBER_OF_DESKTOPS",
269 "_NET_DESKTOP_GEOMETRY",
270 "_NET_DESKTOP_VIEWPORT",
271 "_NET_CURRENT_DESKTOP",
272 "_NET_DESKTOP_NAMES",
273 "_NET_ACTIVE_WINDOW",
275 "_NET_VIRTUAL_ROOTS",
276 "_NET_DESKTOP_LAYOUT",
277 "_NET_SHOWING_DESKTOP",
279 "_NET_RESTACK_WINDOW",
281 "_NET_WM_MOVERESIZE",
282 "_NET_MOVERESIZE_WINDOW",
284 "_NET_WM_VISIBLE_NAME",
286 "_NET_WM_VISIBLE_ICON_NAME",
288 "_NET_WM_WINDOW_TYPE",
291 "_NET_WM_STRUT_PARTIAL",
292 "_NET_WM_ICON_GEOMETRY",
296 "_NET_WM_HANDLED_ICONS",
298 "_NET_WM_ALLOWED_ACTIONS",
300 "_NET_WM_TAKE_ACTIVITY",
302 "_NET_FRAME_EXTENTS",
303 "_NET_WM_WINDOW_OPACITY",
304 "_NET_WM_FULLSCREEN_MONITORS",
306 "_NET_WM_WINDOW_TYPE_NORMAL",
307 "_NET_WM_WINDOW_TYPE_DESKTOP",
308 "_NET_WM_WINDOW_TYPE_DOCK",
309 "_NET_WM_WINDOW_TYPE_TOOLBAR",
310 "_NET_WM_WINDOW_TYPE_MENU",
311 "_NET_WM_WINDOW_TYPE_DIALOG",
312 "_NET_WM_WINDOW_TYPE_UTILITY",
313 "_NET_WM_WINDOW_TYPE_SPLASH",
314 "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
315 "_NET_WM_WINDOW_TYPE_POPUP_MENU",
316 "_NET_WM_WINDOW_TYPE_TOOLTIP",
317 "_NET_WM_WINDOW_TYPE_NOTIFICATION",
318 "_NET_WM_WINDOW_TYPE_COMBOBOX",
319 "_NET_WM_WINDOW_TYPE_DND",
321 "_NET_WM_STATE_MODAL",
322 "_NET_WM_STATE_STICKY",
323 "_NET_WM_STATE_MAXIMIZED_VERT",
324 "_NET_WM_STATE_MAXIMIZED_HORZ",
325 "_NET_WM_STATE_SHADED",
326 "_NET_WM_STATE_SKIP_TASKBAR",
327 "_NET_WM_STATE_SKIP_PAGER",
328 "_NET_WM_STATE_HIDDEN",
329 "_NET_WM_STATE_FULLSCREEN",
330 "_NET_WM_STATE_ABOVE",
331 "_NET_WM_STATE_BELOW",
332 "_NET_WM_STATE_DEMANDS_ATTENTION",
334 "_NET_WM_ACTION_MOVE",
335 "_NET_WM_ACTION_RESIZE",
336 "_NET_WM_ACTION_MINIMIZE",
337 "_NET_WM_ACTION_SHADE",
338 "_NET_WM_ACTION_STICK",
339 "_NET_WM_ACTION_MAXIMIZE_VERT",
340 "_NET_WM_ACTION_MAXIMIZE_HORZ",
341 "_NET_WM_ACTION_FULLSCREEN",
342 "_NET_WM_ACTION_CHANGE_DESKTOP",
343 "_NET_WM_ACTION_CLOSE",
345 "_NET_WM_STATE_STAYS_ON_TOP",
347 "_KDE_NET_WM_FRAME_STRUT",
348 "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE",
349 "_KDE_NET_WM_WINDOW_TYPE_TOPMENU",
350 "_KDE_NET_WM_TEMPORARY_RULES",
351 "_NET_WM_FRAME_OVERLAP",
356 "_NET_WM_FULL_PLACEMENT",
357 "_KDE_NET_WM_ACTIVITIES",
358 "_KDE_NET_WM_BLOCK_COMPOSITING",
469 XInternAtoms(d, (
char **) names,
netAtomCount, False, atoms);
473 *atomsp[i] = atoms[i];
482 fprintf(stderr,
"NET: readIcon\n");
487 unsigned long nitems_ret = 0, after_ret = 0;
488 unsigned char *data_ret = 0;
491 for (
int i = 0; i < icons.size(); i++)
492 delete [] icons[i].data;
497 unsigned char *buffer = 0;
498 unsigned long offset = 0;
499 unsigned long buffer_offset = 0;
500 unsigned long bufsize = 0;
504 if (XGetWindowProperty(display, window, property, offset,
506 &format_ret, &nitems_ret, &after_ret, &data_ret)
510 if (nitems_ret < 3 || type_ret != XA_CARDINAL ||
521 bufsize = nitems_ret *
sizeof(long) + after_ret;
522 buffer = (
unsigned char *) malloc(bufsize);
524 else if (buffer_offset + nitems_ret*
sizeof(
long) > bufsize)
526fprintf(stderr,
"NETWM: Warning readIcon() needs buffer adjustment!\n");
527 bufsize = buffer_offset + nitems_ret *
sizeof(long) + after_ret;
528 buffer = (
unsigned char *) realloc(buffer, bufsize);
530 memcpy((buffer + buffer_offset), data_ret, nitems_ret *
sizeof(
long));
531 buffer_offset += nitems_ret *
sizeof(long);
532 offset += nitems_ret;
542 while (after_ret > 0);
545 unsigned long i, j, k, sz, s;
546 unsigned long *d = (
unsigned long *) buffer;
547 for (i = 0, j = 0; i < bufsize;) {
548 icons[j].size.width = *d++;
550 icons[j].size.height = *d++;
553 sz = icons[j].size.width * icons[j].size.height;
554 s = sz *
sizeof(long);
556 if ( i + s - 1 > bufsize || sz == 0 || sz > 1024 * 1024 ) {
560 delete [] icons[j].data;
561 data32 =
new CARD32[sz];
562 icons[j].data = (
unsigned char *) data32;
563 for (k = 0; k < sz; k++, i +=
sizeof(long)) {
564 *data32++ = (CARD32) *d++;
571 fprintf(stderr,
"NET: readIcon got %d icons\n", icon_count);
582 d = (Z*) calloc(capacity,
sizeof(Z));
596 d = (Z*) realloc(d,
sizeof(Z)*capacity);
597 memset( (
void*) d, 0,
sizeof(Z)*capacity );
602 if (index >= capacity) {
606 int newcapacity = 2*capacity > index+1 ? 2*capacity : index+1;
608 d = (Z*) realloc(d,
sizeof(Z)*newcapacity);
609 memset( (
void*) &d[capacity], 0,
sizeof(Z)*(newcapacity-capacity) );
610 capacity = newcapacity;
631 const unsigned long properties[],
int properties_size,
632 int screen,
bool doActivate)
636 fprintf(stderr,
"NETRootInfo::NETRootInfo: using window manager constructor\n");
639 p =
new NETRootInfoPrivate;
642 p->display = display;
648 p->screen = DefaultScreen(p->display);
651 p->root = RootWindow(p->display, p->screen);
652 p->supportwindow = supportWindow;
653 p->number_of_desktops = p->current_desktop = 0;
655 p->clients = p->stacking = p->virtual_roots = (
Window *) 0;
656 p->clients_count = p->stacking_count = p->virtual_roots_count = 0;
657 p->showing_desktop =
false;
660 p->desktop_layout_columns = p->desktop_layout_rows = 0;
661 setDefaultProperties();
663 fprintf( stderr,
"NETRootInfo::NETRootInfo(): properties array too large\n");
666 for(
int i = 0; i < properties_size; ++i )
667 p->properties[ i ] = properties[ i ];
683 int screen,
bool doActivate)
687 fprintf(stderr,
"NETRootInfo::NETRootInfo: using Client constructor\n");
690 p =
new NETRootInfoPrivate;
695 p->display = display;
700 p->screen = DefaultScreen(p->display);
703 p->root = RootWindow(p->display, p->screen);
704 p->rootSize.width = WidthOfScreen(ScreenOfDisplay(p->display, p->screen));
705 p->rootSize.height = HeightOfScreen(ScreenOfDisplay(p->display, p->screen));
707 p->supportwindow =
None;
708 p->number_of_desktops = p->current_desktop = 0;
710 p->clients = p->stacking = p->virtual_roots = (
Window *) 0;
711 p->clients_count = p->stacking_count = p->virtual_roots_count = 0;
712 p->showing_desktop =
false;
715 p->desktop_layout_columns = p->desktop_layout_rows = 0;
716 setDefaultProperties();
717 if( properties_size > 2 ) {
718 fprintf( stderr,
"NETWinInfo::NETWinInfo(): properties array too large\n");
721 for(
int i = 0; i < properties_size; ++i )
725 p->client_properties[
PROTOCOLS ] = properties[ i ];
728 p->client_properties[
PROTOCOLS2 ] = properties[ i ];
732 p->properties[ i ] = 0;
746 fprintf(stderr,
"NETRootInfo::NETRootInfo: using Client constructor\n");
749 p =
new NETRootInfoPrivate;
754 p->display = display;
759 p->screen = DefaultScreen(p->display);
762 p->root = RootWindow(p->display, p->screen);
763 p->rootSize.width = WidthOfScreen(ScreenOfDisplay(p->display, p->screen));
764 p->rootSize.height = HeightOfScreen(ScreenOfDisplay(p->display, p->screen));
766 p->supportwindow =
None;
767 p->number_of_desktops = p->current_desktop = 0;
769 p->clients = p->stacking = p->virtual_roots = (
Window *) 0;
770 p->clients_count = p->stacking_count = p->virtual_roots_count = 0;
771 p->showing_desktop =
false;
774 p->desktop_layout_columns = p->desktop_layout_rows = 0;
775 setDefaultProperties();
776 p->client_properties[
PROTOCOLS ] = properties;
778 p->properties[ i ] = 0;
793 fprintf(stderr,
"NETRootInfo::NETRootInfo: using copy constructor\n");
807 if (! p->ref)
delete p;
811void NETRootInfo::setDefaultProperties()
813 p->properties[ PROTOCOLS ] = Supported | SupportingWMCheck;
814 p->properties[ WINDOW_TYPES ] = NormalMask | DesktopMask | DockMask
815 | ToolbarMask | MenuMask | DialogMask;
816 p->properties[ STATES ] = Modal | Sticky | MaxVert | MaxHoriz | Shaded
817 | SkipTaskbar | StaysOnTop;
818 p->properties[ PROTOCOLS2 ] = 0;
819 p->properties[ ACTIONS ] = 0;
820 p->client_properties[ PROTOCOLS ] = 0;
821 p->client_properties[ WINDOW_TYPES ] = 0;
822 p->client_properties[ STATES ] = 0;
823 p->client_properties[ PROTOCOLS2 ] = 0;
824 p->client_properties[ ACTIONS ] = 0;
832 "NETRootInfo::activate: setting supported properties on root\n");
836 update(p->client_properties);
840 fprintf(stderr,
"NETRootInfo::activate: updating client information\n");
843 update(p->client_properties);
851 p->clients_count = count;
853 delete [] p->clients;
854 p->clients =
nwindup(windows, count);
857 fprintf(stderr,
"NETRootInfo::setClientList: setting list with %ld windows\n",
862 PropModeReplace, (
unsigned char *)p->clients,
870 p->stacking_count = count;
871 delete [] p->stacking;
872 p->stacking =
nwindup(windows, count);
876 "NETRootInfo::setClientListStacking: setting list with %ld windows\n",
881 PropModeReplace, (
unsigned char *) p->stacking,
890 "NETRootInfo::setNumberOfDesktops: setting desktop count to %d (%s)\n",
891 numberOfDesktops, (p->role ==
WindowManager) ?
"WM" :
"Client");
895 p->number_of_desktops = numberOfDesktops;
896 long d = numberOfDesktops;
898 PropModeReplace, (
unsigned char *) &d, 1);
902 e.xclient.type = ClientMessage;
904 e.xclient.display = p->display;
905 e.xclient.window = p->root;
906 e.xclient.format = 32;
907 e.xclient.data.l[0] = numberOfDesktops;
908 e.xclient.data.l[1] = 0l;
909 e.xclient.data.l[2] = 0l;
910 e.xclient.data.l[3] = 0l;
911 e.xclient.data.l[4] = 0l;
922 "NETRootInfo::setCurrentDesktop: setting current desktop = %d (%s)\n",
927 p->current_desktop = desktop;
928 long d = p->current_desktop - 1;
930 PropModeReplace, (
unsigned char *) &d, 1);
939 e.xclient.type = ClientMessage;
941 e.xclient.display = p->display;
942 e.xclient.window = p->root;
943 e.xclient.format = 32;
944 e.xclient.data.l[0] = desktop - 1;
945 e.xclient.data.l[1] = 0l;
946 e.xclient.data.l[2] = 0l;
947 e.xclient.data.l[3] = 0l;
948 e.xclient.data.l[4] = 0l;
957 if (desktop < 1)
return;
959 delete [] p->desktop_names[desktop - 1];
960 p->desktop_names[desktop - 1] =
nstrdup(desktopName);
962 unsigned int i, proplen,
963 num = ((p->number_of_desktops > p->desktop_names.size()) ?
964 p->number_of_desktops : p->desktop_names.size());
965 for (i = 0, proplen = 0; i < num; i++)
966 proplen += (p->desktop_names[i] != 0 ? strlen(p->desktop_names[i])+1 : 1 );
968 char *prop =
new char[proplen], *propp = prop;
970 for (i = 0; i < num; i++)
971 if (p->desktop_names[i]) {
972 strcpy(propp, p->desktop_names[i]);
973 propp += strlen(p->desktop_names[i]) + 1;
979 "NETRootInfo::setDesktopName(%d, '%s')\n"
980 "NETRootInfo::setDesktopName: total property length = %d",
981 desktop, desktopName, proplen);
985 PropModeReplace, (
unsigned char *) prop, proplen);
994 fprintf(stderr,
"NETRootInfo::setDesktopGeometry( -- , { %d, %d }) (%s)\n",
999 p->geometry = geometry;
1002 data[0] = p->geometry.width;
1003 data[1] = p->geometry.height;
1006 PropModeReplace, (
unsigned char *) data, 2);
1010 e.xclient.type = ClientMessage;
1012 e.xclient.display = p->display;
1013 e.xclient.window = p->root;
1014 e.xclient.format = 32;
1015 e.xclient.data.l[0] = geometry.
width;
1016 e.xclient.data.l[1] = geometry.
height;
1017 e.xclient.data.l[2] = 0l;
1018 e.xclient.data.l[3] = 0l;
1019 e.xclient.data.l[4] = 0l;
1029 fprintf(stderr,
"NETRootInfo::setDesktopViewport(%d, { %d, %d }) (%s)\n",
1030 desktop, viewport.
x, viewport.
y, (p->role ==
WindowManager) ?
"WM" :
"Client");
1033 if (desktop < 1)
return;
1036 p->viewport[desktop - 1] = viewport;
1039 l = p->number_of_desktops * 2;
1040 long *data =
new long[l];
1041 for (d = 0, i = 0; d < p->number_of_desktops; d++) {
1042 data[i++] = p->viewport[d].x;
1043 data[i++] = p->viewport[d].y;
1047 PropModeReplace, (
unsigned char *) data, l);
1053 e.xclient.type = ClientMessage;
1055 e.xclient.display = p->display;
1056 e.xclient.window = p->root;
1057 e.xclient.format = 32;
1058 e.xclient.data.l[0] = viewport.
x;
1059 e.xclient.data.l[1] = viewport.
y;
1060 e.xclient.data.l[2] = 0l;
1061 e.xclient.data.l[3] = 0l;
1062 e.xclient.data.l[4] = 0l;
1069void NETRootInfo::setSupported() {
1070 if (p->role != WindowManager) {
1072 fprintf(stderr,
"NETRootInfo::setSupported - role != WindowManager\n");
1085 if (p->properties[ PROTOCOLS ] & ClientList)
1088 if (p->properties[ PROTOCOLS ] & ClientListStacking)
1091 if (p->properties[ PROTOCOLS ] & NumberOfDesktops)
1094 if (p->properties[ PROTOCOLS ] & DesktopGeometry)
1097 if (p->properties[ PROTOCOLS ] & DesktopViewport)
1100 if (p->properties[ PROTOCOLS ] & CurrentDesktop)
1103 if (p->properties[ PROTOCOLS ] & DesktopNames)
1106 if (p->properties[ PROTOCOLS ] & ActiveWindow)
1109 if (p->properties[ PROTOCOLS ] & WorkArea)
1112 if (p->properties[ PROTOCOLS ] & VirtualRoots)
1115 if (p->properties[ PROTOCOLS2 ] & WM2DesktopLayout)
1118 if (p->properties[ PROTOCOLS ] & CloseWindow)
1121 if (p->properties[ PROTOCOLS2 ] & WM2RestackWindow)
1124 if (p->properties[ PROTOCOLS2 ] & WM2ShowingDesktop)
1128 if (p->properties[ PROTOCOLS ] & WMMoveResize)
1131 if (p->properties[ PROTOCOLS2 ] & WM2MoveResizeWindow)
1134 if (p->properties[ PROTOCOLS ] & WMName)
1137 if (p->properties[ PROTOCOLS ] & WMVisibleName)
1140 if (p->properties[ PROTOCOLS ] & WMIconName)
1143 if (p->properties[ PROTOCOLS ] & WMVisibleIconName)
1146 if (p->properties[ PROTOCOLS ] & WMDesktop)
1149 if (p->properties[ PROTOCOLS ] & WMWindowType) {
1153 if (p->properties[ WINDOW_TYPES ] & NormalMask)
1155 if (p->properties[ WINDOW_TYPES ] & DesktopMask)
1157 if (p->properties[ WINDOW_TYPES ] & DockMask)
1159 if (p->properties[ WINDOW_TYPES ] & ToolbarMask)
1161 if (p->properties[ WINDOW_TYPES ] & MenuMask)
1163 if (p->properties[ WINDOW_TYPES ] & DialogMask)
1165 if (p->properties[ WINDOW_TYPES ] & UtilityMask)
1167 if (p->properties[ WINDOW_TYPES ] & SplashMask)
1169 if (p->properties[ WINDOW_TYPES ] & DropdownMenuMask)
1171 if (p->properties[ WINDOW_TYPES ] & PopupMenuMask)
1173 if (p->properties[ WINDOW_TYPES ] & TooltipMask)
1175 if (p->properties[ WINDOW_TYPES ] & NotificationMask)
1177 if (p->properties[ WINDOW_TYPES ] & ComboBoxMask)
1179 if (p->properties[ WINDOW_TYPES ] & DNDIconMask)
1182 if (p->properties[ WINDOW_TYPES ] & OverrideMask)
1184 if (p->properties[ WINDOW_TYPES ] & TopMenuMask)
1188 if (p->properties[ PROTOCOLS ] & WMState) {
1192 if (p->properties[ STATES ] & Modal)
1194 if (p->properties[ STATES ] & Sticky)
1196 if (p->properties[ STATES ] & MaxVert)
1198 if (p->properties[ STATES ] & MaxHoriz)
1200 if (p->properties[ STATES ] & Shaded)
1202 if (p->properties[ STATES ] & SkipTaskbar)
1204 if (p->properties[ STATES ] & SkipPager)
1206 if (p->properties[ STATES ] & Hidden)
1208 if (p->properties[ STATES ] & FullScreen)
1210 if (p->properties[ STATES ] & KeepAbove)
1212 if (p->properties[ STATES ] & KeepBelow)
1214 if (p->properties[ STATES ] & DemandsAttention)
1217 if (p->properties[ STATES ] & StaysOnTop)
1221 if (p->properties[ PROTOCOLS ] & WMStrut)
1224 if (p->properties[ PROTOCOLS2 ] & WM2ExtendedStrut)
1227 if (p->properties[ PROTOCOLS ] & WMIconGeometry)
1230 if (p->properties[ PROTOCOLS ] & WMIcon)
1233 if (p->properties[ PROTOCOLS ] & WMPid)
1236 if (p->properties[ PROTOCOLS ] & WMHandledIcons)
1239 if (p->properties[ PROTOCOLS ] & WMPing)
1242 if (p->properties[ PROTOCOLS2 ] & WM2TakeActivity)
1245 if (p->properties[ PROTOCOLS2 ] & WM2UserTime)
1248 if (p->properties[ PROTOCOLS2 ] & WM2StartupId)
1251 if (p->properties[ PROTOCOLS2 ] & WM2Opacity)
1254 if (p->properties[ PROTOCOLS2 ] & WM2FullscreenMonitors)
1257 if (p->properties[ PROTOCOLS2 ] & WM2AllowedActions) {
1261 if (p->properties[ ACTIONS ] & ActionMove)
1263 if (p->properties[ ACTIONS ] & ActionResize)
1265 if (p->properties[ ACTIONS ] & ActionMinimize)
1267 if (p->properties[ ACTIONS ] & ActionShade)
1269 if (p->properties[ ACTIONS ] & ActionStick)
1271 if (p->properties[ ACTIONS ] & ActionMaxVert)
1273 if (p->properties[ ACTIONS ] & ActionMaxHoriz)
1275 if (p->properties[ ACTIONS ] & ActionFullScreen)
1277 if (p->properties[ ACTIONS ] & ActionChangeDesktop)
1279 if (p->properties[ ACTIONS ] & ActionClose)
1283 if (p->properties[ PROTOCOLS ] & WMFrameExtents) {
1288 if (p->properties[ PROTOCOLS2 ] & WM2FrameOverlap) {
1292 if (p->properties[ PROTOCOLS2 ] & WM2KDETemporaryRules)
1294 if (p->properties[ PROTOCOLS2 ] & WM2FullPlacement)
1297 if (p->properties[ PROTOCOLS2 ] & WM2Activities)
1300 if (p->properties[ PROTOCOLS2 ] & WM2BlockCompositing)
1303 if (p->properties[ PROTOCOLS2 ] & WM2KDEShadow ) {
1307 XChangeProperty(p->display, p->root,
net_supported, XA_ATOM, 32,
1308 PropModeReplace, (
unsigned char *) atoms, pnum);
1310 PropModeReplace, (
unsigned char *) &(p->supportwindow), 1);
1314 "NETRootInfo::setSupported: _NET_SUPPORTING_WM_CHECK = 0x%lx on 0x%lx\n"
1315 " : _NET_WM_NAME = '%s' on 0x%lx\n",
1316 p->supportwindow, p->supportwindow, p->name, p->supportwindow);
1320 XA_WINDOW, 32, PropModeReplace,
1321 (
unsigned char *) &(p->supportwindow), 1);
1323 PropModeReplace, (
unsigned char *) p->name,
1327void NETRootInfo::updateSupportedProperties(
Atom atom )
1336 p->properties[
PROTOCOLS ] |= ClientList;
1339 p->properties[
PROTOCOLS ] |= ClientListStacking;
1342 p->properties[
PROTOCOLS ] |= NumberOfDesktops;
1345 p->properties[
PROTOCOLS ] |= DesktopGeometry;
1348 p->properties[
PROTOCOLS ] |= DesktopViewport;
1351 p->properties[
PROTOCOLS ] |= CurrentDesktop;
1354 p->properties[
PROTOCOLS ] |= DesktopNames;
1357 p->properties[
PROTOCOLS ] |= ActiveWindow;
1363 p->properties[
PROTOCOLS ] |= VirtualRoots;
1366 p->properties[
PROTOCOLS2 ] |= WM2DesktopLayout;
1372 p->properties[
PROTOCOLS2 ] |= WM2RestackWindow;
1375 p->properties[
PROTOCOLS2 ] |= WM2ShowingDesktop;
1379 p->properties[
PROTOCOLS ] |= WMMoveResize;
1382 p->properties[
PROTOCOLS2 ] |= WM2MoveResizeWindow;
1388 p->properties[
PROTOCOLS ] |= WMVisibleName;
1391 p->properties[
PROTOCOLS ] |= WMIconName;
1394 p->properties[
PROTOCOLS ] |= WMVisibleIconName;
1397 p->properties[
PROTOCOLS ] |= WMDesktop;
1400 p->properties[
PROTOCOLS ] |= WMWindowType;
1442 p->properties[
STATES ] |= Modal;
1444 p->properties[
STATES ] |= Sticky;
1446 p->properties[
STATES ] |= MaxVert;
1448 p->properties[
STATES ] |= MaxHoriz;
1450 p->properties[
STATES ] |= Shaded;
1452 p->properties[
STATES ] |= SkipTaskbar;
1454 p->properties[
STATES ] |= SkipPager;
1456 p->properties[
STATES ] |= Hidden;
1460 p->properties[
STATES ] |= KeepAbove;
1462 p->properties[
STATES ] |= KeepBelow;
1464 p->properties[
STATES ] |= DemandsAttention;
1473 p->properties[
PROTOCOLS2 ] |= WM2ExtendedStrut;
1476 p->properties[
PROTOCOLS ] |= WMIconGeometry;
1485 p->properties[
PROTOCOLS ] |= WMHandledIcons;
1491 p->properties[
PROTOCOLS2 ] |= WM2TakeActivity;
1503 p->properties[
PROTOCOLS2 ] |= WM2FullscreenMonitors;
1506 p->properties[
PROTOCOLS2 ] |= WM2AllowedActions;
1510 p->properties[
ACTIONS ] |= ActionMove;
1512 p->properties[
ACTIONS ] |= ActionResize;
1514 p->properties[
ACTIONS ] |= ActionMinimize;
1516 p->properties[
ACTIONS ] |= ActionShade;
1518 p->properties[
ACTIONS ] |= ActionStick;
1520 p->properties[
ACTIONS ] |= ActionMaxVert;
1522 p->properties[
ACTIONS ] |= ActionMaxHoriz;
1524 p->properties[
ACTIONS ] |= ActionFullScreen;
1526 p->properties[
ACTIONS ] |= ActionChangeDesktop;
1531 p->properties[
PROTOCOLS ] |= WMFrameExtents;
1533 p->properties[
PROTOCOLS ] |= WMFrameExtents;
1535 p->properties[
PROTOCOLS2 ] |= WM2FrameOverlap;
1538 p->properties[
PROTOCOLS2 ] |= WM2KDETemporaryRules;
1540 p->properties[
PROTOCOLS2 ] |= WM2FullPlacement;
1543 p->properties[
PROTOCOLS2 ] |= WM2Activities;
1546 p->properties[
PROTOCOLS2 ] |= WM2BlockCompositing;
1557 Time timestamp, Window active_window ) {
1560 fprintf(stderr,
"NETRootInfo::setActiveWindow(0x%lx) (%s)\n",
1567 PropModeReplace, (
unsigned char *) &(p->active), 1);
1571 e.xclient.type = ClientMessage;
1573 e.xclient.display = p->display;
1574 e.xclient.window = window;
1575 e.xclient.format = 32;
1576 e.xclient.data.l[0] = src;
1577 e.xclient.data.l[1] = timestamp;
1578 e.xclient.data.l[2] = active_window;
1579 e.xclient.data.l[3] = 0l;
1580 e.xclient.data.l[4] = 0l;
1590 fprintf(stderr,
"NETRootInfo::setWorkArea(%d, { %d, %d, %d, %d }) (%s)\n",
1597 p->workarea[desktop - 1] = workarea;
1599 long *wa =
new long[p->number_of_desktops * 4];
1601 for (i = 0, o = 0; i < p->number_of_desktops; i++) {
1602 wa[o++] = p->workarea[i].pos.x;
1603 wa[o++] = p->workarea[i].pos.y;
1604 wa[o++] = p->workarea[i].size.width;
1605 wa[o++] = p->workarea[i].size.height;
1608 XChangeProperty(p->display, p->root,
net_workarea, XA_CARDINAL, 32,
1609 PropModeReplace, (
unsigned char *) wa,
1610 p->number_of_desktops * 4);
1619 p->virtual_roots_count = count;
1620 delete[] p->virtual_roots;
1621 p->virtual_roots =
nwindup(windows,count);;
1624 fprintf(stderr,
"NETRootInfo::setVirtualRoots: setting list with %ld windows\n",
1625 p->virtual_roots_count);
1629 PropModeReplace, (
unsigned char *) p->virtual_roots,
1630 p->virtual_roots_count);
1637 p->desktop_layout_orientation = orientation;
1638 p->desktop_layout_columns = columns;
1639 p->desktop_layout_rows = rows;
1640 p->desktop_layout_corner = corner;
1643 fprintf(stderr,
"NETRootInfo::setDesktopLayout: %d %d %d %d\n",
1644 orientation, columns, rows, corner);
1648 data[ 0 ] = orientation;
1649 data[ 1 ] = columns;
1653 PropModeReplace, (
unsigned char *) &data, 4);
1659 long d = p->showing_desktop = showing;
1661 PropModeReplace, (
unsigned char *) &d, 1);
1665 e.xclient.type = ClientMessage;
1667 e.xclient.display = p->display;
1668 e.xclient.window = 0;
1669 e.xclient.format = 32;
1670 e.xclient.data.l[0] = showing ? 1 : 0;
1671 e.xclient.data.l[1] = 0;
1672 e.xclient.data.l[2] = 0;
1673 e.xclient.data.l[3] = 0;
1674 e.xclient.data.l[4] = 0;
1682 return p->showing_desktop;
1689 fprintf(stderr,
"NETRootInfo::closeWindowRequest: requesting close for 0x%lx\n",
1695 e.xclient.type = ClientMessage;
1697 e.xclient.display = p->display;
1698 e.xclient.window = window;
1699 e.xclient.format = 32;
1700 e.xclient.data.l[0] = 0l;
1701 e.xclient.data.l[1] = 0l;
1702 e.xclient.data.l[2] = 0l;
1703 e.xclient.data.l[3] = 0l;
1704 e.xclient.data.l[4] = 0l;
1716 "NETRootInfo::moveResizeRequest: requesting resize/move for 0x%lx (%d, %d, %d)\n",
1717 window, x_root, y_root, direction);
1722 e.xclient.type = ClientMessage;
1724 e.xclient.display = p->display;
1725 e.xclient.window = window,
1726 e.xclient.format = 32;
1727 e.xclient.data.l[0] = x_root;
1728 e.xclient.data.l[1] = y_root;
1729 e.xclient.data.l[2] = direction;
1730 e.xclient.data.l[3] = 0l;
1731 e.xclient.data.l[4] = 0l;
1741 "NETRootInfo::moveResizeWindowRequest: resizing/moving 0x%lx (%d, %d, %d, %d, %d)\n",
1742 window, flags, x, y, width, height);
1747 e.xclient.type = ClientMessage;
1749 e.xclient.display = p->display;
1750 e.xclient.window = window,
1751 e.xclient.format = 32;
1752 e.xclient.data.l[0] = flags;
1753 e.xclient.data.l[1] = x;
1754 e.xclient.data.l[2] = y;
1755 e.xclient.data.l[3] = width;
1756 e.xclient.data.l[4] = height;
1765 "NETRootInfo::restackRequest: requesting restack for 0x%lx (%lx, %d)\n",
1766 window, above, detail);
1771 e.xclient.type = ClientMessage;
1773 e.xclient.display = p->display;
1774 e.xclient.window = window,
1775 e.xclient.format = 32;
1776 e.xclient.data.l[0] = src;
1777 e.xclient.data.l[1] = above;
1778 e.xclient.data.l[2] = detail;
1779 e.xclient.data.l[3] = timestamp;
1780 e.xclient.data.l[4] = 0l;
1789 fprintf(stderr,
"NETRootInfo::setPing: window 0x%lx, timestamp %lu\n",
1790 window, timestamp );
1793 e.xclient.type = ClientMessage;
1795 e.xclient.display = p->display;
1796 e.xclient.window = window,
1797 e.xclient.format = 32;
1799 e.xclient.data.l[1] = timestamp;
1800 e.xclient.data.l[2] = window;
1801 e.xclient.data.l[3] = 0;
1802 e.xclient.data.l[4] = 0;
1804 XSendEvent(p->display, window, False, 0, &e);
1811 fprintf(stderr,
"NETRootInfo::takeActivity: window 0x%lx, timestamp %lu, flags 0x%lx\n",
1812 window, timestamp, flags );
1815 e.xclient.type = ClientMessage;
1817 e.xclient.display = p->display;
1818 e.xclient.window = window,
1819 e.xclient.format = 32;
1821 e.xclient.data.l[1] = timestamp;
1822 e.xclient.data.l[2] = window;
1823 e.xclient.data.l[3] = flags;
1824 e.xclient.data.l[4] = 0;
1826 XSendEvent(p->display, window, False, 0, &e);
1836 fprintf(stderr,
"NETRootInfo::operator=()\n");
1839 if (p != rootinfo.p) {
1842 if (! p->ref)
delete p;
1853 unsigned long props[ 1 ];
1854 event( ev, props, 1 );
1862 unsigned long& dirty = props[
PROTOCOLS ];
1864 bool do_update =
false;
1868 if (p->role ==
WindowManager && event->type == ClientMessage &&
1869 event->xclient.format == 32) {
1871 fprintf(stderr,
"NETRootInfo::event: handling ClientMessage event\n");
1875 dirty = NumberOfDesktops;
1878 fprintf(stderr,
"NETRootInfo::event: changeNumberOfDesktops(%ld)\n",
1879 event->xclient.data.l[0]);
1884 dirty = DesktopGeometry;
1887 sz.
width =
event->xclient.data.l[0];
1888 sz.
height =
event->xclient.data.l[1];
1891 fprintf(stderr,
"NETRootInfo::event: changeDesktopGeometry( -- , { %d, %d })\n",
1897 dirty = DesktopViewport;
1900 pt.
x =
event->xclient.data.l[0];
1901 pt.
y =
event->xclient.data.l[1];
1904 fprintf(stderr,
"NETRootInfo::event: changeDesktopViewport(%d, { %d, %d })\n",
1905 p->current_desktop, pt.
x, pt.
y);
1910 dirty = CurrentDesktop;
1913 fprintf(stderr,
"NETRootInfo::event: changeCurrentDesktop(%ld)\n",
1914 event->xclient.data.l[0] + 1);
1919 dirty = ActiveWindow;
1922 fprintf(stderr,
"NETRootInfo::event: changeActiveWindow(0x%lx)\n",
1923 event->xclient.window);
1927 Time timestamp = CurrentTime;
1931 && event->xclient.data.l[0] <=
FromTool )
1933 src =
static_cast< RequestSource >(
event->xclient.data.l[0] );
1934 timestamp =
event->xclient.data.l[1];
1935 active_window =
event->xclient.data.l[2];
1941 fprintf(stderr,
"NETRootInfo::event: moveResize(%ld, %ld, %ld, %ld)\n",
1942 event->xclient.window,
1943 event->xclient.data.l[0],
1944 event->xclient.data.l[1],
1945 event->xclient.data.l[2]
1950 event->xclient.data.l[0],
1951 event->xclient.data.l[1],
1952 event->xclient.data.l[2]);
1956 fprintf(stderr,
"NETRootInfo::event: moveResizeWindow(%ld, %ld, %ld, %ld, %ld, %ld)\n",
1957 event->xclient.window,
1958 event->xclient.data.l[0],
1959 event->xclient.data.l[1],
1960 event->xclient.data.l[2],
1961 event->xclient.data.l[3],
1962 event->xclient.data.l[4]
1967 event->xclient.data.l[0],
1968 event->xclient.data.l[1],
1969 event->xclient.data.l[2],
1970 event->xclient.data.l[3],
1971 event->xclient.data.l[4]);
1975 fprintf(stderr,
"NETRootInfo::event: closeWindow(0x%lx)\n",
1976 event->xclient.window);
1983 fprintf(stderr,
"NETRootInfo::event: restackWindow(0x%lx)\n",
1984 event->xclient.window);
1988 Time timestamp = CurrentTime;
1991 && event->xclient.data.l[0] <=
FromTool )
1993 src =
static_cast< RequestSource >(
event->xclient.data.l[0] );
1994 timestamp =
event->xclient.data.l[3];
1997 event->xclient.data.l[1], event->xclient.data.l[2], timestamp);
2003 fprintf(stderr,
"NETRootInfo::event: gotPing(0x%lx,%lu)\n",
2004 event->xclient.window, event->xclient.data.l[1]);
2006 gotPing( event->xclient.data.l[2], event->xclient.data.l[1]);
2009 dirty2 = WM2TakeActivity;
2012 fprintf(stderr,
"NETRootInfo::event: gotTakeActivity(0x%lx,%lu,0x%lx)\n",
2013 event->xclient.window, event->xclient.data.l[1], event->xclient.data.l[3]);
2016 event->xclient.data.l[3]);
2018 dirty2 = WM2ShowingDesktop;
2021 fprintf(stderr,
"NETRootInfo::event: changeShowingDesktop(%ld)\n",
2022 event->xclient.data.l[0]);
2029 if (event->type == PropertyNotify) {
2032 fprintf(stderr,
"NETRootInfo::event: handling PropertyNotify event\n");
2038 Bool compaction = False;
2042 fprintf(stderr,
"NETRootInfo::event: loop fire\n");
2046 dirty |= ClientList;
2048 dirty |= ClientListStacking;
2050 dirty |= DesktopNames;
2054 dirty |= NumberOfDesktops;
2056 dirty |= DesktopGeometry;
2058 dirty |= DesktopViewport;
2060 dirty |= CurrentDesktop;
2062 dirty |= ActiveWindow;
2064 dirty2 |= WM2ShowingDesktop;
2070 dirty |= VirtualRoots;
2072 dirty2 |= WM2DesktopLayout;
2076 fprintf(stderr,
"NETRootInfo::event: putting back event and breaking\n");
2080 XPutBackEvent(p->display, &pe);
2089 if (
false && XCheckTypedWindowEvent(p->display, p->root, PropertyNotify, &pe) )
2102 fprintf(stderr,
"NETRootInfo::event: handled events, returning dirty = 0x%lx, 0x%lx\n",
2109 i < properties_size;
2111 properties[ i ] = props[ i ];
2117void NETRootInfo::update(
const unsigned long dirty_props[] )
2121 unsigned char *data_ret;
2122 unsigned long nitems_ret, unused;
2123 unsigned long props[ PROPERTIES_SIZE ];
2125 i < PROPERTIES_SIZE;
2127 props[ i ] = dirty_props[ i ] & p->client_properties[ i ];
2128 const unsigned long& dirty = props[ PROTOCOLS ];
2129 const unsigned long& dirty2 = props[ PROTOCOLS2 ];
2131 if (dirty & Supported ) {
2133 for(
int i = 0; i < PROPERTIES_SIZE; ++i )
2134 p->properties[ i ] = 0;
2137 &format_ret, &nitems_ret, &unused, &data_ret)
2139 if( type_ret == XA_ATOM && format_ret == 32 ) {
2141 for(
unsigned int i = 0;
2144 updateSupportedProperties( atoms[ i ] );
2151 if (dirty & ClientList) {
2155 bool read_ok =
false;
2158 &format_ret, &nitems_ret, &unused, &data_ret)
2160 if (type_ret == XA_WINDOW && format_ret == 32) {
2163 qsort(wins, nitems_ret,
sizeof(Window),
wcmp);
2166 if (p->role == Client) {
2167 unsigned long new_index = 0, old_index = 0;
2168 unsigned long new_count = nitems_ret,
2169 old_count = p->clients_count;
2171 while (old_index < old_count || new_index < new_count) {
2172 if (old_index == old_count) {
2173 clientsToAdd.append(wins[new_index++]);
2174 }
else if (new_index == new_count) {
2175 clientsToRemove.append(p->clients[old_index++]);
2177 if (p->clients[old_index] <
2179 clientsToRemove.append(p->clients[old_index++]);
2180 }
else if (wins[new_index] <
2181 p->clients[old_index]) {
2182 clientsToAdd.append(wins[new_index++]);
2191 delete [] p->clients;
2194 fprintf(stderr,
"NETRootInfo::update: client list null, creating\n");
2198 for (n = 0; n < nitems_ret; n++) {
2199 clientsToAdd.append(wins[n]);
2203 p->clients_count = nitems_ret;
2204 p->clients =
nwindup(wins, p->clients_count);
2212 for(
unsigned int i = 0; i < p->clients_count; ++ i )
2213 clientsToRemove.append(p->clients[i]);
2214 p->clients_count = 0;
2215 delete[] p->clients;
2220 fprintf(stderr,
"NETRootInfo::update: client list updated (%ld clients)\n",
2223 for (
int i = 0; i < clientsToRemove.size(); ++i) {
2226 for (
int i = 0; i < clientsToAdd.size(); ++i) {
2231 if (dirty & ClientListStacking) {
2232 p->stacking_count = 0;
2233 delete[] p->stacking;
2237 &format_ret, &nitems_ret, &unused, &data_ret)
2239 if (type_ret == XA_WINDOW && format_ret == 32) {
2242 p->stacking_count = nitems_ret;
2243 p->stacking =
nwindup(wins, p->stacking_count);
2247 fprintf(stderr,
"NETRootInfo::update: client stacking updated (%ld clients)\n",
2256 if (dirty & NumberOfDesktops) {
2257 p->number_of_desktops = 0;
2260 0l, 1l, False, XA_CARDINAL, &type_ret, &format_ret,
2261 &nitems_ret, &unused, &data_ret)
2263 if (type_ret == XA_CARDINAL && format_ret == 32 && nitems_ret == 1) {
2264 p->number_of_desktops = *((
long *) data_ret);
2268 fprintf(stderr,
"NETRootInfo::update: number of desktops = %d\n",
2269 p->number_of_desktops);
2276 if (dirty & DesktopGeometry) {
2277 p->geometry = p->rootSize;
2279 0l, 2l, False, XA_CARDINAL, &type_ret, &format_ret,
2280 &nitems_ret, &unused, &data_ret)
2282 if (type_ret == XA_CARDINAL && format_ret == 32 &&
2284 long *data = (
long *) data_ret;
2286 p->geometry.width = data[0];
2287 p->geometry.height = data[1];
2290 fprintf(stderr,
"NETRootInfo::update: desktop geometry updated\n");
2298 if (dirty & DesktopViewport) {
2299 for (
int i = 0; i < p->viewport.size(); i++)
2300 p->viewport[i].x = p->viewport[i].y = 0;
2302 0l, 2l, False, XA_CARDINAL, &type_ret, &format_ret,
2303 &nitems_ret, &unused, &data_ret)
2305 if (type_ret == XA_CARDINAL && format_ret == 32 &&
2307 long *data = (
long *) data_ret;
2311 for (d = 0, i = 0; d < n; d++) {
2312 p->viewport[d].x = data[i++];
2313 p->viewport[d].y = data[i++];
2318 "NETRootInfo::update: desktop viewport array updated (%d entries)\n",
2319 p->viewport.size());
2321 if (nitems_ret % 2 != 0) {
2323 "NETRootInfo::update(): desktop viewport array "
2324 "size not a multiple of 2\n");
2333 if (dirty & CurrentDesktop) {
2334 p->current_desktop = 0;
2336 0l, 1l, False, XA_CARDINAL, &type_ret, &format_ret,
2337 &nitems_ret, &unused, &data_ret)
2339 if (type_ret == XA_CARDINAL && format_ret == 32 && nitems_ret == 1) {
2340 p->current_desktop = *((
long *) data_ret) + 1;
2344 fprintf(stderr,
"NETRootInfo::update: current desktop = %d\n",
2345 p->current_desktop);
2352 if (dirty & DesktopNames) {
2353 for(
int i = 0; i < p->desktop_names.size(); ++i )
2354 delete[] p->desktop_names[ i ];
2355 p->desktop_names.reset();
2358 &format_ret, &nitems_ret, &unused, &data_ret)
2361 const char *d = (
const char *) data_ret;
2362 unsigned int s, n, index;
2364 for (s = 0, n = 0, index = 0; n < nitems_ret; n++) {
2366 delete [] p->desktop_names[index];
2367 p->desktop_names[index++] =
nstrndup((d + s), n - s + 1);
2374 fprintf(stderr,
"NETRootInfo::update: desktop names array updated (%d entries)\n",
2375 p->desktop_names.size());
2382 if (dirty & ActiveWindow) {
2385 False, XA_WINDOW, &type_ret, &format_ret,
2386 &nitems_ret, &unused, &data_ret)
2388 if (type_ret == XA_WINDOW && format_ret == 32 && nitems_ret == 1) {
2389 p->active = *((
Window *) data_ret);
2393 fprintf(stderr,
"NETRootInfo::update: active window = 0x%lx\n",
2401 if (dirty & WorkArea) {
2402 p->workarea.reset();
2403 if (XGetWindowProperty(p->display, p->root,
net_workarea, 0l,
2404 (p->number_of_desktops * 4), False, XA_CARDINAL,
2405 &type_ret, &format_ret, &nitems_ret, &unused,
2408 if (type_ret == XA_CARDINAL && format_ret == 32 &&
2409 nitems_ret == (
unsigned) (p->number_of_desktops * 4)) {
2410 long *d = (
long *) data_ret;
2412 for (i = 0, j = 0; i < p->number_of_desktops; i++) {
2413 p->workarea[i].pos.x = d[j++];
2414 p->workarea[i].pos.y = d[j++];
2415 p->workarea[i].size.width = d[j++];
2416 p->workarea[i].size.height = d[j++];
2421 fprintf(stderr,
"NETRootInfo::update: work area array updated (%d entries)\n",
2422 p->workarea.size());
2430 if (dirty & SupportingWMCheck) {
2431 p->supportwindow =
None;
2435 0l, 1l, False, XA_WINDOW, &type_ret, &format_ret,
2436 &nitems_ret, &unused, &data_ret)
2438 if (type_ret == XA_WINDOW && format_ret == 32 && nitems_ret == 1) {
2439 p->supportwindow = *((
Window *) data_ret);
2441 unsigned char *name_ret;
2442 if (XGetWindowProperty(p->display, p->supportwindow,
2445 &nitems_ret, &unused, &name_ret)
2448 p->name =
nstrndup((
const char *) name_ret, nitems_ret);
2457 "NETRootInfo::update: supporting window manager = '%s'\n",
2465 if (dirty & VirtualRoots) {
2466 p->virtual_roots_count = 0;
2467 delete[] p->virtual_roots;
2468 p->virtual_roots = NULL;
2471 &format_ret, &nitems_ret, &unused, &data_ret)
2473 if (type_ret == XA_WINDOW && format_ret == 32) {
2476 p->virtual_roots_count = nitems_ret;
2477 p->virtual_roots =
nwindup(wins, p->virtual_roots_count);
2481 fprintf(stderr,
"NETRootInfo::updated: virtual roots updated (%ld windows)\n",
2482 p->virtual_roots_count);
2489 if (dirty2 & WM2DesktopLayout) {
2492 p->desktop_layout_columns = p->desktop_layout_rows = 0;
2495 &format_ret, &nitems_ret, &unused, &data_ret)
2497 if (type_ret == XA_CARDINAL && format_ret == 32) {
2498 long* data = (
long*) data_ret;
2499 if( nitems_ret >= 4 && data[ 3 ] >= 0 && data[ 3 ] <= 3 )
2501 if( nitems_ret >= 3 ) {
2502 if( data[ 0 ] >= 0 && data[ 0 ] <= 1 )
2504 p->desktop_layout_columns = data[ 1 ];
2505 p->desktop_layout_rows = data[ 2 ];
2510 fprintf(stderr,
"NETRootInfo::updated: desktop layout updated (%d %d %d %d)\n",
2511 p->desktop_layout_orientation, p->desktop_layout_columns,
2512 p->desktop_layout_rows, p->desktop_layout_corner );
2519 if (dirty2 & WM2ShowingDesktop) {
2520 p->showing_desktop =
false;
2523 &format_ret, &nitems_ret, &unused, &data_ret)
2525 if (type_ret == XA_CARDINAL && format_ret == 32 && nitems_ret == 1) {
2526 p->showing_desktop = *((
long *) data_ret);
2530 fprintf(stderr,
"NETRootInfo::update: showing desktop = %d\n",
2531 p->showing_desktop);
2551 return p->supportwindow;
2566 return p->properties;
2572 : p->client_properties;
2583 p->properties[
PROTOCOLS ] &= ~property;
2619 p->properties[
STATES ] |= property;
2622 p->properties[
STATES ] &= ~property;
2632 p->properties[
ACTIONS ] |= property;
2635 p->properties[
ACTIONS ] &= ~property;
2641 return p->properties[
PROTOCOLS ] & property;
2645 return p->properties[
PROTOCOLS2 ] & property;
2653 return p->properties[
STATES ] & state;
2657 return p->properties[
ACTIONS ] & action;
2666 return p->clients_count;
2676 return p->stacking_count;
2681 return p->geometry.width != 0 ? p->geometry : p->rootSize;
2691 return p->viewport[desktop - 1];
2701 return p->workarea[desktop - 1];
2710 return p->desktop_names[desktop - 1];
2715 return p->virtual_roots;
2720 return p->virtual_roots_count;
2725 return p->desktop_layout_orientation;
2730 return QSize( p->desktop_layout_columns, p->desktop_layout_rows );
2735 return p->desktop_layout_corner;
2742 return p->number_of_desktops == 0 ? 1 : p->number_of_desktops;
2749 return p->current_desktop == 0 ? 1 : p->current_desktop;
2763 const unsigned long properties[],
int properties_size,
2768 fprintf(stderr,
"NETWinInfo::NETWinInfo: constructing object with role '%s'\n",
2772 p =
new NETWinInfoPrivate;
2775 p->display = display;
2777 p->root = rootWindow;
2779 p->mapping_state_dirty = True;
2782 p->name = (
char *) 0;
2783 p->visible_name = (
char *) 0;
2784 p->icon_name = (
char *) 0;
2785 p->visible_icon_name = (
char *) 0;
2786 p->desktop = p->pid = p->handled_icons = 0;
2788 p->startup_id = NULL;
2789 p->transient_for =
None;
2790 p->opacity = 0xffffffffU;
2791 p->window_group =
None;
2792 p->allowed_actions = 0;
2793 p->has_net_support =
false;
2794 p->class_class = (
char*) 0;
2795 p->class_name = (
char*) 0;
2796 p->window_role = (
char*) 0;
2797 p->client_machine = (
char*) 0;
2798 p->icon_sizes = NULL;
2799 p->activities = (
char *) 0;
2800 p->blockCompositing =
false;
2807 i < PROPERTIES_SIZE;
2809 p->properties[ i ] = 0;
2810 if( properties_size > PROPERTIES_SIZE )
2811 properties_size = PROPERTIES_SIZE;
2813 i < properties_size;
2815 p->properties[ i ] = properties[ i ];
2823 update(p->properties);
2828 unsigned long properties,
Role role)
2832 fprintf(stderr,
"NETWinInfo::NETWinInfo: constructing object with role '%s'\n",
2836 p =
new NETWinInfoPrivate;
2839 p->display = display;
2841 p->root = rootWindow;
2843 p->mapping_state_dirty = True;
2846 p->name = (
char *) 0;
2847 p->visible_name = (
char *) 0;
2848 p->icon_name = (
char *) 0;
2849 p->visible_icon_name = (
char *) 0;
2850 p->desktop = p->pid = p->handled_icons = 0;
2852 p->startup_id = NULL;
2853 p->transient_for =
None;
2854 p->opacity = 0xffffffffU;
2855 p->window_group =
None;
2856 p->allowed_actions = 0;
2857 p->has_net_support =
false;
2858 p->class_class = (
char*) 0;
2859 p->class_name = (
char*) 0;
2860 p->window_role = (
char*) 0;
2861 p->client_machine = (
char*) 0;
2862 p->icon_sizes = NULL;
2863 p->activities = (
char *) 0;
2864 p->blockCompositing =
false;
2871 i < PROPERTIES_SIZE;
2873 p->properties[ i ] = 0;
2874 p->properties[
PROTOCOLS ] = properties;
2882 update(p->properties);
2887 const unsigned long properties[],
int properties_size,
Role role)
2888 :
NETWinInfo(display, window, rootWindow, properties, properties_size, role) {
2893 unsigned long properties,
Role role)
2894 :
NETWinInfo(display, window, rootWindow, properties, role) {
2907 if (! p->ref)
delete p;
2916 fprintf(stderr,
"NETWinInfo::operator=()\n");
2919 if (p != wininfo.p) {
2922 if (! p->ref)
delete p;
2933 setIconInternal( p->icons, p->icon_count,
net_wm_icon, icon, replace );
2937 if (p->role != Client)
return;
2939 int proplen, i, sz, j;
2943 for (i = 0; i < icons.size(); i++) {
2944 delete [] icons[i].data;
2946 icons[i].size.width = 0;
2947 icons[i].size.height = 0;
2954 icons[icon_count] = icon;
2958 NETIcon &ni = icons[icon_count - 1];
2960 CARD32 *d =
new CARD32[sz];
2961 ni.
data = (
unsigned char *) d;
2962 memcpy(d, icon.
data, sz *
sizeof(CARD32));
2965 for (i = 0, proplen = 0; i < icon_count; i++) {
2966 proplen += 2 + (icons[i].size.width *
2967 icons[i].size.height);
2971 long *prop =
new long[proplen], *pprop = prop;
2972 for (i = 0; i < icon_count; i++) {
2974 *pprop++ = icons[i].size.width;
2975 *pprop++ = icons[i].size.height;
2978 sz = (icons[i].size.width * icons[i].size.height);
2979 d32 = (CARD32 *) icons[i].data;
2980 for (j = 0; j < sz; j++) *pprop++ = *d32++;
2983 XChangeProperty(p->display, p->window, property, XA_CARDINAL, 32,
2984 PropModeReplace, (
unsigned char *) prop, proplen);
2987 delete [] p->icon_sizes;
2988 p->icon_sizes = NULL;
2993 if (p->role !=
Client)
return;
2995 p->icon_geom = geometry;
3001 data[0] = geometry.
pos.
x;
3002 data[1] = geometry.
pos.
y;
3007 32, PropModeReplace, (
unsigned char *) data, 4);
3013 if (p->role !=
Client)
return;
3015 p->extended_strut = extended_strut;
3027 data[9] = extended_strut.
top_end;
3032 PropModeReplace, (
unsigned char *) data, 12);
3037 if (p->role !=
Client)
return;
3042 data[0] = strut.
left;
3043 data[1] = strut.
right;
3044 data[2] = strut.
top;
3047 XChangeProperty(p->display, p->window,
net_wm_strut, XA_CARDINAL, 32,
3048 PropModeReplace, (
unsigned char *) data, 4);
3053 if (p->role !=
Client)
return;
3055 p->fullscreen_monitors = topology;
3058 data[0] = topology.
top;
3059 data[1] = topology.
bottom;
3060 data[2] = topology.
left;
3061 data[3] = topology.
right;
3064 PropModeReplace, (
unsigned char *) data, 4);
3069 if (p->mapping_state_dirty)
3073 if( ( p->properties[
PROTOCOLS ] & WMState ) == 0 ) {
3075 unsigned long props[ PROPERTIES_SIZE ] = { WMState, 0 };
3076 assert( PROPERTIES_SIZE == 2 );
3084 fprintf(stderr,
"NETWinInfo::setState (0x%lx, 0x%lx) (Client)\n",
3089 e.xclient.type = ClientMessage;
3091 e.xclient.display = p->display;
3092 e.xclient.window = p->window;
3093 e.xclient.format = 32;
3094 e.xclient.data.l[3] = 0l;
3095 e.xclient.data.l[4] = 0l;
3097 if ((
mask & Modal) && ((p->state & Modal) != (state & Modal))) {
3098 e.xclient.data.l[0] = (state & Modal) ? 1 : 0;
3100 e.xclient.data.l[2] = 0l;
3105 if ((
mask & Sticky) && ((p->state & Sticky) != (state & Sticky))) {
3106 e.xclient.data.l[0] = (state & Sticky) ? 1 : 0;
3108 e.xclient.data.l[2] = 0l;
3113 if ((
mask &
Max) && (( (p->state&
mask) & Max) != (state & Max))) {
3115 unsigned long wishstate = (p->state & ~mask) | (state &
mask);
3116 if ( ( (wishstate & MaxHoriz) != (p->state & MaxHoriz) )
3117 && ( (wishstate & MaxVert) != (p->state & MaxVert) ) ) {
3118 if ( (wishstate & Max) == Max ) {
3119 e.xclient.data.l[0] = 1;
3123 }
else if ( (wishstate & Max) == 0 ) {
3124 e.xclient.data.l[0] = 0;
3129 e.xclient.data.l[0] = ( wishstate & MaxHoriz ) ? 1 : 0;
3131 e.xclient.data.l[2] = 0;
3133 e.xclient.data.l[0] = ( wishstate & MaxVert ) ? 1 : 0;
3135 e.xclient.data.l[2] = 0;
3138 }
else if ( (wishstate & MaxVert) != (p->state & MaxVert) ) {
3139 e.xclient.data.l[0] = ( wishstate & MaxVert ) ? 1 : 0;
3141 e.xclient.data.l[2] = 0;
3143 }
else if ( (wishstate & MaxHoriz) != (p->state & MaxHoriz) ) {
3144 e.xclient.data.l[0] = ( wishstate & MaxHoriz ) ? 1 : 0;
3146 e.xclient.data.l[2] = 0;
3151 if ((
mask & Shaded) && ((p->state & Shaded) != (state & Shaded))) {
3152 e.xclient.data.l[0] = (state & Shaded) ? 1 : 0;
3154 e.xclient.data.l[2] = 0l;
3159 if ((
mask & SkipTaskbar) &&
3160 ((p->state & SkipTaskbar) != (state & SkipTaskbar))) {
3161 e.xclient.data.l[0] = (state & SkipTaskbar) ? 1 : 0;
3163 e.xclient.data.l[2] = 0l;
3168 if ((
mask & SkipPager) &&
3169 ((p->state & SkipPager) != (state & SkipPager))) {
3170 e.xclient.data.l[0] = (state & SkipPager) ? 1 : 0;
3172 e.xclient.data.l[2] = 0l;
3177 if ((
mask & Hidden) &&
3178 ((p->state & Hidden) != (state & Hidden))) {
3179 e.xclient.data.l[0] = (state & Hidden) ? 1 : 0;
3181 e.xclient.data.l[2] = 0l;
3186 if ((
mask & FullScreen) &&
3187 ((p->state & FullScreen) != (state & FullScreen))) {
3188 e.xclient.data.l[0] = (state & FullScreen) ? 1 : 0;
3190 e.xclient.data.l[2] = 0l;
3195 if ((
mask & KeepAbove) &&
3196 ((p->state & KeepAbove) != (state & KeepAbove))) {
3197 e.xclient.data.l[0] = (state & KeepAbove) ? 1 : 0;
3199 e.xclient.data.l[2] = 0l;
3204 if ((
mask & KeepBelow) &&
3205 ((p->state & KeepBelow) != (state & KeepBelow))) {
3206 e.xclient.data.l[0] = (state & KeepBelow) ? 1 : 0;
3208 e.xclient.data.l[2] = 0l;
3213 if ((
mask &
StaysOnTop) && ((p->state & StaysOnTop) != (state & StaysOnTop))) {
3214 e.xclient.data.l[0] = (state & StaysOnTop) ? 1 : 0;
3216 e.xclient.data.l[2] = 0l;
3221 if ((
mask & DemandsAttention) &&
3222 ((p->state & DemandsAttention) != (state & DemandsAttention))) {
3223 e.xclient.data.l[0] = (state & DemandsAttention) ? 1 : 0;
3225 e.xclient.data.l[2] = 0l;
3255 fprintf(stderr,
"NETWinInfo::setState: setting state property (%d)\n", count);
3256 for (
int i = 0; i < count; i++) {
3257 char* data_ret = XGetAtomName(p->display, (
Atom) data[i]);
3258 fprintf(stderr,
"NETWinInfo::setState: state %ld '%s'\n",
3266 XChangeProperty(p->display, p->window,
net_wm_state, XA_ATOM, 32,
3267 PropModeReplace, (
unsigned char *) data, count);
3273 if (p->role !=
Client)
return;
3382 PropModeReplace, (
unsigned char *) &data, len);
3387 if (p->role !=
Client)
return;
3391 if( p->name[ 0 ] !=
'\0' )
3393 PropModeReplace, (
unsigned char *) p->name,
3396 XDeleteProperty(p->display, p->window,
net_wm_name);
3403 delete [] p->visible_name;
3404 p->visible_name =
nstrdup(visibleName);
3405 if( p->visible_name[ 0 ] !=
'\0' )
3407 PropModeReplace, (
unsigned char *) p->visible_name,
3408 strlen(p->visible_name));
3415 if (p->role !=
Client)
return;
3417 delete [] p->icon_name;
3418 p->icon_name =
nstrdup(iconName);
3419 if( p->icon_name[ 0 ] !=
'\0' )
3421 PropModeReplace, (
unsigned char *) p->icon_name,
3422 strlen(p->icon_name));
3431 delete [] p->visible_icon_name;
3432 p->visible_icon_name =
nstrdup(visibleIconName);
3433 if( p->visible_icon_name[ 0 ] !=
'\0' )
3435 PropModeReplace, (
unsigned char *) p->visible_icon_name,
3436 strlen(p->visible_icon_name));
3443 if (p->mapping_state_dirty)
3458 e.xclient.type = ClientMessage;
3460 e.xclient.display = p->display;
3461 e.xclient.window = p->window;
3462 e.xclient.format = 32;
3464 e.xclient.data.l[1] = 0l;
3465 e.xclient.data.l[2] = 0l;
3466 e.xclient.data.l[3] = 0l;
3467 e.xclient.data.l[4] = 0l;
3472 p->desktop = desktop;
3484 XChangeProperty(p->display, p->window,
net_wm_desktop, XA_CARDINAL, 32,
3485 PropModeReplace, (
unsigned char *) &d, 1);
3491 if (p->role !=
Client)
return;
3495 XChangeProperty(p->display, p->window,
net_wm_pid, XA_CARDINAL, 32,
3496 PropModeReplace, (
unsigned char *) &d, 1);
3501 if (p->role !=
Client)
return;
3503 p->handled_icons = handled;
3506 PropModeReplace, (
unsigned char *) &d, 1);
3510 if (p->role !=
Client)
return;
3512 delete[] p->startup_id;
3515 PropModeReplace,
reinterpret_cast< unsigned char*
>( p->startup_id ),
3516 strlen( p->startup_id ));
3522 p->opacity = opacity;
3524 PropModeReplace,
reinterpret_cast< unsigned char*
>( &p->opacity ), 1);
3533 p->allowed_actions = actions;
3546 fprintf(stderr,
"NETWinInfo::setAllowedActions: setting property (%d)\n", count);
3547 for (
int i = 0; i < count; i++) {
3548 char* data_ret = XGetAtomName(p->display, (
Atom) data[i]);
3549 fprintf(stderr,
"NETWinInfo::setAllowedActions: action %ld '%s'\n",
3557 PropModeReplace, (
unsigned char *) data, count);
3563 p->frame_strut = strut;
3572 PropModeReplace, (
unsigned char *) d, 4);
3574 PropModeReplace, (
unsigned char *) d, 4);
3578 return p->frame_strut;
3582 if (strut.
left != -1 || strut.
top != -1 || strut.
right != -1 || strut.
bottom != -1) {
3584 strut.
top = qMax(0, strut.
top);
3589 p->frame_overlap = strut;
3598 PropModeReplace, (
unsigned char *) d, 4);
3602 return p->frame_overlap;
3606 if (p->win_geom.size.width == 0 || p->win_geom.size.height == 0) {
3609 unsigned int w, h, junk;
3610 XGetGeometry(p->display, p->window, &unused, &x, &y, &w, &h, &junk, &junk);
3611 XTranslateCoordinates(p->display, p->window, p->root, 0, 0, &x, &y, &unused
3614 p->win_geom.pos.x = x;
3615 p->win_geom.pos.y = y;
3617 p->win_geom.size.width = w;
3618 p->win_geom.size.height = h;
3621 window = p->win_geom;
3623 frame.
pos.
x = window.
pos.
x - p->frame_strut.left;
3624 frame.
pos.
y = window.
pos.
y - p->frame_strut.top;
3631 return iconInternal( p->icons, p->icon_count, width, height );
3635 if( p->icon_sizes == NULL ) {
3636 p->icon_sizes =
new int[ p->icon_count * 2 + 2 ];
3640 p->icon_sizes[ i * 2 ] = p->icons[ i ].size.width;
3641 p->icon_sizes[ i * 2 + 1 ] = p->icons[ i ].size.height;
3643 p->icon_sizes[ p->icon_count * 2 ] = 0;
3644 p->icon_sizes[ p->icon_count * 2 + 1 ] = 0;
3646 return p->icon_sizes;
3652 if ( !icon_count ) {
3661 for (
int i = 1; i < icons.size(); i++) {
3662 if( icons[i].size.width >= result.
size.
width &&
3668 if (width == -1 && height == -1)
return result;
3671 for (
int i = 0; i < icons.size(); i++) {
3672 if ((icons[i].size.width >= width &&
3673 icons[i].size.width < result.
size.
width) &&
3674 (icons[i].size.height >= height &&
3683 if (p->role !=
Client)
return;
3685 p->user_time = time;
3688 PropModeReplace, (
unsigned char *) &d, 1);
3694 unsigned long props[ 1 ];
3695 event( ev, props, 1 );
3700 unsigned long props[ PROPERTIES_SIZE ] = { 0, 0 };
3701 assert( PROPERTIES_SIZE == 2 );
3702 unsigned long& dirty = props[
PROTOCOLS ];
3704 bool do_update =
false;
3706 if (p->role ==
WindowManager && event->type == ClientMessage &&
3707 event->xclient.format == 32) {
3710 fprintf(stderr,
"NETWinInfo::event: handling ClientMessage event\n");
3720 "NETWinInfo::event: state client message, getting new state/mask\n");
3726 for (i = 1; i < 3; i++) {
3728 char* debug_txt = XGetAtomName(p->display, (
Atom) event->xclient.data.l[i]);
3729 fprintf(stderr,
"NETWinInfo::event: message %ld '%s'\n",
3730 event->xclient.data.l[i], debug_txt );
3746 mask |= SkipTaskbar;
3758 mask |= DemandsAttention;
3764 switch (event->xclient.data.l[0]) {
3781 fprintf(stderr,
"NETWinInfo::event: calling changeState(%lx, %lx)\n",
3794 dirty2 = WM2FullscreenMonitors;
3797 topology.
top =
event->xclient.data.l[0];
3798 topology.
bottom =
event->xclient.data.l[1];
3799 topology.
left =
event->xclient.data.l[2];
3800 topology.
right =
event->xclient.data.l[3];
3803 fprintf(stderr,
"NETWinInfo2::event: calling changeFullscreenMonitors"
3804 "(%ld, %ld, %ld, %ld, %ld)\n",
3805 event->xclient.window,
3806 event->xclient.data.l[0],
3807 event->xclient.data.l[1],
3808 event->xclient.data.l[2],
3809 event->xclient.data.l[3]
3813 this2->changeFullscreenMonitors(topology);
3817 if (event->type == PropertyNotify) {
3820 fprintf(stderr,
"NETWinInfo::event: handling PropertyNotify event\n");
3826 Bool compaction = False;
3830 fprintf(stderr,
"NETWinInfo::event: loop fire\n");
3836 dirty |= WMVisibleName;
3840 dirty |=WMWindowType;
3846 dirty2 |= WM2ExtendedStrut;
3848 dirty |= WMIconGeometry;
3854 dirty |= WMHandledIcons;
3856 dirty2 |= WM2StartupId;
3858 dirty2 |= WM2Opacity;
3860 dirty2 |= WM2AllowedActions;
3864 dirty |= WMFrameExtents;
3866 dirty |= WMFrameExtents;
3868 dirty2 |= WM2FrameOverlap;
3870 dirty |= WMIconName;
3872 dirty |= WMVisibleIconName;
3874 dirty2 |= WM2UserTime;
3875 else if (pe.xproperty.atom == XA_WM_HINTS)
3877 else if (pe.xproperty.atom == XA_WM_TRANSIENT_FOR)
3879 else if (pe.xproperty.atom == XA_WM_CLASS)
3883 else if (pe.xproperty.atom == XA_WM_CLIENT_MACHINE)
3886 dirty2 |= WM2Activities;
3888 dirty2 |= WM2BlockCompositing;
3890 dirty2 |= WM2KDEShadow;
3894 fprintf(stderr,
"NETWinInfo::event: putting back event and breaking\n");
3898 XPutBackEvent(p->display, &pe);
3902 if (
false && XCheckTypedWindowEvent(p->display, p->window, PropertyNotify, &pe) )
3909 }
else if (event->type == ConfigureNotify) {
3912 fprintf(stderr,
"NETWinInfo::event: handling ConfigureNotify event\n");
3918 p->win_geom.pos.x =
event->xconfigure.x;
3919 p->win_geom.pos.y =
event->xconfigure.y;
3920 p->win_geom.size.width =
event->xconfigure.width;
3921 p->win_geom.size.height =
event->xconfigure.height;
3927 if( properties_size > PROPERTIES_SIZE )
3928 properties_size = PROPERTIES_SIZE;
3930 i < properties_size;
3932 properties[ i ] = props[ i ];
3935void NETWinInfo::updateWMState() {
3936 unsigned long props[ PROPERTIES_SIZE ] = { XAWMState, 0 };
3937 assert( PROPERTIES_SIZE == 2 );
3941void NETWinInfo::update(
const unsigned long dirty_props[]) {
3944 unsigned long nitems_ret, unused;
3945 unsigned char *data_ret;
3946 unsigned long props[ PROPERTIES_SIZE ];
3948 i < PROPERTIES_SIZE;
3950 props[ i ] = dirty_props[ i ] & p->properties[ i ];
3951 const unsigned long& dirty = props[ PROTOCOLS ];
3952 const unsigned long& dirty2 = props[ PROTOCOLS2 ];
3955 if( dirty_props[ PROTOCOLS ] & XAWMState )
3958 if (dirty & XAWMState) {
3960 if (XGetWindowProperty(p->display, p->window,
xa_wm_state, 0l, 1l,
3962 &nitems_ret, &unused, &data_ret)
3964 if (type_ret ==
xa_wm_state && format_ret == 32 &&
3966 long *
state = (
long *) data_ret;
3970 p->mapping_state =
Iconic;
3975 case WithdrawnState:
3981 p->mapping_state_dirty = False;
3988 if (dirty & WMState) {
3990 if (XGetWindowProperty(p->display, p->window,
net_wm_state, 0l, 2048l,
3991 False, XA_ATOM, &type_ret, &format_ret,
3992 &nitems_ret, &unused, &data_ret)
3994 if (type_ret == XA_ATOM && format_ret == 32 && nitems_ret > 0) {
3997 fprintf(stderr,
"NETWinInfo::update: updating window state (%ld)\n",
4001 long *states = (
long *) data_ret;
4002 unsigned long count;
4004 for (count = 0; count < nitems_ret; count++) {
4006 char* data_ret = XGetAtomName(p->display, (
Atom) states[count]);
4008 "NETWinInfo::update: adding window state %ld '%s'\n",
4009 states[count], data_ret );
4019 p->state |= MaxVert;
4021 p->state |= MaxHoriz;
4025 p->state |= SkipTaskbar;
4027 p->state |= SkipPager;
4033 p->state |= KeepAbove;
4035 p->state |= KeepBelow;
4037 p->state |= DemandsAttention;
4047 if (dirty & WMDesktop) {
4049 if (XGetWindowProperty(p->display, p->window,
net_wm_desktop, 0l, 1l,
4050 False, XA_CARDINAL, &type_ret,
4051 &format_ret, &nitems_ret,
4054 if (type_ret == XA_CARDINAL && format_ret == 32 &&
4056 p->desktop = *((
long *) data_ret);
4060 if ( p->desktop == 0 )
4068 if (dirty & WMName) {
4071 if (XGetWindowProperty(p->display, p->window,
net_wm_name, 0l,
4073 &format_ret, &nitems_ret, &unused, &data_ret)
4075 if (type_ret ==
UTF8_STRING && format_ret == 8 && nitems_ret > 0) {
4076 p->name =
nstrndup((
const char *) data_ret, nitems_ret);
4084 if (dirty & WMVisibleName) {
4085 delete[] p->visible_name;
4086 p->visible_name = NULL;
4089 &format_ret, &nitems_ret, &unused, &data_ret)
4091 if (type_ret ==
UTF8_STRING && format_ret == 8 && nitems_ret > 0) {
4092 p->visible_name =
nstrndup((
const char *) data_ret, nitems_ret);
4100 if (dirty & WMIconName) {
4101 delete[] p->icon_name;
4102 p->icon_name = NULL;
4105 &format_ret, &nitems_ret, &unused, &data_ret)
4107 if (type_ret ==
UTF8_STRING && format_ret == 8 && nitems_ret > 0) {
4108 p->icon_name =
nstrndup((
const char *) data_ret, nitems_ret);
4116 if (dirty & WMVisibleIconName)
4118 delete[] p->visible_icon_name;
4119 p->visible_icon_name = NULL;
4122 &format_ret, &nitems_ret, &unused, &data_ret)
4124 if (type_ret ==
UTF8_STRING && format_ret == 8 && nitems_ret > 0) {
4125 p->visible_icon_name =
nstrndup((
const char *) data_ret, nitems_ret);
4133 if (dirty & WMWindowType) {
4136 p->has_net_support =
false;
4138 False, XA_ATOM, &type_ret, &format_ret,
4139 &nitems_ret, &unused, &data_ret)
4141 if (type_ret == XA_ATOM && format_ret == 32 && nitems_ret > 0) {
4144 fprintf(stderr,
"NETWinInfo::update: getting window type (%ld)\n",
4148 p->has_net_support =
true;
4150 unsigned long count = 0;
4151 long *types = (
long *) data_ret;
4154 while (count < nitems_ret) {
4157 char* debug_type = XGetAtomName(p->display, (
Atom) types[count]);
4159 "NETWinInfo::update: examining window type %ld %s\n",
4160 types[count], debug_type );
4162 XFree( debug_type );
4166 p->types[ pos++ ] =
Normal;
4170 p->types[ pos++ ] =
Dock;
4174 p->types[ pos++ ] =
Menu;
4176 p->types[ pos++ ] =
Dialog;
4180 p->types[ pos++ ] =
Splash;
4207 if (dirty & WMStrut) {
4209 if (XGetWindowProperty(p->display, p->window,
net_wm_strut, 0l, 4l,
4210 False, XA_CARDINAL, &type_ret, &format_ret,
4211 &nitems_ret, &unused, &data_ret)
4213 if (type_ret == XA_CARDINAL && format_ret == 32 &&
4215 long *d = (
long *) data_ret;
4216 p->strut.left = d[0];
4217 p->strut.right = d[1];
4218 p->strut.top = d[2];
4219 p->strut.bottom = d[3];
4226 if (dirty2 & WM2ExtendedStrut) {
4229 False, XA_CARDINAL, &type_ret, &format_ret,
4230 &nitems_ret, &unused, &data_ret)
4232 if (type_ret == XA_CARDINAL && format_ret == 32 &&
4234 long *d = (
long *) data_ret;
4235 p->extended_strut.left_width = d[0];
4236 p->extended_strut.right_width = d[1];
4237 p->extended_strut.top_width = d[2];
4238 p->extended_strut.bottom_width = d[3];
4239 p->extended_strut.left_start = d[4];
4240 p->extended_strut.left_end = d[5];
4241 p->extended_strut.right_start = d[6];
4242 p->extended_strut.right_end = d[7];
4243 p->extended_strut.top_start = d[8];
4244 p->extended_strut.top_end = d[9];
4245 p->extended_strut.bottom_start = d[10];
4246 p->extended_strut.bottom_end = d[11];
4253 if (dirty2 & WM2FullscreenMonitors) {
4256 False, XA_CARDINAL, &type_ret, &format_ret,
4257 &nitems_ret, &unused, &data_ret)
4259 if (type_ret == XA_CARDINAL && format_ret == 32 &&
4261 long *d = (
long *) data_ret;
4262 p->fullscreen_monitors.top = d[0];
4263 p->fullscreen_monitors.bottom = d[1];
4264 p->fullscreen_monitors.left = d[2];
4265 p->fullscreen_monitors.right = d[3];
4272 if (dirty & WMIconGeometry) {
4275 False, XA_CARDINAL, &type_ret, &format_ret,
4276 &nitems_ret, &unused, &data_ret)
4278 if (type_ret == XA_CARDINAL && format_ret == 32 &&
4280 long *d = (
long *) data_ret;
4281 p->icon_geom.pos.x = d[0];
4282 p->icon_geom.pos.y = d[1];
4283 p->icon_geom.size.width = d[2];
4284 p->icon_geom.size.height = d[3];
4291 if (dirty & WMIcon) {
4293 delete[] p->icon_sizes;
4294 p->icon_sizes = NULL;
4297 if (dirty & WMFrameExtents) {
4301 0l, 4l, False, XA_CARDINAL, &type_ret, &format_ret,
4302 &nitems_ret, &unused, &data_ret) == Success) {
4303 if (type_ret == XA_CARDINAL && format_ret == 32 && nitems_ret == 4) {
4305 long *d = (
long *) data_ret;
4307 p->frame_strut.left = d[0];
4308 p->frame_strut.right = d[1];
4309 p->frame_strut.top = d[2];
4310 p->frame_strut.bottom = d[3];
4316 0l, 4l, False, XA_CARDINAL, &type_ret, &format_ret,
4317 &nitems_ret, &unused, &data_ret) == Success) {
4318 if (type_ret == XA_CARDINAL && format_ret == 32 && nitems_ret == 4) {
4320 long *d = (
long *) data_ret;
4322 p->frame_strut.left = d[0];
4323 p->frame_strut.right = d[1];
4324 p->frame_strut.top = d[2];
4325 p->frame_strut.bottom = d[3];
4332 if (dirty2 & WM2FrameOverlap) {
4335 0l, 4l, False, XA_CARDINAL, &type_ret, &format_ret,
4336 &nitems_ret, &unused, &data_ret) == Success) {
4337 if (type_ret == XA_CARDINAL && format_ret == 32 && nitems_ret == 4) {
4338 long *d = (
long *) data_ret;
4340 p->frame_overlap.left = d[0];
4341 p->frame_overlap.right = d[1];
4342 p->frame_overlap.top = d[2];
4343 p->frame_overlap.bottom = d[3];
4350 if (dirty2 & WM2Activities) {
4351 delete[] p->activities;
4352 p->activities = NULL;
4355 &format_ret, &nitems_ret, &unused, &data_ret)
4357 if (type_ret == XA_STRING && format_ret == 8 && nitems_ret > 0) {
4358 p->activities =
nstrndup((
const char *) data_ret, nitems_ret);
4366 if (dirty2 & WM2BlockCompositing) {
4367 p->blockCompositing =
false;
4369 1, False, XA_STRING, &type_ret,
4370 &format_ret, &nitems_ret, &unused, &data_ret) == Success) {
4371 p->blockCompositing = (data_ret != NULL);
4377 if (dirty & WMPid) {
4379 if (XGetWindowProperty(p->display, p->window,
net_wm_pid, 0l, 1l,
4380 False, XA_CARDINAL, &type_ret, &format_ret,
4381 &nitems_ret, &unused, &data_ret) == Success) {
4382 if (type_ret == XA_CARDINAL && format_ret == 32 && nitems_ret == 1) {
4383 p->pid = *((
long *) data_ret);
4390 if (dirty2 & WM2StartupId)
4392 delete[] p->startup_id;
4393 p->startup_id = NULL;
4394 if (XGetWindowProperty(p->display, p->window,
net_startup_id, 0l,
4396 &format_ret, &nitems_ret, &unused, &data_ret)
4398 if (type_ret ==
UTF8_STRING && format_ret == 8 && nitems_ret > 0) {
4399 p->startup_id =
nstrndup((
const char *) data_ret, nitems_ret);
4407 if (dirty2 & WM2Opacity)
4409 p->opacity = 0xffffffffU;
4412 &format_ret, &nitems_ret, &unused, &data_ret)
4414 if (type_ret == XA_CARDINAL && format_ret == 32 && nitems_ret == 1) {
4418 p->opacity = *((
unsigned long*)data_ret) & 0xffffffffU;
4426 if( dirty2 & WM2AllowedActions ) {
4427 p->allowed_actions = 0;
4429 False, XA_ATOM, &type_ret, &format_ret,
4430 &nitems_ret, &unused, &data_ret)
4432 if (type_ret == XA_ATOM && format_ret == 32 && nitems_ret > 0) {
4435 fprintf(stderr,
"NETWinInfo::update: updating allowed actions (%ld)\n",
4439 long *actions = (
long *) data_ret;
4440 unsigned long count;
4442 for (count = 0; count < nitems_ret; count++) {
4445 "NETWinInfo::update: adding allowed action %ld '%s'\n",
4447 XGetAtomName(p->display, (
Atom) actions[count]));
4451 p->allowed_actions |= ActionMove;
4453 p->allowed_actions |= ActionResize;
4455 p->allowed_actions |= ActionMinimize;
4457 p->allowed_actions |= ActionShade;
4459 p->allowed_actions |= ActionStick;
4461 p->allowed_actions |= ActionMaxVert;
4463 p->allowed_actions |= ActionMaxHoriz;
4465 p->allowed_actions |= ActionFullScreen;
4467 p->allowed_actions |= ActionChangeDesktop;
4477 if (dirty2 & WM2UserTime) {
4480 False, XA_CARDINAL, &type_ret, &format_ret,
4481 &nitems_ret, &unused, &data_ret) == Success) {
4483 if (type_ret == XA_CARDINAL && format_ret == 32 ) {
4484 p->user_time = *((
long *) data_ret);
4491 if (dirty2 & WM2TransientFor) {
4492 p->transient_for =
None;
4493 XGetTransientForHint(p->display, p->window, &p->transient_for);
4496 if (dirty2 & WM2GroupLeader) {
4497 XWMHints *hints = XGetWMHints(p->display, p->window);
4498 p->window_group =
None;
4501 if( hints->flags & WindowGroupHint )
4502 p->window_group = hints->window_group;
4503 XFree(
reinterpret_cast< char*
>( hints ));
4507 if( dirty2 & WM2WindowClass ) {
4508 delete[] p->class_class;
4509 delete[] p->class_name;
4510 p->class_class = NULL;
4511 p->class_name = NULL;
4513 if( XGetClassHint( p->display, p->window, &hint )) {
4514 p->class_class =
nstrdup( hint.res_class );
4515 p->class_name =
nstrdup( hint.res_name );
4516 XFree( hint.res_class );
4517 XFree( hint.res_name );
4521 if( dirty2 & WM2WindowRole ) {
4522 delete[] p->window_role;
4523 p->window_role = NULL;
4524 if (XGetWindowProperty(p->display, p->window,
wm_window_role, 0l,
4526 &format_ret, &nitems_ret, &unused, &data_ret)
4528 if (type_ret == XA_STRING && format_ret == 8 && nitems_ret > 0) {
4529 p->window_role =
nstrndup((
const char *) data_ret, nitems_ret);
4536 if( dirty2 & WM2ClientMachine ) {
4537 delete[] p->client_machine;
4538 p->client_machine = NULL;
4539 if (XGetWindowProperty(p->display, p->window, XA_WM_CLIENT_MACHINE, 0l,
4541 &format_ret, &nitems_ret, &unused, &data_ret)
4543 if (type_ret == XA_STRING && format_ret == 8 && nitems_ret > 0) {
4544 p->client_machine =
nstrndup((
const char *) data_ret, nitems_ret);
4554 return p->icon_geom;
4568 return p->extended_strut;
4572 return p->fullscreen_monitors;
4577#define CHECK_TYPE_MASK( type ) \
4579 if( mask & type##Mask ) \
4598#undef CHECK_TYPE_MASK
4607 i < p->types.size();
4611 return p->types[ i ];
4617 return p->types.size() > 0;
4626 return p->visible_name;
4631 return p->icon_name;
4636 return p->visible_icon_name;
4651 return p->user_time;
4655 return p->startup_id;
4663 return p->allowed_actions;
4667 return p->has_net_support;
4671 return p->transient_for;
4675 return p->window_group;
4679 return p->class_class;
4683 return p->class_name;
4687 return p->window_role;
4691 return p->client_machine;
4695 return p->activities;
4699 if (p->role !=
Client)
return;
4701 p->blockCompositing = active;
4705 PropModeReplace, (
unsigned char *) &d, 1);
4712 return p->blockCompositing;
4716 return p->handled_icons;
4721 return p->properties;
4726 return p->mapping_state;
int desktop() const
Returns the virtual desktop this window is on (NET::OnAllDesktops if the window is on all desktops).
static void setOnDesktop(WId win, int desktop)
Moves window win to desktop desktop.
static bool mapViewport()
static int currentDesktop()
Returns the current virtual desktop.
static KWindowInfo windowInfo(WId win, unsigned long properties, unsigned long properties2=0)
Returns information about window win.
static void setCurrentDesktop(int desktop)
Convenience function to set the current desktop to desktop.
static int numberOfDesktops()
Returns the number of virtual desktops.
Common API for root window properties/protocols.
virtual void changeDesktopViewport(int desktop, const NETPoint &viewport)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
int clientListCount() const
Returns the number of managed windows in clientList array.
virtual void moveResizeWindow(Window 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...
void setDesktopLayout(NET::Orientation orientation, int columns, int rows, NET::DesktopLayoutCorner corner)
Sets the desktop layout.
Display * x11Display() const
Returns the X11 Display struct used.
NET::Orientation desktopLayoutOrientation() const
Returns the desktop layout orientation.
int virtualRootsCount() const
Returns the number of window in the virtualRoots array.
Window supportWindow() const
Returns the Window id of the supportWindow.
const Window * virtualRoots() const
Returns an array of Window id's, which contain the virtual root windows.
void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp)
Sends the _NET_RESTACK_WINDOW request.
void setDesktopViewport(int desktop, const NETPoint &viewport)
Sets the viewport for the current desktop to the specified point.
int currentDesktop(bool ignore_viewport=false) const
Returns the current desktop.
void event(XEvent *event, unsigned long *properties, int properties_size)
This function takes the passed XEvent and returns an OR'ed list of NETRootInfo properties that have c...
virtual void addClient(Window window)
A Client should subclass NETRootInfo and reimplement this function when it wants to know when a windo...
void setVirtualRoots(const Window *windows, unsigned int count)
Sets the list of virtual root windows on the root window.
virtual void moveResize(Window window, int x_root, int y_root, unsigned long direction)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
virtual void removeClient(Window window)
A Client should subclass NETRootInfo and reimplement this function when it wants to know when a windo...
virtual void gotTakeActivity(Window window, Time timestamp, long flags)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to receive r...
void setDesktopName(int desktop, const char *desktopName)
Sets the name of the specified desktop.
NETRootInfo(Display *display, Window supportWindow, const char *wmName, const unsigned long properties[], int properties_size, int screen=-1, bool doActivate=true)
Window Managers should use this constructor to create a NETRootInfo object, which will be used to set...
void activate()
Window Managers must call this after creating the NETRootInfo object, and before using any other meth...
int clientListStackingCount() const
Returns the number of managed windows in the clientListStacking array.
void setActiveWindow(Window window, NET::RequestSource src, Time timestamp, Window active_window)
Requests that the specified window becomes the active (focused) one.
NETPoint desktopViewport(int desktop) const
Returns the viewport of the specified desktop.
void setClientList(const Window *windows, unsigned int count)
Sets the list of managed windows on the Root/Desktop window.
void sendPing(Window window, Time timestamp)
Sends a ping with the given timestamp to the window, using the _NET_WM_PING protocol.
virtual void gotPing(Window window, Time timestamp)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to receive r...
void setWorkArea(int desktop, const NETRect &workArea)
Sets the workarea for the specified desktop.
Window rootWindow() const
Returns the Window id of the rootWindow.
virtual void closeWindow(Window window)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
virtual ~NETRootInfo()
Destroys the NETRootInfo object.
virtual void restackWindow(Window window, RequestSource source, Window above, int detail, Time timestamp)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
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...
void takeActivity(Window window, Time timestamp, long flags)
Sends a take activity message with the given timestamp to the window, using the _NET_WM_TAKE_ACTIVITY...
NET::DesktopLayoutCorner desktopLayoutCorner() const
Returns the desktop layout starting corner.
const char * desktopName(int desktop) const
Returns the name for the specified desktop.
void moveResizeWindowRequest(Window 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...
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...
const unsigned long * passedProperties() const
Returns the properties argument passed to the constructor.
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.
Window activeWindow() const
Returns the active (focused) window.
void setClientListStacking(const Window *windows, unsigned int count)
Sets the list of managed windows in stacking order on the Root/Desktop window.
virtual void changeActiveWindow(Window window, NET::RequestSource src, Time timestamp, Window active_window)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
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.
void moveResizeRequest(Window window, int x_root, int y_root, Direction direction)
Clients (such as pagers/taskbars) that wish to start a WMMoveResize (where the window manager control...
int screenNumber() const
Returns the screenNumber.
const unsigned long * supportedProperties() const
In the Window Manager mode, this is equivalent to the properties 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.
void closeWindowRequest(Window window)
Clients (such as pagers/taskbars) that wish to close a window should call this function.
const NETRootInfo & operator=(const NETRootInfo &rootinfo)
Assignment operator.
const char * wmName() const
Returns the name of the Window Manager.
const Window * clientList() const
Returns an array of Window id's, which contain all managed windows.
virtual void changeShowingDesktop(bool showing)
A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when...
void setDesktopGeometry(int desktop, const NETSize &geometry)
Sets the desktop geometry to the specified geometry.
int numberOfDesktops(bool ignore_viewport=false) const
Returns the number of desktops.
bool showingDesktop() const
Returns the status of _NET_SHOWING_DESKTOP.
NETSize desktopGeometry(int desktop) const
Returns the desktop geometry size.
const Window * clientListStacking() const
Returns an array of Window id's, which contain all managed windows in stacking order.
This class is an extension of the NETWinInfo class, and exists solely for binary compatibility reason...
NETFullscreenMonitors fullscreenMonitors() const
Returns the desired fullscreen monitor topology for this client, should it be in fullscreen state.
void setFullscreenMonitors(NETFullscreenMonitors topology)
Sets the desired multiple-monitor topology (4 monitor indices indicating the top, bottom,...
Common API for application window properties/protocols.
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.
Window transientFor() const
Returns the WM_TRANSIENT_FOR property for the window, i.e.
Bool handledIcons() const
Returns whether or not this client handles icons.
void setOpacity(unsigned long opacity)
Sets opacity (0 = transparent, 0xffffffff = opaque ) on the window.
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.
const char * name() const
Returns the name of the window in UTF-8 format.
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)
WindowType windowType(unsigned long supported_types) const
Returns the window type for this client (see the NET base class documentation for a description of th...
const char * windowRole() const
Returns the window role for the window (i.e.
NETStrut frameExtents() const
Returns the frame decoration strut, i.e.
virtual void changeState(unsigned long state, unsigned long mask)
A Window Manager should subclass NETWinInfo and reimplement this function when it wants to know when ...
void setIconName(const char *name)
Sets the iconic name for the application window.
Window groupLeader() const
Returns the leader window for the group the window is in, if any.
NETIcon icon(int width=-1, int height=-1) const
Returns an icon.
void setExtendedStrut(const NETExtendedStrut &extended_strut)
Set the extended (partial) strut for the application window.
unsigned long allowedActions() const
Returns actions that the window manager allows for the window.
void setUserTime(Time time)
Sets user timestamp time on the window (property _NET_WM_USER_TIME).
void event(XEvent *event, unsigned long *properties, int properties_size)
This function takes the passed XEvent and returns an OR'ed list of NETWinInfo properties that have ch...
NETExtendedStrut extendedStrut() const
Returns the extended (partial) strut specified by this client.
const NETWinInfo & operator=(const NETWinInfo &wintinfo)
Assignment operator.
void setHandledIcons(Bool handled)
Set whether this application window handles icons.
unsigned long state() const
Returns the state of the window (see the NET base class documentation for a description of the variou...
const char * visibleIconName() const
Returns the visible iconic name as set by the window manager in UTF-8 format.
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.
const unsigned long * passedProperties() const
Returns the properties argument passed to the constructor.
const char * startupId() const
Returns the startup notification id of the window.
void setFrameExtents(NETStrut strut)
Set the frame decoration strut, i.e.
Time userTime() const
Returns the time of last user action on the window, or -1 if not set.
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)
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.
void setIcon(NETIcon icon, Bool replace=True)
Set icons for the application window.
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...
int pid() const
Returns the process id for the client window.
NETWinInfo(Display *display, Window window, Window rootWindow, const unsigned long properties[], int properties_size, Role role=Client)
Create a NETWinInfo object, which will be used to set/read/change information stored on an applicatio...
void setState(unsigned long state, unsigned long mask)
Set the state for the application window (see the NET base class documentation for a description of w...
virtual ~NETWinInfo()
Destroys the NETWinInfo object.
void setAllowedActions(unsigned long actions)
Sets actions that the window manager allows for the window.
const char * windowClassName() const
Returns the name component of the window class for the window (i.e.
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.
DesktopLayoutCorner
Starting corner for desktop layout.
@ DesktopLayoutCornerTopLeft
@ 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.
@ TopMenu
indicates a toplevel menu (AKA macmenu).
@ 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)
@ 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.
static bool typeMatchesMask(WindowType type, unsigned long mask)
Returns true if the given window type matches the mask given using WindowTypeMask flags.
Property2
Supported properties.
static int timestampCompare(unsigned long time1, unsigned long time2)
Compares two X timestamps, taking into account wrapping and 64bit architectures.
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.
KGuiItem ok()
Returns the 'Ok' gui item.
int timestampDiff(unsigned long time1_, unsigned long time2_)
Returns a difference of two X timestamps, time2 - time1, where time2 must be later than time1,...
int timestampCompare(unsigned long time1_, unsigned long time2_)
Compares two X timestamps, taking into account wrapping and 64bit architectures.
static Atom net_wm_state_hidden
static Atom net_wm_window_type_splash
static Atom net_wm_allowed_actions
static Atom net_wm_window_type
static Atom net_wm_window_opacity
static Atom net_wm_window_type_dialog
static Window * nwindup(const Window *w1, int n)
static Atom net_supporting_wm_check
static Atom net_wm_window_type_toolbar
static Atom net_supported
static Atom net_wm_action_max_horiz
static Bool netwm_atoms_created
static Atom net_close_window
static Atom net_wm_state_stays_on_top
static Atom net_wm_desktop
static Atom net_wm_icon_name
static Atom net_wm_icon_geometry
static Atom net_current_desktop
static Atom net_wm_state_shaded
static Atom net_wm_state_skip_pager
static Atom net_wm_action_max_vert
static Atom net_desktop_viewport
static Atom net_wm_window_type_notification
static Atom net_wm_action_close
static int wcmp(const void *a, const void *b)
static Atom kde_net_wm_window_type_topmenu
static Atom kde_net_wm_shadow
static Atom net_wm_full_placement
static Atom net_wm_state_max_horiz
static Atom net_wm_state_skip_taskbar
static Atom net_wm_window_type_popup_menu
static char * nstrndup(const char *s1, int l)
static Atom net_wm_action_minimize
static Atom net_wm_window_type_tooltip
static Atom kde_net_wm_frame_overlap
static Atom net_wm_state_demands_attention
static Atom net_wm_action_stick
static Atom net_wm_state_fullscreen
static Atom kde_net_wm_block_compositing
static void refdec_nri(NETRootInfoPrivate *p)
static Atom net_wm_extended_strut
static Atom net_wm_action_fullscreen
static Atom kde_net_wm_window_type_override
static Atom net_wm_state_above
static Atom net_wm_window_type_combobox
static char * nstrdup(const char *s1)
static Atom net_wm_fullscreen_monitors
static Atom kde_net_wm_activities
static Atom net_desktop_geometry
static Atom kde_net_wm_temporary_rules
static Atom net_wm_window_type_desktop
static Atom net_wm_handled_icons
static Atom net_wm_action_resize
static Atom net_client_list
static Atom net_restack_window
static Atom net_startup_id
static Atom net_virtual_roots
static Atom kde_net_wm_frame_strut
static void readIcon(Display *display, Window window, Atom property, NETRArray< NETIcon > &icons, int &icon_count)
static Atom wm_window_role
static Atom net_wm_window_type_dropdown_menu
static Atom net_active_window
static Atom net_desktop_layout
static Atom net_wm_action_shade
static Atom net_number_of_desktops
static void create_netwm_atoms(Display *d)
static const int netAtomCount
static Atom net_wm_window_type_normal
static Atom net_wm_user_time
static Atom net_wm_visible_name
static Atom net_wm_action_change_desk
static Atom net_desktop_names
static Atom net_wm_window_type_menu
static Atom net_moveresize_window
static Atom net_wm_state_sticky
static Atom net_wm_state_below
static Atom net_client_list_stacking
static Atom net_wm_visible_icon_name
static Atom net_wm_window_type_dnd
static Atom net_wm_take_activity
const unsigned long netwm_sendevent_mask
static Atom net_showing_desktop
#define CHECK_TYPE_MASK(type)
static Atom net_frame_extents
static Atom net_wm_window_type_utility
static void refdec_nwi(NETWinInfoPrivate *p)
static Atom net_wm_state_modal
static Atom net_wm_state_max_vert
static Atom net_wm_window_type_dock
static Atom net_wm_action_move
static Atom net_wm_moveresize
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.