- Fixed crashing bug in menu.c
[wmaker-crm.git] / src / client.c
blob05ee06043da52b1d2393bee09ff8aa3c89aa9c6c
1 /*
2 * Window Maker window manager
3 *
4 * Copyright (c) 1997-2003 Alfredo K. Kojima
5 *
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 KWM_HINTS
47 #include "kwm.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 if (!WFLAGP(wwin, no_border))
243 nx -= FRAME_BORDER_WIDTH;
245 else
246 nx = wwin->frame_x;
248 if (xcre->value_mask & CWY) {
249 ny = xcre->y - ((ofs_y < 0) ? 0 : wwin->frame->top_width);
250 if (!WFLAGP(wwin, no_border))
251 ny -= FRAME_BORDER_WIDTH;
253 else
254 ny = wwin->frame_y;
256 if (xcre->value_mask & CWWidth)
257 nwidth = xcre->width;
258 else
259 nwidth = wwin->frame->core->width;
261 if (xcre->value_mask & CWHeight)
262 nheight = xcre->height;
263 else
264 nheight = wwin->frame->core->height - wwin->frame->top_width - wwin->frame->bottom_width;
266 wWindowConfigure(wwin, nx, ny, nwidth, nheight);
267 wwin->old_geometry.x = nx;
268 wwin->old_geometry.y = ny;
269 wwin->old_geometry.width = nwidth;
270 wwin->old_geometry.height = nheight;
275 void
276 wClientSendProtocol(WWindow *wwin, Atom protocol, Time time)
278 XEvent event;
280 event.xclient.type = ClientMessage;
281 event.xclient.message_type = _XA_WM_PROTOCOLS;
282 event.xclient.format = 32;
283 event.xclient.display = dpy;
284 event.xclient.window = wwin->client_win;
285 event.xclient.data.l[0] = protocol;
286 event.xclient.data.l[1] = time;
287 event.xclient.data.l[2] = 0;
288 event.xclient.data.l[3] = 0;
289 XSendEvent(dpy, wwin->client_win, False, NoEventMask, &event);
290 XSync(dpy, False);
295 void
296 wClientKill(WWindow *wwin)
298 XKillClient(dpy, wwin->client_win);
300 XFlush(dpy);
306 *----------------------------------------------------------------------
307 * wClientCheckProperty--
308 * Handles PropertyNotify'es, verifying which property was
309 * changed and updating internal state according to that, like redrawing
310 * the icon title when it is changed.
312 * Side effects:
313 * Depends on the changed property.
315 * TODO: _GNUSTEP_WM_ATTR
316 *----------------------------------------------------------------------
318 void
319 wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
321 XWindowAttributes attribs;
322 XWMHints *new_hints;
323 int i, g1, g2;
324 char *tmp = NULL;
326 switch (event->atom) {
327 case XA_WM_NAME:
328 /* window title was changed */
329 if (!wFetchName(dpy, wwin->client_win, &tmp)) {
330 wWindowUpdateName(wwin, NULL);
331 } else {
332 wWindowUpdateName(wwin, tmp);
334 if (tmp)
335 XFree(tmp);
336 break;
338 case XA_WM_ICON_NAME:
339 #ifdef KWM_HINTS
340 wKWMSendEventMessage(wwin, WKWMChangedClient);
341 #endif
342 if (!wwin->icon)
343 break;
344 else {
345 char *new_title;
347 /* icon title was changed */
348 wGetIconName(dpy, wwin->client_win, &new_title);
349 wIconChangeTitle(wwin->icon, new_title);
351 break;
353 case XA_WM_COMMAND:
354 if (wwin->main_window!=None) {
355 WApplication *wapp = wApplicationOf(wwin->main_window);
356 char **argv;
357 int argc;
359 if (!wapp || !wapp->app_icon)
360 break;
362 if (XGetCommand(dpy, wwin->main_window, &argv, &argc)) {
363 if (argc > 0 && argv != NULL) {
364 if (wapp->app_icon->command)
365 wfree(wapp->app_icon->command);
366 wapp->app_icon->command = wtokenjoin(argv, argc);
368 if (argv) {
369 XFreeStringList(argv);
373 break;
375 case XA_WM_HINTS:
376 /* WM_HINTS */
378 new_hints = XGetWMHints(dpy, wwin->client_win);
380 /* group leader update
382 * This means that the window is setting the leader after
383 * it was mapped, changing leaders or removing the leader.
385 * Valid state transitions are:
387 * _1 __2
388 * / \ / \
389 * v | v |
390 * (GC) (GC')
391 * / ^ / ^
392 * 3| |4 5| |6
393 * | | | |
394 * v / v /
395 * (G'C) (G'C')
397 * Where G is the window_group hint, C is CLIENT_LEADER property
398 * and ' indicates the hint is unset.
400 * 1,2 - change group leader to new value of window_group
401 * 3 - change leader to value of CLIENT_LEADER
402 * 4 - change leader to value of window_group
403 * 5 - destroy application
404 * 6 - create application
406 if (new_hints && (new_hints->flags & WindowGroupHint)
407 && new_hints->window_group!=None) {
408 g2 = 1;
409 } else {
410 g2 = 0;
412 if (wwin->wm_hints && (wwin->wm_hints->flags & WindowGroupHint)
413 && wwin->wm_hints->window_group!=None) {
414 g1 = 1;
415 } else {
416 g1 = 0;
419 if (wwin->client_leader) {
420 if (g1 && g2
421 && wwin->wm_hints->window_group!=new_hints->window_group) {
422 i = 1;
423 } else if (g1 && !g2) {
424 i = 3;
425 } else if (!g1 && g2) {
426 i = 4;
427 } else {
428 i = 0;
430 } else {
431 if (g1 && g2
432 && wwin->wm_hints->window_group!=new_hints->window_group) {
433 i = 2;
434 } else if (g1 && !g2) {
435 i = 5;
436 } else if (!g1 && g2) {
437 i = 6;
438 } else {
439 i = 0;
443 /* Handling this may require more work. -Dan */
444 if (wwin->fake_group!=NULL) {
445 i = 7;
448 if (wwin->wm_hints)
449 XFree(wwin->wm_hints);
451 wwin->wm_hints = new_hints;
453 /* do action according to state transition */
454 switch (i) {
455 /* 3 - change leader to value of CLIENT_LEADER */
456 case 3:
457 wApplicationDestroy(wApplicationOf(wwin->main_window));
458 wwin->main_window = wwin->client_leader;
459 wwin->group_id = None;
460 wApplicationCreate(wwin->screen_ptr, wwin->main_window);
461 break;
463 /* 1,2,4 - change leader to new value of window_group */
464 case 1:
465 case 2:
466 case 4:
467 wApplicationDestroy(wApplicationOf(wwin->main_window));
468 wwin->main_window = new_hints->window_group;
469 wwin->group_id = wwin->main_window;
470 wApplicationCreate(wwin->screen_ptr, wwin->main_window);
471 break;
473 /* 5 - destroy application */
474 case 5:
475 wApplicationDestroy(wApplicationOf(wwin->main_window));
476 wwin->main_window = None;
477 wwin->group_id = None;
478 break;
480 /* 6 - create application */
481 case 6:
482 wwin->main_window = new_hints->window_group;
483 wwin->group_id = wwin->main_window;
484 wApplicationCreate(wwin->screen_ptr, wwin->main_window);
485 break;
486 /* 7 - we have a fake window group id, so just ignore anything else */
487 case 7:
488 break;
490 #ifdef DEBUG
491 if (i) {
492 printf("window leader update caused state transition %i\n",i);
494 #endif
496 if (wwin->wm_hints) {
497 /* update icon */
498 if ((wwin->wm_hints->flags & IconPixmapHint)
499 || (wwin->wm_hints->flags & IconWindowHint)) {
500 WApplication *wapp;
502 if (wwin->flags.miniaturized && wwin->icon) {
503 wIconUpdate(wwin->icon);
505 wapp = wApplicationOf(wwin->main_window);
506 if (wapp && wapp->app_icon) {
507 wIconUpdate(wapp->app_icon->icon);
509 #ifdef KWM_HINTS
510 wKWMSendEventMessage(wwin, WKWMIconChange);
511 #endif
514 if (wwin->wm_hints->flags & UrgencyHint)
515 wwin->flags.urgent = 1;
516 else
517 wwin->flags.urgent = 0;
518 /*} else if (wwin->fake_group!=NULL) {
519 wwin->group_id = wwin->fake_group->leader;*/
520 } else {
521 wwin->group_id = None;
523 break;
525 case XA_WM_NORMAL_HINTS:
526 /* normal (geometry) hints */
528 int foo;
529 unsigned bar;
531 XGetWindowAttributes(dpy, wwin->client_win, &attribs);
532 wClientGetNormalHints(wwin, &attribs, False, &foo, &foo,
533 &bar, &bar);
534 /* TODO: should we check for consistency of the current
535 * size against the new geometry hints? */
537 break;
539 case XA_WM_TRANSIENT_FOR:
541 Window new_owner;
542 WWindow *owner;
544 if (!XGetTransientForHint(dpy, wwin->client_win, &new_owner)) {
545 new_owner = None;
546 } else {
547 if (new_owner==0 || new_owner == wwin->client_win) {
548 new_owner = wwin->screen_ptr->root_win;
551 if (new_owner!=wwin->transient_for) {
552 owner = wWindowFor(wwin->transient_for);
553 if (owner) {
554 if (owner->flags.semi_focused) {
555 owner->flags.semi_focused = 0;
556 if ((owner->flags.mapped || owner->flags.shaded)
557 && owner->frame)
558 wFrameWindowPaint(owner->frame);
561 owner = wWindowFor(new_owner);
562 if (owner) {
563 if (!owner->flags.semi_focused) {
564 owner->flags.semi_focused = 1;
565 if ((owner->flags.mapped || owner->flags.shaded)
566 && owner->frame)
567 wFrameWindowPaint(owner->frame);
570 wwin->transient_for = new_owner;
571 if (new_owner==None) {
572 if (WFLAGP(wwin, no_miniaturizable)) {
573 WSETUFLAG(wwin, no_miniaturizable, 0);
574 WSETUFLAG(wwin, no_miniaturize_button, 0);
575 if (wwin->frame)
576 wWindowConfigureBorders(wwin);
578 } else if (!WFLAGP(wwin, no_miniaturizable)) {
579 WSETUFLAG(wwin, no_miniaturizable, 1);
580 WSETUFLAG(wwin, no_miniaturize_button, 1);
581 if (wwin->frame)
582 wWindowConfigureBorders(wwin);
586 break;
588 default:
589 if (event->atom==_XA_WM_PROTOCOLS) {
591 PropGetProtocols(wwin->client_win, &wwin->protocols);
593 WSETUFLAG(wwin, kill_close, !wwin->protocols.DELETE_WINDOW);
595 if (wwin->frame)
596 wWindowUpdateButtonImages(wwin);
598 } else if (event->atom==_XA_WM_COLORMAP_WINDOWS) {
600 GetColormapWindows(wwin);
601 wColormapInstallForWindow(wwin->screen_ptr, wwin);
603 } else if (event->atom==_XA_WINDOWMAKER_MENU) {
604 WApplication *wapp;
606 wapp = wApplicationOf(wwin->main_window);
607 if (wapp) {
608 if (wapp->menu) {
609 /* update menu */
610 /* TODO: remake appmenu update */
611 wAppMenuDestroy(wapp->menu);
613 if (wwin->fake_group) {
614 extern WPreferences wPreferences;
615 WScreen *scr = wwin->screen_ptr;
616 WWindow *foo = scr->focused_window;
617 WFakeGroupLeader *fPtr = wwin->fake_group;
619 wApplicationDestroy(wapp);
620 while (foo) {
621 if (foo->fake_group && foo->fake_group==fPtr) {
622 WSETUFLAG(foo, shared_appicon, 0);
623 foo->fake_group = NULL;
624 if (foo->group_id!=None)
625 foo->main_window = foo->group_id;
626 else if (foo->client_leader!=None)
627 foo->main_window = foo->client_leader;
628 else if (WFLAGP(foo, emulate_appicon))
629 foo->main_window = foo->client_win;
630 else
631 foo->main_window = None;
632 if (foo->main_window) {
633 wapp = wApplicationCreate(scr, foo->main_window);
636 foo = foo->prev;
639 if (fPtr->leader!=None)
640 XDestroyWindow(dpy, fPtr->leader);
641 fPtr->retainCount = 0;
642 fPtr->leader = None;
643 fPtr->origLeader = None;
645 wapp = wApplicationOf(wwin->main_window);
646 if (wapp) {
647 wapp->menu = wAppMenuGet(scr, wwin->main_window);
649 if (wPreferences.auto_arrange_icons) {
650 wArrangeIcons(wwin->screen_ptr, True);
652 } else {
653 wapp->menu = wAppMenuGet(wwin->screen_ptr, wwin->main_window);
655 /* make the appmenu be mapped */
656 wSetFocusTo(wwin->screen_ptr, NULL);
657 wSetFocusTo(wwin->screen_ptr, wwin->screen_ptr->focused_window);
659 } else if (event->atom==_XA_GNUSTEP_WM_ATTR) {
660 GNUstepWMAttributes *attr;
662 PropGetGNUstepWMAttr(wwin->client_win, &attr);
664 wWindowUpdateGNUstepAttr(wwin, attr);
666 XFree(attr);
667 } else {
668 #ifdef KWM_HINTS
669 Bool done;
671 done = wKWMCheckClientHintChange(wwin, event);
672 #endif /* KWM_HINTS */
679 *----------------------------------------------------------------------
680 * wClientGetNormalHints--
681 * Get size (normal) hints and a default geometry for the client
682 * window. The hints are also checked for inconsistency. If geometry is
683 * True, the returned data will account for client specified initial
684 * geometry.
686 * Side effects:
687 * normal_hints is filled with valid data.
688 *----------------------------------------------------------------------
690 void
691 wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry,
692 int *x, int *y, unsigned *width, unsigned *height)
694 int pre_icccm = 0; /* not used */
696 /* find a position for the window */
697 if (!wwin->normal_hints)
698 wwin->normal_hints = XAllocSizeHints();
700 if (!PropGetNormalHints(wwin->client_win, wwin->normal_hints, &pre_icccm)) {
701 wwin->normal_hints->flags = 0;
703 *x = wattribs->x;
704 *y = wattribs->y;
706 *width = wattribs->width;
707 *height = wattribs->height;
709 if (!(wwin->normal_hints->flags & PWinGravity)) {
710 wwin->normal_hints->win_gravity = NorthWestGravity;
712 if (!(wwin->normal_hints->flags & PMinSize)) {
713 wwin->normal_hints->min_width = MIN_WINDOW_SIZE;
714 wwin->normal_hints->min_height = MIN_WINDOW_SIZE;
716 if (!(wwin->normal_hints->flags & PBaseSize)) {
717 wwin->normal_hints->base_width = 0;
718 wwin->normal_hints->base_height = 0;
720 if (!(wwin->normal_hints->flags & PMaxSize)) {
721 wwin->normal_hints->max_width = wwin->screen_ptr->scr_width*2;
722 wwin->normal_hints->max_height = wwin->screen_ptr->scr_height*2;
725 /* some buggy apps set weird hints.. */
726 if (wwin->normal_hints->min_width <= 0)
727 wwin->normal_hints->min_width = MIN_WINDOW_SIZE;
729 if (wwin->normal_hints->min_height <= 0)
730 wwin->normal_hints->min_height = MIN_WINDOW_SIZE;
733 if (wwin->normal_hints->max_width < wwin->normal_hints->min_width)
734 wwin->normal_hints->max_width = wwin->normal_hints->min_width;
736 if (wwin->normal_hints->max_height < wwin->normal_hints->min_height)
737 wwin->normal_hints->max_height = wwin->normal_hints->min_height;
739 if (!(wwin->normal_hints->flags & PResizeInc)) {
740 wwin->normal_hints->width_inc = 1;
741 wwin->normal_hints->height_inc = 1;
742 } else {
743 if (wwin->normal_hints->width_inc <= 0)
744 wwin->normal_hints->width_inc = 1;
745 if (wwin->normal_hints->height_inc <= 0)
746 wwin->normal_hints->height_inc = 1;
749 if (wwin->normal_hints->flags & PAspect) {
750 if (wwin->normal_hints->min_aspect.x < 1)
751 wwin->normal_hints->min_aspect.x = 1;
752 if (wwin->normal_hints->min_aspect.y < 1)
753 wwin->normal_hints->min_aspect.y = 1;
755 if (wwin->normal_hints->max_aspect.x < 1)
756 wwin->normal_hints->max_aspect.x = 1;
757 if (wwin->normal_hints->max_aspect.y < 1)
758 wwin->normal_hints->max_aspect.y = 1;
761 if (wwin->normal_hints->min_height > wwin->normal_hints->max_height) {
762 wwin->normal_hints->min_height = wwin->normal_hints->max_height;
764 if (wwin->normal_hints->min_width > wwin->normal_hints->max_width) {
765 wwin->normal_hints->min_width = wwin->normal_hints->max_width;
768 #ifdef IGNORE_PPOSITION
769 wwin->normal_hints->flags &= ~PPosition;
770 #endif
772 if (pre_icccm && !wwin->screen_ptr->flags.startup && geometry) {
773 if (wwin->normal_hints->flags & (USPosition|PPosition)) {
774 *x = wwin->normal_hints->x;
775 *y = wwin->normal_hints->y;
777 if (wwin->normal_hints->flags & (USSize|PSize)) {
778 *width = wwin->normal_hints->width;
779 *height = wwin->normal_hints->height;
785 void
786 GetColormapWindows(WWindow *wwin)
788 #ifndef NO_CRASHES
789 if (wwin->cmap_windows) {
790 XFree(wwin->cmap_windows);
793 wwin->cmap_windows = NULL;
794 wwin->cmap_window_no = 0;
796 if (!XGetWMColormapWindows(dpy, wwin->client_win, &(wwin->cmap_windows),
797 &(wwin->cmap_window_no))
798 || !wwin->cmap_windows) {
799 wwin->cmap_window_no = 0;
800 wwin->cmap_windows = NULL;
803 #endif