Fix Maximize/Unmaximize in window menu
[wmaker-crm.git] / src / client.c
blob975adb1d2f32f81e1e092821c3a40b737a578e31
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"
46 /****** Global Variables ******/
48 /* contexts */
49 extern XContext wWinContext;
51 extern Atom _XA_WM_STATE;
52 extern Atom _XA_WM_PROTOCOLS;
53 extern Atom _XA_WM_COLORMAP_WINDOWS;
55 extern Atom _XA_WINDOWMAKER_MENU;
57 extern Atom _XA_GNUSTEP_WM_ATTR;
58 extern Atom _XA_GNUSTEP_WM_RESIZEBAR;
60 #ifdef SHAPE
61 extern Bool wShapeSupported;
62 #endif
65 *--------------------------------------------------------------------
66 * wClientRestore--
67 * Reparent the window back to the root window.
69 *--------------------------------------------------------------------
71 void wClientRestore(WWindow * wwin)
73 #if 0
74 int gx, gy;
76 wClientGetGravityOffsets(wwin, &gx, &gy);
77 /* set the position of the frame on screen */
78 wwin->frame_x -= gx * FRAME_BORDER_WIDTH;
79 wwin->frame_y -= gy * FRAME_BORDER_WIDTH;
80 /* if gravity is to the south, account for the border sizes */
81 if (gy > 0)
82 wwin->frame_y += (wwin->frame->top_width + wwin->frame->bottom_width);
83 #endif
84 /* account for titlebar and border */
85 wwin->frame_y += wwin->frame->top_width;
86 wwin->frame_x -= wwin->old_border_width;
87 wwin->frame_y -= wwin->old_border_width;
88 if (HAS_BORDER(wwin)) {
89 wwin->frame_x += FRAME_BORDER_WIDTH;
90 wwin->frame_y += FRAME_BORDER_WIDTH;
93 XSetWindowBorderWidth(dpy, wwin->client_win, wwin->old_border_width);
94 XReparentWindow(dpy, wwin->client_win, wwin->screen_ptr->root_win, wwin->frame_x, wwin->frame_y);
96 /* don't let the window get iconified after restart */
98 if (wwin->flags.shaded)
99 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 wClientSetState(WWindow * wwin, int state, Window icon_win)
116 long data[2];
118 wwin->state = state;
120 data[0] = (unsigned long)state;
121 data[1] = (unsigned long)icon_win;
123 XChangeProperty(dpy, wwin->client_win, _XA_WM_STATE, _XA_WM_STATE, 32,
124 PropModeReplace, (unsigned char *)data, 2);
127 void wClientGetGravityOffsets(WWindow * wwin, int *ofs_x, int *ofs_y)
129 switch (wwin->normal_hints->win_gravity) {
130 case ForgetGravity:
131 case CenterGravity:
132 case StaticGravity:
133 *ofs_x = 0;
134 *ofs_y = 0;
135 break;
136 case NorthWestGravity:
137 *ofs_x = -1;
138 *ofs_y = -1;
139 break;
140 case NorthGravity:
141 *ofs_x = 0;
142 *ofs_y = -1;
143 break;
144 case NorthEastGravity:
145 *ofs_x = 1;
146 *ofs_y = -1;
147 break;
148 case WestGravity:
149 *ofs_x = -1;
150 *ofs_y = 0;
151 break;
152 case EastGravity:
153 *ofs_x = 1;
154 *ofs_y = 0;
155 break;
156 case SouthWestGravity:
157 *ofs_x = -1;
158 *ofs_y = 1;
159 break;
160 case SouthGravity:
161 *ofs_x = 0;
162 *ofs_y = 1;
163 break;
164 case SouthEastGravity:
165 *ofs_x = 1;
166 *ofs_y = 1;
167 break;
171 void wClientConfigure(WWindow * wwin, XConfigureRequestEvent * xcre)
173 XWindowChanges xwc;
174 int nx, ny, nwidth, nheight;
175 int ofs_x, ofs_y;
177 /* printf("configure event: %d %d %d %d\n", xcre->x, xcre->y, xcre->width, xcre->height); */
179 if (wwin == NULL) {
181 * configure a window that was not mapped by us
183 xwc.x = xcre->x;
184 xwc.y = xcre->y;
185 xwc.width = xcre->width;
186 xwc.height = xcre->height;
187 xwc.border_width = xcre->border_width;
188 xwc.stack_mode = xcre->detail;
189 xwc.sibling = xcre->above;
190 XConfigureWindow(dpy, xcre->window, xcre->value_mask, &xwc);
191 return;
193 #ifdef SHAPE
194 if (wShapeSupported) {
195 int junk;
196 unsigned int ujunk;
197 int b_shaped;
199 XShapeSelectInput(dpy, wwin->client_win, ShapeNotifyMask);
200 XShapeQueryExtents(dpy, wwin->client_win, &b_shaped, &junk, &junk,
201 &ujunk, &ujunk, &junk, &junk, &junk, &ujunk, &ujunk);
202 wwin->flags.shaped = b_shaped;
204 #endif
205 if (xcre->value_mask & CWStackMode) {
206 WObjDescriptor *desc;
207 WWindow *sibling;
209 if ((xcre->value_mask & CWSibling) &&
210 (XFindContext(dpy, xcre->above, wWinContext, (XPointer *) & desc) == XCSUCCESS)
211 && (desc->parent_type == WCLASS_WINDOW)) {
212 sibling = desc->parent;
213 xwc.sibling = sibling->frame->core->window;
214 } else {
215 xwc.sibling = xcre->above;
217 xwc.stack_mode = xcre->detail;
218 XConfigureWindow(dpy, wwin->frame->core->window,
219 xcre->value_mask & (CWSibling | CWStackMode), &xwc);
220 /* fix stacking order */
221 RemakeStackList(wwin->screen_ptr);
224 wClientGetGravityOffsets(wwin, &ofs_x, &ofs_y);
226 if (xcre->value_mask & CWBorderWidth) {
227 wwin->old_border_width = xcre->border_width;
230 if (!wwin->flags.shaded) {
231 /* If the window is shaded, wrong height will be set for the window */
232 if (xcre->value_mask & CWX) {
233 nx = xcre->x;
234 /* Subtracting the border makes the window shift by 1 pixel -Dan */
235 /*if (HAS_BORDER(wwin)) {
236 nx -= FRAME_BORDER_WIDTH;
237 } */
238 } else {
239 nx = wwin->frame_x;
242 if (xcre->value_mask & CWY) {
243 ny = xcre->y - ((ofs_y < 0) ? 0 : wwin->frame->top_width);
244 /* Subtracting the border makes the window shift by 1 pixel -Dan */
245 /*if (HAS_BORDER(wwin)) {
246 ny -= FRAME_BORDER_WIDTH;
247 } */
248 } else {
249 ny = wwin->frame_y;
252 if (xcre->value_mask & CWWidth)
253 nwidth = xcre->width;
254 else
255 nwidth = wwin->frame->core->width;
257 if (xcre->value_mask & CWHeight)
258 nheight = xcre->height;
259 else
260 nheight = wwin->frame->core->height - wwin->frame->top_width - wwin->frame->bottom_width;
262 if (nwidth != wwin->old_geometry.width)
263 wwin->flags.maximized &= ~(MAX_HORIZONTAL | MAX_MAXIMUS);
264 if (nheight != wwin->old_geometry.height)
265 wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS);
267 wWindowConfigure(wwin, nx, ny, nwidth, nheight);
268 wwin->old_geometry.x = nx;
269 wwin->old_geometry.y = ny;
270 wwin->old_geometry.width = nwidth;
271 wwin->old_geometry.height = nheight;
275 void wClientSendProtocol(WWindow * wwin, Atom protocol, Time time)
277 XEvent event;
279 event.xclient.type = ClientMessage;
280 event.xclient.message_type = _XA_WM_PROTOCOLS;
281 event.xclient.format = 32;
282 event.xclient.display = dpy;
283 event.xclient.window = wwin->client_win;
284 event.xclient.data.l[0] = protocol;
285 event.xclient.data.l[1] = time;
286 event.xclient.data.l[2] = 0;
287 event.xclient.data.l[3] = 0;
288 XSendEvent(dpy, wwin->client_win, False, NoEventMask, &event);
289 XSync(dpy, False);
292 void wClientKill(WWindow * wwin)
294 XKillClient(dpy, wwin->client_win);
296 XFlush(dpy);
300 *----------------------------------------------------------------------
301 * wClientCheckProperty--
302 * Handles PropertyNotify'es, verifying which property was
303 * changed and updating internal state according to that, like redrawing
304 * the icon title when it is changed.
306 * Side effects:
307 * Depends on the changed property.
309 * TODO: _GNUSTEP_WM_ATTR
310 *----------------------------------------------------------------------
312 void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event)
314 XWindowAttributes attribs;
315 XWMHints *new_hints;
316 int i, g1, g2;
317 char *tmp = NULL;
319 switch (event->atom) {
320 case XA_WM_NAME:
321 if (!wwin->flags.net_has_title) {
322 /* window title was changed */
323 if (!wFetchName(dpy, wwin->client_win, &tmp)) {
324 wWindowUpdateName(wwin, NULL);
325 } else {
326 wWindowUpdateName(wwin, tmp);
328 if (tmp)
329 XFree(tmp);
331 break;
333 case XA_WM_ICON_NAME:
334 if (!wwin->flags.net_has_icon_title) {
335 if (!wwin->icon)
336 break;
337 else {
338 char *new_title;
340 /* icon title was changed */
341 wGetIconName(dpy, wwin->client_win, &new_title);
342 wIconChangeTitle(wwin->icon, new_title);
345 break;
347 case XA_WM_COMMAND:
348 if (wwin->main_window != None) {
349 WApplication *wapp = wApplicationOf(wwin->main_window);
350 char *command;
352 if (!wapp || !wapp->app_icon || wapp->app_icon->docked)
353 break;
355 command = GetCommandForWindow(wwin->main_window);
356 if (command) {
357 if (wapp->app_icon->command)
358 wfree(wapp->app_icon->command);
359 wapp->app_icon->command = command;
362 break;
364 case XA_WM_HINTS:
365 /* WM_HINTS */
367 new_hints = XGetWMHints(dpy, wwin->client_win);
369 /* group leader update
371 * This means that the window is setting the leader after
372 * it was mapped, changing leaders or removing the leader.
374 * Valid state transitions are:
376 * _1 __2
377 * / \ / \
378 * v | v |
379 * (GC) (GC')
380 * / ^ / ^
381 * 3| |4 5| |6
382 * | | | |
383 * v / v /
384 * (G'C) (G'C')
386 * Where G is the window_group hint, C is CLIENT_LEADER property
387 * and ' indicates the hint is unset.
389 * 1,2 - change group leader to new value of window_group
390 * 3 - change leader to value of CLIENT_LEADER
391 * 4 - change leader to value of window_group
392 * 5 - destroy application
393 * 6 - create application
395 if (new_hints && (new_hints->flags & WindowGroupHint)
396 && new_hints->window_group != None) {
397 g2 = 1;
398 } else {
399 g2 = 0;
401 if (wwin->wm_hints && (wwin->wm_hints->flags & WindowGroupHint)
402 && wwin->wm_hints->window_group != None) {
403 g1 = 1;
404 } else {
405 g1 = 0;
408 if (wwin->client_leader) {
409 if (g1 && g2 && wwin->wm_hints->window_group != new_hints->window_group) {
410 i = 1;
411 } else if (g1 && !g2) {
412 i = 3;
413 } else if (!g1 && g2) {
414 i = 4;
415 } else {
416 i = 0;
418 } else {
419 if (g1 && g2 && wwin->wm_hints->window_group != new_hints->window_group) {
420 i = 2;
421 } else if (g1 && !g2) {
422 i = 5;
423 } else if (!g1 && g2) {
424 i = 6;
425 } else {
426 i = 0;
430 /* Handling this may require more work. -Dan */
431 if (wwin->fake_group != NULL) {
432 i = 7;
435 if (wwin->wm_hints)
436 XFree(wwin->wm_hints);
438 wwin->wm_hints = new_hints;
440 /* do action according to state transition */
441 switch (i) {
442 /* 3 - change leader to value of CLIENT_LEADER */
443 case 3:
444 wApplicationDestroy(wApplicationOf(wwin->main_window));
445 wwin->main_window = wwin->client_leader;
446 wwin->group_id = None;
447 wApplicationCreate(wwin);
448 break;
450 /* 1,2,4 - change leader to new value of window_group */
451 case 1:
452 case 2:
453 case 4:
454 wApplicationDestroy(wApplicationOf(wwin->main_window));
455 wwin->main_window = new_hints->window_group;
456 wwin->group_id = wwin->main_window;
457 wApplicationCreate(wwin);
458 break;
460 /* 5 - destroy application */
461 case 5:
462 wApplicationDestroy(wApplicationOf(wwin->main_window));
463 wwin->main_window = None;
464 wwin->group_id = None;
465 break;
467 /* 6 - create application */
468 case 6:
469 wwin->main_window = new_hints->window_group;
470 wwin->group_id = wwin->main_window;
471 wApplicationCreate(wwin);
472 break;
473 /* 7 - we have a fake window group id, so just ignore anything else */
474 case 7:
475 break;
478 if (wwin->wm_hints) {
479 /* update icon */
480 if ((wwin->wm_hints->flags & IconPixmapHint)
481 || (wwin->wm_hints->flags & IconWindowHint)) {
482 WApplication *wapp;
484 if (wwin->flags.miniaturized && wwin->icon) {
485 wIconUpdate(wwin->icon, NULL);
487 wapp = wApplicationOf(wwin->main_window);
488 if (wapp && wapp->app_icon) {
489 wIconUpdate(wapp->app_icon->icon, NULL);
490 wAppIconPaint(wapp->app_icon);
494 if (wwin->wm_hints->flags & UrgencyHint)
495 wwin->flags.urgent = 1;
496 else
497 wwin->flags.urgent = 0;
498 wAppBounceWhileUrgent(wApplicationOf(wwin->main_window));
499 /*} else if (wwin->fake_group!=NULL) {
500 wwin->group_id = wwin->fake_group->leader; */
501 } else {
502 wwin->group_id = None;
504 break;
506 case XA_WM_NORMAL_HINTS:
507 /* normal (geometry) hints */
509 int foo;
510 unsigned bar;
512 XGetWindowAttributes(dpy, wwin->client_win, &attribs);
513 wClientGetNormalHints(wwin, &attribs, False, &foo, &foo, &bar, &bar);
514 /* TODO: should we check for consistency of the current
515 * size against the new geometry hints? */
517 break;
519 case XA_WM_TRANSIENT_FOR:
521 Window new_owner;
522 WWindow *owner;
524 if (!XGetTransientForHint(dpy, wwin->client_win, &new_owner)) {
525 new_owner = None;
526 } else {
527 if (new_owner == 0 || new_owner == wwin->client_win) {
528 new_owner = wwin->screen_ptr->root_win;
531 if (new_owner != wwin->transient_for) {
532 owner = wWindowFor(wwin->transient_for);
533 if (owner) {
534 if (owner->flags.semi_focused) {
535 owner->flags.semi_focused = 0;
536 if ((owner->flags.mapped || owner->flags.shaded)
537 && owner->frame)
538 wFrameWindowPaint(owner->frame);
541 owner = wWindowFor(new_owner);
542 if (owner) {
543 if (!owner->flags.semi_focused) {
544 owner->flags.semi_focused = 1;
545 if ((owner->flags.mapped || owner->flags.shaded)
546 && owner->frame)
547 wFrameWindowPaint(owner->frame);
550 wwin->transient_for = new_owner;
551 if (new_owner == None) {
552 if (WFLAGP(wwin, no_miniaturizable)) {
553 WSETUFLAG(wwin, no_miniaturizable, 0);
554 WSETUFLAG(wwin, no_miniaturize_button, 0);
555 if (wwin->frame)
556 wWindowConfigureBorders(wwin);
558 } else if (!WFLAGP(wwin, no_miniaturizable)) {
559 WSETUFLAG(wwin, no_miniaturizable, 1);
560 WSETUFLAG(wwin, no_miniaturize_button, 1);
561 if (wwin->frame)
562 wWindowConfigureBorders(wwin);
566 break;
568 default:
569 if (event->atom == _XA_WM_PROTOCOLS) {
571 PropGetProtocols(wwin->client_win, &wwin->protocols);
573 WSETUFLAG(wwin, kill_close, !wwin->protocols.DELETE_WINDOW);
575 if (wwin->frame)
576 wWindowUpdateButtonImages(wwin);
578 } else if (event->atom == _XA_WM_COLORMAP_WINDOWS) {
580 GetColormapWindows(wwin);
581 wColormapInstallForWindow(wwin->screen_ptr, wwin);
583 } else if (event->atom == _XA_WINDOWMAKER_MENU) {
584 WApplication *wapp;
586 wapp = wApplicationOf(wwin->main_window);
587 if (wapp) {
588 if (wapp->menu) {
589 /* update menu */
590 /* TODO: remake appmenu update */
591 wAppMenuDestroy(wapp->menu);
593 if (wwin->fake_group) {
594 extern WPreferences wPreferences;
595 WScreen *scr = wwin->screen_ptr;
596 WWindow *foo = scr->focused_window;
597 WFakeGroupLeader *fPtr = wwin->fake_group;
599 wApplicationDestroy(wapp);
600 while (foo) {
601 if (foo->fake_group && foo->fake_group == fPtr) {
602 WSETUFLAG(foo, shared_appicon, 0);
603 foo->fake_group = NULL;
604 if (foo->group_id != None)
605 foo->main_window = foo->group_id;
606 else if (foo->client_leader != None)
607 foo->main_window = foo->client_leader;
608 else if (WFLAGP(foo, emulate_appicon))
609 foo->main_window = foo->client_win;
610 else
611 foo->main_window = None;
612 if (foo->main_window) {
613 wapp = wApplicationCreate(foo);
616 foo = foo->prev;
619 if (fPtr->leader != None)
620 XDestroyWindow(dpy, fPtr->leader);
621 fPtr->retainCount = 0;
622 fPtr->leader = None;
623 fPtr->origLeader = None;
625 wapp = wApplicationOf(wwin->main_window);
626 if (wapp) {
627 wapp->menu = wAppMenuGet(scr, wwin->main_window);
629 if (wPreferences.auto_arrange_icons) {
630 wArrangeIcons(wwin->screen_ptr, True);
632 } else {
633 wapp->menu = wAppMenuGet(wwin->screen_ptr, wwin->main_window);
635 /* make the appmenu be mapped */
636 wSetFocusTo(wwin->screen_ptr, NULL);
637 wSetFocusTo(wwin->screen_ptr, wwin->screen_ptr->focused_window);
639 } else if (event->atom == _XA_GNUSTEP_WM_ATTR) {
640 GNUstepWMAttributes *attr;
642 PropGetGNUstepWMAttr(wwin->client_win, &attr);
644 wWindowUpdateGNUstepAttr(wwin, attr);
646 XFree(attr);
647 } else {
648 wNETWMCheckClientHintChange(wwin, event);
654 *----------------------------------------------------------------------
655 * wClientGetNormalHints--
656 * Get size (normal) hints and a default geometry for the client
657 * window. The hints are also checked for inconsistency. If geometry is
658 * True, the returned data will account for client specified initial
659 * geometry.
661 * Side effects:
662 * normal_hints is filled with valid data.
663 *----------------------------------------------------------------------
665 void
666 wClientGetNormalHints(WWindow * wwin, XWindowAttributes * wattribs, Bool geometry,
667 int *x, int *y, unsigned *width, unsigned *height)
669 int pre_icccm = 0; /* not used */
671 /* find a position for the window */
672 if (!wwin->normal_hints)
673 wwin->normal_hints = XAllocSizeHints();
675 if (!PropGetNormalHints(wwin->client_win, wwin->normal_hints, &pre_icccm)) {
676 wwin->normal_hints->flags = 0;
678 *x = wattribs->x;
679 *y = wattribs->y;
681 *width = wattribs->width;
682 *height = wattribs->height;
684 if (!(wwin->normal_hints->flags & PWinGravity)) {
685 wwin->normal_hints->win_gravity = NorthWestGravity;
687 if (!(wwin->normal_hints->flags & PMinSize)) {
688 wwin->normal_hints->min_width = MIN_WINDOW_SIZE;
689 wwin->normal_hints->min_height = MIN_WINDOW_SIZE;
691 if (!(wwin->normal_hints->flags & PBaseSize)) {
692 wwin->normal_hints->base_width = 0;
693 wwin->normal_hints->base_height = 0;
695 if (!(wwin->normal_hints->flags & PMaxSize)) {
696 wwin->normal_hints->max_width = wwin->screen_ptr->scr_width * 2;
697 wwin->normal_hints->max_height = wwin->screen_ptr->scr_height * 2;
700 /* some buggy apps set weird hints.. */
701 if (wwin->normal_hints->min_width <= 0)
702 wwin->normal_hints->min_width = MIN_WINDOW_SIZE;
704 if (wwin->normal_hints->min_height <= 0)
705 wwin->normal_hints->min_height = MIN_WINDOW_SIZE;
707 if (wwin->normal_hints->max_width < wwin->normal_hints->min_width)
708 wwin->normal_hints->max_width = wwin->normal_hints->min_width;
710 if (wwin->normal_hints->max_height < wwin->normal_hints->min_height)
711 wwin->normal_hints->max_height = wwin->normal_hints->min_height;
713 if (!(wwin->normal_hints->flags & PResizeInc)) {
714 wwin->normal_hints->width_inc = 1;
715 wwin->normal_hints->height_inc = 1;
716 } else {
717 if (wwin->normal_hints->width_inc <= 0)
718 wwin->normal_hints->width_inc = 1;
719 if (wwin->normal_hints->height_inc <= 0)
720 wwin->normal_hints->height_inc = 1;
723 if (wwin->normal_hints->flags & PAspect) {
724 if (wwin->normal_hints->min_aspect.x < 1)
725 wwin->normal_hints->min_aspect.x = 1;
726 if (wwin->normal_hints->min_aspect.y < 1)
727 wwin->normal_hints->min_aspect.y = 1;
729 if (wwin->normal_hints->max_aspect.x < 1)
730 wwin->normal_hints->max_aspect.x = 1;
731 if (wwin->normal_hints->max_aspect.y < 1)
732 wwin->normal_hints->max_aspect.y = 1;
735 if (wwin->normal_hints->min_height > wwin->normal_hints->max_height) {
736 wwin->normal_hints->min_height = wwin->normal_hints->max_height;
738 if (wwin->normal_hints->min_width > wwin->normal_hints->max_width) {
739 wwin->normal_hints->min_width = wwin->normal_hints->max_width;
741 #ifdef IGNORE_PPOSITION
742 wwin->normal_hints->flags &= ~PPosition;
743 #endif
745 if (pre_icccm && !wwin->screen_ptr->flags.startup && geometry) {
746 if (wwin->normal_hints->flags & (USPosition | PPosition)) {
747 *x = wwin->normal_hints->x;
748 *y = wwin->normal_hints->y;
750 if (wwin->normal_hints->flags & (USSize | PSize)) {
751 *width = wwin->normal_hints->width;
752 *height = wwin->normal_hints->height;
757 void GetColormapWindows(WWindow * wwin)
759 #ifndef NO_CRASHES
760 if (wwin->cmap_windows) {
761 XFree(wwin->cmap_windows);
764 wwin->cmap_windows = NULL;
765 wwin->cmap_window_no = 0;
767 if (!XGetWMColormapWindows(dpy, wwin->client_win, &(wwin->cmap_windows), &(wwin->cmap_window_no))
768 || !wwin->cmap_windows) {
769 wwin->cmap_window_no = 0;
770 wwin->cmap_windows = NULL;
772 #endif