2 * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
10 static char rcsid[] = "$XConsortium: WmIDecor.c /main/6 1996/06/20 09:38:43 rswiston $"
14 * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */
23 #include <Xm/DrawP.h> /* for XmeClearBorder */
25 * include extern functions
29 #include "WmGraphics.h"
30 #include "WmIconBox.h"
32 #include "WmWinInfo.h"
34 #include "WmWrkspace.h"
42 static unsigned int activeIconTextWidth = 1;
43 static unsigned int activeIconTextHeight = 1;
44 static RList *pActiveIconTopRects = NULL;
45 static RList *pActiveIconBotRects = NULL;
47 static int iconShrinkX;
48 static int iconShrinkY;
49 static unsigned int iconShrinkWidth;
50 static unsigned int iconShrinkHeight;
53 /*************************************<->*************************************
60 * Create an icon frame and fill it in as appropriate for the client.
65 * pWS - pointer to workspace data
66 * pcd - pointer to client data
71 * Return - TRUE if success, FALSE if failure.
78 *************************************<->***********************************/
80 Boolean MakeIcon (WmWorkspaceData *pWS, ClientData *pcd)
82 XSetWindowAttributes window_attribs;
83 unsigned long attr_mask;
87 WsClientData *pWsc = GetWsClientData (pWS, pcd);
95 /* compute dimensions of outer icon frame */
96 /* create icon frame window */
98 attr_mask = CWEventMask | CWCursor;
99 window_attribs.event_mask = (ButtonPressMask | ButtonReleaseMask |
100 SELECT_BUTTON_MOTION_MASK |
101 DMANIP_BUTTON_MOTION_MASK |
103 SubstructureRedirectMask |
105 window_attribs.cursor = wmGD.workspaceCursor;
107 if ((wmGD.keyboardFocusPolicy == KEYBOARD_FOCUS_POINTER) ||
108 (wmGD.colormapFocusPolicy == CMAP_FOCUS_POINTER))
110 window_attribs.event_mask |= EnterWindowMask | LeaveWindowMask;
114 * Use background pixmap if one is specified, otherwise set the
115 * appropriate background color.
118 if (ICON_APPEARANCE(pcd).backgroundPixmap)
120 attr_mask |= CWBackPixmap;
121 window_attribs.background_pixmap =
122 ICON_APPEARANCE(pcd).backgroundPixmap;
126 attr_mask |= CWBackPixel;
127 window_attribs.background_pixel =
128 ICON_APPEARANCE(pcd).background;
132 if ((!pcd->pSD->useIconBox) ||
133 (pcd->clientFlags & (CLIENT_WM_CLIENTS | FRONT_PANEL_BOX)))
135 if ((!pcd->pSD->useIconBox) || (pcd->clientFlags & ICON_BOX))
139 pWsc->iconFrameWin = XCreateWindow (DISPLAY,
140 ROOT_FOR_CLIENT(pcd), /* parent */
144 pcd->iconFrameWin = XCreateWindow (DISPLAY,
145 ROOT_FOR_CLIENT(pcd), /* parent */
149 (unsigned int) ICON_WIDTH(pcd),
150 (unsigned int) ICON_HEIGHT(pcd),
151 0, /* border width */
152 CopyFromParent, /* depth */
153 InputOutput, /* class */
154 CopyFromParent, /* visual */
162 * Insert the icon into the icon box.
163 * Don't make icon in the box for any icon box (or any WM window)
164 * OR any client that doesn't have the MWM_FUNC_MINIMIZE bit set
165 * in pcd->clientFunctions
168 if ((pcd->pSD->useIconBox) &&
170 (!(pcd->clientFlags & CLIENT_WM_CLIENTS)) &&
172 (!(pcd->clientFlags & ICON_BOX)) &&
174 (pcd->clientFunctions & MWM_FUNC_MINIMIZE) )
176 if (!InsertIconIntoBox(pWS->pIconBox, pcd))
177 Warning(((char *)GETMESSAGE(30, 1, "Could not make icon to go in icon box")));
184 /* make space for the top/bottom changing shadow rectangles */
186 if ((pcd->piconTopShadows =
187 AllocateRList ((unsigned)NUM_BOTH_TOP_RECTS)) == NULL)
190 Warning (((char *)GETMESSAGE(30, 2, "Insufficient memory for icon creation")));
194 if ((pcd->piconBottomShadows =
195 AllocateRList ((unsigned)NUM_BOTH_BOTTOM_RECTS)) == NULL)
198 Warning (((char *)GETMESSAGE(30, 3, "Insufficient memory for icon creation")));
204 * Adjust for icons in the box
205 * Don't adjust the icon for the icon box itself
209 if (pWS->pIconBox && (pWS->pIconBox->pCD_iconBox != pcd) &&
210 !(pcd->clientFlags & FRONT_PANEL_BOX))
212 if (pWS->pIconBox && (pWS->pIconBox->pCD_iconBox != pcd))
213 #endif /* PANELIST */
215 xOffset = IB_MARGIN_WIDTH;
216 yOffset = IB_MARGIN_HEIGHT;
226 * Reparent the icon window if there is one
228 if ((ICON_DECORATION(pcd) & ICON_IMAGE_PART) &&
231 ReparentIconWindow (pcd, xOffset, yOffset);
235 if (pcd->piconTopShadows->used == 0)
237 MakeIconShadows (pcd, xOffset, yOffset);
241 } /* END OF FUNCTION MakeIcon */
245 /*************************************<->*************************************
247 * MakeIconShadows (pcd, xOffset, yOffset)
252 *************************************<->***********************************/
254 void MakeIconShadows (ClientData *pcd, int xOffset, int yOffset)
258 * Handle different icon styles
261 switch (ICON_DECORATION(pcd) & (ICON_LABEL_PART | ICON_IMAGE_PART))
263 case ICON_LABEL_PART:
264 BevelRectangle (pcd->piconTopShadows, /* label */
265 pcd->piconBottomShadows,
266 0 + xOffset, (int)ICON_IMAGE_HEIGHT(pcd) + yOffset,
267 (unsigned int) ICON_WIDTH(pcd),
268 (unsigned int) ICON_LABEL_HEIGHT(pcd),
269 ICON_EXTERNAL_SHADOW_WIDTH,
270 ICON_EXTERNAL_SHADOW_WIDTH,
271 ICON_EXTERNAL_SHADOW_WIDTH,
272 ICON_EXTERNAL_SHADOW_WIDTH);
275 case ICON_IMAGE_PART:
276 BevelRectangle (pcd->piconTopShadows, /* image outside */
277 pcd->piconBottomShadows,
278 0 + xOffset, 0 + yOffset,
279 (unsigned int) ICON_WIDTH(pcd),
280 (unsigned int) ICON_IMAGE_HEIGHT(pcd),
281 ICON_EXTERNAL_SHADOW_WIDTH,
282 ICON_EXTERNAL_SHADOW_WIDTH,
283 ICON_EXTERNAL_SHADOW_WIDTH,
284 ICON_EXTERNAL_SHADOW_WIDTH);
286 if (wmGD.frameStyle == WmRECESSED)
287 BevelRectangle (pcd->piconBottomShadows, /* image inside */
288 pcd->piconTopShadows,
289 ICON_INNER_X_OFFSET + xOffset,
290 ICON_INNER_Y_OFFSET + yOffset,
291 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).width +
292 4*ICON_INTERNAL_SHADOW_WIDTH),
293 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).height +
294 4*ICON_INTERNAL_SHADOW_WIDTH),
295 ICON_INTERNAL_SHADOW_WIDTH,
296 ICON_INTERNAL_SHADOW_WIDTH,
297 ICON_INTERNAL_SHADOW_WIDTH,
298 ICON_INTERNAL_SHADOW_WIDTH);
302 case (ICON_IMAGE_PART | ICON_LABEL_PART):
303 if (wmGD.frameStyle == WmSLAB)
305 BevelRectangle (pcd->piconTopShadows, /* image outside */
306 pcd->piconBottomShadows,
307 0 + xOffset, 0 + yOffset,
308 (unsigned int) ICON_WIDTH(pcd),
309 (unsigned int) (ICON_IMAGE_HEIGHT(pcd) +
310 ICON_LABEL_HEIGHT(pcd)),
311 ICON_EXTERNAL_SHADOW_WIDTH,
312 ICON_EXTERNAL_SHADOW_WIDTH,
313 ICON_EXTERNAL_SHADOW_WIDTH,
314 ICON_EXTERNAL_SHADOW_WIDTH);
318 BevelRectangle (pcd->piconTopShadows, /* image outside */
319 pcd->piconBottomShadows,
320 0 + xOffset, 0 + yOffset,
321 (unsigned int) ICON_WIDTH(pcd),
322 (unsigned int) ICON_IMAGE_HEIGHT(pcd),
323 ICON_EXTERNAL_SHADOW_WIDTH,
324 ICON_EXTERNAL_SHADOW_WIDTH,
325 ICON_INTERNAL_SHADOW_WIDTH,
326 ICON_EXTERNAL_SHADOW_WIDTH);
329 if (wmGD.frameStyle == WmRECESSED)
330 BevelRectangle (pcd->piconBottomShadows, /* image inside */
331 pcd->piconTopShadows,
332 ICON_INNER_X_OFFSET + xOffset,
333 ICON_INNER_Y_OFFSET + yOffset,
334 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).width +
335 4*ICON_INTERNAL_SHADOW_WIDTH),
336 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).height +
337 4*ICON_INTERNAL_SHADOW_WIDTH),
338 ICON_INTERNAL_SHADOW_WIDTH,
339 ICON_INTERNAL_SHADOW_WIDTH,
340 ICON_INTERNAL_SHADOW_WIDTH,
341 ICON_INTERNAL_SHADOW_WIDTH);
343 if (wmGD.frameStyle == WmRECESSED)
344 BevelRectangle (pcd->piconTopShadows, /* label */
345 pcd->piconBottomShadows,
346 0 + xOffset, (int)ICON_IMAGE_HEIGHT(pcd) + yOffset,
347 (unsigned int) ICON_WIDTH(pcd),
348 (unsigned int) ICON_LABEL_HEIGHT(pcd),
349 ICON_INTERNAL_SHADOW_WIDTH,
350 ICON_EXTERNAL_SHADOW_WIDTH,
351 ICON_EXTERNAL_SHADOW_WIDTH,
352 ICON_EXTERNAL_SHADOW_WIDTH);
357 } /* END OF FUNCTION MakeIconShadows */
364 /*************************************<->*************************************
366 * IconExposureProc (pcd, expose)
376 * pcd - pointer to client data
385 *************************************<->***********************************/
387 void IconExposureProc (ClientData *pcd, Boolean expose)
394 unsigned int width, height;
395 GC iconGC, topGC, botGC;
396 static XRectangle shrinkRects[4];
401 * Adjust for icons in the iconBox
406 xOffset = IB_MARGIN_WIDTH;
407 yOffset = IB_MARGIN_HEIGHT;
415 /* get appropriate GCs */
417 if ((wmGD.keyboardFocus == pcd) && (pcd->clientState == MINIMIZED_STATE))
419 iconGC = ICON_APPEARANCE(pcd).activeGC;
420 topGC = ICON_APPEARANCE(pcd).activeTopShadowGC;
421 botGC = ICON_APPEARANCE(pcd).activeBottomShadowGC;
425 iconGC = ICON_APPEARANCE(pcd).inactiveGC;
426 topGC = ICON_APPEARANCE(pcd).inactiveTopShadowGC;
427 botGC = ICON_APPEARANCE(pcd).inactiveBottomShadowGC;
430 if (ACTIVE_PSD->useIconBox && P_ICON_BOX(pcd))
440 (unsigned int) ICON_WIDTH(pcd),
441 (unsigned int) ICON_HEIGHT(pcd), False);
444 if (pcd->clientState == MINIMIZED_STATE)
447 * This is the "raised" icon appearance
450 if (pcd->piconTopShadows)
453 XFillRectangles (DISPLAY,
456 pcd->piconTopShadows->prect,
457 pcd->piconTopShadows->used);
460 if (pcd->piconBottomShadows)
462 XFillRectangles (DISPLAY,
465 pcd->piconBottomShadows->prect,
466 pcd->piconBottomShadows->used);
471 shrinkRects[0].x = IB_MARGIN_WIDTH;
472 shrinkRects[0].y = IB_MARGIN_HEIGHT;
473 shrinkRects[0].width = (unsigned int) ICON_WIDTH(pcd);
474 shrinkRects[0].height = iconShrinkY - IB_MARGIN_HEIGHT;
476 shrinkRects[1].x = IB_MARGIN_WIDTH;
477 shrinkRects[1].y = iconShrinkY;
478 shrinkRects[1].width = iconShrinkX - IB_MARGIN_WIDTH;
479 shrinkRects[1].height = iconShrinkHeight;
481 shrinkRects[2].x = iconShrinkX + iconShrinkWidth;
482 shrinkRects[2].y = iconShrinkY;
483 shrinkRects[2].width = iconShrinkX - IB_MARGIN_WIDTH;
484 shrinkRects[2].height = iconShrinkHeight;
486 shrinkRects[3].x = IB_MARGIN_WIDTH;
487 shrinkRects[3].y = iconShrinkY + iconShrinkHeight;
488 shrinkRects[3].width = (unsigned int) ICON_WIDTH(pcd);
489 shrinkRects[3].height = iconShrinkY - IB_MARGIN_HEIGHT;
491 XFillRectangles (DISPLAY,
503 if (pcd->clientState == MINIMIZED_STATE)
506 * This is the "raised" icon appearance
509 if (pcd->piconTopShadows->prect)
512 XFillRectangles (DISPLAY,
515 pcd->piconTopShadows->prect,
516 pcd->piconTopShadows->used);
519 if (pcd->piconBottomShadows->prect)
521 XFillRectangles (DISPLAY,
524 pcd->piconBottomShadows->prect,
525 pcd->piconBottomShadows->used);
534 if ((ICON_DECORATION(pcd) & ICON_LABEL_PART) &&
535 (expose || !(ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)))
537 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
543 * Draw image if no icon window (client has to redraw that!)
544 * OR if using the iconbox, draw the default image where
545 * the icon window was.
549 ((!pcd->iconWindow && (ICON_DECORATION(pcd) & ICON_IMAGE_PART)) ||
550 (ACTIVE_PSD->useIconBox && P_ICON_BOX(pcd) &&
552 pcd->clientState != MINIMIZED_STATE &&
553 (ICON_DECORATION(pcd) & ICON_IMAGE_PART))))
557 image = DEFAULT_PIXMAP(pcd);
561 image = pcd->iconPixmap;
567 if ((ACTIVE_PSD->useIconBox) && (P_ICON_BOX(pcd)))
570 if (pcd->clientState != MINIMIZED_STATE)
572 dest_x = ICON_IMAGE_X_OFFSET
573 + ICON_INTERNAL_SHADOW_WIDTH
576 dest_y = ICON_IMAGE_Y_OFFSET
577 + ICON_INTERNAL_SHADOW_WIDTH
579 if (wmGD.frameStyle == WmSLAB)
581 /* less beveling in this style */
582 dest_x -= ICON_INTERNAL_SHADOW_WIDTH;
583 dest_y -= ICON_INTERNAL_SHADOW_WIDTH;
586 width = ICON_IMAGE_MAXIMUM(pcd).width;
587 height= ICON_IMAGE_MAXIMUM(pcd).height;
588 if (wmGD.frameStyle == WmSLAB)
593 XCopyArea (DISPLAY, image,
596 ICON_INTERNAL_SHADOW_WIDTH,
597 ICON_INTERNAL_SHADOW_WIDTH,
598 width, height, dest_x, dest_y);
600 if (FADE_NORMAL_ICON(pcd))
602 iconGC = FADE_ICON_GC(pcd);
603 XFillRectangle (DISPLAY,
613 dest_x = ICON_IMAGE_X_OFFSET
616 dest_y = ICON_IMAGE_Y_OFFSET
618 if (wmGD.frameStyle == WmSLAB)
620 /* less beveling in this style */
621 dest_x -= ICON_INTERNAL_SHADOW_WIDTH;
622 dest_y -= ICON_INTERNAL_SHADOW_WIDTH;
625 width = ICON_IMAGE_MAXIMUM(pcd).width
626 + (2 * ICON_INTERNAL_SHADOW_WIDTH);
627 height= ICON_IMAGE_MAXIMUM(pcd).height
628 + (2 * ICON_INTERNAL_SHADOW_WIDTH);
630 if (wmGD.frameStyle == WmSLAB)
635 XCopyArea (DISPLAY, image,
637 iconGC, 0, 0, width, height,
645 width = ICON_IMAGE_MAXIMUM(pcd).width +
646 2 * ICON_INTERNAL_SHADOW_WIDTH;
648 height= ICON_IMAGE_MAXIMUM(pcd).height +
649 2 * ICON_INTERNAL_SHADOW_WIDTH;
651 if (wmGD.frameStyle == WmSLAB)
653 dest_x = ICON_INNER_X_OFFSET;
654 dest_y = ICON_INNER_Y_OFFSET;
660 dest_x = ICON_INNER_X_OFFSET + ICON_INTERNAL_SHADOW_WIDTH;
661 dest_y = ICON_INNER_Y_OFFSET + ICON_INTERNAL_SHADOW_WIDTH;
663 XCopyArea (DISPLAY, image,
665 iconGC, 0, 0, width, height,
675 } /* END OF FUNCTION IconExposureProc */
680 /*************************************<->*************************************
682 * GetIconTitleBox (pcd, pBox)
687 * Returns a rectangle containing the icon text box
692 * pcd - pointer to client data
693 * pBox - pointer to an XRectangle structure that gets returned data
697 * pBox - returned data
702 *************************************<->***********************************/
704 void GetIconTitleBox (ClientData *pcd, XRectangle *pBox)
711 * Adjust for icons in the iconBox
716 xOffset = IB_MARGIN_WIDTH;
717 yOffset = IB_MARGIN_HEIGHT;
725 if ((P_ICON_BOX(pcd)) && (pcd->clientState != MINIMIZED_STATE))
727 /* move label up to enhance shrink wrap effect */
728 pBox->x = ICON_EXTERNAL_SHADOW_WIDTH
729 + ICON_IMAGE_LEFT_PAD
730 + (2 * ICON_INTERNAL_SHADOW_WIDTH)
731 + ICON_IMAGE_LEFT_PAD
734 pBox->y = ICON_IMAGE_HEIGHT(pcd)
736 + ((ICON_IMAGE_HEIGHT(pcd) > 0)
737 ? - ICON_IMAGE_BOTTOM_PAD
738 : ICON_EXTERNAL_SHADOW_WIDTH)
739 + ((ICON_IMAGE_HEIGHT(pcd) >0)
741 : WM_TOP_TITLE_PADDING );
743 if (wmGD.frameStyle == WmSLAB)
745 /* account for less beveling in this style */
746 pBox->x -= ICON_INTERNAL_SHADOW_WIDTH;
747 pBox->y -= ICON_INTERNAL_SHADOW_WIDTH;
752 pBox->width = ICON_IMAGE_MAXIMUM(pcd).width
753 + ((wmGD.frameStyle == WmSLAB) ? 2 : 0)
754 - ICON_IMAGE_LEFT_PAD
755 - ICON_EXTERNAL_SHADOW_WIDTH;
757 pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
760 else if ((P_ICON_BOX(pcd)) && (pcd->clientState == MINIMIZED_STATE))
762 pBox->x = ICON_EXTERNAL_SHADOW_WIDTH
763 + ICON_IMAGE_LEFT_PAD
764 + (2 * ICON_INTERNAL_SHADOW_WIDTH)
765 + ICON_IMAGE_LEFT_PAD
768 pBox->y = ICON_IMAGE_HEIGHT(pcd)
770 + ((ICON_IMAGE_HEIGHT(pcd) > 0)
771 ? ICON_INTERNAL_SHADOW_WIDTH
772 : ICON_EXTERNAL_SHADOW_WIDTH)
773 + WM_TOP_TITLE_PADDING ;
775 pBox->width = ICON_IMAGE_MAXIMUM(pcd).width
776 + ((wmGD.frameStyle == WmSLAB) ? 2 : 0)
777 - ICON_IMAGE_LEFT_PAD;
779 pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
781 if (wmGD.frameStyle == WmSLAB)
783 /* account for less beveling in this style */
784 pBox->x -= ICON_INTERNAL_SHADOW_WIDTH + 2*ICON_IMAGE_LEFT_PAD;
785 pBox->y -= 3 * ICON_INTERNAL_SHADOW_WIDTH;
786 pBox->width += ICON_IMAGE_LEFT_PAD + 2;
792 pBox->x = ICON_EXTERNAL_SHADOW_WIDTH
793 + WM_TOP_TITLE_PADDING
796 if (wmGD.frameStyle == WmSLAB)
798 /* account for less beveling in this style */
799 yOffset -= ICON_INTERNAL_SHADOW_WIDTH;
801 pBox->y = ICON_IMAGE_HEIGHT(pcd)
802 + WM_TOP_TITLE_PADDING
804 + ((ICON_IMAGE_HEIGHT(pcd) > 0)
805 ? ICON_INTERNAL_SHADOW_WIDTH
806 : ICON_EXTERNAL_SHADOW_WIDTH);
808 pBox->width = ICON_WIDTH(pcd) - 2 * ICON_EXTERNAL_SHADOW_WIDTH -
809 WM_TOP_TITLE_PADDING - WM_BOTTOM_TITLE_PADDING;
810 pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
815 } /* END OF FUNCTION GetIconTitleBox */
819 /*************************************<->*************************************
821 * DrawIconTitle (pcd)
826 * Draws the title in the Icon title area
831 * pcd - pointer to client data
839 *************************************<->***********************************/
841 void DrawIconTitle (ClientData *pcd)
847 GetIconTitleBox (pcd, &textBox);
849 /* get appropriate GCs */
852 if ((ACTIVE_PSD->useIconBox &&
853 !((pcd->dtwmBehaviors & (DtWM_BEHAVIOR_PANEL)) ||
854 (pcd->clientFlags & CLIENT_WM_CLIENTS))) ||
856 if ((ACTIVE_PSD->useIconBox && !(pcd->clientFlags & CLIENT_WM_CLIENTS)) ||
857 #endif /* PANELIST */
859 if ((ACTIVE_PSD->useIconBox && !(pcd->clientFlags & ICON_BOX)) ||
861 !(wmGD.keyboardFocus == pcd))
863 iconGC = ICON_APPEARANCE(pcd).inactiveGC;
867 iconGC = ICON_APPEARANCE(pcd).activeGC;
871 * Dim text if this is in the icon box and the client is mapped
874 if ((ACTIVE_PSD->useIconBox) &&
876 (FADE_NORMAL_ICON(pcd)) &&
877 (!(pcd->clientState == MINIMIZED_STATE)))
879 iconGC = FADE_ICON_TEXT_GC(pcd);
887 WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd), ICON_APPEARANCE(pcd).fontList,
888 pcd->iconTitle, iconGC,
889 textBox.x, textBox.y, textBox.width, &textBox, True);
891 WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd), ICON_APPEARANCE(pcd).fontList,
892 pcd->iconTitle, iconGC,
893 textBox.x, textBox.y, textBox.width, &textBox);
896 } /* END OF FUNCTION DrawIconTitle */
901 /*************************************<->*************************************
903 * RedisplayIconTitle (pcd)
908 * Draws the title in the Icon title area
913 * pcd - pointer to client data
921 *************************************<->***********************************/
923 void RedisplayIconTitle (ClientData *pcd)
929 * only proceed if we've got the right icon parts to work on
932 if (ICON_DECORATION(pcd) & ICON_LABEL_PART && ICON_FRAME_WIN(pcd))
935 /* nothing to do if no labels */
936 if (!(ICON_DECORATION(pcd) & ICON_LABEL_PART))
939 /* get the box that the text sits in */
940 GetIconTitleBox (pcd, &textBox);
943 * Get appropriate GCs
944 * Dim text if this is in the icon box and the client is mapped
947 if ((ACTIVE_PSD->useIconBox && (P_ICON_BOX(pcd)) &&
948 !(pcd->clientFlags & CLIENT_WM_CLIENTS)) ||
950 if ((ACTIVE_PSD->useIconBox && (P_ICON_BOX(pcd)) &&
951 !(pcd->clientFlags & ICON_BOX)) ||
953 !(wmGD.keyboardFocus == pcd))
955 iconGC = ICON_APPEARANCE(pcd).inactiveGC;
959 iconGC = ICON_APPEARANCE(pcd).activeGC;
962 if ((ACTIVE_PSD->useIconBox) &&
964 (FADE_NORMAL_ICON(pcd)) &&
965 (!(pcd->clientState == MINIMIZED_STATE)))
967 iconGC = FADE_ICON_TEXT_GC(pcd);
970 /* out with the old */
973 textBox.x, textBox.y,
974 (unsigned int) textBox.width, (unsigned int) textBox.height,
977 /* in with the new */
979 WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd),
980 ICON_APPEARANCE(pcd).fontList,
981 pcd->iconTitle, iconGC,
982 textBox.x, textBox.y, textBox.width, &textBox,
985 WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd),
986 ICON_APPEARANCE(pcd).fontList,
987 pcd->iconTitle, iconGC,
988 textBox.x, textBox.y, textBox.width, &textBox);
992 * Erase & paint text in the active icon text window
994 if ((wmGD.keyboardFocus == pcd) &&
995 (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART))
997 PaintActiveIconText (pcd, True);
1000 } /* END OF FUNCTION RedisplayIconTitle */
1004 /*************************************<->*************************************
1006 * GetIconDimensions (pSD, &pWidth, &pLabelHeight, &pImageHeight)
1011 * returns dimensions of icon frame parts
1016 * pSD - pointer to screen data
1017 * pWidth - pointer to width of frame
1018 * pLabelHeight - pointer to height of label part of icon
1019 * pImageHeight - pointer to height of image part of icon
1024 * *pWidth - width of frame
1025 * *pLabelHeight - height of label part of icon
1026 * *pImageHeight - height of image part of icon
1032 *************************************<->***********************************/
1033 void GetIconDimensions (WmScreenData *pSD, unsigned int *pWidth, unsigned int *pLabelHeight, unsigned int *pImageHeight)
1036 * The icon width is always keyed to the icon image maximum regardless
1037 * of whether an icon image part appears or not.
1039 *pWidth = pSD->iconImageMaximum.width +
1040 ((wmGD.frameStyle == WmSLAB) ? 2 : 0) +
1041 ICON_IMAGE_LEFT_PAD +
1042 ICON_IMAGE_RIGHT_PAD +
1043 2 * ICON_EXTERNAL_SHADOW_WIDTH +
1044 4 * ICON_INTERNAL_SHADOW_WIDTH;
1045 if (wmGD.frameStyle == WmSLAB)
1047 /* less beveling in this style */
1048 *pWidth -= 2 * ICON_INTERNAL_SHADOW_WIDTH;
1051 switch (pSD->iconDecoration & (ICON_IMAGE_PART | ICON_LABEL_PART))
1053 case ICON_LABEL_PART:
1056 *pLabelHeight = ICON_EXTERNAL_SHADOW_WIDTH +
1057 WM_TOP_TITLE_PADDING +
1058 TEXT_HEIGHT(pSD->iconAppearance.font) +
1059 WM_BOTTOM_TITLE_PADDING +
1060 ICON_EXTERNAL_SHADOW_WIDTH;
1063 case ICON_IMAGE_PART:
1064 *pImageHeight = ICON_EXTERNAL_SHADOW_WIDTH +
1065 ICON_IMAGE_TOP_PAD +
1066 ICON_INTERNAL_SHADOW_WIDTH +
1067 ICON_INTERNAL_SHADOW_WIDTH +
1068 pSD->iconImageMaximum.height +
1069 ((wmGD.frameStyle == WmSLAB) ? 2 : 0) +
1070 ICON_INTERNAL_SHADOW_WIDTH +
1071 ICON_INTERNAL_SHADOW_WIDTH +
1072 ICON_IMAGE_BOTTOM_PAD +
1073 ICON_EXTERNAL_SHADOW_WIDTH;
1074 if (wmGD.frameStyle == WmSLAB)
1076 /* less beveling in this style */
1077 *pImageHeight -= 2 * ICON_INTERNAL_SHADOW_WIDTH;
1085 case (ICON_IMAGE_PART | ICON_LABEL_PART):
1086 *pImageHeight = ICON_EXTERNAL_SHADOW_WIDTH +
1087 ICON_IMAGE_TOP_PAD +
1088 ICON_INTERNAL_SHADOW_WIDTH +
1089 ICON_INTERNAL_SHADOW_WIDTH +
1090 pSD->iconImageMaximum.height +
1091 ((wmGD.frameStyle == WmSLAB) ? 2 : 0) +
1092 ICON_INTERNAL_SHADOW_WIDTH +
1093 ICON_INTERNAL_SHADOW_WIDTH +
1094 ICON_IMAGE_BOTTOM_PAD +
1095 ICON_INTERNAL_SHADOW_WIDTH;
1097 *pLabelHeight = ICON_INTERNAL_SHADOW_WIDTH +
1098 WM_TOP_TITLE_PADDING +
1099 TEXT_HEIGHT(pSD->iconAppearance.font) +
1100 WM_BOTTOM_TITLE_PADDING +
1101 ICON_EXTERNAL_SHADOW_WIDTH;
1102 if (wmGD.frameStyle == WmSLAB)
1105 * In this style there is less beveling and no
1106 * etching between the icon image and label.
1108 *pImageHeight -= 3 * ICON_INTERNAL_SHADOW_WIDTH;
1109 *pLabelHeight -= ICON_INTERNAL_SHADOW_WIDTH;
1115 *pLabelHeight = *pImageHeight = 0;
1122 /*************************************<->*************************************
1124 * InitIconSize (pSD)
1129 * set global icon size variables
1143 *************************************<->***********************************/
1144 void InitIconSize (WmScreenData *pSD)
1146 Cardinal label, image;
1148 GetIconDimensions (pSD, (unsigned int *)&(pSD->iconWidth),
1151 pSD->iconHeight = label+image;
1153 pSD->iconImageHeight = image;
1154 pSD->iconLabelHeight = label;
1157 iconShrinkX = IB_MARGIN_WIDTH
1158 + ICON_EXTERNAL_SHADOW_WIDTH
1159 + ICON_IMAGE_LEFT_PAD
1160 + 2 * ICON_INTERNAL_SHADOW_WIDTH;
1163 iconShrinkY = IB_MARGIN_HEIGHT
1164 + ICON_EXTERNAL_SHADOW_WIDTH
1165 + ((pSD->iconDecoration & ICON_IMAGE_PART)
1166 ? (ICON_IMAGE_TOP_PAD +
1167 (2 * ICON_INTERNAL_SHADOW_WIDTH))
1168 : (WM_TOP_TITLE_PADDING));
1169 if (wmGD.frameStyle == WmSLAB)
1171 /* less beveling in this style */
1172 iconShrinkX -= ICON_INTERNAL_SHADOW_WIDTH;
1173 iconShrinkY -= ICON_INTERNAL_SHADOW_WIDTH;
1177 iconShrinkWidth = pSD->iconImageMaximum.width ;
1178 if (wmGD.frameStyle == WmSLAB)
1180 iconShrinkWidth += 2;
1186 switch (pSD->iconDecoration & (ICON_IMAGE_PART | ICON_LABEL_PART))
1188 case ICON_LABEL_PART:
1189 iconShrinkHeight = TEXT_HEIGHT(pSD->iconAppearance.font);
1192 case ICON_IMAGE_PART:
1193 iconShrinkHeight = pSD->iconImageMaximum.height;
1197 case (ICON_IMAGE_PART | ICON_LABEL_PART):
1198 iconShrinkHeight = pSD->iconHeight
1199 - ICON_EXTERNAL_SHADOW_WIDTH
1200 - ICON_IMAGE_TOP_PAD
1201 - ICON_INTERNAL_SHADOW_WIDTH
1202 - ICON_INTERNAL_SHADOW_WIDTH
1203 - ICON_IMAGE_BOTTOM_PAD
1204 - WM_BOTTOM_TITLE_PADDING
1205 - ICON_EXTERNAL_SHADOW_WIDTH;
1206 if (wmGD.frameStyle == WmSLAB)
1208 /* adjust for less beveling in this style */
1209 iconShrinkHeight += ICON_INTERNAL_SHADOW_WIDTH;
1216 } /* END OF FUNCTION InitIconSize */
1219 /*************************************<->*************************************
1221 * ShowActiveIcon (pcd)
1226 * Paint the icon to indicate an "active" state
1231 * pcd - pointer to client data
1242 *************************************<->***********************************/
1244 void ShowActiveIcon (ClientData *pcd)
1246 unsigned long attr_mask;
1247 XSetWindowAttributes window_attribs;
1249 if (ICON_FRAME_WIN(pcd))
1252 * Use background pixmap if one is specified, otherwise set the
1253 * appropriate background color.
1256 if (ICON_APPEARANCE(pcd).activeBackgroundPixmap)
1258 attr_mask = CWBackPixmap;
1259 window_attribs.background_pixmap =
1260 ICON_APPEARANCE(pcd).activeBackgroundPixmap;
1264 attr_mask = CWBackPixel;
1265 window_attribs.background_pixel =
1266 ICON_APPEARANCE(pcd).activeBackground;
1270 /* set active window attributes */
1271 XChangeWindowAttributes (DISPLAY,
1272 ICON_FRAME_WIN(pcd),
1273 attr_mask, &window_attribs);
1275 /* clear the frame to the right background */
1276 if ((!ACTIVE_PSD->useIconBox) ||
1277 (P_ICON_BOX(pcd) == NULL))
1279 #ifndef MOTIF_ONE_DOT_ONE
1280 if (ICON_DECORATION(pcd) & ICON_IMAGE_PART)
1282 Dimension dheight, dwidth;
1284 dwidth = ICON_WIDTH(pcd) -
1285 2*ICON_EXTERNAL_SHADOW_WIDTH;
1286 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1288 dheight = ICON_IMAGE_HEIGHT(pcd) -
1289 ICON_EXTERNAL_SHADOW_WIDTH;
1293 dheight = ICON_IMAGE_HEIGHT(pcd) -
1294 2*ICON_EXTERNAL_SHADOW_WIDTH;
1296 if (wmGD.frameStyle == WmRECESSED)
1298 dheight -= ICON_INTERNAL_SHADOW_WIDTH;
1301 XmeClearBorder (DISPLAY, ICON_FRAME_WIN(pcd),
1302 ICON_EXTERNAL_SHADOW_WIDTH,
1303 ICON_EXTERNAL_SHADOW_WIDTH,
1306 ICON_IMAGE_TOP_PAD);
1309 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1311 XClearArea (DISPLAY,
1312 ICON_FRAME_WIN(pcd),
1314 ICON_IMAGE_HEIGHT(pcd),
1315 (unsigned int) ICON_WIDTH(pcd),
1316 (unsigned int) ICON_HEIGHT(pcd), False);
1319 XClearWindow (DISPLAY, ICON_FRAME_WIN(pcd));
1325 * clear only area of real frame, not highlight area
1328 XClearArea (DISPLAY,
1329 ICON_FRAME_WIN(pcd),
1332 (unsigned int) ICON_WIDTH(pcd),
1333 (unsigned int) ICON_HEIGHT(pcd), False);
1338 * Put up a big icon text label.
1341 if (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)
1344 if (wmGD.activeIconTextDisplayed)
1345 PaintActiveIconText(pcd, True);
1347 ShowActiveIconText(pcd);
1350 /* simulate exposure of window */
1351 #ifndef MOTIF_ONE_DOT_ONE
1352 IconExposureProc(pcd, False);
1354 IconExposureProc(pcd, True);
1359 } /* END OF FUNCTION ShowActiveIcon */
1363 /*************************************<->*************************************
1365 * ShowInactiveIcon (pcd, refresh)
1370 * Make the icon appear "inactive"
1375 * pcd - pointer to client data
1377 * refresh - if True redraw the icon
1379 *************************************<->***********************************/
1380 void ShowInactiveIcon (ClientData *pcd, Boolean refresh)
1382 unsigned long attr_mask = 0;
1383 XSetWindowAttributes window_attribs;
1385 /* turn off the active icon text */
1386 if (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)
1388 /* pass in screen to fix multiscreen bug [P3385] */
1389 HideActiveIconText(pcd->pSD);
1392 if (ICON_FRAME_WIN(pcd))
1395 * Use background pixmap if one is specified, otherwise set the
1396 * appropriate background color.
1399 if (ICON_APPEARANCE(pcd).backgroundPixmap)
1401 attr_mask |= CWBackPixmap;
1402 window_attribs.background_pixmap =
1403 ICON_APPEARANCE(pcd).backgroundPixmap;
1407 attr_mask |= CWBackPixel;
1408 window_attribs.background_pixel =
1409 ICON_APPEARANCE(pcd).background;
1413 /* set active window attributes */
1414 XChangeWindowAttributes (DISPLAY, ICON_FRAME_WIN(pcd), attr_mask,
1420 /* clear the frame to the right background */
1421 if ((!ACTIVE_PSD->useIconBox) ||
1422 (P_ICON_BOX(pcd) == NULL))
1424 #ifndef MOTIF_ONE_DOT_ONE
1425 XmeClearBorder (DISPLAY, ICON_FRAME_WIN(pcd),
1427 ICON_WIDTH(pcd), ICON_IMAGE_HEIGHT(pcd), 4);
1429 XClearArea (DISPLAY,
1430 ICON_FRAME_WIN(pcd),
1431 0, ICON_IMAGE_HEIGHT(pcd),
1432 (unsigned int) ICON_WIDTH(pcd),
1433 (unsigned int) ICON_HEIGHT(pcd), False);
1435 XClearWindow (DISPLAY, ICON_FRAME_WIN(pcd));
1441 * clear only area of real frame, not highlight area
1444 XClearArea (DISPLAY,
1445 ICON_FRAME_WIN(pcd),
1448 (unsigned int) ICON_WIDTH(pcd),
1449 (unsigned int) ICON_HEIGHT(pcd), False);
1453 /* simulate exposure of window */
1454 #ifndef MOTIF_ONE_DOT_ONE
1455 IconExposureProc(pcd, False);
1457 IconExposureProc(pcd, True);
1463 } /* END OF FUNTION ShowInactiveIcon */
1467 /*************************************<->*************************************
1469 * ReparentIconWindow (pcd, xOffset, yOffset)
1474 * Reparent the icon window in the center of the image area
1479 * pcd - pointer to client data
1480 * xOffset - adjusts for icons in the iconBox
1481 * yOffset - adjusts for icons in the iconBox
1491 *************************************<->***********************************/
1492 void ReparentIconWindow (ClientData *pcd, int xOffset, int yOffset)
1495 unsigned int width, height, bw, depth;
1497 XWindowChanges windowChanges;
1503 #endif /* PANELIST */
1505 * Check if window size is too big
1507 XGetGeometry (DISPLAY, pcd->iconWindow, &root, &x, &y, &width, &height,
1511 * strip off previous window border and set window geometry to
1512 * fit inside icon frame
1515 mask = CWBorderWidth;
1516 windowChanges.border_width = 0;
1523 if (width > ((ICON_IMAGE_MAXIMUM(pcd).width) +
1524 ((wmGD.frameStyle == WmSLAB) ? 2 : 0)))
1526 width = windowChanges.width = ICON_IMAGE_MAXIMUM(pcd).width +
1527 ((wmGD.frameStyle == WmSLAB) ? 2 : 0);
1530 else if (width < ICON_IMAGE_MINIMUM(pcd).width) {
1531 width = windowChanges.width = ICON_IMAGE_MINIMUM(pcd).width;
1535 if (height > ((ICON_IMAGE_MAXIMUM(pcd).height) +
1536 ((wmGD.frameStyle == WmSLAB) ? 2 : 0)))
1538 height = windowChanges.height = ICON_IMAGE_MAXIMUM(pcd).height +
1539 ((wmGD.frameStyle == WmSLAB) ? 2 : 0);
1542 else if (height < ICON_IMAGE_MINIMUM(pcd).height) {
1543 height = windowChanges.height = ICON_IMAGE_MINIMUM(pcd).height;
1548 XConfigureWindow (DISPLAY, pcd->iconWindow, mask, &windowChanges);
1551 * Reparent the icon window to the center of the icon image frame
1554 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1556 yOffset += ICON_INTERNAL_SHADOW_WIDTH;
1559 rpX = ((ICON_WIDTH(pcd) - width)/2) + xOffset;
1560 rpY = ((ICON_IMAGE_HEIGHT(pcd) - height)/2) + yOffset;
1565 XReparentWindow (DISPLAY, pcd->iconWindow, ICON_FRAME_WIN(pcd), rpX, rpY);
1566 pcd->clientFlags |= ICON_REPARENTED;
1569 * Map the icon window when the icon frame is mapped.
1572 } /* END if (!pcd->pECD) */
1573 #endif /* PANELIST */
1574 } /* END OF FUNCTION ReparentIconWindow */
1577 /*************************************<->*************************************
1579 * PutBoxOnScreen (screen, px, py, width, height)
1584 * Changes the position of the passed box so that it is all on screen
1589 * screen - screen we're talking about
1590 * px - pointer to x-coord
1591 * py - pointer to y-coord
1592 * width - width of box
1593 * height - height of box
1604 *************************************<->***********************************/
1605 void PutBoxOnScreen (int screen, int *px, int *py, unsigned int width, unsigned int height)
1608 * Place active label text nicely on screen
1611 if (*px+width+1 > DisplayWidth (DISPLAY, screen))
1612 *px -= (*px+width+1) - DisplayWidth (DISPLAY, screen);
1614 if (*py+height+1 > DisplayHeight (DISPLAY, screen))
1615 *py -= (*py+height+1) - DisplayHeight (DISPLAY, screen);
1617 if (*px < 1) *px = 1;
1619 if (*py < 1) *py = 1;
1621 } /* END OF FUNCTION PutBoxOnScreen */
1624 /*************************************<->*************************************
1626 * PutBoxInIconBox (pCD, px, py, width, height)
1631 * Changes the position of the passed box so that it is not
1632 * clipped by the bulletin board
1638 * pCD - pointer to client data
1639 * px - pointer to x-coord
1640 * py - pointer to y-coord
1641 * width - width of box
1642 * height - height of box
1653 *************************************<->***********************************/
1654 void PutBoxInIconBox (ClientData *pCD, int *px, int *py, unsigned int *width, unsigned int *height)
1659 Dimension bBoardWidth;
1660 Dimension bBoardHeight;
1667 XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &bBoardWidth ); i++;
1668 XtSetArg (getArgs[i], XmNheight, (XtArgVal) &bBoardHeight ); i++;
1669 XtGetValues (P_ICON_BOX(pCD)->bBoardWidget, getArgs, i);
1671 clipWidth = (int) bBoardWidth;
1672 clipHeight = (int) bBoardHeight;
1674 if (*px + *width-1 > clipWidth)
1675 *px -= (*px + *width-1) - clipWidth;
1677 if (*py + *height-1 > clipHeight)
1678 *py -= (*py + *height-1) - clipHeight;
1680 if (*px < 0) *px = 0;
1682 if (*py < 0) *py = 0;
1685 } /* END OF FUNCTION PutBoxInIconBox */
1688 /*************************************<->*************************************
1690 * CreateActiveIconTextWindow (pSD)
1695 * creates the window that's popped up when an icon is activated
1699 * pSD - pointer to screen data
1707 *************************************<->***********************************/
1709 void CreateActiveIconTextWindow (WmScreenData *pSD)
1711 XSetWindowAttributes window_attribs;
1712 unsigned long attr_mask;
1714 /* create active icon text window */
1715 attr_mask = CWEventMask| CWCursor;
1716 window_attribs.event_mask = ExposureMask;
1717 window_attribs.cursor = wmGD.workspaceCursor;
1720 * Use background pixmap if one is specified, otherwise set the
1721 * appropriate background color.
1724 if (pSD->iconAppearance.activeBackgroundPixmap)
1726 attr_mask |= CWBackPixmap;
1727 window_attribs.background_pixmap =
1728 pSD->iconAppearance.activeBackgroundPixmap;
1732 attr_mask |= CWBackPixel;
1733 window_attribs.background_pixel =
1734 pSD->iconAppearance.activeBackground;
1738 pSD->activeIconTextWin = XCreateWindow (DISPLAY,
1739 pSD->rootWindow, /* parent */
1741 1, 1, /* width, height */
1742 0, /* border width */
1743 CopyFromParent, /* depth */
1744 InputOutput, /* class */
1745 CopyFromParent, /* visual */
1750 pSD->activeLabelParent = pSD->rootWindow;
1752 } /* END OF FUNCTION CreateActiveIconTextWindow */
1756 /*************************************<->*************************************
1758 * PaintActiveIconText (pcd, erase)
1767 * pcd - pointer to client data
1768 * erase - if true, then erase the area before repainting
1777 *************************************<->***********************************/
1778 void PaintActiveIconText (ClientData *pcd, Boolean erase)
1781 GC iconGC, topGC, botGC;
1783 if (!(ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART))
1786 /* get appropriate GCs */
1787 iconGC = ICON_APPEARANCE(pcd).activeGC;
1788 topGC = ICON_APPEARANCE(pcd).activeTopShadowGC;
1789 botGC = ICON_APPEARANCE(pcd).activeBottomShadowGC;
1791 /* draw shadowing */
1793 if (pActiveIconTopRects) {
1794 XFillRectangles (DISPLAY,
1795 pcd->pSD->activeIconTextWin,
1797 pActiveIconTopRects->prect,
1798 pActiveIconTopRects->used);
1801 if (pActiveIconBotRects) {
1802 XFillRectangles (DISPLAY,
1803 pcd->pSD->activeIconTextWin,
1805 pActiveIconBotRects->prect,
1806 pActiveIconBotRects->used);
1809 /* paint the text */
1810 textBox.x = ICON_EXTERNAL_SHADOW_WIDTH;
1811 textBox.y = ICON_EXTERNAL_SHADOW_WIDTH;
1812 textBox.width = activeIconTextWidth - 2*ICON_EXTERNAL_SHADOW_WIDTH;
1813 textBox.height = activeIconTextHeight - 2*ICON_EXTERNAL_SHADOW_WIDTH;
1817 XClearArea (DISPLAY, pcd->pSD->activeIconTextWin, textBox.x, textBox.y,
1818 (unsigned int) textBox.width,
1819 (unsigned int) textBox.height,
1824 WmDrawXmString(DISPLAY, pcd->pSD->activeIconTextWin,
1825 ICON_APPEARANCE(pcd).fontList,
1826 pcd->iconTitle, iconGC,
1827 textBox.x, textBox.y, textBox.width, &textBox, True);
1829 WmDrawXmString(DISPLAY, pcd->pSD->activeIconTextWin,
1830 ICON_APPEARANCE(pcd).fontList,
1831 pcd->iconTitle, iconGC,
1832 textBox.x, textBox.y, textBox.width, &textBox);
1836 } /* END OF FUNCTION PaintActiveIconText */
1839 /*************************************<->*************************************
1841 * ShowActiveIconText (pcd)
1858 *************************************<->***********************************/
1859 void ShowActiveIconText (ClientData *pcd)
1861 XWindowAttributes iconFrameAttribs;
1862 XSetWindowAttributes window_attribs;
1863 XWindowChanges windowChanges;
1868 Dimension dWidth, dHeight;
1872 * put up a big icon text label
1874 if (pcd->pSD->activeIconTextWin) {
1875 /* copy event mask from icon frame window */
1876 XGetWindowAttributes (DISPLAY, ICON_FRAME_WIN(pcd), &iconFrameAttribs);
1878 /* set attributes of window */
1879 window_attribs.event_mask = iconFrameAttribs.your_event_mask;
1880 XChangeWindowAttributes (DISPLAY, pcd->pSD->activeIconTextWin,
1881 CWEventMask, &window_attribs);
1883 /* set up geometry for the window */
1885 XmStringExtent (ICON_APPEARANCE(pcd).fontList, pcd->iconTitle,
1888 activeIconTextHeight = (unsigned int) dHeight +
1889 WM_BOTTOM_TITLE_PADDING +
1890 2*ICON_EXTERNAL_SHADOW_WIDTH;
1892 activeIconTextWidth = (unsigned int) dWidth;
1894 if (activeIconTextWidth < (1.2 * ICON_WIDTH(pcd)))
1896 activeIconTextWidth = 1.2 * ICON_WIDTH(pcd);
1899 activeIconTextWidth += 2*ICON_EXTERNAL_SHADOW_WIDTH;
1901 XGetGeometry (DISPLAY,
1902 (Drawable) ICON_FRAME_WIN(pcd),
1904 &junk, &junk, &junk, &junk);
1907 y += ICON_IMAGE_HEIGHT(pcd);
1908 x -= (activeIconTextWidth - ICON_WIDTH(pcd))/2;
1912 if (!(P_ICON_BOX(pcd)))
1915 * This is a normal icon
1917 PutBoxOnScreen (SCREEN_FOR_CLIENT(pcd), &x, &y,
1918 activeIconTextWidth, activeIconTextHeight);
1919 if (ACTIVE_LABEL_PARENT(pcd) != root)
1921 XReparentWindow(DISPLAY, pcd->pSD->activeIconTextWin ,
1923 ACTIVE_LABEL_PARENT(pcd) = root;
1930 * This is an icon in an icon box
1932 x = x + IB_MARGIN_WIDTH;
1933 y = y + IB_MARGIN_HEIGHT;
1935 if(!(pcd->pSD->iconDecoration & ( ICON_LABEL_PART)))
1937 y -= activeIconTextHeight;
1940 PutBoxInIconBox (pcd, &x, &y,
1941 &activeIconTextWidth, &activeIconTextHeight);
1942 if (ACTIVE_LABEL_PARENT(pcd) != pcd->client)
1944 XReparentWindow(DISPLAY, pcd->pSD->activeIconTextWin ,
1945 XtWindow(P_ICON_BOX(pcd)->bBoardWidget),
1947 ACTIVE_LABEL_PARENT(pcd) = pcd->client;
1952 mask = CWX | CWY | CWWidth | CWHeight;
1953 windowChanges.x = x;
1954 windowChanges.y = y;
1955 windowChanges.width = activeIconTextWidth;
1956 windowChanges.height = activeIconTextHeight;
1957 XConfigureWindow (DISPLAY, pcd->pSD->activeIconTextWin, mask,
1960 /* bevel the rectangle around the edges */
1961 if ((pActiveIconTopRects && pActiveIconBotRects) ||
1962 ((pActiveIconTopRects =
1963 AllocateRList((unsigned)4*ICON_EXTERNAL_SHADOW_WIDTH)) &&
1964 (pActiveIconBotRects =
1965 AllocateRList((unsigned)4*ICON_EXTERNAL_SHADOW_WIDTH))))
1967 pActiveIconTopRects->used = 0;
1968 pActiveIconBotRects->used = 0;
1969 BevelRectangle (pActiveIconTopRects,
1970 pActiveIconBotRects,
1972 activeIconTextWidth,
1973 activeIconTextHeight,
1974 ICON_EXTERNAL_SHADOW_WIDTH,
1975 ICON_EXTERNAL_SHADOW_WIDTH,
1976 ICON_EXTERNAL_SHADOW_WIDTH,
1977 ICON_EXTERNAL_SHADOW_WIDTH);
1980 XMapRaised (DISPLAY, pcd->pSD->activeIconTextWin);
1981 wmGD.activeIconTextDisplayed = True;
1983 /* save context for this window */
1984 XSaveContext (DISPLAY, pcd->pSD->activeIconTextWin,
1985 wmGD.windowContextType, (caddr_t) pcd);
1987 } /* END OF FUNCTION ShowActiveIconText */
1990 /*************************************<->*************************************
1992 * HideActiveIconText ()
1997 * Hides the big label shown over the active icon.
2010 *************************************<->***********************************/
2011 void HideActiveIconText (WmScreenData *pSD)
2015 if ((pSD && pSD->activeIconTextWin) || ACTIVE_ICON_TEXT_WIN)
2017 /* disassociate the big label window with this client */
2018 XDeleteContext (DISPLAY,
2020 ? pSD->activeIconTextWin
2021 : ACTIVE_PSD->activeIconTextWin,
2022 wmGD.windowContextType);
2024 /* hide the big label */
2025 XUnmapWindow (DISPLAY,
2027 ? pSD->activeIconTextWin
2028 : ACTIVE_PSD->activeIconTextWin);
2029 wmGD.activeIconTextDisplayed = False;
2034 /*************************************<->*************************************
2036 * MoveActiveIconText (pcd)
2053 *************************************<->***********************************/
2054 void MoveActiveIconText (ClientData *pcd)
2059 Dimension dWidth, dHeight;
2063 * put up a big icon text label
2065 if (pcd->pSD->activeIconTextWin && wmGD.activeIconTextDisplayed) {
2066 /* set up geometry for the window */
2068 XmStringExtent (ICON_APPEARANCE(pcd).fontList, pcd->iconTitle,
2071 activeIconTextHeight = (unsigned int) dHeight +
2072 WM_BOTTOM_TITLE_PADDING +
2073 2 * ICON_EXTERNAL_SHADOW_WIDTH;
2075 activeIconTextWidth = (unsigned int) dWidth;
2077 if (activeIconTextWidth < (1.2 * ICON_WIDTH(pcd)))
2079 activeIconTextWidth = 1.2 * ICON_WIDTH(pcd);
2082 activeIconTextWidth += 2 * ICON_EXTERNAL_SHADOW_WIDTH;
2084 XGetGeometry (DISPLAY,
2085 (Drawable) ICON_FRAME_WIN(pcd),
2087 &junk, &junk, &junk, &junk);
2090 y += ICON_IMAGE_HEIGHT(pcd);
2091 x -= (activeIconTextWidth - ICON_WIDTH(pcd))/2;
2093 if (!(P_ICON_BOX(pcd)))
2095 /* This is a normal icon */
2096 PutBoxOnScreen (SCREEN_FOR_CLIENT(pcd), &x, &y,
2097 activeIconTextWidth, activeIconTextHeight);
2102 x = x + IB_MARGIN_WIDTH;
2103 y = y + IB_MARGIN_HEIGHT;
2105 if(!(pcd->pSD->iconDecoration & ( ICON_LABEL_PART)))
2107 y -= activeIconTextHeight;
2110 PutBoxInIconBox (pcd, &x, &y,
2111 &activeIconTextWidth, &activeIconTextHeight);
2114 XMoveWindow(DISPLAY, pcd->pSD->activeIconTextWin, x, y );
2117 } /* END OF FUNCTION MoveActiveIconText */