Makefile: Beautify compilation messages
[wmaker-crm.git] / src / client.c
blob14ec9d1412e1abad98668a5e2024680f4cf641cf
1 /*
2 * Window Maker window manager
4 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 * USA.
21 #include "wconfig.h"
23 #include <X11/Xlib.h>
24 #include <X11/Xutil.h>
25 #include <X11/Xatom.h>
26 #ifdef SHAPE
27 #include <X11/extensions/shape.h>
28 #endif
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <string.h>
34 #include "WindowMaker.h"
35 #include "wcore.h"
36 #include "framewin.h"
37 #include "window.h"
38 #include "properties.h"
39 #include "actions.h"
40 #include "icon.h"
41 #include "client.h"
42 #include "funcs.h"
43 #include "stacking.h"
44 #include "appicon.h"
45 #include "appmenu.h"
46 #ifdef NETWM_HINTS
47 # include "wmspec.h"
48 #endif
51 /****** Global Variables ******/
53 /* contexts */
54 extern XContext wWinContext;
56 extern Atom _XA_WM_STATE;
57 extern Atom _XA_WM_PROTOCOLS;
58 extern Atom _XA_WM_COLORMAP_WINDOWS;
60 extern Atom _XA_WINDOWMAKER_MENU;
62 extern Atom _XA_GNUSTEP_WM_ATTR;
63 extern Atom _XA_GNUSTEP_WM_RESIZEBAR;
65 #ifdef SHAPE
66 extern Bool wShapeSupported;
67 #endif
71 *--------------------------------------------------------------------
72 * wClientRestore--
73 * Reparent the window back to the root window.
75 *--------------------------------------------------------------------
77 void
78 wClientRestore(WWindow *wwin)
80 #if 0
81 int gx, gy;
83 wClientGetGravityOffsets(wwin, &gx, &gy);
84 /* set the positio of the frame on screen */
85 wwin->frame_x -= gx * FRAME_BORDER_WIDTH;
86 wwin->frame_y -= gy * FRAME_BORDER_WIDTH;
87 /* if gravity is to the south, account for the border sizes */
88 if (gy > 0)
89 wwin->frame_y += (wwin->frame->top_width + wwin->frame->bottom_width);
90 #endif
91 XSetWindowBorderWidth(dpy, wwin->client_win, wwin->old_border_width);
92 XReparentWindow(dpy, wwin->client_win, wwin->screen_ptr->root_win,
93 wwin->frame_x, wwin->frame_y);
95 /* don't let the window get iconified after restart */
97 if (wwin->flags.shaded)
98 wClientSetState(wwin, NormalState, None);
104 *----------------------------------------------------------------------
105 * wClientSetState--
106 * Set the state of the client window to one of the window
107 * states defined in ICCCM (Iconic, Withdrawn, Normal)
109 * Side effects:
110 * The WM_STATE property of the window is updated as well as the
111 * WWindow.state variable.
112 *----------------------------------------------------------------------
114 void
115 wClientSetState(WWindow *wwin, int state, Window icon_win)
117 CARD32 data[2];
119 wwin->state = state;
121 data[0] = (unsigned long) state;
122 data[1] = (unsigned long) icon_win;
124 XChangeProperty(dpy, wwin->client_win, _XA_WM_STATE, _XA_WM_STATE, 32,
125 PropModeReplace, (unsigned char *) data, 2);
129 void
130 wClientGetGravityOffsets(WWindow *wwin, int *ofs_x, int *ofs_y)
132 switch (wwin->normal_hints->win_gravity) {
133 case ForgetGravity:
134 case CenterGravity:
135 case StaticGravity:
136 *ofs_x = 0;
137 *ofs_y = 0;
138 break;
139 case NorthWestGravity:
140 *ofs_x = -1;
141 *ofs_y = -1;
142 break;
143 case NorthGravity:
144 *ofs_x = 0;
145 *ofs_y = -1;
146 break;
147 case NorthEastGravity:
148 *ofs_x = 1;
149 *ofs_y = -1;
150 break;
151 case WestGravity:
152 *ofs_x = -1;
153 *ofs_y = 0;
154 break;
155 case EastGravity:
156 *ofs_x = 1;
157 *ofs_y = 0;
158 break;
159 case SouthWestGravity:
160 *ofs_x = -1;
161 *ofs_y = 1;
162 break;
163 case SouthGravity:
164 *ofs_x = 0;
165 *ofs_y = 1;
166 break;
167 case SouthEastGravity:
168 *ofs_x = 1;
169 *ofs_y = 1;
170 break;
176 void
177 wClientConfigure(WWindow *wwin, XConfigureRequestEvent *xcre)
179 XWindowChanges xwc;
180 int nx, ny, nwidth, nheight;
181 int ofs_x, ofs_y;
183 /* printf("configure event: %d %d %d %d\n", xcre->x, xcre->y, xcre->width, xcre->height);*/
185 if (wwin==NULL) {
187 * configure a window that was not mapped by us
189 xwc.x = xcre->x;
190 xwc.y = xcre->y;
191 xwc.width = xcre->width;
192 xwc.height = xcre->height;
193 xwc.border_width = xcre->border_width;
194 xwc.stack_mode = xcre->detail;
195 xwc.sibling = xcre->above;
196 XConfigureWindow(dpy, xcre->window, xcre->value_mask, &xwc);
197 return;
199 #ifdef SHAPE
200 if (wShapeSupported) {
201 int junk;
202 unsigned int ujunk;
203 int b_shaped;
205 XShapeSelectInput(dpy, wwin->client_win, ShapeNotifyMask);
206 XShapeQueryExtents(dpy, wwin->client_win, &b_shaped, &junk, &junk,
207 &ujunk, &ujunk, &junk, &junk, &junk, &ujunk,
208 &ujunk);
209 wwin->flags.shaped = b_shaped;
211 #endif
212 if (xcre->value_mask & CWStackMode) {
213 WObjDescriptor *desc;
214 WWindow *sibling;
216 if ((xcre->value_mask & CWSibling) &&
217 (XFindContext(dpy, xcre->above, wWinContext,
218 (XPointer *)&desc) == XCSUCCESS)
219 && (desc->parent_type==WCLASS_WINDOW)) {
220 sibling=desc->parent;
221 xwc.sibling = sibling->frame->core->window;
222 } else {
223 xwc.sibling = xcre->above;
225 xwc.stack_mode = xcre->detail;
226 XConfigureWindow(dpy, wwin->frame->core->window,
227 xcre->value_mask & (CWSibling | CWStackMode), &xwc);
228 /* fix stacking order */
229 RemakeStackList(wwin->screen_ptr);
232 wClientGetGravityOffsets(wwin, &ofs_x, &ofs_y);
234 if (xcre->value_mask & CWBorderWidth) {
235 wwin->old_border_width = xcre->border_width;
238 if (!wwin->flags.shaded) {
239 /* If the window is shaded, wrong height will be set for the window */
240 if (xcre->value_mask & CWX) {
241 nx = xcre->x;
242 /* Subtracting the border makes the window shift by 1 pixel -Dan */
243 /*if (HAS_BORDER(wwin)) {
244 nx -= FRAME_BORDER_WIDTH;
246 } else {
247 nx = wwin->frame_x;
250 if (xcre->value_mask & CWY) {
251 ny = xcre->y - ((ofs_y < 0) ? 0 : wwin->frame->top_width);
252 /* Subtracting the border makes the window shift by 1 pixel -Dan */
253 /*if (HAS_BORDER(wwin)) {
254 ny -= FRAME_BORDER_WIDTH;
256 } else {
257 ny = wwin->frame_y;
260 if (xcre->value_mask & CWWidth)
261 nwidth = xcre->width;
262 else
263 nwidth = wwin->frame->core->width;
265 if (xcre->value_mask & CWHeight)
266 nheight = xcre->height;
267 else
268 nheight = wwin->frame->core->height - wwin->frame->top_width - wwin->frame->bottom_width;
270 wWindowConfigure(wwin, nx, ny, nwidth, nheight);
271 wwin->old_geometry.x = nx;
272 wwin->old_geometry.y = ny;
273 wwin->old_geometry.width = nwidth;
274 wwin->old_geometry.height = nheight;
279 void
280 wClientSendProtocol(WWindow *wwin, Atom protocol, Time time)
282 XEvent event;
284 event.xclient.type = ClientMessage;
285 event.xclient.message_type = _XA_WM_PROTOCOLS;
286 event.xclient.format = 32;
287 event.xclient.display = dpy;
288 event.xclient.window = wwin->client_win;
289 event.xclient.data.l[0] = protocol;
290 event.xclient.data.l[1] = time;
291 event.xclient.data.l[2] = 0;
292 event.xclient.data.l[3] = 0;
293 XSendEvent(dpy, wwin->client_win, False, NoEventMask, &event);
294 XSync(dpy, False);
299 void
300 wClientKill(WWindow *wwin)
302 XKillClient(dpy, wwin->client_win);
304 XFlush(dpy);
310 *----------------------------------------------------------------------
311 * wClientCheckProperty--
312 * Handles PropertyNotify'es, verifying which property was
313 * changed and updating internal state according to that, like redrawing
314 * the icon title when it is changed.
316 * Side effects:
317 * Depends on the changed property.
319 * TODO: _GNUSTEP_WM_ATTR
320 *----------------------------------------------------------------------
322 void
323 wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
325 XWindowAttributes attribs;
326 XWMHints *new_hints;
327 int i, g1, g2;
328 char *tmp = NULL;
330 switch (event->atom) {
331 case XA_WM_NAME:
332 if (!wwin->flags.net_has_title)
334 /* window title was changed */
335 if (!wFetchName(dpy, wwin->client_win, &tmp)) {
336 wWindowUpdateName(wwin, NULL);
337 } else {
338 wWindowUpdateName(wwin, tmp);
340 if (tmp)
341 XFree(tmp);
343 break;
345 case XA_WM_ICON_NAME:
346 if (!wwin->flags.net_has_icon_title)
348 if (!wwin->icon)
349 break;
350 else {
351 char *new_title;
353 /* icon title was changed */
354 wGetIconName(dpy, wwin->client_win, &new_title);
355 wIconChangeTitle(wwin->icon, new_title);
358 break;
360 case XA_WM_COMMAND:
361 if (wwin->main_window!=None) {
362 WApplication *wapp = wApplicationOf(wwin->main_window);
363 char *command;
365 if (!wapp || !wapp->app_icon || wapp->app_icon->docked)
366 break;
368 command = GetCommandForWindow(wwin->main_window);
369 if (command) {
370 if (wapp->app_icon->command)
371 wfree(wapp->app_icon->command);
372 wapp->app_icon->command = command;
375 break;
377 case XA_WM_HINTS:
378 /* WM_HINTS */
380 new_hints = XGetWMHints(dpy, wwin->client_win);
382 /* group leader update
384 * This means that the window is setting the leader after
385 * it was mapped, changing leaders or removing the leader.
387 * Valid state transitions are:
389 * _1 __2
390 * / \ / \
391 * v | v |
392 * (GC) (GC')
393 * / ^ / ^
394 * 3| |4 5| |6
395 * | | | |
396 * v / v /
397 * (G'C) (G'C')
399 * Where G is the window_group hint, C is CLIENT_LEADER property
400 * and ' indicates the hint is unset.
402 * 1,2 - change group leader to new value of window_group
403 * 3 - change leader to value of CLIENT_LEADER
404 * 4 - change leader to value of window_group
405 * 5 - destroy application
406 * 6 - create application
408 if (new_hints && (new_hints->flags & WindowGroupHint)
409 && new_hints->window_group!=None) {
410 g2 = 1;
411 } else {
412 g2 = 0;
414 if (wwin->wm_hints && (wwin->wm_hints->flags & WindowGroupHint)
415 && wwin->wm_hints->window_group!=None) {
416 g1 = 1;
417 } else {
418 g1 = 0;
421 if (wwin->client_leader) {
422 if (g1 && g2
423 && wwin->wm_hints->window_group!=new_hints->window_group) {
424 i = 1;
425 } else if (g1 && !g2) {
426 i = 3;
427 } else if (!g1 && g2) {
428 i = 4;
429 } else {
430 i = 0;
432 } else {
433 if (g1 && g2
434 && wwin->wm_hints->window_group!=new_hints->window_group) {
435 i = 2;
436 } else if (g1 && !g2) {
437 i = 5;
438 } else if (!g1 && g2) {
439 i = 6;
440 } else {
441 i = 0;
445 /* Handling this may require more work. -Dan */
446 if (wwin->fake_group!=NULL) {
447 i = 7;
450 if (wwin->wm_hints)
451 XFree(wwin->wm_hints);
453 wwin->wm_hints = new_hints;
455 /* do action according to state transition */
456 switch (i) {
457 /* 3 - change leader to value of CLIENT_LEADER */
458 case 3:
459 wApplicationDestroy(wApplicationOf(wwin->main_window));
460 wwin->main_window = wwin->client_leader;
461 wwin->group_id = None;
462 wApplicationCreate(wwin);
463 break;
465 /* 1,2,4 - change leader to new value of window_group */
466 case 1:
467 case 2:
468 case 4:
469 wApplicationDestroy(wApplicationOf(wwin->main_window));
470 wwin->main_window = new_hints->window_group;
471 wwin->group_id = wwin->main_window;
472 wApplicationCreate(wwin);
473 break;
475 /* 5 - destroy application */
476 case 5:
477 wApplicationDestroy(wApplicationOf(wwin->main_window));
478 wwin->main_window = None;
479 wwin->group_id = None;
480 break;
482 /* 6 - create application */
483 case 6:
484 wwin->main_window = new_hints->window_group;
485 wwin->group_id = wwin->main_window;
486 wApplicationCreate(wwin);
487 break;
488 /* 7 - we have a fake window group id, so just ignore anything else */
489 case 7:
490 break;
492 #ifdef DEBUG
493 if (i) {
494 printf("window leader update caused state transition %i\n",i);
496 #endif
498 if (wwin->wm_hints) {
499 /* update icon */
500 if ((wwin->wm_hints->flags & IconPixmapHint)
501 || (wwin->wm_hints->flags & IconWindowHint)) {
502 WApplication *wapp;
504 if (wwin->flags.miniaturized && wwin->icon) {
505 wIconUpdate(wwin->icon);
507 wapp = wApplicationOf(wwin->main_window);
508 if (wapp && wapp->app_icon) {
509 wIconUpdate(wapp->app_icon->icon);
513 if (wwin->wm_hints->flags & UrgencyHint)
514 wwin->flags.urgent = 1;
515 else
516 wwin->flags.urgent = 0;
517 /*} else if (wwin->fake_group!=NULL) {
518 wwin->group_id = wwin->fake_group->leader;*/
519 } else {
520 wwin->group_id = None;
522 break;
524 case XA_WM_NORMAL_HINTS:
525 /* normal (geometry) hints */
527 int foo;
528 unsigned bar;
530 XGetWindowAttributes(dpy, wwin->client_win, &attribs);
531 wClientGetNormalHints(wwin, &attribs, False, &foo, &foo,
532 &bar, &bar);
533 /* TODO: should we check for consistency of the current
534 * size against the new geometry hints? */
536 break;
538 case XA_WM_TRANSIENT_FOR:
540 Window new_owner;
541 WWindow *owner;
543 if (!XGetTransientForHint(dpy, wwin->client_win, &new_owner)) {
544 new_owner = None;
545 } else {
546 if (new_owner==0 || new_owner == wwin->client_win) {
547 new_owner = wwin->screen_ptr->root_win;
550 if (new_owner!=wwin->transient_for) {
551 owner = wWindowFor(wwin->transient_for);
552 if (owner) {
553 if (owner->flags.semi_focused) {
554 owner->flags.semi_focused = 0;
555 if ((owner->flags.mapped || owner->flags.shaded)
556 && owner->frame)
557 wFrameWindowPaint(owner->frame);
560 owner = wWindowFor(new_owner);
561 if (owner) {
562 if (!owner->flags.semi_focused) {
563 owner->flags.semi_focused = 1;
564 if ((owner->flags.mapped || owner->flags.shaded)
565 && owner->frame)
566 wFrameWindowPaint(owner->frame);
569 wwin->transient_for = new_owner;
570 if (new_owner==None) {
571 if (WFLAGP(wwin, no_miniaturizable)) {
572 WSETUFLAG(wwin, no_miniaturizable, 0);
573 WSETUFLAG(wwin, no_miniaturize_button, 0);
574 if (wwin->frame)
575 wWindowConfigureBorders(wwin);
577 } else if (!WFLAGP(wwin, no_miniaturizable)) {
578 WSETUFLAG(wwin, no_miniaturizable, 1);
579 WSETUFLAG(wwin, no_miniaturize_button, 1);
580 if (wwin->frame)
581 wWindowConfigureBorders(wwin);
585 break;
587 default:
588 if (event->atom==_XA_WM_PROTOCOLS) {
590 PropGetProtocols(wwin->client_win, &wwin->protocols);
592 WSETUFLAG(wwin, kill_close, !wwin->protocols.DELETE_WINDOW);
594 if (wwin->frame)
595 wWindowUpdateButtonImages(wwin);
597 } else if (event->atom==_XA_WM_COLORMAP_WINDOWS) {
599 GetColormapWindows(wwin);
600 wColormapInstallForWindow(wwin->screen_ptr, wwin);
602 } else if (event->atom==_XA_WINDOWMAKER_MENU) {
603 WApplication *wapp;
605 wapp = wApplicationOf(wwin->main_window);
606 if (wapp) {
607 if (wapp->menu) {
608 /* update menu */
609 /* TODO: remake appmenu update */
610 wAppMenuDestroy(wapp->menu);
612 if (wwin->fake_group) {
613 extern WPreferences wPreferences;
614 WScreen *scr = wwin->screen_ptr;
615 WWindow *foo = scr->focused_window;
616 WFakeGroupLeader *fPtr = wwin->fake_group;
618 wApplicationDestroy(wapp);
619 while (foo) {
620 if (foo->fake_group && foo->fake_group==fPtr) {
621 WSETUFLAG(foo, shared_appicon, 0);
622 foo->fake_group = NULL;
623 if (foo->group_id!=None)
624 foo->main_window = foo->group_id;
625 else if (foo->client_leader!=None)
626 foo->main_window = foo->client_leader;
627 else if (WFLAGP(foo, emulate_appicon))
628 foo->main_window = foo->client_win;
629 else
630 foo->main_window = None;
631 if (foo->main_window) {
632 wapp = wApplicationCreate(foo);
635 foo = foo->prev;
638 if (fPtr->leader!=None)
639 XDestroyWindow(dpy, fPtr->leader);
640 fPtr->retainCount = 0;
641 fPtr->leader = None;
642 fPtr->origLeader = None;
644 wapp = wApplicationOf(wwin->main_window);
645 if (wapp) {
646 wapp->menu = wAppMenuGet(scr, wwin->main_window);
648 if (wPreferences.auto_arrange_icons) {
649 wArrangeIcons(wwin->screen_ptr, True);
651 } else {
652 wapp->menu = wAppMenuGet(wwin->screen_ptr, wwin->main_window);
654 /* make the appmenu be mapped */
655 wSetFocusTo(wwin->screen_ptr, NULL);
656 wSetFocusTo(wwin->screen_ptr, wwin->screen_ptr->focused_window);
658 } else if (event->atom==_XA_GNUSTEP_WM_ATTR) {
659 GNUstepWMAttributes *attr;
661 PropGetGNUstepWMAttr(wwin->client_win, &attr);
663 wWindowUpdateGNUstepAttr(wwin, attr);
665 XFree(attr);
666 } else {
667 #ifdef NETWM_HINTS
668 wNETWMCheckClientHintChange(wwin, event);
669 #endif
676 *----------------------------------------------------------------------
677 * wClientGetNormalHints--
678 * Get size (normal) hints and a default geometry for the client
679 * window. The hints are also checked for inconsistency. If geometry is
680 * True, the returned data will account for client specified initial
681 * geometry.
683 * Side effects:
684 * normal_hints is filled with valid data.
685 *----------------------------------------------------------------------
687 void
688 wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry,
689 int *x, int *y, unsigned *width, unsigned *height)
691 int pre_icccm = 0; /* not used */
693 /* find a position for the window */
694 if (!wwin->normal_hints)
695 wwin->normal_hints = XAllocSizeHints();
697 if (!PropGetNormalHints(wwin->client_win, wwin->normal_hints, &pre_icccm)) {
698 wwin->normal_hints->flags = 0;
700 *x = wattribs->x;
701 *y = wattribs->y;
703 *width = wattribs->width;
704 *height = wattribs->height;
706 if (!(wwin->normal_hints->flags & PWinGravity)) {
707 wwin->normal_hints->win_gravity = NorthWestGravity;
709 if (!(wwin->normal_hints->flags & PMinSize)) {
710 wwin->normal_hints->min_width = MIN_WINDOW_SIZE;
711 wwin->normal_hints->min_height = MIN_WINDOW_SIZE;
713 if (!(wwin->normal_hints->flags & PBaseSize)) {
714 wwin->normal_hints->base_width = 0;
715 wwin->normal_hints->base_height = 0;
717 if (!(wwin->normal_hints->flags & PMaxSize)) {
718 wwin->normal_hints->max_width = wwin->screen_ptr->scr_width*2;
719 wwin->normal_hints->max_height = wwin->screen_ptr->scr_height*2;
722 /* some buggy apps set weird hints.. */
723 if (wwin->normal_hints->min_width <= 0)
724 wwin->normal_hints->min_width = MIN_WINDOW_SIZE;
726 if (wwin->normal_hints->min_height <= 0)
727 wwin->normal_hints->min_height = MIN_WINDOW_SIZE;
730 if (wwin->normal_hints->max_width < wwin->normal_hints->min_width)
731 wwin->normal_hints->max_width = wwin->normal_hints->min_width;
733 if (wwin->normal_hints->max_height < wwin->normal_hints->min_height)
734 wwin->normal_hints->max_height = wwin->normal_hints->min_height;
736 if (!(wwin->normal_hints->flags & PResizeInc)) {
737 wwin->normal_hints->width_inc = 1;
738 wwin->normal_hints->height_inc = 1;
739 } else {
740 if (wwin->normal_hints->width_inc <= 0)
741 wwin->normal_hints->width_inc = 1;
742 if (wwin->normal_hints->height_inc <= 0)
743 wwin->normal_hints->height_inc = 1;
746 if (wwin->normal_hints->flags & PAspect) {
747 if (wwin->normal_hints->min_aspect.x < 1)
748 wwin->normal_hints->min_aspect.x = 1;
749 if (wwin->normal_hints->min_aspect.y < 1)
750 wwin->normal_hints->min_aspect.y = 1;
752 if (wwin->normal_hints->max_aspect.x < 1)
753 wwin->normal_hints->max_aspect.x = 1;
754 if (wwin->normal_hints->max_aspect.y < 1)
755 wwin->normal_hints->max_aspect.y = 1;
758 if (wwin->normal_hints->min_height > wwin->normal_hints->max_height) {
759 wwin->normal_hints->min_height = wwin->normal_hints->max_height;
761 if (wwin->normal_hints->min_width > wwin->normal_hints->max_width) {
762 wwin->normal_hints->min_width = wwin->normal_hints->max_width;
765 #ifdef IGNORE_PPOSITION
766 wwin->normal_hints->flags &= ~PPosition;
767 #endif
769 if (pre_icccm && !wwin->screen_ptr->flags.startup && geometry) {
770 if (wwin->normal_hints->flags & (USPosition|PPosition)) {
771 *x = wwin->normal_hints->x;
772 *y = wwin->normal_hints->y;
774 if (wwin->normal_hints->flags & (USSize|PSize)) {
775 *width = wwin->normal_hints->width;
776 *height = wwin->normal_hints->height;
782 void
783 GetColormapWindows(WWindow *wwin)
785 #ifndef NO_CRASHES
786 if (wwin->cmap_windows) {
787 XFree(wwin->cmap_windows);
790 wwin->cmap_windows = NULL;
791 wwin->cmap_window_no = 0;
793 if (!XGetWMColormapWindows(dpy, wwin->client_win, &(wwin->cmap_windows),
794 &(wwin->cmap_window_no))
795 || !wwin->cmap_windows) {
796 wwin->cmap_window_no = 0;
797 wwin->cmap_windows = NULL;
800 #endif