2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * (c) Copyright 1989, 1990, 1991, 1992 OPEN SOFTWARE FOUNDATION, INC.
31 * (c) Copyright 1987,1988,1989,1990,1991,1993 HEWLETT-PACKARD COMPANY */
41 #include <X11/cursorfont.h>
51 * include extern functions
56 #include "WmGraphics.h"
57 #include "WmIconBox.h"
59 #include "WmWinInfo.h"
66 int external; /* bevel from frame to root */
67 int join; /* bevel between frame components */
68 int internal; /* bevel from frame to client */
72 Single_Bevel_Count top;
73 Single_Bevel_Count bottom;
77 * "Worst case" bevel counts for frame pieces: this structure is
78 * indexed by definitions in WmGlobal.h. Edit if they change!
80 * These counts are multiplied by the internal, external,
81 * and join bevel resources to determine the sizes of dynamic
82 * data structures to allocate.
85 static Bevel_Count Bevels[] =
87 { {0, 0, 0}, {0, 0, 0} }, /* FRAME_NONE */
88 { {0, 0, 0}, {0, 0, 0} }, /* FRAME_CLIENT */
89 { {0, 4, 0}, {0, 3, 1} }, /* FRAME_SYSTEM */
90 { {0, 2, 0}, {0, 1, 1} }, /* FRAME_TITLE */
91 { {0, 4, 0}, {0, 3, 1} }, /* FRAME_MINIMIZE */
92 { {0, 4, 0}, {0, 3, 1} }, /* FRAME_MAXIMIZE */
93 { {2, 0, 0}, {0, 2, 2} }, /* FRAME_RESIZE_NW */
94 { {1, 1, 0}, {0, 1, 1} }, /* FRAME_RESIZE_N */
95 { {1, 1, 1}, {1, 1, 1} }, /* FRAME_RESIZE_NE */
96 { {0, 1, 1}, {1, 1, 0} }, /* FRAME_RESIZE_E */
97 { {0, 2, 2}, {2, 0, 0} }, /* FRAME_RESIZE_SE */
98 { {0, 1, 1}, {1, 1, 0} }, /* FRAME_RESIZE_S */
99 { {1, 1, 1}, {1, 1, 1} }, /* FRAME_RESIZE_SW */
100 { {1, 1, 0}, {0, 1, 1} } /* FRAME_RESIZE_W */
108 /*************************************<->*************************************
115 * Build a decorated frame for a client window and reparent the client
116 * window to the frame.
121 * pcd - pointer to client data structure for window
123 * << Need the following member data >>
126 * fields from WM_HINTS property
127 * fields from WM_CLASS property
128 * fields from WM_NORMAL_HINTS property
133 * fields from WM_NAME property
142 * This will create a top level shell (frame), fill in the appropriate
143 * decoration, and reparent the window (in *pcd) to the frame.
145 *************************************<->***********************************/
147 Boolean FrameWindow (ClientData *pcd)
149 if (!ConstructFrame (pcd)) /* window hierarchy for frame */
154 GenerateFrameDisplayLists (pcd); /* graphics for frame decoration */
156 AdoptClient(pcd); /* reparent the window */
159 /* shape the frame */
160 if (wmGD.hasShape && pcd->wShaped)
164 #endif /* NO_SHAPE */
168 } /* END OF FUNCTION FrameWindow */
172 /*************************************<->*************************************
174 * FrameExposureProc (pcd)
179 * Repaint the frame graphics
184 * pcd - pointer to client data
193 * Assumes that the display lists for the frame graphics are already
196 *************************************<->***********************************/
198 void FrameExposureProc (ClientData *pcd)
201 Window win = pcd->clientFrameWin;
203 /* use "active" GCs if we have keyboard focus */
205 if (pcd == wmGD.keyboardFocus) {
206 topGC = CLIENT_APPEARANCE(pcd).activeTopShadowGC;
207 botGC = CLIENT_APPEARANCE(pcd).activeBottomShadowGC;
210 topGC = CLIENT_APPEARANCE(pcd).inactiveTopShadowGC;
211 botGC = CLIENT_APPEARANCE(pcd).inactiveBottomShadowGC;
214 /* draw the frame decoration */
216 if (pcd->pclientTopShadows) {
217 XFillRectangles (DISPLAY,
220 pcd->pclientTopShadows->prect,
221 pcd->pclientTopShadows->used);
224 if (pcd->pclientBottomShadows) {
225 XFillRectangles (DISPLAY,
228 pcd->pclientBottomShadows->prect,
229 pcd->pclientBottomShadows->used);
232 if (DECOUPLE_TITLE_APPEARANCE(pcd) &&
233 (pcd->decor & MWM_DECOR_TITLE))
235 if (pcd == wmGD.keyboardFocus) {
236 topGC = CLIENT_TITLE_APPEARANCE(pcd).activeTopShadowGC;
237 botGC = CLIENT_TITLE_APPEARANCE(pcd).activeBottomShadowGC;
240 topGC = CLIENT_TITLE_APPEARANCE(pcd).inactiveTopShadowGC;
241 botGC = CLIENT_TITLE_APPEARANCE(pcd).inactiveBottomShadowGC;
244 if (pcd->pclientTitleTopShadows) {
245 XFillRectangles (DISPLAY,
248 pcd->pclientTitleTopShadows->prect,
249 pcd->pclientTitleTopShadows->used);
252 if (pcd->pclientTitleBottomShadows) {
253 XFillRectangles (DISPLAY,
256 pcd->pclientTitleBottomShadows->prect,
257 pcd->pclientTitleBottomShadows->used);
261 /* draw the title bar text */
262 DrawWindowTitle(pcd, False);
267 /*************************************<->*************************************
269 * BaseWinExposureProc (pcd)
274 * Repaint the beveled matte graphics if any.
279 * pcd - pointer to client data
288 * Assumes that the display lists for the matte graphics are already
291 *************************************<->***********************************/
293 void BaseWinExposureProc (ClientData *pcd)
295 /* bevel the matte (if there is one) */
297 if (pcd->matteWidth > 0) {
299 if (pcd->pclientMatteTopShadows) {
300 XFillRectangles (DISPLAY,
302 pcd->clientMatteTopShadowGC,
303 pcd->pclientMatteTopShadows->prect,
304 pcd->pclientMatteTopShadows->used);
307 if (pcd->pclientMatteBottomShadows) {
308 XFillRectangles (DISPLAY,
310 pcd->clientMatteBottomShadowGC,
311 pcd->pclientMatteBottomShadows->prect,
312 pcd->pclientMatteBottomShadows->used);
319 /*************************************<->*************************************
321 * ConstructFrame (pcd)
326 * Construct the window hierarchy for the frame
331 * pcd - pointer to client data record
341 *************************************<->***********************************/
343 Boolean ConstructFrame (ClientData *pcd)
345 unsigned long decoration = pcd->decor;
346 unsigned int wclass; /* window class */
347 unsigned long attr_mask;
348 XSetWindowAttributes window_attribs;
351 /* set frame information */
355 if (!AllocateFrameDisplayLists(pcd)) {
359 /* create frame window */
361 attr_mask = CWEventMask;
362 window_attribs.event_mask = (ButtonPressMask | ButtonReleaseMask |
363 SELECT_BUTTON_MOTION_MASK |
364 DMANIP_BUTTON_MOTION_MASK |
367 if ((wmGD.keyboardFocusPolicy == KEYBOARD_FOCUS_POINTER) ||
368 (wmGD.colormapFocusPolicy == CMAP_FOCUS_POINTER))
370 window_attribs.event_mask |= EnterWindowMask | LeaveWindowMask;
374 * Use background pixmap if one is specified, otherwise set the
375 * appropriate background color.
378 if (CLIENT_APPEARANCE(pcd).backgroundPixmap)
380 attr_mask |= CWBackPixmap;
381 window_attribs.background_pixmap =
382 CLIENT_APPEARANCE(pcd).backgroundPixmap;
386 attr_mask |= CWBackPixel;
387 window_attribs.background_pixel = CLIENT_APPEARANCE(pcd).background;
390 attr_mask |= CWCursor;
391 window_attribs.cursor = wmGD.workspaceCursor;
393 frmY = pcd->frameInfo.y;
394 frmX = pcd->frameInfo.x;
396 if (CLIENT_APPEARANCE(pcd).saveUnder &&
397 WmGetWindowAttributes (pcd->client) &&
398 wmGD.windowAttributes.save_under)
400 attr_mask |= CWSaveUnder;
401 window_attribs.save_under = True;
404 pcd->clientFrameWin = XCreateWindow(DISPLAY,
406 SCREEN_FOR_CLIENT(pcd)),
409 pcd->frameInfo.width,
410 pcd->frameInfo.height, 0,
411 CopyFromParent,InputOutput,CopyFromParent,
412 attr_mask, &window_attribs);
414 /* create resizing windows with cursors*/
415 if (SHOW_RESIZE_CURSORS(pcd) && (decoration & MWM_DECOR_RESIZEH)) {
416 CreateStretcherWindows (pcd);
420 * Create title bar window. If the title bar has its own appearance,
421 * or if there is no border around the client area,
422 * then we need to create an input/output window to draw in. Otherwise
423 * we can use an input-only window (to clip the corner resize windows).
425 if (decoration & MWM_DECOR_TITLE) {
427 attr_mask = CWCursor;
428 window_attribs.cursor = wmGD.workspaceCursor;
430 if (DECOUPLE_TITLE_APPEARANCE(pcd))
432 /* title bar has a different appearance than rest of frame */
433 wclass = InputOutput;
435 /* need to handle exposure events */
436 attr_mask |= CWEventMask;
437 window_attribs.event_mask = ExposureMask;
440 * Use background pixmap if one is specified, otherwise set the
441 * appropriate background color.
444 if (CLIENT_TITLE_APPEARANCE(pcd).backgroundPixmap)
446 attr_mask |= CWBackPixmap;
447 window_attribs.background_pixmap =
448 CLIENT_TITLE_APPEARANCE(pcd).backgroundPixmap;
452 attr_mask |= CWBackPixel;
453 window_attribs.background_pixel =
454 CLIENT_TITLE_APPEARANCE(pcd).background;
459 /* title bar has same appearance as rest of frame */
463 pcd->clientTitleWin = XCreateWindow(DISPLAY, pcd->clientFrameWin,
464 (int) pcd->frameInfo.upperBorderWidth,
465 (int) pcd->frameInfo.upperBorderWidth,
466 pcd->frameInfo.width -
467 2*pcd->frameInfo.upperBorderWidth,
468 pcd->frameInfo.titleBarHeight,
470 CopyFromParent,wclass,CopyFromParent,
471 attr_mask, &window_attribs);
474 /* generate gadget position search structure */
475 if (!AllocateGadgetRectangles (pcd))
477 ComputeGadgetRectangles (pcd);
481 * Create base window for reparenting. Save rectangle data for use
482 * in event dispatching.
485 window_attribs.event_mask = (SubstructureRedirectMask |
486 SubstructureNotifyMask |
488 if (pcd->matteWidth > 0)
490 window_attribs.event_mask |= ExposureMask;
491 window_attribs.background_pixel = pcd->matteBackground;
495 window_attribs.background_pixel =
496 CLIENT_TITLE_APPEARANCE(pcd).background;
499 attr_mask = CWBackPixel | CWEventMask;
501 pcd->clientBaseWin = XCreateWindow(DISPLAY, pcd->clientFrameWin,
504 BaseWindowWidth (pcd),
505 BaseWindowHeight (pcd),
507 CopyFromParent,InputOutput,CopyFromParent,
508 attr_mask, &window_attribs);
510 /* map all subwindows of client frame */
512 XMapSubwindows(DISPLAY, pcd->clientFrameWin);
519 /*************************************<->*************************************
521 * GenerateFrameDisplayLists (pcd)
526 * Set up the graphic decorations for the frame
531 * pcd - pointer to client data record
541 * o This must be called after ConstructFrame to insure that the memory
542 * for the rectangles has been allocated.
543 * o If cnum values for StretcherCorner change, also change
544 * StretcherCorner() in WmGraphics.c
545 * o The variable internalBevel sets the depth of shadowing from the
546 * frame to the client area.
547 * o The variable insideBevel is used to decide how deep the bevel is
548 * immediately inside the frame. This may not be internalBevel if
549 * there's a matte, for example.
550 * o The variable diffBevel stores the difference between insideBevel
551 * and what's needed so the bottom of the title bar is correctly
552 * beveled down to the client.
554 *************************************<->***********************************/
556 void GenerateFrameDisplayLists (ClientData *pcd)
558 unsigned long decoration = pcd->decor;
559 int matte_width = pcd->matteWidth;
561 int insideBevel, inset, diffBevel;
562 unsigned int nTitleBevel, sTitleBevel, eTitleBevel, wTitleBevel;
563 unsigned int meTitleBevel, inWidth;
564 int x, y, xAdj = 0, yAdj = 0;
565 unsigned int width, height;
566 RList *prlTop = NULL, *prlBot = NULL;
571 /* zero out part counts */
573 if (pcd->pclientTopShadows)
574 pcd->pclientTopShadows->used = 0;
575 if (pcd->pclientBottomShadows)
576 pcd->pclientBottomShadows->used = 0;
578 if (pcd->pclientTitleTopShadows)
579 pcd->pclientTitleTopShadows->used = 0;
580 if (pcd->pclientTitleBottomShadows)
581 pcd->pclientTitleBottomShadows->used = 0;
583 if (pcd->pclientMatteTopShadows)
584 pcd->pclientMatteTopShadows->used = 0;
585 if (pcd->pclientMatteBottomShadows)
586 pcd->pclientMatteBottomShadows->used = 0;
588 /* adjust inside bevel of gadgetry if there's a matte */
589 if ((wmGD.frameStyle == WmRECESSED) && (matte_width > 0))
590 insideBevel = JOIN_BEVEL(pcd);
592 insideBevel = pcd->internalBevel;
594 diffBevel = insideBevel - 1;
596 if (decoration & MWM_DECOR_RESIZEH)
598 /* adjust part width/heights if no title bar */
599 if ((pcd->internalBevel > 1) && !(decoration & MWM_DECOR_TITLE))
609 * Draw the stretchers. If the horizontal or vertical pieces
610 * get "too small", then don't draw them at all.
612 GetFramePartInfo (pcd, FRAME_RESIZE_NW, &x, &y, &width, &height);
613 StretcherCorner (pcd->pclientTopShadows, /* NW */
614 pcd->pclientBottomShadows,
617 pcd->frameInfo.upperBorderWidth - inset,
620 GetFramePartInfo (pcd, FRAME_RESIZE_N, &x, &y, &width, &height);
622 BevelRectangle (pcd->pclientTopShadows, /* N */
623 pcd->pclientBottomShadows,
625 width, height - inset,
626 2, 1, ((wmGD.frameStyle == WmSLAB) ? 0 : 1), 1);
628 GetFramePartInfo (pcd, FRAME_RESIZE_NE, &x, &y, &width, &height);
629 StretcherCorner (pcd->pclientTopShadows,
630 pcd->pclientBottomShadows,
633 pcd->frameInfo.upperBorderWidth - inset, width, height);
635 GetFramePartInfo (pcd, FRAME_RESIZE_E, &x, &y, &width, &height);
637 BevelRectangle (pcd->pclientTopShadows, /* E */
638 pcd->pclientBottomShadows,
640 width-diffBevel, height,
641 1, 2, 1, ((wmGD.frameStyle == WmSLAB) ? 0 : 1));
643 GetFramePartInfo (pcd, FRAME_RESIZE_SE, &x, &y, &width, &height);
644 StretcherCorner (pcd->pclientTopShadows, /* SE */
645 pcd->pclientBottomShadows,
648 pcd->frameInfo.upperBorderWidth-inset, width, height);
650 GetFramePartInfo (pcd, FRAME_RESIZE_S, &x, &y, &width, &height);
652 BevelRectangle (pcd->pclientTopShadows, /* S */
653 pcd->pclientBottomShadows,
655 width, height-diffBevel,
656 ((wmGD.frameStyle == WmSLAB) ? 0 : 1), 1, 2, 1);
658 GetFramePartInfo (pcd, FRAME_RESIZE_SW, &x, &y, &width, &height);
659 StretcherCorner (pcd->pclientTopShadows, /* SW */
660 pcd->pclientBottomShadows,
663 pcd->frameInfo.upperBorderWidth-inset, width, height);
665 GetFramePartInfo (pcd, FRAME_RESIZE_W, &x, &y, &width, &height);
666 if ((int) height > 0)
667 BevelRectangle (pcd->pclientTopShadows, /* W */
668 pcd->pclientBottomShadows,
670 width-diffBevel, height,
671 1, ((wmGD.frameStyle == WmSLAB) ? 0 : 1), 1, 2);
676 * Draw second inside bevel level. This goes just around the
677 * client area under the title bar.
679 BevelRectangle (pcd->pclientBottomShadows, /* inside */
680 pcd->pclientTopShadows,
681 (int) (pcd->frameInfo.lowerBorderWidth-diffBevel),
682 (int) (pcd->clientOffset.y - diffBevel),
683 pcd->frameInfo.width -
684 2*pcd->frameInfo.lowerBorderWidth +
686 pcd->frameInfo.height - pcd->clientOffset.y -
687 pcd->frameInfo.lowerBorderWidth +
689 (unsigned int) diffBevel, (unsigned int) diffBevel,
690 (unsigned int) diffBevel, (unsigned int) diffBevel);
693 else if (decoration & MWM_DECOR_BORDER)
696 /* produce default border with no resizing functions */
698 BevelRectangle (pcd->pclientTopShadows, /* outside */
699 pcd->pclientBottomShadows,
701 pcd->frameInfo.width, pcd->frameInfo.height,
702 FRAME_EXTERNAL_SHADOW_WIDTH,
703 FRAME_EXTERNAL_SHADOW_WIDTH,
704 FRAME_EXTERNAL_SHADOW_WIDTH,
705 FRAME_EXTERNAL_SHADOW_WIDTH);
707 if ((pcd->internalBevel > 1) &&
709 (decoration & MWM_DECOR_TITLE)) {
711 * Need to do special beveling around the inside of the
712 * client area separately from around title area.
714 GetFramePartInfo (pcd, FRAME_TITLE, &x, &y, &width, &height);
715 inset = 1 + (pcd->frameInfo.lowerBorderWidth -
716 pcd->frameInfo.upperBorderWidth);
717 BevelRectangle (pcd->pclientBottomShadows,
718 pcd->pclientTopShadows,
719 (int) (pcd->frameInfo.lowerBorderWidth-inset),
720 (int) (pcd->frameInfo.lowerBorderWidth-inset),
721 pcd->frameInfo.width -
722 2*pcd->frameInfo.lowerBorderWidth + 2*inset,
723 pcd->frameInfo.height -
724 2*pcd->frameInfo.lowerBorderWidth + 2*inset,
727 BevelRectangle (pcd->pclientBottomShadows, /* inside */
728 pcd->pclientTopShadows,
729 (int) (pcd->frameInfo.lowerBorderWidth-diffBevel),
730 pcd->clientOffset.y - diffBevel,
731 pcd->frameInfo.width -
732 2*pcd->frameInfo.lowerBorderWidth +
734 pcd->frameInfo.height - pcd->clientOffset.y -
735 pcd->frameInfo.lowerBorderWidth + 2*diffBevel,
736 (unsigned int)diffBevel, (unsigned int)diffBevel,
737 (unsigned int)diffBevel, (unsigned int)diffBevel);
741 if((pcd->dtwmBehaviors & DtWM_BEHAVIOR_PANEL) &&
742 (pcd->clientDecoration == WM_DECOR_BORDER))
746 BevelRectangle (pcd->pclientBottomShadows, /* inside */
747 pcd->pclientTopShadows,
748 (int)(pcd->frameInfo.lowerBorderWidth-insideBevel),
749 (int)(pcd->frameInfo.lowerBorderWidth-insideBevel),
750 pcd->frameInfo.width -
751 2*pcd->frameInfo.lowerBorderWidth +
753 pcd->frameInfo.height -
754 2*pcd->frameInfo.lowerBorderWidth +
756 (unsigned int)insideBevel,
757 (unsigned int)insideBevel,
758 (unsigned int)insideBevel,
759 (unsigned int)insideBevel);
767 * set bevels for title bar and parts
769 if (decoration & (MWM_DECOR_RESIZEH | MWM_DECOR_BORDER))
771 nTitleBevel = JOIN_BEVEL(pcd); /* north side of title */
772 if (wmGD.frameStyle == WmSLAB)
774 sTitleBevel = JOIN_BEVEL(pcd); /* south side of title */
778 sTitleBevel = insideBevel; /* south side of title */
780 eTitleBevel = JOIN_BEVEL(pcd); /* east side of title */
781 wTitleBevel = JOIN_BEVEL(pcd); /* west side of title */
782 meTitleBevel = JOIN_BEVEL(pcd); /* btw Minimize, Maximize */
786 /* borderless window */
788 nTitleBevel = EXTERNAL_BEVEL(pcd);
789 if (wmGD.frameStyle == WmSLAB)
791 sTitleBevel = (matte_width > 0) ? JOIN_BEVEL(pcd) :
796 sTitleBevel = (matte_width > 0) ? insideBevel : EXTERNAL_BEVEL(pcd);
798 eTitleBevel = (decoration & (MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE))?
799 JOIN_BEVEL(pcd) : EXTERNAL_BEVEL(pcd);
800 wTitleBevel = (decoration & MWM_DECOR_MENU) ?
801 JOIN_BEVEL(pcd) : EXTERNAL_BEVEL(pcd);
803 /* beveling east of minimize */
804 meTitleBevel = (decoration & (MWM_DECOR_MAXIMIZE)) ?
805 JOIN_BEVEL(pcd) : EXTERNAL_BEVEL(pcd);
809 if (decoration & MWM_DECOR_TITLE)
812 * Use a different set of rectangles if title appearance
813 * is different from the rest of the frame.
815 if (DECOUPLE_TITLE_APPEARANCE(pcd))
817 prlTop = pcd->pclientTitleTopShadows;
818 prlBot = pcd->pclientTitleBottomShadows;
819 xAdj = yAdj = pcd->frameInfo.upperBorderWidth;
823 prlTop = pcd->pclientTopShadows;
824 prlBot = pcd->pclientBottomShadows;
829 GetFramePartInfo (pcd, FRAME_TITLE, &x, &y, &width, &height);
830 if (pcd->decorFlags & TITLE_DEPRESSED) {
831 /* show depressed title gadget */
832 GetDepressInfo (pcd, FRAME_TITLE, &jX, &jY, &jW, &jH,
834 BevelDepressedRectangle (prlTop, prlBot,
835 x-xAdj, y-yAdj, width, height,
836 nTitleBevel, eTitleBevel,
837 sTitleBevel, wTitleBevel, inWidth);
840 /* show normal title gadget */
841 BevelRectangle (prlTop, prlBot,
842 x-xAdj, y-yAdj, width, height,
843 nTitleBevel, eTitleBevel,
844 sTitleBevel, wTitleBevel);
848 if (decoration & MWM_DECOR_MENU) {
850 GetFramePartInfo (pcd, FRAME_SYSTEM, &x, &y, &width, &height);
851 if (pcd->decorFlags & SYSTEM_DEPRESSED) {
852 /* show depressed system gadget */
853 GetDepressInfo (pcd, FRAME_SYSTEM, &jX, &jY, &jW, &jH,
855 BevelDepressedRectangle (prlTop, prlBot,
856 x-xAdj, y-yAdj, width, height,
857 nTitleBevel, wTitleBevel,
858 sTitleBevel, nTitleBevel, inWidth);
862 /* show normal system gadget */
863 BevelRectangle (prlTop, prlBot,
864 x-xAdj, y-yAdj, width, height,
865 nTitleBevel, wTitleBevel,
866 sTitleBevel, nTitleBevel);
871 BevelSystemButton (prlTop, prlBot,
872 x-xAdj, y-yAdj, width, height);
875 if (decoration & MWM_DECOR_MINIMIZE) {
876 GetFramePartInfo (pcd, FRAME_MINIMIZE, &x, &y, &width, &height);
878 if (pcd->decorFlags & MINIMIZE_DEPRESSED) {
879 /* show depressed minimize gadget */
880 GetDepressInfo (pcd, FRAME_MINIMIZE, &jX, &jY, &jW, &jH,
882 BevelDepressedRectangle (prlTop, prlBot,
883 x-xAdj, y-yAdj, width, height,
884 nTitleBevel, meTitleBevel,
885 sTitleBevel, eTitleBevel, inWidth);
888 /* show normal minimize gadget */
889 BevelRectangle (prlTop, prlBot,
890 x-xAdj, y-yAdj, width, height,
891 nTitleBevel, meTitleBevel,
892 sTitleBevel, eTitleBevel);
896 BevelMinimizeButton(prlTop, /* minimize icon */
898 x-xAdj, y-yAdj, height);
901 if (decoration & MWM_DECOR_MAXIMIZE) {
902 GetFramePartInfo (pcd, FRAME_MAXIMIZE, &x, &y, &width, &height);
905 if (pcd->decorFlags & MAXIMIZE_DEPRESSED) {
906 /* show depressed maximize gadget */
907 GetDepressInfo (pcd, FRAME_MAXIMIZE, &jX, &jY, &jW, &jH,
909 BevelDepressedRectangle (prlTop, prlBot,
910 x-xAdj, y-yAdj, width, height,
911 nTitleBevel, nTitleBevel,
912 sTitleBevel, eTitleBevel, inWidth);
915 /* show normal maximize gadget */
916 BevelRectangle (prlTop, prlBot,
917 x-xAdj, y-yAdj, width, height,
918 nTitleBevel, nTitleBevel,
919 sTitleBevel, eTitleBevel);
922 /* maximize icon - in or out depending on client state */
923 if (pcd->maxConfig) {
924 BevelMaximizeButton(prlBot,
926 x-xAdj, y-yAdj, height);
929 BevelMaximizeButton(prlTop,
931 x-xAdj, y-yAdj, height);
936 /* draw the client matte (this is in the base window!!!) */
938 if (matte_width > 0) {
939 unsigned int mWidth, mHeight, exMatteBevel, tMatteBevel;
941 mWidth = BaseWindowWidth (pcd);
942 mHeight = BaseWindowHeight (pcd);
944 if (decoration & (MWM_DECOR_RESIZEH | MWM_DECOR_BORDER))
946 exMatteBevel = JOIN_BEVEL(pcd);
947 tMatteBevel = JOIN_BEVEL(pcd);
951 exMatteBevel = EXTERNAL_BEVEL(pcd);
952 tMatteBevel = (decoration & MWM_DECOR_TITLE) ?
953 JOIN_BEVEL(pcd) : EXTERNAL_BEVEL(pcd);
956 /* set up beveling around the edges */
958 BevelRectangle (pcd->pclientMatteTopShadows,
959 pcd->pclientMatteBottomShadows,
964 tMatteBevel, exMatteBevel,
965 exMatteBevel, exMatteBevel);
967 /* reversed beveling on inside rectange ! */
969 BevelRectangle ( pcd->pclientMatteBottomShadows,
970 pcd->pclientMatteTopShadows,
971 matte_width - pcd->internalBevel,
972 matte_width - pcd->internalBevel,
973 mWidth - 2*matte_width + 2*pcd->internalBevel,
974 mHeight - 2*matte_width + 2*pcd->internalBevel,
975 (unsigned int) pcd->internalBevel,
976 (unsigned int) pcd->internalBevel,
977 (unsigned int) pcd->internalBevel,
978 (unsigned int) pcd->internalBevel);
983 /*************************************<->*************************************
990 * Reparent the client window to the window frame
995 * pcd - pointer to client data record
1006 *************************************<->***********************************/
1008 void AdoptClient (ClientData *pcd)
1010 XWindowChanges windowChanges;
1013 /* Put the window in the window manager's save set */
1015 if (!(pcd->clientFlags & CLIENT_WM_CLIENTS))
1017 XChangeSaveSet (DISPLAY, pcd->client, SetModeInsert);
1018 pcd->clientFlags |= CLIENT_IN_SAVE_SET;
1022 * set window geometry to be consistent with what we believe
1024 mask = CWWidth | CWHeight;
1025 windowChanges.width = pcd->clientWidth;
1026 windowChanges.height = pcd->clientHeight;
1029 * strip off previous window border if we're adding our own border
1032 if ( (pcd->decor & (MWM_DECOR_RESIZEH | MWM_DECOR_BORDER)) ||
1033 (pcd->matteWidth > 0) )
1035 mask |= CWBorderWidth;
1036 windowChanges.border_width = 0;
1039 XConfigureWindow (DISPLAY, pcd->client, mask, &windowChanges);
1042 /* shape our frame to match that of the client's window */
1045 int xws, yws, xbs, ybs;
1046 unsigned wws, hws, wbs, hbs;
1047 int boundingShaped, clipShaped;
1049 XShapeSelectInput (DISPLAY, pcd->client, ShapeNotifyMask);
1050 XShapeQueryExtents (DISPLAY, pcd->client,
1051 &boundingShaped, &xws, &yws, &wws, &hws,
1052 &clipShaped, &xbs, &ybs, &wbs, &hbs);
1053 pcd->wShaped = boundingShaped;
1055 #endif /* NO_SHAPE */
1056 /* reparent the window to the base window */
1058 XReparentWindow (DISPLAY, pcd->client, pcd->clientBaseWin,
1061 pcd->clientFlags |= CLIENT_REPARENTED;
1063 } /* END OF FUNCTION AdoptClient */
1067 /*************************************<->*************************************
1069 * GetTextBox (pcd, pBox)
1074 * Gets the rectangle that the text should fit into in the title bar
1079 * pcd - pointer to client data
1080 * pBox - pointer to an XRectangle structure that gets return data
1084 * pBox - data is returned here
1089 *************************************<->***********************************/
1091 void GetTextBox (ClientData *pcd, XRectangle *pBox)
1094 unsigned int width,height;
1095 #if defined(DT_LEFT_JUSTIFIED_TITLE)
1096 Dimension textWidth;
1098 XmFontList fontList;
1101 /* get size of title area */
1103 if (!GetFramePartInfo (pcd, FRAME_TITLE, &x, &y, &width, &height))
1105 /* no title area !!! */
1113 /* adjust for shadowing and allow for some padding around the edges */
1114 x += WM_TOP_TITLE_SHADOW + WM_TOP_TITLE_PADDING;
1115 y += WM_TOP_TITLE_SHADOW + WM_TOP_TITLE_PADDING;
1117 width -= WM_TOP_TITLE_SHADOW + WM_BOTTOM_TITLE_SHADOW +
1118 WM_TOP_TITLE_PADDING + WM_BOTTOM_TITLE_PADDING;
1119 height -= WM_TOP_TITLE_SHADOW + WM_BOTTOM_TITLE_SHADOW +
1120 WM_TOP_TITLE_PADDING + WM_BOTTOM_TITLE_PADDING;
1122 #ifdef DT_LEFT_JUSTIFIED_TITLE
1123 if (wmGD.frameStyle == WmSLAB)
1126 * We left justify the title in this style.
1127 * To keep it a little neat, we offset the title from
1128 * the left edge just a little (half the title height).
1129 * See if we have room to do this.
1131 if (DECOUPLE_TITLE_APPEARANCE(pcd))
1132 fontList = CLIENT_TITLE_APPEARANCE(pcd).fontList;
1134 fontList = CLIENT_APPEARANCE(pcd).fontList;
1135 textWidth = XmStringWidth(fontList, pcd->clientTitle);
1137 offset = TitleBarHeight(pcd)/2;
1139 if ((textWidth + offset) <= width)
1141 /* We have plenty of room, do the offset */
1145 else if ((short) (width - textWidth) > 0)
1147 /* We don't have enough room to do our usual offset,
1148 * but if we reduce the offset, the text won't get
1151 offset = (width - textWidth) / 2;
1157 #endif /* DT_LEFT_JUSTIFIED_TITLE */
1158 /* return position and size */
1161 pBox->width = width;
1162 pBox->height = height;
1169 /*************************************<->*************************************
1171 * DrawWindowTitle (pcd, eraseFirst)
1176 * Overwrites or replaces the client's title text in the
1177 * title bar of the frame.
1182 * pcd - pointer to client data
1183 * eraseFirst - if true, then the old title is erased first
1191 * o Assumes 8-bit text for now.
1194 *************************************<->***********************************/
1196 void DrawWindowTitle (ClientData *pcd, Boolean eraseFirst)
1199 unsigned long decoration = pcd->decor;
1202 XmFontList fontList;
1204 /* make sure there is a title bar first */
1205 if (!(decoration & MWM_DECOR_TITLE))
1208 if (DECOUPLE_TITLE_APPEARANCE(pcd))
1210 /* use "active" GC if we have keyboard focus */
1211 if (pcd == wmGD.keyboardFocus) {
1212 clientGC = CLIENT_TITLE_APPEARANCE(pcd).activeGC;
1215 clientGC = CLIENT_TITLE_APPEARANCE(pcd).inactiveGC;
1218 /* get the area that the text must fit in */
1219 GetTextBox (pcd, &textBox);
1221 /* adjust position to be relative to titlebar window, not frame */
1222 textBox.x -= (short) pcd->frameInfo.upperBorderWidth;
1223 textBox.y -= (short) pcd->frameInfo.upperBorderWidth;
1225 win = pcd->clientTitleWin;
1226 fontList = CLIENT_TITLE_APPEARANCE(pcd).fontList;
1230 /* use "active" GC if we have keyboard focus */
1231 if (pcd == wmGD.keyboardFocus) {
1232 clientGC = CLIENT_APPEARANCE(pcd).activeGC;
1235 clientGC = CLIENT_APPEARANCE(pcd).inactiveGC;
1238 /* get the area that the text must fit in */
1239 GetTextBox (pcd, &textBox);
1240 win = pcd->clientFrameWin;
1241 fontList = CLIENT_APPEARANCE(pcd).fontList;
1246 XClearArea (DISPLAY, win, textBox.x, textBox.y,
1247 (unsigned int) textBox.width, (unsigned int) textBox.height,
1251 #ifdef DT_LEFT_JUSTIFIED_TITLE
1252 WmDrawXmString(DISPLAY, win, fontList, pcd->clientTitle, clientGC,
1253 textBox.x, textBox.y, textBox.width, &textBox,
1254 ((wmGD.frameStyle == WmSLAB) ? False : True));
1255 #else /* DT_LEFT_JUSTIFIED_TITLE */
1256 WmDrawXmString(DISPLAY, win, fontList, pcd->clientTitle, clientGC,
1257 textBox.x, textBox.y, textBox.width, &textBox,
1259 #endif /* DT_LEFT_JUSTIFIED_TITLE */
1263 } /* END OF FUNCTION DrawWindowTitle */
1267 /*************************************<->*************************************
1269 * CreateStretcherWindows (pcd)
1274 * Create the input-only windows that overlay the resize gadgets.
1279 * pcd - pointer to client data.
1291 * o The windows are sized based upon resizeBorderWidth
1292 * o This should be called before creating the title bar,
1293 * and reparenting window. Later windows should obscure parts of the
1295 * o The stretchers are given special cursors.
1297 *************************************<->***********************************/
1299 void CreateStretcherWindows (ClientData *pcd)
1303 unsigned int width, height;
1304 XSetWindowAttributes win_attribs;
1305 unsigned long attr_mask;
1307 for (iWin = 0; iWin < STRETCH_COUNT; iWin++) {
1309 case STRETCH_NORTH_WEST:
1310 GetFramePartInfo (pcd, FRAME_RESIZE_NW,
1311 &x, &y, &width, &height);
1315 GetFramePartInfo (pcd, FRAME_RESIZE_N,
1316 &x, &y, &width, &height);
1319 case STRETCH_NORTH_EAST:
1320 GetFramePartInfo (pcd, FRAME_RESIZE_NE,
1321 &x, &y, &width, &height);
1325 GetFramePartInfo (pcd, FRAME_RESIZE_E,
1326 &x, &y, &width, &height);
1329 case STRETCH_SOUTH_EAST:
1330 GetFramePartInfo (pcd, FRAME_RESIZE_SE,
1331 &x, &y, &width, &height);
1335 GetFramePartInfo (pcd, FRAME_RESIZE_S,
1336 &x, &y, &width, &height);
1339 case STRETCH_SOUTH_WEST:
1340 GetFramePartInfo (pcd, FRAME_RESIZE_SW,
1341 &x, &y, &width, &height);
1345 GetFramePartInfo (pcd, FRAME_RESIZE_W,
1346 &x, &y, &width, &height);
1350 attr_mask = CWCursor;
1351 win_attribs.cursor = wmGD.stretchCursors[iWin];
1353 pcd->clientStretchWin[iWin] =
1354 XCreateWindow(DISPLAY, pcd->clientFrameWin,
1355 x, y, width, height, 0, CopyFromParent,
1356 InputOnly, CopyFromParent, attr_mask, &win_attribs);
1358 } /* END OF FUNCTION CreateStretcherWindows */
1362 /*************************************<->*************************************
1364 * CountFrameRectangles (pSD)
1369 * Computes the number of top and bottom shadow rectangles to allocate
1374 * pWS - pointer to workspace data
1383 *************************************<->***********************************/
1385 void CountFrameRectangles (WmScreenData *pSD)
1389 pSD->Num_Title_Ts_Elements = pSD->Num_Title_Bs_Elements = 0;
1391 /* count up rectangles for title bar */
1392 for (i = FRAME_SYSTEM; i <= FRAME_MAXIMIZE; i++)
1394 pSD->Num_Title_Ts_Elements += ((Bevels[i].top.external *
1395 pSD->externalBevel) +
1396 (Bevels[i].top.internal * MAX_INTERNAL_BEVEL) +
1397 (Bevels[i].top.join * pSD->joinBevel));
1399 pSD->Num_Title_Bs_Elements += ((Bevels[i].bottom.external*
1400 pSD->externalBevel)+
1401 (Bevels[i].bottom.internal * MAX_INTERNAL_BEVEL) +
1402 (Bevels[i].bottom.join * pSD->joinBevel));
1405 pSD->Num_Resize_Ts_Elements = pSD->Num_Resize_Bs_Elements = 0;
1407 /* count up rectangles for resize handles*/
1408 for (i = FRAME_RESIZE_NW; i <= FRAME_RESIZE_W; i++)
1410 pSD->Num_Resize_Ts_Elements += ((Bevels[i].top.external *
1411 pSD->externalBevel) +
1412 (Bevels[i].top.internal * MAX_INTERNAL_BEVEL) +
1413 (Bevels[i].top.join * pSD->joinBevel));
1415 pSD->Num_Resize_Bs_Elements += ((Bevels[i].bottom.external*
1416 pSD->externalBevel)+
1417 (Bevels[i].bottom.internal * MAX_INTERNAL_BEVEL) +
1418 (Bevels[i].bottom.join * pSD->joinBevel));
1420 } /* END OF FUNCTION CountFrameRectangles */
1424 /*************************************<->*************************************
1426 * AllocateFrameDisplayLists (pcd)
1431 * Allocates memory for the graphic display lists for the frame.
1436 * pcd - pointer to the client data
1441 * pcd - fields modified
1443 * Return - TRUE if successful, FALSE otherwise.
1450 *************************************<->***********************************/
1452 Boolean AllocateFrameDisplayLists (ClientData *pcd)
1454 int frame_top_count, frame_bottom_count;
1457 * If the title bar has it's own appearance, then allocate
1458 * separate display lists for it.
1460 if (DECOUPLE_TITLE_APPEARANCE(pcd) &&
1461 (pcd->decor & MWM_DECOR_TITLE))
1463 if (((pcd->pclientTitleTopShadows =
1464 AllocateRList ((unsigned)NUM_TITLE_TS_ELEMENTS(pcd))) == NULL) ||
1465 ((pcd->pclientTitleBottomShadows =
1466 AllocateRList ((unsigned)NUM_TITLE_BS_ELEMENTS(pcd))) == NULL))
1468 /* out of memory! */
1469 Warning (((char *)GETMESSAGE(8, 1, "Insufficient memory for client window framing")));
1473 frame_top_count = NUM_RESIZE_TS_ELEMENTS(pcd);
1474 frame_bottom_count = NUM_RESIZE_BS_ELEMENTS(pcd);
1478 frame_top_count = NUM_RESIZE_TS_ELEMENTS(pcd) +
1479 NUM_TITLE_TS_ELEMENTS(pcd);
1480 frame_bottom_count = NUM_RESIZE_BS_ELEMENTS(pcd) +
1481 NUM_RESIZE_BS_ELEMENTS(pcd);
1485 * Allocate the primary lists for the frame
1487 if ( (pcd->pclientTopShadows == NULL) &&
1488 ((pcd->pclientTopShadows =
1489 AllocateRList ((unsigned)frame_top_count)) == NULL) )
1491 /* out of memory! */
1492 Warning (((char *)GETMESSAGE(8, 2, "Insufficient memory for client window framing")));
1496 if ( (pcd->pclientBottomShadows == NULL) &&
1497 ((pcd->pclientBottomShadows =
1498 AllocateRList ((unsigned)frame_bottom_count)) == NULL) )
1500 /* out of memory! */
1501 Warning (((char *)GETMESSAGE(8, 3, "Insufficient memory for client window framing")));
1506 * Only allocate matte lists if there is a matte.
1508 if ( (pcd->matteWidth) &&
1509 (pcd->pclientMatteTopShadows == NULL) &&
1510 ((pcd->pclientMatteTopShadows =
1511 AllocateRList ((unsigned)NUM_MATTE_TS_RECTS)) == NULL))
1513 /* out of memory! */
1514 Warning (((char *)GETMESSAGE(8, 4, "Insufficient memory for client window framing")));
1518 if ( (pcd->matteWidth) &&
1519 (pcd->pclientMatteBottomShadows == NULL) &&
1520 ((pcd->pclientMatteBottomShadows =
1521 AllocateRList ((unsigned)NUM_MATTE_BS_RECTS)) == NULL))
1523 /* out of memory! */
1524 Warning (((char *)GETMESSAGE(8, 5, "Insufficient memory for client window framing")));
1529 } /* END OF FUNCTION AllocateFrameDisplayLists */
1532 /*************************************<->*************************************
1534 * InitClientDecoration (pSD)
1539 * Initializes client decoration routines
1544 * pSD - pointer to screen data
1552 * This must be called once before decorating any client frames.
1553 *************************************<->***********************************/
1555 void InitClientDecoration (WmScreenData *pSD)
1557 CountFrameRectangles(pSD);
1558 } /* END OF FUNCTION InitClientDecoration */
1562 /*************************************<->*************************************
1564 * AllocateGadgetRectangles (pcd)
1569 * Allocate the memory for event rectangles structures.
1574 * pcd - pointer to client data structure
1584 *************************************<->***********************************/
1586 Boolean AllocateGadgetRectangles (ClientData *pcd)
1589 unsigned long decor = pcd->decor;
1590 GadgetRectangle *pgr;
1592 if (decor & MWM_DECOR_TITLE) {
1594 /* count how many rectangles to allocate for titlebar */
1596 if (decor & MWM_DECOR_MENU) num_rects += 1;
1597 if (decor & MWM_DECOR_MINIMIZE) num_rects += 1;
1598 if (decor & MWM_DECOR_MAXIMIZE) num_rects += 1;
1600 /* allocate memory if no memory is allocated */
1601 if ( pcd->pTitleGadgets == NULL) {
1602 /* allocate memory for these guys */
1603 pgr = (GadgetRectangle *)
1604 XtMalloc (num_rects * sizeof(GadgetRectangle));
1607 /* out of memory! */
1608 Warning (((char *)GETMESSAGE(8, 6, "Insufficient memory for client window framing")));
1612 /* update client data */
1613 pcd->pTitleGadgets = pgr;
1614 pcd->cTitleGadgets = 0;
1618 if (decor & MWM_DECOR_RESIZEH) {
1620 /* allocate memory if no memory is allocated */
1621 if ( pcd->pResizeGadgets == NULL) {
1622 /* allocate memory for these guys */
1623 pgr = (GadgetRectangle *)
1624 XtMalloc (STRETCH_COUNT * sizeof(GadgetRectangle));
1627 /* out of memory! */
1628 Warning (((char *)GETMESSAGE(8, 7, "Insufficient memory for client window framing")));
1632 /* update client data */
1633 pcd->pResizeGadgets = pgr;
1637 } /* END OF FUNCTION AllocateGadgetRectangles */
1640 /*************************************<->*************************************
1642 * ComputeGadgetRectangles (pcd)
1647 * Creates the event rectangles structures to aid in identifying
1648 * frame parts when events come in
1653 * pcd - pointer to client data structure
1662 * o assumes gadget rectangles are already allocated.
1664 *************************************<->***********************************/
1666 void ComputeGadgetRectangles (ClientData *pcd)
1668 unsigned long decor = pcd->decor;
1669 GadgetRectangle *pgr;
1671 unsigned int fpWidth, fpHeight;
1673 int clientWidth = (pcd->maxConfig) ? pcd->maxWidth : pcd->clientWidth;
1678 if (decor & MWM_DECOR_TITLE) {
1680 if ( (pgr = pcd->pTitleGadgets) == NULL) {
1681 return; /* nothing there !!! */
1684 /* do title rectangle */
1685 pcd->titleRectangle.x = pcd->frameInfo.upperBorderWidth;
1686 pcd->titleRectangle.y = pcd->frameInfo.upperBorderWidth;
1689 * Fixed bug where last button in title bar did not activate when
1690 * the client's X border was showing.
1692 pcd->titleRectangle.width = clientWidth +
1693 (XBorderIsShowing(pcd) ? 2*pcd->xBorderWidth : 2*pcd->matteWidth);
1694 pcd->titleRectangle.height = pcd->frameInfo.titleBarHeight;
1696 /* fill in title bar rectangles */
1699 pgr[igr].id = FRAME_TITLE;
1700 GetFramePartInfo (pcd, FRAME_TITLE, &fpX, &fpY, &fpWidth, &fpHeight);
1702 /* copy in and convert to shorts */
1703 pgr[igr].rect.x = fpX;
1704 pgr[igr].rect.y = fpY;
1705 pgr[igr].rect.width = fpWidth;
1706 pgr[igr].rect.height = fpHeight;
1709 if (decor & MWM_DECOR_MENU) {
1710 pgr[igr].id = FRAME_SYSTEM;
1711 GetFramePartInfo (pcd, FRAME_SYSTEM, &fpX, &fpY, &fpWidth,
1714 /* copy in and convert to shorts */
1715 pgr[igr].rect.x = fpX;
1716 pgr[igr].rect.y = fpY;
1717 pgr[igr].rect.width = fpWidth;
1718 pgr[igr].rect.height = fpHeight;
1722 if (decor & MWM_DECOR_MINIMIZE) {
1723 pgr[igr].id = FRAME_MINIMIZE;
1724 GetFramePartInfo (pcd, FRAME_MINIMIZE,
1725 &fpX, &fpY, &fpWidth, &fpHeight);
1726 /* copy in and convert to shorts */
1727 pgr[igr].rect.x = fpX;
1728 pgr[igr].rect.y = fpY;
1729 pgr[igr].rect.width = fpWidth;
1730 pgr[igr].rect.height = fpHeight;
1734 if (decor & MWM_DECOR_MAXIMIZE) {
1735 pgr[igr].id = FRAME_MAXIMIZE;
1736 GetFramePartInfo (pcd, FRAME_MAXIMIZE,
1737 &fpX, &fpY, &fpWidth, &fpHeight);
1738 /* copy in and convert to shorts */
1739 pgr[igr].rect.x = fpX;
1740 pgr[igr].rect.y = fpY;
1741 pgr[igr].rect.width = fpWidth;
1742 pgr[igr].rect.height = fpHeight;
1746 /* update client data */
1747 pcd->pTitleGadgets = pgr;
1748 pcd->cTitleGadgets = igr;
1751 /* client matte area (actually base window area) */
1753 if (decor & (MWM_DECOR_RESIZEH | MWM_DECOR_BORDER))
1755 pcd->matteRectangle.x = pcd->frameInfo.lowerBorderWidth;
1756 pcd->matteRectangle.y = pcd->frameInfo.upperBorderWidth +
1757 pcd->frameInfo.titleBarHeight;
1758 pcd->matteRectangle.width = pcd->frameInfo.width -
1759 (2 * pcd->frameInfo.lowerBorderWidth);
1760 pcd->matteRectangle.height = pcd->frameInfo.height -
1761 pcd->frameInfo.upperBorderWidth -
1762 pcd->frameInfo.lowerBorderWidth -
1763 pcd->frameInfo.titleBarHeight;
1767 pcd->matteRectangle.x = 0;
1768 pcd->matteRectangle.y = pcd->frameInfo.titleBarHeight;
1769 pcd->matteRectangle.width = pcd->frameInfo.width;
1770 pcd->matteRectangle.height = pcd->frameInfo.height -
1771 pcd->frameInfo.titleBarHeight;
1774 if (decor & MWM_DECOR_RESIZEH) {
1776 if ( (pgr = pcd->pResizeGadgets) == NULL) {
1777 return; /* nothing there !!! */
1780 /* fill in resize rectangles */
1782 if (decor & MWM_DECOR_RESIZEH) {
1784 pgr[igr].id = FRAME_RESIZE_NW;
1785 GetFramePartInfo (pcd, FRAME_RESIZE_NW,
1786 &fpX, &fpY, &fpWidth, &fpHeight);
1787 /* copy in and convert to shorts */
1788 pgr[igr].rect.x = fpX;
1789 pgr[igr].rect.y = fpY;
1790 pgr[igr].rect.width = fpWidth;
1791 pgr[igr].rect.height = fpHeight;
1794 pgr[igr].id = FRAME_RESIZE_N;
1795 GetFramePartInfo (pcd, FRAME_RESIZE_N,
1796 &fpX, &fpY, &fpWidth, &fpHeight);
1797 if ((int) fpWidth > 0) {
1798 /* copy in and convert to shorts */
1799 pgr[igr].rect.x = fpX;
1800 pgr[igr].rect.y = fpY;
1801 pgr[igr].rect.width = fpWidth;
1802 pgr[igr].rect.height = fpHeight;
1806 pgr[igr].id = FRAME_RESIZE_NE;
1807 GetFramePartInfo (pcd, FRAME_RESIZE_NE,
1808 &fpX, &fpY, &fpWidth, &fpHeight);
1809 /* copy in and convert to shorts */
1810 pgr[igr].rect.x = fpX;
1811 pgr[igr].rect.y = fpY;
1812 pgr[igr].rect.width = fpWidth;
1813 pgr[igr].rect.height = fpHeight;
1816 pgr[igr].id = FRAME_RESIZE_W;
1817 GetFramePartInfo (pcd, FRAME_RESIZE_W,
1818 &fpX, &fpY, &fpWidth, &fpHeight);
1819 if ((int)fpHeight > 0) {
1820 /* copy in and convert to shorts */
1821 pgr[igr].rect.x = fpX;
1822 pgr[igr].rect.y = fpY;
1823 pgr[igr].rect.width = fpWidth;
1824 pgr[igr].rect.height = fpHeight;
1828 pgr[igr].id = FRAME_RESIZE_E;
1829 GetFramePartInfo (pcd, FRAME_RESIZE_E,
1830 &fpX, &fpY, &fpWidth, &fpHeight);
1831 if ((int) fpHeight > 0) {
1832 /* copy in and convert to shorts */
1833 pgr[igr].rect.x = fpX;
1834 pgr[igr].rect.y = fpY;
1835 pgr[igr].rect.width = fpWidth;
1836 pgr[igr].rect.height = fpHeight;
1840 pgr[igr].id = FRAME_RESIZE_SW;
1841 GetFramePartInfo (pcd, FRAME_RESIZE_SW,
1842 &fpX, &fpY, &fpWidth, &fpHeight);
1843 /* copy in and convert to shorts */
1844 pgr[igr].rect.x = fpX;
1845 pgr[igr].rect.y = fpY;
1846 pgr[igr].rect.width = fpWidth;
1847 pgr[igr].rect.height = fpHeight;
1850 pgr[igr].id = FRAME_RESIZE_S;
1851 GetFramePartInfo (pcd, FRAME_RESIZE_S,
1852 &fpX, &fpY, &fpWidth, &fpHeight);
1853 if ((int) fpWidth > 0) {
1854 /* copy in and convert to shorts */
1855 pgr[igr].rect.x = fpX;
1856 pgr[igr].rect.y = fpY;
1857 pgr[igr].rect.width = fpWidth;
1858 pgr[igr].rect.height = fpHeight;
1862 pgr[igr].id = FRAME_RESIZE_SE;
1863 GetFramePartInfo (pcd, FRAME_RESIZE_SE,
1864 &fpX, &fpY, &fpWidth, &fpHeight);
1865 /* copy in and convert to shorts */
1866 pgr[igr].rect.x = fpX;
1867 pgr[igr].rect.y = fpY;
1868 pgr[igr].rect.width = fpWidth;
1869 pgr[igr].rect.height = fpHeight;
1872 /* update client data */
1873 pcd->pResizeGadgets = pgr;
1876 } /* END OF FUNCTION ComputeGadgetRectangles */
1880 /*************************************<->*************************************
1882 * GetSystemMenuPosition (pcd, px, py, height, context)
1887 * Returns the position of where the system menu should be popped up.
1888 * The hotspotRectangle in global is also set up to match the icon or
1889 * system menu button area.
1894 * pcd = pointer to client data
1896 * px = pointer to x location
1898 * py = pointer to y location
1900 * height = height of the system menu
1902 * context = context that the menu is to be posted under.
1911 * wmGD.hotspotRectangle = system menu button or icon area (root relative)
1913 *************************************<->***********************************/
1915 void GetSystemMenuPosition (ClientData *pcd, int *px, int *py,
1916 unsigned int height, Context context)
1919 if ((pcd->clientState == MINIMIZED_STATE) ||
1920 ((pcd->clientState != MINIMIZED_STATE) &&
1921 (context == F_SUBCONTEXT_IB_WICON)))
1924 * Try to put the menu directly above the icon.
1925 * If it would hit the top of the screen then try to put it below
1926 * the icon and label.
1927 * If it would then hit the bottom of the screen turn of the hotspot
1932 if (pcd->pSD->useIconBox && P_ICON_BOX(pcd))
1934 GetIconBoxIconRootXY (pcd, px, py);
1936 wmGD.hotspotRectangle.x = *px;
1937 wmGD.hotspotRectangle.y = *py;
1943 *py += height + ICON_HEIGHT(pcd);
1944 if (*py + height >= DisplayHeight (DISPLAY,
1945 SCREEN_FOR_CLIENT(pcd)))
1947 wmGD.checkHotspot = FALSE;
1954 *py = ICON_Y(pcd) - height;
1958 *py = ICON_Y(pcd) + ICON_HEIGHT(pcd);
1959 if (*py + height >= DisplayHeight (DISPLAY,
1960 SCREEN_FOR_CLIENT(pcd)))
1962 wmGD.checkHotspot = FALSE;
1966 wmGD.hotspotRectangle.x = ICON_X(pcd);
1967 wmGD.hotspotRectangle.y = ICON_Y(pcd);
1970 /* setup the hotspot rectangle data */
1972 wmGD.hotspotRectangle.width = ICON_WIDTH(pcd);
1973 wmGD.hotspotRectangle.height = ICON_HEIGHT(pcd);
1978 * Try to put the menu directly below the SW corner of the
1980 * If it would hit the bottom of the screen then try to put it directly
1981 * above the NW corner of the titlebar/border.
1982 * If it would then hit the top of the screen turn of the hotspot
1986 if ((pcd->decor & MWM_DECOR_TITLE) &&
1987 !(pcd->decor & (MWM_DECOR_RESIZEH | MWM_DECOR_BORDER)))
1989 *px = pcd->frameInfo.x;
1990 *py = pcd->frameInfo.y + pcd->frameInfo.titleBarHeight;
1994 *px = pcd->frameInfo.x + pcd->frameInfo.lowerBorderWidth;
1995 *py = pcd->frameInfo.y + pcd->frameInfo.upperBorderWidth +
1996 pcd->frameInfo.titleBarHeight;
1998 if (*py + height >= DisplayHeight (DISPLAY,
1999 SCREEN_FOR_CLIENT(pcd)))
2001 if ((pcd->decor & MWM_DECOR_TITLE) &&
2002 !(pcd->decor & (MWM_DECOR_RESIZEH | MWM_DECOR_BORDER)))
2004 *py = pcd->frameInfo.y - height;
2008 *py = pcd->frameInfo.y + pcd->frameInfo.upperBorderWidth -
2013 wmGD.checkHotspot = FALSE;
2017 /* setup the hotspot rectangle data */
2019 wmGD.hotspotRectangle.x = pcd->frameInfo.x +
2020 pcd->frameInfo.lowerBorderWidth;
2021 wmGD.hotspotRectangle.y = pcd->frameInfo.y +
2022 pcd->frameInfo.upperBorderWidth;
2024 /* assume square button */
2025 wmGD.hotspotRectangle.width = pcd->frameInfo.titleBarHeight;
2026 wmGD.hotspotRectangle.height = pcd->frameInfo.titleBarHeight;
2029 } /* END OF FUNCTION GetSystemMenuPosition */
2033 /*************************************<->*************************************
2035 * ShowActiveClientFrame (pcd)
2040 * Paint the frame to indicate an "active" window
2045 * pcd - pointer to client data
2054 * o This calls the frame exposure procedure, which gets some GCs based
2055 * on the current keyboard focus. Thus, wmGD.keyboardFocus == pcd
2056 * must be TRUE when this is called for the correct highlighting to
2059 *************************************<->***********************************/
2062 ShowActiveClientFrame (ClientData *pcd)
2064 unsigned long attr_mask = 0;
2065 XSetWindowAttributes window_attribs;
2067 if (DECOUPLE_TITLE_APPEARANCE(pcd) &&
2068 (pcd->decor & MWM_DECOR_TITLE))
2071 * Use background pixmap if one is specified, otherwise set the
2072 * appropriate background color.
2075 if (CLIENT_TITLE_APPEARANCE(pcd).activeBackgroundPixmap)
2077 attr_mask |= CWBackPixmap;
2078 window_attribs.background_pixmap =
2079 CLIENT_TITLE_APPEARANCE(pcd).activeBackgroundPixmap;
2083 attr_mask |= CWBackPixel;
2084 window_attribs.background_pixel =
2085 CLIENT_TITLE_APPEARANCE(pcd).activeBackground;
2089 XChangeWindowAttributes (DISPLAY, pcd->clientTitleWin, attr_mask,
2092 /* clear the frame to the right background */
2093 XClearWindow (DISPLAY, pcd->clientTitleWin);
2097 * Use background pixmap if one is specified, otherwise set the
2098 * appropriate background color.
2101 if (CLIENT_APPEARANCE(pcd).activeBackgroundPixmap)
2103 attr_mask |= CWBackPixmap;
2104 window_attribs.background_pixmap =
2105 CLIENT_APPEARANCE(pcd).activeBackgroundPixmap;
2109 attr_mask |= CWBackPixel;
2110 window_attribs.background_pixel =
2111 CLIENT_APPEARANCE(pcd).activeBackground;
2115 XChangeWindowAttributes (DISPLAY, pcd->clientFrameWin, attr_mask,
2118 /* clear the frame to the right background */
2119 XClearWindow (DISPLAY, pcd->clientFrameWin);
2121 /* simulate exposure of window */
2122 FrameExposureProc (pcd);
2125 } /* END OF FUNCTION ShowActiveClient */
2129 /*************************************<->*************************************
2131 * ShowInactiveClientFrame (pcd)
2136 * Paint the frame to indicate an "inactive" window
2141 * pcd - pointer to client data
2150 * o This calls the frame exposure procedure, which gets some GCs based
2151 * on the current keyboard focus. Thus, wmGD.keyboardFocus == pcd
2152 * must be FALSE when this is called for the correct highlighting to
2156 ******************************<->***********************************/
2159 ShowInactiveClientFrame (ClientData *pcd)
2161 unsigned long attr_mask = 0;
2162 XSetWindowAttributes window_attribs;
2164 if (DECOUPLE_TITLE_APPEARANCE(pcd) &&
2165 (pcd->decor & MWM_DECOR_TITLE))
2168 * Use background pixmap if one is specified, otherwise set the
2169 * appropriate background color.
2172 if (CLIENT_TITLE_APPEARANCE(pcd).backgroundPixmap)
2174 attr_mask |= CWBackPixmap;
2175 window_attribs.background_pixmap =
2176 CLIENT_TITLE_APPEARANCE(pcd).backgroundPixmap;
2180 attr_mask |= CWBackPixel;
2181 window_attribs.background_pixel =
2182 CLIENT_TITLE_APPEARANCE(pcd).background;
2186 XChangeWindowAttributes (DISPLAY, pcd->clientTitleWin, attr_mask,
2189 /* clear the frame to the right background */
2190 XClearWindow (DISPLAY, pcd->clientTitleWin);
2193 * attr_mask must be cleared because it is set if
2194 * DECOUPLE_TITLE_APPEARANCE(pcd) is true.
2200 * Use background pixmap if one is specified, otherwise set the
2201 * appropriate background color.
2204 if (CLIENT_APPEARANCE(pcd).backgroundPixmap)
2206 attr_mask |= CWBackPixmap;
2207 window_attribs.background_pixmap =
2208 CLIENT_APPEARANCE(pcd).backgroundPixmap;
2212 attr_mask |= CWBackPixel;
2213 window_attribs.background_pixel =
2214 CLIENT_APPEARANCE(pcd).background;
2218 /* change window attribs so clear does the right thing */
2219 XChangeWindowAttributes (DISPLAY, pcd->clientFrameWin, attr_mask,
2222 /* clear the frame to the right background */
2223 XClearWindow (DISPLAY, pcd->clientFrameWin);
2225 /* simulate exposure of window */
2226 FrameExposureProc (pcd);
2228 } /* END OF FUNCTION ShowInactiveClientFrame */
2232 /*************************************<->*************************************
2234 * RegenerateClientFrame (pcd)
2239 * Reconfigure the sizes of all the components of the client frame
2244 * pcd - pointer to client data
2254 *************************************<->***********************************/
2256 void RegenerateClientFrame (ClientData *pcd)
2258 unsigned long decor = pcd->decor;
2260 * If an embedded client, there is no frame.
2264 if (!pcd->clientFrameWin)
2270 /* recompute frame information */
2273 /* move & resize frame window */
2274 XMoveResizeWindow (DISPLAY, pcd->clientFrameWin, pcd->frameInfo.x,
2275 pcd->frameInfo.y, pcd->frameInfo.width, pcd->frameInfo.height);
2278 /* resize title bar window */
2279 if (decor & MWM_DECOR_TITLE)
2281 XResizeWindow (DISPLAY, pcd->clientTitleWin,
2282 pcd->frameInfo.width - 2*pcd->frameInfo.upperBorderWidth,
2283 pcd->frameInfo.titleBarHeight);
2286 /* resize base window */
2287 XResizeWindow (DISPLAY, pcd->clientBaseWin, BaseWindowWidth (pcd),
2288 BaseWindowHeight (pcd));
2290 /* resize the stretcher windows */
2291 if (SHOW_RESIZE_CURSORS(pcd) && (decor & MWM_DECOR_RESIZEH)) {
2292 XMoveResizeWindow (DISPLAY,
2293 pcd->clientStretchWin[STRETCH_NORTH_WEST],
2294 0, 0, pcd->frameInfo.cornerWidth,
2295 pcd->frameInfo.cornerHeight);
2297 XMoveResizeWindow (DISPLAY,
2298 pcd->clientStretchWin[STRETCH_NORTH],
2299 (int) pcd->frameInfo.cornerWidth, 0,
2300 pcd->frameInfo.width - 2*pcd->frameInfo.cornerWidth,
2301 pcd->frameInfo.upperBorderWidth);
2303 XMoveResizeWindow (DISPLAY,
2304 pcd->clientStretchWin[STRETCH_NORTH_EAST],
2305 (int) (pcd->frameInfo.width - pcd->frameInfo.cornerWidth), 0,
2306 pcd->frameInfo.cornerWidth, pcd->frameInfo.cornerHeight);
2308 XMoveResizeWindow (DISPLAY,
2309 pcd->clientStretchWin[STRETCH_EAST],
2310 (int) (pcd->frameInfo.width - pcd->frameInfo.lowerBorderWidth),
2311 (int) (pcd->frameInfo.cornerHeight),
2312 pcd->frameInfo.lowerBorderWidth,
2313 pcd->frameInfo.height - 2*pcd->frameInfo.cornerHeight);
2315 XMoveResizeWindow (DISPLAY,
2316 pcd->clientStretchWin[STRETCH_SOUTH_EAST],
2317 (int) (pcd->frameInfo.width - pcd->frameInfo.cornerWidth),
2318 (int) (pcd->frameInfo.height - pcd->frameInfo.cornerHeight),
2319 pcd->frameInfo.cornerWidth, pcd->frameInfo.cornerHeight);
2321 XMoveResizeWindow (DISPLAY,
2322 pcd->clientStretchWin[STRETCH_SOUTH],
2323 (int) pcd->frameInfo.cornerWidth,
2324 (int) (pcd->frameInfo.height - pcd->frameInfo.lowerBorderWidth),
2325 pcd->frameInfo.width - 2*pcd->frameInfo.cornerWidth,
2326 pcd->frameInfo.lowerBorderWidth);
2328 XMoveResizeWindow (DISPLAY,
2329 pcd->clientStretchWin[STRETCH_SOUTH_WEST],
2330 0, (int) (pcd->frameInfo.height - pcd->frameInfo.cornerHeight),
2331 pcd->frameInfo.cornerWidth, pcd->frameInfo.cornerHeight);
2333 XMoveResizeWindow (DISPLAY,
2334 pcd->clientStretchWin[STRETCH_WEST],
2335 0, (int) pcd->frameInfo.cornerHeight,
2336 pcd->frameInfo.lowerBorderWidth,
2337 pcd->frameInfo.height - 2*pcd->frameInfo.cornerHeight);
2340 /* recreate gadget rectangles */
2341 ComputeGadgetRectangles (pcd);
2343 /* regenerate the graphics */
2344 GenerateFrameDisplayLists (pcd);
2347 if (wmGD.hasShape && pcd->wShaped)
2349 SetFrameShape (pcd);
2351 #endif /* NO_SHAPE */
2353 } /* END OF FUNCTION RegenerateClientFrame */
2358 /*************************************<->*************************************
2360 * BevelSystemButton (prTop, prBot, x, y, width, height)
2365 * Bevels a rectangle for the system button (drawer handle?)
2370 * prTop - ptr to top shadow rectangles
2371 * prBot - ptr to bottom shadow rectangles
2372 * x - x coord of maximize gadget
2373 * y - y coord of maximize gadget
2374 * width - width of maximize gadget
2375 * height - height of maximize gadget
2384 * o This draws a horizontal "drawer handle" for the system gadget.
2385 * Assumptions: the enclosing box is square (width == height)
2386 *************************************<->***********************************/
2388 void BevelSystemButton (RList *prTop, RList *prBot, int x, int y,
2389 unsigned int width, unsigned int height)
2391 int offset1, offset2;
2392 unsigned int dim1, dim2;
2397 offset1 = offset2 = 2;
2398 dim1 = dim2 = height-4;
2402 offset1 = offset2 = 2;
2426 offset2 = (height-3)/2;
2433 offset2 = (height - 4)/2;
2442 BevelRectangle (prTop, prBot, /* system icon */
2443 (x+offset1), (y+offset2),
2447 } /* END OF FUNCTION BevelSystemButton */
2451 /*************************************<->*************************************
2453 * BevelMinimizeButton (prTop, prBot, x, y, height)
2458 * Bevels a rectangle for the minimize button
2463 * prTop - ptr to top shadow rectangles
2464 * prBot - ptr to bottom shadow rectangles
2465 * x - x coord of maximize gadget
2466 * y - y coord of maximize gadget
2467 * height - height of maximize gadget
2477 *************************************<->***********************************/
2479 void BevelMinimizeButton (RList *prTop, RList *prBot, int x, int y,
2480 unsigned int height)
2482 int offset1, offset2;
2483 unsigned int dim1, dim2;
2489 offset1 = offset2 = 3;
2490 dim1 = dim2 = height-6;
2496 offset1 = offset2 = (height-3)/2;
2501 offset1 = offset2 = (height-4)/2;
2508 BevelRectangle (prTop, prBot,
2509 (x+offset1), (y+offset2),
2513 } /* END OF FUNCTION BevelMinimizeButton */
2517 /*************************************<->*************************************
2519 * BevelMaximizeButton (prTop, prBot, x, y, height)
2524 * Bevels a rectangle for the maximize button
2529 * prTop - ptr to top shadow rectangles
2530 * prBot - ptr to bottom shadow rectangles
2531 * x - x coord of maximize gadget
2532 * y - y coord of maximize gadget
2533 * height - height of maximize gadget
2543 *************************************<->***********************************/
2545 void BevelMaximizeButton (RList *prTop, RList *prBot, int x, int y,
2546 unsigned int height)
2548 int offset1, offset2;
2549 unsigned int dim1, dim2;
2559 offset1 = offset2 = 2;
2560 dim1 = dim2 = height-4;
2567 offset1 = offset2 = 3;
2568 dim1 = dim2 = height-6;
2572 offset1 = offset2 = 4;
2573 dim1 = dim2 = height-8;
2578 BevelRectangle (prTop, prBot,
2579 (x+offset1), (y+offset2),
2582 } /* END OF FUNCTION BevelMaximizeButton */
2585 /*************************************<->*************************************
2587 * DepressGadget (pcd, gadget, depressed)
2592 * Show the gadget in a "depressed" state
2597 * pcd - pointer to client data
2598 * gadget - gadget id
2599 * depressed - if True, then gadget is shown depressed, if False it is
2600 * shown not depressed
2605 * return - true if sucessful
2610 * o This assumes there is a one-pixel bevel around the gadget.
2611 * o This only works on title bar gadgets.
2613 *************************************<->***********************************/
2615 Boolean DepressGadget (ClientData *pcd, int gadget, Boolean depressed)
2618 unsigned int width, height, invertWidth;
2619 static RList *pTopRect = NULL;
2620 static RList *pBotRect = NULL;
2624 /* get outside dimensions of box we want */
2629 case FRAME_MINIMIZE:
2630 case FRAME_MAXIMIZE:
2631 if (!GetDepressInfo (pcd, gadget, &x, &y, &width,
2632 &height, &invertWidth))
2638 return(FALSE); /* do nothing on non-title bar gagdets */
2641 if (DECOUPLE_TITLE_APPEARANCE(pcd) &&
2642 (pcd->decor & MWM_DECOR_TITLE))
2644 /* adjust position to be relative to titlebar window, not frame */
2645 x -= (short) pcd->frameInfo.upperBorderWidth;
2646 y -= (short) pcd->frameInfo.upperBorderWidth;
2648 /* use "active" GCs if we have keyboard focus */
2649 if (pcd == wmGD.keyboardFocus) {
2650 topGC = CLIENT_TITLE_APPEARANCE(pcd).activeTopShadowGC;
2651 botGC = CLIENT_TITLE_APPEARANCE(pcd).activeBottomShadowGC;
2654 topGC = CLIENT_TITLE_APPEARANCE(pcd).inactiveTopShadowGC;
2656 CLIENT_TITLE_APPEARANCE(pcd).inactiveBottomShadowGC;
2659 /* draw into title bar window */
2660 win = pcd->clientTitleWin;
2664 /* use "active" GCs if we have keyboard focus */
2665 if (pcd == wmGD.keyboardFocus) {
2666 topGC = CLIENT_APPEARANCE(pcd).activeTopShadowGC;
2667 botGC = CLIENT_APPEARANCE(pcd).activeBottomShadowGC;
2670 topGC = CLIENT_APPEARANCE(pcd).inactiveTopShadowGC;
2671 botGC = CLIENT_APPEARANCE(pcd).inactiveBottomShadowGC;
2674 /* draw into client frame window */
2675 win = pcd->clientFrameWin;
2679 * Bevel a rectangle for the desired button effect
2680 * Allocate the rectangles if necessary.
2682 if ( (pTopRect && pBotRect) ||
2683 ((pTopRect = AllocateRList(2)) &&
2684 (pBotRect = AllocateRList(2))))
2688 BevelRectangle (pTopRect, pBotRect,
2689 x, y, width, height,
2690 invertWidth, invertWidth,
2691 invertWidth, invertWidth);
2694 /* draw the gadget border to make it look depressed or normal */
2697 XFillRectangles (DISPLAY, win, botGC, pTopRect->prect, pTopRect->used);
2698 XFillRectangles (DISPLAY, win, topGC, pBotRect->prect, pBotRect->used);
2701 XFillRectangles (DISPLAY, win, topGC, pTopRect->prect, pTopRect->used);
2702 XFillRectangles (DISPLAY, win, botGC, pBotRect->prect, pBotRect->used);
2705 } /* END OF FUNCTION DepressGadget */
2708 /*************************************<->*************************************
2710 * PushGadgetIn (pcd, gadget)
2715 * Shows a title bar gadget in a depressed state
2720 * pcd - pointer to client data
2721 * gadget - gadget id
2729 *************************************<->***********************************/
2731 void PushGadgetIn (ClientData *pcd, int gadget)
2735 pcd->decorFlags |= SYSTEM_DEPRESSED;
2739 pcd->decorFlags |= TITLE_DEPRESSED;
2742 case FRAME_MINIMIZE:
2743 pcd->decorFlags |= MINIMIZE_DEPRESSED;
2746 case FRAME_MAXIMIZE:
2747 pcd->decorFlags |= MAXIMIZE_DEPRESSED;
2753 GenerateFrameDisplayLists(pcd);
2754 (void) DepressGadget (pcd, gadget, TRUE);
2755 wmGD.gadgetClient = pcd;
2756 wmGD.gadgetDepressed = gadget;
2757 } /* END OF FUNCTION PushGadgetIn */
2760 /*************************************<->*************************************
2762 * PopGadgetOut (pcd, gadget)
2767 * Shows a title bar gadget in a depressed state
2772 * pcd - pointer to client data
2773 * gadget - gadget id
2781 *************************************<->***********************************/
2783 void PopGadgetOut (ClientData *pcd, int gadget)
2787 pcd->decorFlags &= ~SYSTEM_DEPRESSED;
2791 pcd->decorFlags &= ~TITLE_DEPRESSED;
2794 case FRAME_MINIMIZE:
2795 pcd->decorFlags &= ~MINIMIZE_DEPRESSED;
2798 case FRAME_MAXIMIZE:
2799 pcd->decorFlags &= ~MAXIMIZE_DEPRESSED;
2805 GenerateFrameDisplayLists(pcd);
2806 (void) DepressGadget (pcd, gadget, FALSE);
2807 wmGD.gadgetClient = NULL;
2808 wmGD.gadgetDepressed = 0;
2809 } /* END OF FUNCTION PopGadgetOut */
2813 /*************************************<->*************************************
2815 * SetFrameShape (pcd)
2820 * Shapes the frame and base window to the shape of the client
2821 * window. Also ors the title window into the shaped frame
2822 * window if present.
2826 * pcd - pointer to client data
2833 * o currently punt on resize handle around the frame.
2835 *************************************<->***********************************/
2836 void SetFrameShape (ClientData *pcd)
2839 * The frame consists of the shape of the contents window offset by
2840 * title_height or'ed with the shape of title window (which is always
2846 if (XBorderIsShowing(pcd))
2848 xOffset = pcd->xBorderWidth;
2849 yOffset = pcd->xBorderWidth;
2851 else if(pcd->matteWidth > 0)
2853 xOffset = pcd->matteWidth;
2854 yOffset = pcd->matteWidth;
2860 * need to do general case
2862 XShapeCombineShape (DISPLAY, pcd->clientBaseWin, ShapeBounding,
2865 pcd->client, ShapeBounding,
2868 XShapeCombineShape (DISPLAY, pcd->clientFrameWin, ShapeBounding,
2871 pcd->clientBaseWin, ShapeBounding,
2874 if (pcd->decor & MWM_DECOR_TITLE)
2876 XShapeCombineShape (DISPLAY, pcd->clientFrameWin, ShapeBounding,
2877 pcd->frameInfo.upperBorderWidth,
2878 pcd->frameInfo.upperBorderWidth,
2879 pcd->clientTitleWin, ShapeBounding,
2885 (void) XShapeCombineMask (DISPLAY, pcd->clientFrameWin,
2886 ShapeBounding, 0, 0,
2888 (void) XShapeCombineMask (DISPLAY, pcd->clientFrameWin,
2891 (void) XShapeCombineMask (DISPLAY, pcd->clientBaseWin,
2892 ShapeBounding, 0, 0,
2894 (void) XShapeCombineMask (DISPLAY, pcd->clientBaseWin,
2898 } /* END OF FUNCTION SetFrameShape */
2899 #endif /* NO_SHAPE */