changed indentation to use spaces only
[wmaker-crm.git] / src / client.c
blobf00e6eb0f439e1df22e2706131cb20917b65010e
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 KWM_HINTS
47 #include "kwm.h"
48 #endif
49 #ifdef NETWM_HINTS
50 # include "wmspec.h"
51 #endif
54 /****** Global Variables ******/
56 /* contexts */
57 extern XContext wWinContext;
59 extern Atom _XA_WM_STATE;
60 extern Atom _XA_WM_PROTOCOLS;
61 extern Atom _XA_WM_COLORMAP_WINDOWS;
63 extern Atom _XA_WINDOWMAKER_MENU;
65 extern Atom _XA_GNUSTEP_WM_ATTR;
66 extern Atom _XA_GNUSTEP_WM_RESIZEBAR;
68 #ifdef SHAPE
69 extern Bool wShapeSupported;
70 #endif
74 *--------------------------------------------------------------------
75 * wClientRestore--
76 * Reparent the window back to the root window.
78 *--------------------------------------------------------------------
80 void
81 wClientRestore(WWindow *wwin)
83 #if 0
84 int gx, gy;
86 wClientGetGravityOffsets(wwin, &gx, &gy);
87 /* set the positio of the frame on screen */
88 wwin->frame_x -= gx * FRAME_BORDER_WIDTH;
89 wwin->frame_y -= gy * FRAME_BORDER_WIDTH;
90 /* if gravity is to the south, account for the border sizes */
91 if (gy > 0)
92 wwin->frame_y += (wwin->frame->top_width + wwin->frame->bottom_width);
93 #endif
94 XSetWindowBorderWidth(dpy, wwin->client_win, wwin->old_border_width);
95 XReparentWindow(dpy, wwin->client_win, wwin->screen_ptr->root_win,
96 wwin->frame_x, wwin->frame_y);
98 /* don't let the window get iconified after restart */
100 if (wwin->flags.shaded)
101 wClientSetState(wwin, NormalState, None);
107 *----------------------------------------------------------------------
108 * wClientSetState--
109 * Set the state of the client window to one of the window
110 * states defined in ICCCM (Iconic, Withdrawn, Normal)
112 * Side effects:
113 * The WM_STATE property of the window is updated as well as the
114 * WWindow.state variable.
115 *----------------------------------------------------------------------
117 void
118 wClientSetState(WWindow *wwin, int state, Window icon_win)
120 CARD32 data[2];
122 wwin->state = state;
124 data[0] = (unsigned long) state;
125 data[1] = (unsigned long) icon_win;
127 XChangeProperty(dpy, wwin->client_win, _XA_WM_STATE, _XA_WM_STATE, 32,
128 PropModeReplace, (unsigned char *) data, 2);
132 void
133 wClientGetGravityOffsets(WWindow *wwin, int *ofs_x, int *ofs_y)
135 switch (wwin->normal_hints->win_gravity) {
136 case ForgetGravity:
137 case CenterGravity:
138 case StaticGravity:
139 *ofs_x = 0;
140 *ofs_y = 0;
141 break;
142 case NorthWestGravity:
143 *ofs_x = -1;
144 *ofs_y = -1;
145 break;
146 case NorthGravity:
147 *ofs_x = 0;
148 *ofs_y = -1;
149 break;
150 case NorthEastGravity:
151 *ofs_x = 1;
152 *ofs_y = -1;
153 break;
154 case WestGravity:
155 *ofs_x = -1;
156 *ofs_y = 0;
157 break;
158 case EastGravity:
159 *ofs_x = 1;
160 *ofs_y = 0;
161 break;
162 case SouthWestGravity:
163 *ofs_x = -1;
164 *ofs_y = 1;
165 break;
166 case SouthGravity:
167 *ofs_x = 0;
168 *ofs_y = 1;
169 break;
170 case SouthEastGravity:
171 *ofs_x = 1;
172 *ofs_y = 1;
173 break;
179 void
180 wClientConfigure(WWindow *wwin, XConfigureRequestEvent *xcre)
182 XWindowChanges xwc;
183 int nx, ny, nwidth, nheight;
184 int ofs_x, ofs_y;
186 /* printf("configure event: %d %d %d %d\n", xcre->x, xcre->y, xcre->width, xcre->height);*/
188 if (wwin==NULL) {
190 * configure a window that was not mapped by us
192 xwc.x = xcre->x;
193 xwc.y = xcre->y;
194 xwc.width = xcre->width;
195 xwc.height = xcre->height;
196 xwc.border_width = xcre->border_width;
197 xwc.stack_mode = xcre->detail;
198 xwc.sibling = xcre->above;
199 XConfigureWindow(dpy, xcre->window, xcre->value_mask, &xwc);
200 return;
202 #ifdef SHAPE
203 if (wShapeSupported) {
204 int junk;
205 unsigned int ujunk;
206 int b_shaped;
208 XShapeSelectInput(dpy, wwin->client_win, ShapeNotifyMask);
209 XShapeQueryExtents(dpy, wwin->client_win, &b_shaped, &junk, &junk,
210 &ujunk, &ujunk, &junk, &junk, &junk, &ujunk,
211 &ujunk);
212 wwin->flags.shaped = b_shaped;
214 #endif
215 if (xcre->value_mask & CWStackMode) {
216 WObjDescriptor *desc;
217 WWindow *sibling;
219 if ((xcre->value_mask & CWSibling) &&
220 (XFindContext(dpy, xcre->above, wWinContext,
221 (XPointer *)&desc) == XCSUCCESS)
222 && (desc->parent_type==WCLASS_WINDOW)) {
223 sibling=desc->parent;
224 xwc.sibling = sibling->frame->core->window;
225 } else {
226 xwc.sibling = xcre->above;
228 xwc.stack_mode = xcre->detail;
229 XConfigureWindow(dpy, wwin->frame->core->window,
230 xcre->value_mask & (CWSibling | CWStackMode), &xwc);
231 /* fix stacking order */
232 RemakeStackList(wwin->screen_ptr);
235 wClientGetGravityOffsets(wwin, &ofs_x, &ofs_y);
237 if (xcre->value_mask & CWBorderWidth) {
238 wwin->old_border_width = xcre->border_width;
241 if (!wwin->flags.shaded) {
242 /* If the window is shaded, wrong height will be set for the window */
243 if (xcre->value_mask & CWX) {
244 nx = xcre->x;
245 if (HAS_BORDER(wwin))
246 nx -= FRAME_BORDER_WIDTH;
248 else
249 nx = wwin->frame_x;
251 if (xcre->value_mask & CWY) {
252 ny = xcre->y - ((ofs_y < 0) ? 0 : wwin->frame->top_width);
253 if (HAS_BORDER(wwin))
254 ny -= FRAME_BORDER_WIDTH;
256 else
257 ny = wwin->frame_y;
259 if (xcre->value_mask & CWWidth)
260 nwidth = xcre->width;
261 else
262 nwidth = wwin->frame->core->width;
264 if (xcre->value_mask & CWHeight)
265 nheight = xcre->height;
266 else
267 nheight = wwin->frame->core->height - wwin->frame->top_width - wwin->frame->bottom_width;
269 wWindowConfigure(wwin, nx, ny, nwidth, nheight);
270 wwin->old_geometry.x = nx;
271 wwin->old_geometry.y = ny;
272 wwin->old_geometry.width = nwidth;
273 wwin->old_geometry.height = nheight;
278 void
279 wClientSendProtocol(WWindow *wwin, Atom protocol, Time time)
281 XEvent event;
283 event.xclient.type = ClientMessage;
284 event.xclient.message_type = _XA_WM_PROTOCOLS;
285 event.xclient.format = 32;
286 event.xclient.display = dpy;
287 event.xclient.window = wwin->client_win;
288 event.xclient.data.l[0] = protocol;
289 event.xclient.data.l[1] = time;
290 event.xclient.data.l[2] = 0;
291 event.xclient.data.l[3] = 0;
292 XSendEvent(dpy, wwin->client_win, False, NoEventMask, &event);
293 XSync(dpy, False);
298 void
299 wClientKill(WWindow *wwin)
301 XKillClient(dpy, wwin->client_win);
303 XFlush(dpy);
309 *----------------------------------------------------------------------
310 * wClientCheckProperty--
311 * Handles PropertyNotify'es, verifying which property was
312 * changed and updating internal state according to that, like redrawing
313 * the icon title when it is changed.
315 * Side effects:
316 * Depends on the changed property.
318 * TODO: _GNUSTEP_WM_ATTR
319 *----------------------------------------------------------------------
321 void
322 wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
324 XWindowAttributes attribs;
325 XWMHints *new_hints;
326 int i, g1, g2;
327 char *tmp = NULL;
329 switch (event->atom) {
330 case XA_WM_NAME:
331 /* window title was changed */
332 if (!wFetchName(dpy, wwin->client_win, &tmp)) {
333 wWindowUpdateName(wwin, NULL);
334 } else {
335 wWindowUpdateName(wwin, tmp);
337 if (tmp)
338 XFree(tmp);
339 break;
341 case XA_WM_ICON_NAME:
342 #ifdef KWM_HINTS
343 wKWMSendEventMessage(wwin, WKWMChangedClient);
344 #endif
345 if (!wwin->icon)
346 break;
347 else {
348 char *new_title;
350 /* icon title was changed */
351 wGetIconName(dpy, wwin->client_win, &new_title);
352 wIconChangeTitle(wwin->icon, new_title);
354 break;
356 case XA_WM_COMMAND:
357 if (wwin->main_window!=None) {
358 WApplication *wapp = wApplicationOf(wwin->main_window);
359 char *command;
361 if (!wapp || !wapp->app_icon || wapp->app_icon->docked)
362 break;
364 command = GetCommandForWindow(wwin->main_window);
365 if (command) {
366 if (wapp->app_icon->command)
367 wfree(wapp->app_icon->command);
368 wapp->app_icon->command = command;
371 break;
373 case XA_WM_HINTS:
374 /* WM_HINTS */
376 new_hints = XGetWMHints(dpy, wwin->client_win);
378 /* group leader update
380 * This means that the window is setting the leader after
381 * it was mapped, changing leaders or removing the leader.
383 * Valid state transitions are:
385 * _1 __2
386 * / \ / \
387 * v | v |
388 * (GC) (GC')
389 * / ^ / ^
390 * 3| |4 5| |6
391 * | | | |
392 * v / v /
393 * (G'C) (G'C')
395 * Where G is the window_group hint, C is CLIENT_LEADER property
396 * and ' indicates the hint is unset.
398 * 1,2 - change group leader to new value of window_group
399 * 3 - change leader to value of CLIENT_LEADER
400 * 4 - change leader to value of window_group
401 * 5 - destroy application
402 * 6 - create application
404 if (new_hints && (new_hints->flags & WindowGroupHint)
405 && new_hints->window_group!=None) {
406 g2 = 1;
407 } else {
408 g2 = 0;
410 if (wwin->wm_hints && (wwin->wm_hints->flags & WindowGroupHint)
411 && wwin->wm_hints->window_group!=None) {
412 g1 = 1;
413 } else {
414 g1 = 0;
417 if (wwin->client_leader) {
418 if (g1 && g2
419 && wwin->wm_hints->window_group!=new_hints->window_group) {
420 i = 1;
421 } else if (g1 && !g2) {
422 i = 3;
423 } else if (!g1 && g2) {
424 i = 4;
425 } else {
426 i = 0;
428 } else {
429 if (g1 && g2
430 && wwin->wm_hints->window_group!=new_hints->window_group) {
431 i = 2;
432 } else if (g1 && !g2) {
433 i = 5;
434 } else if (!g1 && g2) {
435 i = 6;
436 } else {
437 i = 0;
441 /* Handling this may require more work. -Dan */
442 if (wwin->fake_group!=NULL) {
443 i = 7;
446 if (wwin->wm_hints)
447 XFree(wwin->wm_hints);
449 wwin->wm_hints = new_hints;
451 /* do action according to state transition */
452 switch (i) {
453 /* 3 - change leader to value of CLIENT_LEADER */
454 case 3:
455 wApplicationDestroy(wApplicationOf(wwin->main_window));
456 wwin->main_window = wwin->client_leader;
457 wwin->group_id = None;
458 wApplicationCreate(wwin);
459 break;
461 /* 1,2,4 - change leader to new value of window_group */
462 case 1:
463 case 2:
464 case 4:
465 wApplicationDestroy(wApplicationOf(wwin->main_window));
466 wwin->main_window = new_hints->window_group;
467 wwin->group_id = wwin->main_window;
468 wApplicationCreate(wwin);
469 break;
471 /* 5 - destroy application */
472 case 5:
473 wApplicationDestroy(wApplicationOf(wwin->main_window));
474 wwin->main_window = None;
475 wwin->group_id = None;
476 break;
478 /* 6 - create application */
479 case 6:
480 wwin->main_window = new_hints->window_group;
481 wwin->group_id = wwin->main_window;
482 wApplicationCreate(wwin);
483 break;
484 /* 7 - we have a fake window group id, so just ignore anything else */
485 case 7:
486 break;
488 #ifdef DEBUG
489 if (i) {
490 printf("window leader update caused state transition %i\n",i);
492 #endif
494 if (wwin->wm_hints) {
495 /* update icon */
496 if ((wwin->wm_hints->flags & IconPixmapHint)
497 || (wwin->wm_hints->flags & IconWindowHint)) {
498 WApplication *wapp;
500 if (wwin->flags.miniaturized && wwin->icon) {
501 wIconUpdate(wwin->icon);
503 wapp = wApplicationOf(wwin->main_window);
504 if (wapp && wapp->app_icon) {
505 wIconUpdate(wapp->app_icon->icon);
507 #ifdef KWM_HINTS
508 wKWMSendEventMessage(wwin, WKWMIconChange);
509 #endif
512 if (wwin->wm_hints->flags & UrgencyHint)
513 wwin->flags.urgent = 1;
514 else
515 wwin->flags.urgent = 0;
516 /*} else if (wwin->fake_group!=NULL) {
517 wwin->group_id = wwin->fake_group->leader;*/
518 } else {
519 wwin->group_id = None;
521 break;
523 case XA_WM_NORMAL_HINTS:
524 /* normal (geometry) hints */
526 int foo;
527 unsigned bar;
529 XGetWindowAttributes(dpy, wwin->client_win, &attribs);
530 wClientGetNormalHints(wwin, &attribs, False, &foo, &foo,
531 &bar, &bar);
532 /* TODO: should we check for consistency of the current
533 * size against the new geometry hints? */
535 break;
537 case XA_WM_TRANSIENT_FOR:
539 Window new_owner;
540 WWindow *owner;
542 if (!XGetTransientForHint(dpy, wwin->client_win, &new_owner)) {
543 new_owner = None;
544 } else {
545 if (new_owner==0 || new_owner == wwin->client_win) {
546 new_owner = wwin->screen_ptr->root_win;
549 if (new_owner!=wwin->transient_for) {
550 owner = wWindowFor(wwin->transient_for);
551 if (owner) {
552 if (owner->flags.semi_focused) {
553 owner->flags.semi_focused = 0;
554 if ((owner->flags.mapped || owner->flags.shaded)
555 && owner->frame)
556 wFrameWindowPaint(owner->frame);
559 owner = wWindowFor(new_owner);
560 if (owner) {
561 if (!owner->flags.semi_focused) {
562 owner->flags.semi_focused = 1;
563 if ((owner->flags.mapped || owner->flags.shaded)
564 && owner->frame)
565 wFrameWindowPaint(owner->frame);
568 wwin->transient_for = new_owner;
569 if (new_owner==None) {
570 if (WFLAGP(wwin, no_miniaturizable)) {
571 WSETUFLAG(wwin, no_miniaturizable, 0);
572 WSETUFLAG(wwin, no_miniaturize_button, 0);
573 if (wwin->frame)
574 wWindowConfigureBorders(wwin);
576 } else if (!WFLAGP(wwin, no_miniaturizable)) {
577 WSETUFLAG(wwin, no_miniaturizable, 1);
578 WSETUFLAG(wwin, no_miniaturize_button, 1);
579 if (wwin->frame)
580 wWindowConfigureBorders(wwin);
584 break;
586 default:
587 if (event->atom==_XA_WM_PROTOCOLS) {
589 PropGetProtocols(wwin->client_win, &wwin->protocols);
591 WSETUFLAG(wwin, kill_close, !wwin->protocols.DELETE_WINDOW);
593 if (wwin->frame)
594 wWindowUpdateButtonImages(wwin);
596 } else if (event->atom==_XA_WM_COLORMAP_WINDOWS) {
598 GetColormapWindows(wwin);
599 wColormapInstallForWindow(wwin->screen_ptr, wwin);
601 } else if (event->atom==_XA_WINDOWMAKER_MENU) {
602 WApplication *wapp;
604 wapp = wApplicationOf(wwin->main_window);
605 if (wapp) {
606 if (wapp->menu) {
607 /* update menu */
608 /* TODO: remake appmenu update */
609 wAppMenuDestroy(wapp->menu);
611 if (wwin->fake_group) {
612 extern WPreferences wPreferences;
613 WScreen *scr = wwin->screen_ptr;
614 WWindow *foo = scr->focused_window;
615 WFakeGroupLeader *fPtr = wwin->fake_group;
617 wApplicationDestroy(wapp);
618 while (foo) {
619 if (foo->fake_group && foo->fake_group==fPtr) {
620 WSETUFLAG(foo, shared_appicon, 0);
621 foo->fake_group = NULL;
622 if (foo->group_id!=None)
623 foo->main_window = foo->group_id;
624 else if (foo->client_leader!=None)
625 foo->main_window = foo->client_leader;
626 else if (WFLAGP(foo, emulate_appicon))
627 foo->main_window = foo->client_win;
628 else
629 foo->main_window = None;
630 if (foo->main_window) {
631 wapp = wApplicationCreate(foo);
634 foo = foo->prev;
637 if (fPtr->leader!=None)
638 XDestroyWindow(dpy, fPtr->leader);
639 fPtr->retainCount = 0;
640 fPtr->leader = None;
641 fPtr->origLeader = None;
643 wapp = wApplicationOf(wwin->main_window);
644 if (wapp) {
645 wapp->menu = wAppMenuGet(scr, wwin->main_window);
647 if (wPreferences.auto_arrange_icons) {
648 wArrangeIcons(wwin->screen_ptr, True);
650 } else {
651 wapp->menu = wAppMenuGet(wwin->screen_ptr, wwin->main_window);
653 /* make the appmenu be mapped */
654 wSetFocusTo(wwin->screen_ptr, NULL);
655 wSetFocusTo(wwin->screen_ptr, wwin->screen_ptr->focused_window);
657 } else if (event->atom==_XA_GNUSTEP_WM_ATTR) {
658 GNUstepWMAttributes *attr;
660 PropGetGNUstepWMAttr(wwin->client_win, &attr);
662 wWindowUpdateGNUstepAttr(wwin, attr);
664 XFree(attr);
665 } else {
666 #if defined(KWM_HINTS) || defined(NETWM_HINTS)
667 Bool done = False;
668 #endif
669 #ifdef KWM_HINTS
670 if (!done)
671 done = wKWMCheckClientHintChange(wwin, event);
672 #endif /* KWM_HINTS */
673 #ifdef NETWM_HINTS
674 if (!done) {
675 done = wNETWMCheckClientHintChange(wwin, event);
677 #endif
684 *----------------------------------------------------------------------
685 * wClientGetNormalHints--
686 * Get size (normal) hints and a default geometry for the client
687 * window. The hints are also checked for inconsistency. If geometry is
688 * True, the returned data will account for client specified initial
689 * geometry.
691 * Side effects:
692 * normal_hints is filled with valid data.
693 *----------------------------------------------------------------------
695 void
696 wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry,
697 int *x, int *y, unsigned *width, unsigned *height)
699 int pre_icccm = 0; /* not used */
701 /* find a position for the window */
702 if (!wwin->normal_hints)
703 wwin->normal_hints = XAllocSizeHints();
705 if (!PropGetNormalHints(wwin->client_win, wwin->normal_hints, &pre_icccm)) {
706 wwin->normal_hints->flags = 0;
708 *x = wattribs->x;
709 *y = wattribs->y;
711 *width = wattribs->width;
712 *height = wattribs->height;
714 if (!(wwin->normal_hints->flags & PWinGravity)) {
715 wwin->normal_hints->win_gravity = NorthWestGravity;
717 if (!(wwin->normal_hints->flags & PMinSize)) {
718 wwin->normal_hints->min_width = MIN_WINDOW_SIZE;
719 wwin->normal_hints->min_height = MIN_WINDOW_SIZE;
721 if (!(wwin->normal_hints->flags & PBaseSize)) {
722 wwin->normal_hints->base_width = 0;
723 wwin->normal_hints->base_height = 0;
725 if (!(wwin->normal_hints->flags & PMaxSize)) {
726 wwin->normal_hints->max_width = wwin->screen_ptr->scr_width*2;
727 wwin->normal_hints->max_height = wwin->screen_ptr->scr_height*2;
730 /* some buggy apps set weird hints.. */
731 if (wwin->normal_hints->min_width <= 0)
732 wwin->normal_hints->min_width = MIN_WINDOW_SIZE;
734 if (wwin->normal_hints->min_height <= 0)
735 wwin->normal_hints->min_height = MIN_WINDOW_SIZE;
738 if (wwin->normal_hints->max_width < wwin->normal_hints->min_width)
739 wwin->normal_hints->max_width = wwin->normal_hints->min_width;
741 if (wwin->normal_hints->max_height < wwin->normal_hints->min_height)
742 wwin->normal_hints->max_height = wwin->normal_hints->min_height;
744 if (!(wwin->normal_hints->flags & PResizeInc)) {
745 wwin->normal_hints->width_inc = 1;
746 wwin->normal_hints->height_inc = 1;
747 } else {
748 if (wwin->normal_hints->width_inc <= 0)
749 wwin->normal_hints->width_inc = 1;
750 if (wwin->normal_hints->height_inc <= 0)
751 wwin->normal_hints->height_inc = 1;
754 if (wwin->normal_hints->flags & PAspect) {
755 if (wwin->normal_hints->min_aspect.x < 1)
756 wwin->normal_hints->min_aspect.x = 1;
757 if (wwin->normal_hints->min_aspect.y < 1)
758 wwin->normal_hints->min_aspect.y = 1;
760 if (wwin->normal_hints->max_aspect.x < 1)
761 wwin->normal_hints->max_aspect.x = 1;
762 if (wwin->normal_hints->max_aspect.y < 1)
763 wwin->normal_hints->max_aspect.y = 1;
766 if (wwin->normal_hints->min_height > wwin->normal_hints->max_height) {
767 wwin->normal_hints->min_height = wwin->normal_hints->max_height;
769 if (wwin->normal_hints->min_width > wwin->normal_hints->max_width) {
770 wwin->normal_hints->min_width = wwin->normal_hints->max_width;
773 #ifdef IGNORE_PPOSITION
774 wwin->normal_hints->flags &= ~PPosition;
775 #endif
777 if (pre_icccm && !wwin->screen_ptr->flags.startup && geometry) {
778 if (wwin->normal_hints->flags & (USPosition|PPosition)) {
779 *x = wwin->normal_hints->x;
780 *y = wwin->normal_hints->y;
782 if (wwin->normal_hints->flags & (USSize|PSize)) {
783 *width = wwin->normal_hints->width;
784 *height = wwin->normal_hints->height;
790 void
791 GetColormapWindows(WWindow *wwin)
793 #ifndef NO_CRASHES
794 if (wwin->cmap_windows) {
795 XFree(wwin->cmap_windows);
798 wwin->cmap_windows = NULL;
799 wwin->cmap_window_no = 0;
801 if (!XGetWMColormapWindows(dpy, wwin->client_win, &(wwin->cmap_windows),
802 &(wwin->cmap_window_no))
803 || !wwin->cmap_windows) {
804 wwin->cmap_window_no = 0;
805 wwin->cmap_windows = NULL;
808 #endif