wmaker: Replaced local 'extern' definition of wPreferences by proper header usage
[wmaker-crm.git] / src / client.c
blob0c4126f2fadaf797fd4678b8f2855670969ffdf1
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 along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "wconfig.h"
22 #include <X11/Xlib.h>
23 #include <X11/Xutil.h>
24 #include <X11/Xatom.h>
25 #ifdef SHAPE
26 #include <X11/extensions/shape.h>
27 #endif
29 #include <stdlib.h>
30 #include <stdio.h>
31 #include <string.h>
33 #include "WindowMaker.h"
34 #include "framewin.h"
35 #include "window.h"
36 #include "properties.h"
37 #include "actions.h"
38 #include "icon.h"
39 #include "client.h"
40 #include "colormap.h"
41 #include "stacking.h"
42 #include "appicon.h"
43 #include "appmenu.h"
44 #include "wmspec.h"
45 #include "misc.h"
47 /****** Global Variables ******/
49 /* contexts */
50 extern XContext wWinContext;
52 extern Atom _XA_WM_STATE;
53 extern Atom _XA_WM_PROTOCOLS;
54 extern Atom _XA_WM_COLORMAP_WINDOWS;
56 extern Atom _XA_WINDOWMAKER_MENU;
58 extern Atom _XA_GNUSTEP_WM_ATTR;
59 extern Atom _XA_GNUSTEP_WM_RESIZEBAR;
61 #ifdef SHAPE
62 extern Bool wShapeSupported;
63 #endif
66 *--------------------------------------------------------------------
67 * wClientRestore--
68 * Reparent the window back to the root window.
70 *--------------------------------------------------------------------
72 void wClientRestore(WWindow * wwin)
74 #if 0
75 int gx, gy;
77 wClientGetGravityOffsets(wwin, &gx, &gy);
78 /* set the position of the frame on screen */
79 wwin->frame_x -= gx * wwin->screen_ptr->frame_border_width;
80 wwin->frame_y -= gy * wwin->screen_ptr->frame_border_width;
81 /* if gravity is to the south, account for the border sizes */
82 if (gy > 0)
83 wwin->frame_y += (wwin->frame->top_width + wwin->frame->bottom_width);
84 #endif
85 XSetWindowBorderWidth(dpy, wwin->client_win, wwin->old_border_width);
86 XReparentWindow(dpy, wwin->client_win, wwin->screen_ptr->root_win, wwin->frame_x, wwin->frame_y);
88 /* don't let the window get iconified after restart */
90 if (wwin->flags.shaded)
91 wClientSetState(wwin, NormalState, None);
96 *----------------------------------------------------------------------
97 * wClientSetState--
98 * Set the state of the client window to one of the window
99 * states defined in ICCCM (Iconic, Withdrawn, Normal)
101 * Side effects:
102 * The WM_STATE property of the window is updated as well as the
103 * WWindow.state variable.
104 *----------------------------------------------------------------------
106 void wClientSetState(WWindow * wwin, int state, Window icon_win)
108 long data[2];
110 wwin->state = state;
112 data[0] = (unsigned long)state;
113 data[1] = (unsigned long)icon_win;
115 XChangeProperty(dpy, wwin->client_win, _XA_WM_STATE, _XA_WM_STATE, 32,
116 PropModeReplace, (unsigned char *)data, 2);
119 void wClientGetGravityOffsets(WWindow * wwin, int *ofs_x, int *ofs_y)
121 switch (wwin->normal_hints->win_gravity) {
122 case ForgetGravity:
123 case CenterGravity:
124 case StaticGravity:
125 *ofs_x = 0;
126 *ofs_y = 0;
127 break;
128 case NorthWestGravity:
129 *ofs_x = -1;
130 *ofs_y = -1;
131 break;
132 case NorthGravity:
133 *ofs_x = 0;
134 *ofs_y = -1;
135 break;
136 case NorthEastGravity:
137 *ofs_x = 1;
138 *ofs_y = -1;
139 break;
140 case WestGravity:
141 *ofs_x = -1;
142 *ofs_y = 0;
143 break;
144 case EastGravity:
145 *ofs_x = 1;
146 *ofs_y = 0;
147 break;
148 case SouthWestGravity:
149 *ofs_x = -1;
150 *ofs_y = 1;
151 break;
152 case SouthGravity:
153 *ofs_x = 0;
154 *ofs_y = 1;
155 break;
156 case SouthEastGravity:
157 *ofs_x = 1;
158 *ofs_y = 1;
159 break;
163 void wClientConfigure(WWindow * wwin, XConfigureRequestEvent * xcre)
165 XWindowChanges xwc;
166 int nx, ny, nwidth, nheight;
167 int ofs_x, ofs_y;
169 /* printf("configure event: %d %d %d %d\n", xcre->x, xcre->y, xcre->width, xcre->height); */
171 if (wwin == NULL) {
173 * configure a window that was not mapped by us
175 xwc.x = xcre->x;
176 xwc.y = xcre->y;
177 xwc.width = xcre->width;
178 xwc.height = xcre->height;
179 xwc.border_width = xcre->border_width;
180 xwc.stack_mode = xcre->detail;
181 xwc.sibling = xcre->above;
182 XConfigureWindow(dpy, xcre->window, xcre->value_mask, &xwc);
183 return;
185 #ifdef SHAPE
186 if (wShapeSupported) {
187 int junk;
188 unsigned int ujunk;
189 int b_shaped;
191 XShapeSelectInput(dpy, wwin->client_win, ShapeNotifyMask);
192 XShapeQueryExtents(dpy, wwin->client_win, &b_shaped, &junk, &junk,
193 &ujunk, &ujunk, &junk, &junk, &junk, &ujunk, &ujunk);
194 wwin->flags.shaped = b_shaped;
196 #endif
197 if (xcre->value_mask & CWStackMode) {
198 WObjDescriptor *desc;
199 WWindow *sibling;
201 if ((xcre->value_mask & CWSibling) &&
202 (XFindContext(dpy, xcre->above, wWinContext, (XPointer *) & desc) == XCSUCCESS)
203 && (desc->parent_type == WCLASS_WINDOW)) {
204 sibling = desc->parent;
205 xwc.sibling = sibling->frame->core->window;
206 } else {
207 xwc.sibling = xcre->above;
209 xwc.stack_mode = xcre->detail;
210 XConfigureWindow(dpy, wwin->frame->core->window,
211 xcre->value_mask & (CWSibling | CWStackMode), &xwc);
212 /* fix stacking order */
213 RemakeStackList(wwin->screen_ptr);
216 wClientGetGravityOffsets(wwin, &ofs_x, &ofs_y);
218 if (xcre->value_mask & CWBorderWidth) {
219 wwin->old_border_width = xcre->border_width;
222 if (!wwin->flags.shaded) {
223 /* If the window is shaded, wrong height will be set for the window */
224 if (xcre->value_mask & CWX) {
225 nx = xcre->x;
226 /* Subtracting the border makes the window shift by 1 pixel -Dan */
227 /*if (HAS_BORDER(wwin)) {
228 nx -= wwin->screen_ptr->frame_border_width;
229 } */
230 } else {
231 nx = wwin->frame_x;
234 if (xcre->value_mask & CWY) {
235 ny = xcre->y - ((ofs_y < 0) ? 0 : wwin->frame->top_width);
236 /* Subtracting the border makes the window shift by 1 pixel -Dan */
237 /*if (HAS_BORDER(wwin)) {
238 ny -= wwin->screen_ptr->frame_border_width;
239 } */
240 } else {
241 ny = wwin->frame_y;
244 if (xcre->value_mask & CWWidth)
245 nwidth = xcre->width;
246 else
247 nwidth = wwin->frame->core->width;
249 if (xcre->value_mask & CWHeight)
250 nheight = xcre->height;
251 else
252 nheight = wwin->frame->core->height - wwin->frame->top_width - wwin->frame->bottom_width;
254 if (nwidth != wwin->old_geometry.width)
255 wwin->flags.maximized &= ~(MAX_HORIZONTAL | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS);
256 if (nheight != wwin->old_geometry.height)
257 wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS);
259 wWindowConfigure(wwin, nx, ny, nwidth, nheight);
260 wwin->old_geometry.x = nx;
261 wwin->old_geometry.y = ny;
262 wwin->old_geometry.width = nwidth;
263 wwin->old_geometry.height = nheight;
267 void wClientSendProtocol(WWindow * wwin, Atom protocol, Time time)
269 XEvent event;
271 event.xclient.type = ClientMessage;
272 event.xclient.message_type = _XA_WM_PROTOCOLS;
273 event.xclient.format = 32;
274 event.xclient.display = dpy;
275 event.xclient.window = wwin->client_win;
276 event.xclient.data.l[0] = protocol;
277 event.xclient.data.l[1] = time;
278 event.xclient.data.l[2] = 0;
279 event.xclient.data.l[3] = 0;
280 XSendEvent(dpy, wwin->client_win, False, NoEventMask, &event);
281 XSync(dpy, False);
284 void wClientKill(WWindow * wwin)
286 XKillClient(dpy, wwin->client_win);
288 XFlush(dpy);
292 *----------------------------------------------------------------------
293 * wClientCheckProperty--
294 * Handles PropertyNotify'es, verifying which property was
295 * changed and updating internal state according to that, like redrawing
296 * the icon title when it is changed.
298 * Side effects:
299 * Depends on the changed property.
301 * TODO: _GNUSTEP_WM_ATTR
302 *----------------------------------------------------------------------
304 void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event)
306 XWindowAttributes attribs;
307 XWMHints *new_hints;
308 int i, g1, g2;
309 char *tmp = NULL;
311 switch (event->atom) {
312 case XA_WM_NAME:
313 if (!wwin->flags.net_has_title) {
314 /* window title was changed */
315 if (!wFetchName(dpy, wwin->client_win, &tmp)) {
316 wWindowUpdateName(wwin, NULL);
317 } else {
318 wWindowUpdateName(wwin, tmp);
320 if (tmp)
321 XFree(tmp);
323 break;
325 case XA_WM_ICON_NAME:
326 /* Title has changed, update the icon title */
327 if (wwin->icon) {
328 wIconChangeTitle(wwin->icon, wwin);
329 wIconPaint(wwin->icon);
331 break;
333 case XA_WM_COMMAND:
334 if (wwin->main_window != None) {
335 WApplication *wapp = wApplicationOf(wwin->main_window);
336 char *command;
338 if (!wapp || !wapp->app_icon || wapp->app_icon->docked)
339 break;
341 command = GetCommandForWindow(wwin->main_window);
342 if (command) {
343 if (wapp->app_icon->command)
344 wfree(wapp->app_icon->command);
345 wapp->app_icon->command = command;
348 break;
350 case XA_WM_HINTS:
351 /* WM_HINTS */
353 new_hints = XGetWMHints(dpy, wwin->client_win);
355 /* group leader update
357 * This means that the window is setting the leader after
358 * it was mapped, changing leaders or removing the leader.
360 * Valid state transitions are:
362 * _1 __2
363 * / \ / \
364 * v | v |
365 * (GC) (GC')
366 * / ^ / ^
367 * 3| |4 5| |6
368 * | | | |
369 * v / v /
370 * (G'C) (G'C')
372 * Where G is the window_group hint, C is CLIENT_LEADER property
373 * and ' indicates the hint is unset.
375 * 1,2 - change group leader to new value of window_group
376 * 3 - change leader to value of CLIENT_LEADER
377 * 4 - change leader to value of window_group
378 * 5 - destroy application
379 * 6 - create application
381 if (new_hints && (new_hints->flags & WindowGroupHint)
382 && new_hints->window_group != None) {
383 g2 = 1;
384 } else {
385 g2 = 0;
387 if (wwin->wm_hints && (wwin->wm_hints->flags & WindowGroupHint)
388 && wwin->wm_hints->window_group != None) {
389 g1 = 1;
390 } else {
391 g1 = 0;
394 if (wwin->client_leader) {
395 if (g1 && g2 && wwin->wm_hints->window_group != new_hints->window_group) {
396 i = 1;
397 } else if (g1 && !g2) {
398 i = 3;
399 } else if (!g1 && g2) {
400 i = 4;
401 } else {
402 i = 0;
404 } else {
405 if (g1 && g2 && wwin->wm_hints->window_group != new_hints->window_group) {
406 i = 2;
407 } else if (g1 && !g2) {
408 i = 5;
409 } else if (!g1 && g2) {
410 i = 6;
411 } else {
412 i = 0;
416 /* Handling this may require more work. -Dan */
417 if (wwin->fake_group != NULL) {
418 i = 7;
421 if (wwin->wm_hints)
422 XFree(wwin->wm_hints);
424 wwin->wm_hints = new_hints;
426 /* do action according to state transition */
427 switch (i) {
428 /* 3 - change leader to value of CLIENT_LEADER */
429 case 3:
430 wApplicationDestroy(wApplicationOf(wwin->main_window));
431 wwin->main_window = wwin->client_leader;
432 wwin->group_id = None;
433 wApplicationCreate(wwin);
434 break;
436 /* 1,2,4 - change leader to new value of window_group */
437 case 1:
438 case 2:
439 case 4:
440 wApplicationDestroy(wApplicationOf(wwin->main_window));
441 wwin->main_window = new_hints->window_group;
442 wwin->group_id = wwin->main_window;
443 wApplicationCreate(wwin);
444 break;
446 /* 5 - destroy application */
447 case 5:
448 wApplicationDestroy(wApplicationOf(wwin->main_window));
449 wwin->main_window = None;
450 wwin->group_id = None;
451 break;
453 /* 6 - create application */
454 case 6:
455 wwin->main_window = new_hints->window_group;
456 wwin->group_id = wwin->main_window;
457 wApplicationCreate(wwin);
458 break;
459 /* 7 - we have a fake window group id, so just ignore anything else */
460 case 7:
461 break;
464 if (wwin->wm_hints) {
465 /* update icon */
466 if ((wwin->wm_hints->flags & IconPixmapHint)
467 || (wwin->wm_hints->flags & IconWindowHint)) {
468 WApplication *wapp;
470 if (wwin->flags.miniaturized && wwin->icon)
471 wIconUpdate(wwin->icon);
473 wapp = wApplicationOf(wwin->main_window);
474 if (wapp && wapp->app_icon) {
475 wIconUpdate(wapp->app_icon->icon);
476 wAppIconPaint(wapp->app_icon);
480 if (wwin->wm_hints->flags & UrgencyHint)
481 wwin->flags.urgent = 1;
482 else
483 wwin->flags.urgent = 0;
484 wAppBounceWhileUrgent(wApplicationOf(wwin->main_window));
485 /*} else if (wwin->fake_group!=NULL) {
486 wwin->group_id = wwin->fake_group->leader; */
487 } else {
488 wwin->group_id = None;
490 break;
492 case XA_WM_NORMAL_HINTS:
493 /* normal (geometry) hints */
495 int foo;
496 unsigned bar;
498 XGetWindowAttributes(dpy, wwin->client_win, &attribs);
499 wClientGetNormalHints(wwin, &attribs, False, &foo, &foo, &bar, &bar);
500 /* TODO: should we check for consistency of the current
501 * size against the new geometry hints? */
503 break;
505 case XA_WM_TRANSIENT_FOR:
507 Window new_owner;
508 WWindow *owner;
510 if (!XGetTransientForHint(dpy, wwin->client_win, &new_owner)) {
511 new_owner = None;
512 } else {
513 if (new_owner == 0 || new_owner == wwin->client_win) {
514 new_owner = wwin->screen_ptr->root_win;
517 if (new_owner != wwin->transient_for) {
518 owner = wWindowFor(wwin->transient_for);
519 if (owner) {
520 if (owner->flags.semi_focused) {
521 owner->flags.semi_focused = 0;
522 if ((owner->flags.mapped || owner->flags.shaded)
523 && owner->frame)
524 wFrameWindowPaint(owner->frame);
527 owner = wWindowFor(new_owner);
528 if (owner) {
529 if (!owner->flags.semi_focused) {
530 owner->flags.semi_focused = 1;
531 if ((owner->flags.mapped || owner->flags.shaded)
532 && owner->frame)
533 wFrameWindowPaint(owner->frame);
536 wwin->transient_for = new_owner;
537 if (new_owner == None) {
538 if (WFLAGP(wwin, no_miniaturizable)) {
539 WSETUFLAG(wwin, no_miniaturizable, 0);
540 WSETUFLAG(wwin, no_miniaturize_button, 0);
541 if (wwin->frame)
542 wWindowConfigureBorders(wwin);
544 } else if (!WFLAGP(wwin, no_miniaturizable)) {
545 WSETUFLAG(wwin, no_miniaturizable, 1);
546 WSETUFLAG(wwin, no_miniaturize_button, 1);
547 if (wwin->frame)
548 wWindowConfigureBorders(wwin);
552 break;
554 default:
555 if (event->atom == _XA_WM_PROTOCOLS) {
557 PropGetProtocols(wwin->client_win, &wwin->protocols);
559 WSETUFLAG(wwin, kill_close, !wwin->protocols.DELETE_WINDOW);
561 if (wwin->frame)
562 wWindowUpdateButtonImages(wwin);
564 } else if (event->atom == _XA_WM_COLORMAP_WINDOWS) {
566 GetColormapWindows(wwin);
567 wColormapInstallForWindow(wwin->screen_ptr, wwin);
569 } else if (event->atom == _XA_WINDOWMAKER_MENU) {
570 WApplication *wapp;
572 wapp = wApplicationOf(wwin->main_window);
573 if (wapp) {
574 if (wapp->menu) {
575 /* update menu */
576 /* TODO: remake appmenu update */
577 wAppMenuDestroy(wapp->menu);
579 if (wwin->fake_group) {
580 WScreen *scr = wwin->screen_ptr;
581 WWindow *foo = scr->focused_window;
582 WFakeGroupLeader *fPtr = wwin->fake_group;
584 wApplicationDestroy(wapp);
585 while (foo) {
586 if (foo->fake_group && foo->fake_group == fPtr) {
587 WSETUFLAG(foo, shared_appicon, 0);
588 foo->fake_group = NULL;
589 if (foo->group_id != None)
590 foo->main_window = foo->group_id;
591 else if (foo->client_leader != None)
592 foo->main_window = foo->client_leader;
593 else if (WFLAGP(foo, emulate_appicon))
594 foo->main_window = foo->client_win;
595 else
596 foo->main_window = None;
597 if (foo->main_window) {
598 wapp = wApplicationCreate(foo);
601 foo = foo->prev;
604 if (fPtr->leader != None)
605 XDestroyWindow(dpy, fPtr->leader);
606 fPtr->retainCount = 0;
607 fPtr->leader = None;
608 fPtr->origLeader = None;
610 wapp = wApplicationOf(wwin->main_window);
611 if (wapp) {
612 wapp->menu = wAppMenuGet(scr, wwin->main_window);
614 if (wPreferences.auto_arrange_icons) {
615 wArrangeIcons(wwin->screen_ptr, True);
617 } else {
618 wapp->menu = wAppMenuGet(wwin->screen_ptr, wwin->main_window);
620 /* make the appmenu be mapped */
621 wSetFocusTo(wwin->screen_ptr, NULL);
622 wSetFocusTo(wwin->screen_ptr, wwin->screen_ptr->focused_window);
624 } else if (event->atom == _XA_GNUSTEP_WM_ATTR) {
625 GNUstepWMAttributes *attr;
627 PropGetGNUstepWMAttr(wwin->client_win, &attr);
629 wWindowUpdateGNUstepAttr(wwin, attr);
631 XFree(attr);
632 } else {
633 wNETWMCheckClientHintChange(wwin, event);
639 *----------------------------------------------------------------------
640 * wClientGetNormalHints--
641 * Get size (normal) hints and a default geometry for the client
642 * window. The hints are also checked for inconsistency. If geometry is
643 * True, the returned data will account for client specified initial
644 * geometry.
646 * Side effects:
647 * normal_hints is filled with valid data.
648 *----------------------------------------------------------------------
650 void
651 wClientGetNormalHints(WWindow * wwin, XWindowAttributes * wattribs, Bool geometry,
652 int *x, int *y, unsigned *width, unsigned *height)
654 int pre_icccm = 0; /* not used */
656 /* find a position for the window */
657 if (!wwin->normal_hints)
658 wwin->normal_hints = XAllocSizeHints();
660 if (!PropGetNormalHints(wwin->client_win, wwin->normal_hints, &pre_icccm)) {
661 wwin->normal_hints->flags = 0;
663 *x = wattribs->x;
664 *y = wattribs->y;
666 *width = wattribs->width;
667 *height = wattribs->height;
669 if (!(wwin->normal_hints->flags & PWinGravity)) {
670 wwin->normal_hints->win_gravity = NorthWestGravity;
672 if (!(wwin->normal_hints->flags & PMinSize)) {
673 wwin->normal_hints->min_width = MIN_WINDOW_SIZE;
674 wwin->normal_hints->min_height = MIN_WINDOW_SIZE;
676 if (!(wwin->normal_hints->flags & PBaseSize)) {
677 wwin->normal_hints->base_width = 0;
678 wwin->normal_hints->base_height = 0;
680 if (!(wwin->normal_hints->flags & PMaxSize)) {
681 wwin->normal_hints->max_width = wwin->screen_ptr->scr_width * 2;
682 wwin->normal_hints->max_height = wwin->screen_ptr->scr_height * 2;
685 /* some buggy apps set weird hints.. */
686 if (wwin->normal_hints->min_width <= 0)
687 wwin->normal_hints->min_width = MIN_WINDOW_SIZE;
689 if (wwin->normal_hints->min_height <= 0)
690 wwin->normal_hints->min_height = MIN_WINDOW_SIZE;
692 if (wwin->normal_hints->max_width < wwin->normal_hints->min_width)
693 wwin->normal_hints->max_width = wwin->normal_hints->min_width;
695 if (wwin->normal_hints->max_height < wwin->normal_hints->min_height)
696 wwin->normal_hints->max_height = wwin->normal_hints->min_height;
698 if (!(wwin->normal_hints->flags & PResizeInc)) {
699 wwin->normal_hints->width_inc = 1;
700 wwin->normal_hints->height_inc = 1;
701 } else {
702 if (wwin->normal_hints->width_inc <= 0)
703 wwin->normal_hints->width_inc = 1;
704 if (wwin->normal_hints->height_inc <= 0)
705 wwin->normal_hints->height_inc = 1;
708 if (wwin->normal_hints->flags & PAspect) {
709 if (wwin->normal_hints->min_aspect.x < 1)
710 wwin->normal_hints->min_aspect.x = 1;
711 if (wwin->normal_hints->min_aspect.y < 1)
712 wwin->normal_hints->min_aspect.y = 1;
714 if (wwin->normal_hints->max_aspect.x < 1)
715 wwin->normal_hints->max_aspect.x = 1;
716 if (wwin->normal_hints->max_aspect.y < 1)
717 wwin->normal_hints->max_aspect.y = 1;
720 if (wwin->normal_hints->min_height > wwin->normal_hints->max_height) {
721 wwin->normal_hints->min_height = wwin->normal_hints->max_height;
723 if (wwin->normal_hints->min_width > wwin->normal_hints->max_width) {
724 wwin->normal_hints->min_width = wwin->normal_hints->max_width;
726 #ifdef IGNORE_PPOSITION
727 wwin->normal_hints->flags &= ~PPosition;
728 #endif
730 if (pre_icccm && !wwin->screen_ptr->flags.startup && geometry) {
731 if (wwin->normal_hints->flags & (USPosition | PPosition)) {
732 *x = wwin->normal_hints->x;
733 *y = wwin->normal_hints->y;
735 if (wwin->normal_hints->flags & (USSize | PSize)) {
736 *width = wwin->normal_hints->width;
737 *height = wwin->normal_hints->height;
742 void GetColormapWindows(WWindow * wwin)
744 #ifndef NO_CRASHES
745 if (wwin->cmap_windows) {
746 XFree(wwin->cmap_windows);
749 wwin->cmap_windows = NULL;
750 wwin->cmap_window_no = 0;
752 if (!XGetWMColormapWindows(dpy, wwin->client_win, &(wwin->cmap_windows), &(wwin->cmap_window_no))
753 || !wwin->cmap_windows) {
754 wwin->cmap_window_no = 0;
755 wwin->cmap_windows = NULL;
757 #endif