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 librararies 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, 1993 OPEN SOFTWARE FOUNDATION, INC.
32 static char rcsid[] = "$XConsortium: WmIDecor.c /main/6 1996/06/20 09:38:43 rswiston $"
36 * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */
45 #include <Xm/DrawP.h> /* for XmeClearBorder */
47 * include extern functions
51 #include "WmGraphics.h"
52 #include "WmIconBox.h"
54 #include "WmWinInfo.h"
56 #include "WmWrkspace.h"
64 static unsigned int activeIconTextWidth = 1;
65 static unsigned int activeIconTextHeight = 1;
66 static RList *pActiveIconTopRects = NULL;
67 static RList *pActiveIconBotRects = NULL;
69 static int iconShrinkX;
70 static int iconShrinkY;
71 static unsigned int iconShrinkWidth;
72 static unsigned int iconShrinkHeight;
75 /*************************************<->*************************************
82 * Create an icon frame and fill it in as appropriate for the client.
87 * pWS - pointer to workspace data
88 * pcd - pointer to client data
93 * Return - TRUE if success, FALSE if failure.
100 *************************************<->***********************************/
102 Boolean MakeIcon (WmWorkspaceData *pWS, ClientData *pcd)
104 XSetWindowAttributes window_attribs;
105 unsigned long attr_mask;
109 WsClientData *pWsc = GetWsClientData (pWS, pcd);
114 * Common to all icons
117 /* compute dimensions of outer icon frame */
118 /* create icon frame window */
120 attr_mask = CWEventMask | CWCursor;
121 window_attribs.event_mask = (ButtonPressMask | ButtonReleaseMask |
122 SELECT_BUTTON_MOTION_MASK |
123 DMANIP_BUTTON_MOTION_MASK |
125 SubstructureRedirectMask |
127 window_attribs.cursor = wmGD.workspaceCursor;
129 if ((wmGD.keyboardFocusPolicy == KEYBOARD_FOCUS_POINTER) ||
130 (wmGD.colormapFocusPolicy == CMAP_FOCUS_POINTER))
132 window_attribs.event_mask |= EnterWindowMask | LeaveWindowMask;
136 * Use background pixmap if one is specified, otherwise set the
137 * appropriate background color.
140 if (ICON_APPEARANCE(pcd).backgroundPixmap)
142 attr_mask |= CWBackPixmap;
143 window_attribs.background_pixmap =
144 ICON_APPEARANCE(pcd).backgroundPixmap;
148 attr_mask |= CWBackPixel;
149 window_attribs.background_pixel =
150 ICON_APPEARANCE(pcd).background;
154 if ((!pcd->pSD->useIconBox) ||
155 (pcd->clientFlags & (CLIENT_WM_CLIENTS | FRONT_PANEL_BOX)))
157 if ((!pcd->pSD->useIconBox) || (pcd->clientFlags & ICON_BOX))
161 pWsc->iconFrameWin = XCreateWindow (DISPLAY,
162 ROOT_FOR_CLIENT(pcd), /* parent */
166 pcd->iconFrameWin = XCreateWindow (DISPLAY,
167 ROOT_FOR_CLIENT(pcd), /* parent */
171 (unsigned int) ICON_WIDTH(pcd),
172 (unsigned int) ICON_HEIGHT(pcd),
173 0, /* border width */
174 CopyFromParent, /* depth */
175 InputOutput, /* class */
176 CopyFromParent, /* visual */
184 * Insert the icon into the icon box.
185 * Don't make icon in the box for any icon box (or any WM window)
186 * OR any client that doesn't have the MWM_FUNC_MINIMIZE bit set
187 * in pcd->clientFunctions
190 if ((pcd->pSD->useIconBox) &&
192 (!(pcd->clientFlags & CLIENT_WM_CLIENTS)) &&
194 (!(pcd->clientFlags & ICON_BOX)) &&
196 (pcd->clientFunctions & MWM_FUNC_MINIMIZE) )
198 if (!InsertIconIntoBox(pWS->pIconBox, pcd))
199 Warning(((char *)GETMESSAGE(30, 1, "Could not make icon to go in icon box")));
206 /* make space for the top/bottom changing shadow rectangles */
208 if ((pcd->piconTopShadows =
209 AllocateRList ((unsigned)NUM_BOTH_TOP_RECTS)) == NULL)
212 Warning (((char *)GETMESSAGE(30, 2, "Insufficient memory for icon creation")));
216 if ((pcd->piconBottomShadows =
217 AllocateRList ((unsigned)NUM_BOTH_BOTTOM_RECTS)) == NULL)
220 Warning (((char *)GETMESSAGE(30, 3, "Insufficient memory for icon creation")));
226 * Adjust for icons in the box
227 * Don't adjust the icon for the icon box itself
231 if (pWS->pIconBox && (pWS->pIconBox->pCD_iconBox != pcd) &&
232 !(pcd->clientFlags & FRONT_PANEL_BOX))
234 if (pWS->pIconBox && (pWS->pIconBox->pCD_iconBox != pcd))
235 #endif /* PANELIST */
237 xOffset = IB_MARGIN_WIDTH;
238 yOffset = IB_MARGIN_HEIGHT;
248 * Reparent the icon window if there is one
250 if ((ICON_DECORATION(pcd) & ICON_IMAGE_PART) &&
253 ReparentIconWindow (pcd, xOffset, yOffset);
257 if (pcd->piconTopShadows->used == 0)
259 MakeIconShadows (pcd, xOffset, yOffset);
263 } /* END OF FUNCTION MakeIcon */
267 /*************************************<->*************************************
269 * MakeIconShadows (pcd, xOffset, yOffset)
274 *************************************<->***********************************/
276 void MakeIconShadows (ClientData *pcd, int xOffset, int yOffset)
280 * Handle different icon styles
283 switch (ICON_DECORATION(pcd) & (ICON_LABEL_PART | ICON_IMAGE_PART))
285 case ICON_LABEL_PART:
286 BevelRectangle (pcd->piconTopShadows, /* label */
287 pcd->piconBottomShadows,
288 0 + xOffset, (int)ICON_IMAGE_HEIGHT(pcd) + yOffset,
289 (unsigned int) ICON_WIDTH(pcd),
290 (unsigned int) ICON_LABEL_HEIGHT(pcd),
291 ICON_EXTERNAL_SHADOW_WIDTH,
292 ICON_EXTERNAL_SHADOW_WIDTH,
293 ICON_EXTERNAL_SHADOW_WIDTH,
294 ICON_EXTERNAL_SHADOW_WIDTH);
297 case ICON_IMAGE_PART:
298 BevelRectangle (pcd->piconTopShadows, /* image outside */
299 pcd->piconBottomShadows,
300 0 + xOffset, 0 + yOffset,
301 (unsigned int) ICON_WIDTH(pcd),
302 (unsigned int) ICON_IMAGE_HEIGHT(pcd),
303 ICON_EXTERNAL_SHADOW_WIDTH,
304 ICON_EXTERNAL_SHADOW_WIDTH,
305 ICON_EXTERNAL_SHADOW_WIDTH,
306 ICON_EXTERNAL_SHADOW_WIDTH);
308 if (wmGD.frameStyle == WmRECESSED)
309 BevelRectangle (pcd->piconBottomShadows, /* image inside */
310 pcd->piconTopShadows,
311 ICON_INNER_X_OFFSET + xOffset,
312 ICON_INNER_Y_OFFSET + yOffset,
313 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).width +
314 4*ICON_INTERNAL_SHADOW_WIDTH),
315 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).height +
316 4*ICON_INTERNAL_SHADOW_WIDTH),
317 ICON_INTERNAL_SHADOW_WIDTH,
318 ICON_INTERNAL_SHADOW_WIDTH,
319 ICON_INTERNAL_SHADOW_WIDTH,
320 ICON_INTERNAL_SHADOW_WIDTH);
324 case (ICON_IMAGE_PART | ICON_LABEL_PART):
325 if (wmGD.frameStyle == WmSLAB)
327 BevelRectangle (pcd->piconTopShadows, /* image outside */
328 pcd->piconBottomShadows,
329 0 + xOffset, 0 + yOffset,
330 (unsigned int) ICON_WIDTH(pcd),
331 (unsigned int) (ICON_IMAGE_HEIGHT(pcd) +
332 ICON_LABEL_HEIGHT(pcd)),
333 ICON_EXTERNAL_SHADOW_WIDTH,
334 ICON_EXTERNAL_SHADOW_WIDTH,
335 ICON_EXTERNAL_SHADOW_WIDTH,
336 ICON_EXTERNAL_SHADOW_WIDTH);
340 BevelRectangle (pcd->piconTopShadows, /* image outside */
341 pcd->piconBottomShadows,
342 0 + xOffset, 0 + yOffset,
343 (unsigned int) ICON_WIDTH(pcd),
344 (unsigned int) ICON_IMAGE_HEIGHT(pcd),
345 ICON_EXTERNAL_SHADOW_WIDTH,
346 ICON_EXTERNAL_SHADOW_WIDTH,
347 ICON_INTERNAL_SHADOW_WIDTH,
348 ICON_EXTERNAL_SHADOW_WIDTH);
351 if (wmGD.frameStyle == WmRECESSED)
352 BevelRectangle (pcd->piconBottomShadows, /* image inside */
353 pcd->piconTopShadows,
354 ICON_INNER_X_OFFSET + xOffset,
355 ICON_INNER_Y_OFFSET + yOffset,
356 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).width +
357 4*ICON_INTERNAL_SHADOW_WIDTH),
358 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).height +
359 4*ICON_INTERNAL_SHADOW_WIDTH),
360 ICON_INTERNAL_SHADOW_WIDTH,
361 ICON_INTERNAL_SHADOW_WIDTH,
362 ICON_INTERNAL_SHADOW_WIDTH,
363 ICON_INTERNAL_SHADOW_WIDTH);
365 if (wmGD.frameStyle == WmRECESSED)
366 BevelRectangle (pcd->piconTopShadows, /* label */
367 pcd->piconBottomShadows,
368 0 + xOffset, (int)ICON_IMAGE_HEIGHT(pcd) + yOffset,
369 (unsigned int) ICON_WIDTH(pcd),
370 (unsigned int) ICON_LABEL_HEIGHT(pcd),
371 ICON_INTERNAL_SHADOW_WIDTH,
372 ICON_EXTERNAL_SHADOW_WIDTH,
373 ICON_EXTERNAL_SHADOW_WIDTH,
374 ICON_EXTERNAL_SHADOW_WIDTH);
379 } /* END OF FUNCTION MakeIconShadows */
386 /*************************************<->*************************************
388 * IconExposureProc (pcd, expose)
398 * pcd - pointer to client data
407 *************************************<->***********************************/
409 void IconExposureProc (ClientData *pcd, Boolean expose)
416 unsigned int width, height;
417 GC iconGC, topGC, botGC;
418 static XRectangle shrinkRects[4];
423 * Adjust for icons in the iconBox
428 xOffset = IB_MARGIN_WIDTH;
429 yOffset = IB_MARGIN_HEIGHT;
437 /* get appropriate GCs */
439 if ((wmGD.keyboardFocus == pcd) && (pcd->clientState == MINIMIZED_STATE))
441 iconGC = ICON_APPEARANCE(pcd).activeGC;
442 topGC = ICON_APPEARANCE(pcd).activeTopShadowGC;
443 botGC = ICON_APPEARANCE(pcd).activeBottomShadowGC;
447 iconGC = ICON_APPEARANCE(pcd).inactiveGC;
448 topGC = ICON_APPEARANCE(pcd).inactiveTopShadowGC;
449 botGC = ICON_APPEARANCE(pcd).inactiveBottomShadowGC;
452 if (ACTIVE_PSD->useIconBox && P_ICON_BOX(pcd))
462 (unsigned int) ICON_WIDTH(pcd),
463 (unsigned int) ICON_HEIGHT(pcd), False);
466 if (pcd->clientState == MINIMIZED_STATE)
469 * This is the "raised" icon appearance
472 if (pcd->piconTopShadows)
475 XFillRectangles (DISPLAY,
478 pcd->piconTopShadows->prect,
479 pcd->piconTopShadows->used);
482 if (pcd->piconBottomShadows)
484 XFillRectangles (DISPLAY,
487 pcd->piconBottomShadows->prect,
488 pcd->piconBottomShadows->used);
493 shrinkRects[0].x = IB_MARGIN_WIDTH;
494 shrinkRects[0].y = IB_MARGIN_HEIGHT;
495 shrinkRects[0].width = (unsigned int) ICON_WIDTH(pcd);
496 shrinkRects[0].height = iconShrinkY - IB_MARGIN_HEIGHT;
498 shrinkRects[1].x = IB_MARGIN_WIDTH;
499 shrinkRects[1].y = iconShrinkY;
500 shrinkRects[1].width = iconShrinkX - IB_MARGIN_WIDTH;
501 shrinkRects[1].height = iconShrinkHeight;
503 shrinkRects[2].x = iconShrinkX + iconShrinkWidth;
504 shrinkRects[2].y = iconShrinkY;
505 shrinkRects[2].width = iconShrinkX - IB_MARGIN_WIDTH;
506 shrinkRects[2].height = iconShrinkHeight;
508 shrinkRects[3].x = IB_MARGIN_WIDTH;
509 shrinkRects[3].y = iconShrinkY + iconShrinkHeight;
510 shrinkRects[3].width = (unsigned int) ICON_WIDTH(pcd);
511 shrinkRects[3].height = iconShrinkY - IB_MARGIN_HEIGHT;
513 XFillRectangles (DISPLAY,
525 if (pcd->clientState == MINIMIZED_STATE)
528 * This is the "raised" icon appearance
531 if (pcd->piconTopShadows->prect)
534 XFillRectangles (DISPLAY,
537 pcd->piconTopShadows->prect,
538 pcd->piconTopShadows->used);
541 if (pcd->piconBottomShadows->prect)
543 XFillRectangles (DISPLAY,
546 pcd->piconBottomShadows->prect,
547 pcd->piconBottomShadows->used);
556 if ((ICON_DECORATION(pcd) & ICON_LABEL_PART) &&
557 (expose || !(ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)))
559 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
565 * Draw image if no icon window (client has to redraw that!)
566 * OR if using the iconbox, draw the default image where
567 * the icon window was.
571 ((!pcd->iconWindow && (ICON_DECORATION(pcd) & ICON_IMAGE_PART)) ||
572 (ACTIVE_PSD->useIconBox && P_ICON_BOX(pcd) &&
574 pcd->clientState != MINIMIZED_STATE &&
575 (ICON_DECORATION(pcd) & ICON_IMAGE_PART))))
579 image = DEFAULT_PIXMAP(pcd);
583 image = pcd->iconPixmap;
589 if ((ACTIVE_PSD->useIconBox) && (P_ICON_BOX(pcd)))
592 if (pcd->clientState != MINIMIZED_STATE)
594 dest_x = ICON_IMAGE_X_OFFSET
595 + ICON_INTERNAL_SHADOW_WIDTH
598 dest_y = ICON_IMAGE_Y_OFFSET
599 + ICON_INTERNAL_SHADOW_WIDTH
601 if (wmGD.frameStyle == WmSLAB)
603 /* less beveling in this style */
604 dest_x -= ICON_INTERNAL_SHADOW_WIDTH;
605 dest_y -= ICON_INTERNAL_SHADOW_WIDTH;
608 width = ICON_IMAGE_MAXIMUM(pcd).width;
609 height= ICON_IMAGE_MAXIMUM(pcd).height;
610 if (wmGD.frameStyle == WmSLAB)
615 XCopyArea (DISPLAY, image,
618 ICON_INTERNAL_SHADOW_WIDTH,
619 ICON_INTERNAL_SHADOW_WIDTH,
620 width, height, dest_x, dest_y);
622 if (FADE_NORMAL_ICON(pcd))
624 iconGC = FADE_ICON_GC(pcd);
625 XFillRectangle (DISPLAY,
635 dest_x = ICON_IMAGE_X_OFFSET
638 dest_y = ICON_IMAGE_Y_OFFSET
640 if (wmGD.frameStyle == WmSLAB)
642 /* less beveling in this style */
643 dest_x -= ICON_INTERNAL_SHADOW_WIDTH;
644 dest_y -= ICON_INTERNAL_SHADOW_WIDTH;
647 width = ICON_IMAGE_MAXIMUM(pcd).width
648 + (2 * ICON_INTERNAL_SHADOW_WIDTH);
649 height= ICON_IMAGE_MAXIMUM(pcd).height
650 + (2 * ICON_INTERNAL_SHADOW_WIDTH);
652 if (wmGD.frameStyle == WmSLAB)
657 XCopyArea (DISPLAY, image,
659 iconGC, 0, 0, width, height,
667 width = ICON_IMAGE_MAXIMUM(pcd).width +
668 2 * ICON_INTERNAL_SHADOW_WIDTH;
670 height= ICON_IMAGE_MAXIMUM(pcd).height +
671 2 * ICON_INTERNAL_SHADOW_WIDTH;
673 if (wmGD.frameStyle == WmSLAB)
675 dest_x = ICON_INNER_X_OFFSET;
676 dest_y = ICON_INNER_Y_OFFSET;
682 dest_x = ICON_INNER_X_OFFSET + ICON_INTERNAL_SHADOW_WIDTH;
683 dest_y = ICON_INNER_Y_OFFSET + ICON_INTERNAL_SHADOW_WIDTH;
685 XCopyArea (DISPLAY, image,
687 iconGC, 0, 0, width, height,
697 } /* END OF FUNCTION IconExposureProc */
702 /*************************************<->*************************************
704 * GetIconTitleBox (pcd, pBox)
709 * Returns a rectangle containing the icon text box
714 * pcd - pointer to client data
715 * pBox - pointer to an XRectangle structure that gets returned data
719 * pBox - returned data
724 *************************************<->***********************************/
726 void GetIconTitleBox (ClientData *pcd, XRectangle *pBox)
733 * Adjust for icons in the iconBox
738 xOffset = IB_MARGIN_WIDTH;
739 yOffset = IB_MARGIN_HEIGHT;
747 if ((P_ICON_BOX(pcd)) && (pcd->clientState != MINIMIZED_STATE))
749 /* move label up to enhance shrink wrap effect */
750 pBox->x = ICON_EXTERNAL_SHADOW_WIDTH
751 + ICON_IMAGE_LEFT_PAD
752 + (2 * ICON_INTERNAL_SHADOW_WIDTH)
753 + ICON_IMAGE_LEFT_PAD
756 pBox->y = ICON_IMAGE_HEIGHT(pcd)
758 + ((ICON_IMAGE_HEIGHT(pcd) > 0)
759 ? - ICON_IMAGE_BOTTOM_PAD
760 : ICON_EXTERNAL_SHADOW_WIDTH)
761 + ((ICON_IMAGE_HEIGHT(pcd) >0)
763 : WM_TOP_TITLE_PADDING );
765 if (wmGD.frameStyle == WmSLAB)
767 /* account for less beveling in this style */
768 pBox->x -= ICON_INTERNAL_SHADOW_WIDTH;
769 pBox->y -= ICON_INTERNAL_SHADOW_WIDTH;
774 pBox->width = ICON_IMAGE_MAXIMUM(pcd).width
775 + ((wmGD.frameStyle == WmSLAB) ? 2 : 0)
776 - ICON_IMAGE_LEFT_PAD
777 - ICON_EXTERNAL_SHADOW_WIDTH;
779 pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
782 else if ((P_ICON_BOX(pcd)) && (pcd->clientState == MINIMIZED_STATE))
784 pBox->x = ICON_EXTERNAL_SHADOW_WIDTH
785 + ICON_IMAGE_LEFT_PAD
786 + (2 * ICON_INTERNAL_SHADOW_WIDTH)
787 + ICON_IMAGE_LEFT_PAD
790 pBox->y = ICON_IMAGE_HEIGHT(pcd)
792 + ((ICON_IMAGE_HEIGHT(pcd) > 0)
793 ? ICON_INTERNAL_SHADOW_WIDTH
794 : ICON_EXTERNAL_SHADOW_WIDTH)
795 + WM_TOP_TITLE_PADDING ;
797 pBox->width = ICON_IMAGE_MAXIMUM(pcd).width
798 + ((wmGD.frameStyle == WmSLAB) ? 2 : 0)
799 - ICON_IMAGE_LEFT_PAD;
801 pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
803 if (wmGD.frameStyle == WmSLAB)
805 /* account for less beveling in this style */
806 pBox->x -= ICON_INTERNAL_SHADOW_WIDTH + 2*ICON_IMAGE_LEFT_PAD;
807 pBox->y -= 3 * ICON_INTERNAL_SHADOW_WIDTH;
808 pBox->width += ICON_IMAGE_LEFT_PAD + 2;
814 pBox->x = ICON_EXTERNAL_SHADOW_WIDTH
815 + WM_TOP_TITLE_PADDING
818 if (wmGD.frameStyle == WmSLAB)
820 /* account for less beveling in this style */
821 yOffset -= ICON_INTERNAL_SHADOW_WIDTH;
823 pBox->y = ICON_IMAGE_HEIGHT(pcd)
824 + WM_TOP_TITLE_PADDING
826 + ((ICON_IMAGE_HEIGHT(pcd) > 0)
827 ? ICON_INTERNAL_SHADOW_WIDTH
828 : ICON_EXTERNAL_SHADOW_WIDTH);
830 pBox->width = ICON_WIDTH(pcd) - 2 * ICON_EXTERNAL_SHADOW_WIDTH -
831 WM_TOP_TITLE_PADDING - WM_BOTTOM_TITLE_PADDING;
832 pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
837 } /* END OF FUNCTION GetIconTitleBox */
841 /*************************************<->*************************************
843 * DrawIconTitle (pcd)
848 * Draws the title in the Icon title area
853 * pcd - pointer to client data
861 *************************************<->***********************************/
863 void DrawIconTitle (ClientData *pcd)
869 GetIconTitleBox (pcd, &textBox);
871 /* get appropriate GCs */
874 if ((ACTIVE_PSD->useIconBox &&
875 !((pcd->dtwmBehaviors & (DtWM_BEHAVIOR_PANEL)) ||
876 (pcd->clientFlags & CLIENT_WM_CLIENTS))) ||
878 if ((ACTIVE_PSD->useIconBox && !(pcd->clientFlags & CLIENT_WM_CLIENTS)) ||
879 #endif /* PANELIST */
881 if ((ACTIVE_PSD->useIconBox && !(pcd->clientFlags & ICON_BOX)) ||
883 !(wmGD.keyboardFocus == pcd))
885 iconGC = ICON_APPEARANCE(pcd).inactiveGC;
889 iconGC = ICON_APPEARANCE(pcd).activeGC;
893 * Dim text if this is in the icon box and the client is mapped
896 if ((ACTIVE_PSD->useIconBox) &&
898 (FADE_NORMAL_ICON(pcd)) &&
899 (!(pcd->clientState == MINIMIZED_STATE)))
901 iconGC = FADE_ICON_TEXT_GC(pcd);
909 WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd), ICON_APPEARANCE(pcd).fontList,
910 pcd->iconTitle, iconGC,
911 textBox.x, textBox.y, textBox.width, &textBox, True);
913 WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd), ICON_APPEARANCE(pcd).fontList,
914 pcd->iconTitle, iconGC,
915 textBox.x, textBox.y, textBox.width, &textBox);
918 } /* END OF FUNCTION DrawIconTitle */
923 /*************************************<->*************************************
925 * RedisplayIconTitle (pcd)
930 * Draws the title in the Icon title area
935 * pcd - pointer to client data
943 *************************************<->***********************************/
945 void RedisplayIconTitle (ClientData *pcd)
951 * only proceed if we've got the right icon parts to work on
954 if (ICON_DECORATION(pcd) & ICON_LABEL_PART && ICON_FRAME_WIN(pcd))
957 /* nothing to do if no labels */
958 if (!(ICON_DECORATION(pcd) & ICON_LABEL_PART))
961 /* get the box that the text sits in */
962 GetIconTitleBox (pcd, &textBox);
965 * Get appropriate GCs
966 * Dim text if this is in the icon box and the client is mapped
969 if ((ACTIVE_PSD->useIconBox && (P_ICON_BOX(pcd)) &&
970 !(pcd->clientFlags & CLIENT_WM_CLIENTS)) ||
972 if ((ACTIVE_PSD->useIconBox && (P_ICON_BOX(pcd)) &&
973 !(pcd->clientFlags & ICON_BOX)) ||
975 !(wmGD.keyboardFocus == pcd))
977 iconGC = ICON_APPEARANCE(pcd).inactiveGC;
981 iconGC = ICON_APPEARANCE(pcd).activeGC;
984 if ((ACTIVE_PSD->useIconBox) &&
986 (FADE_NORMAL_ICON(pcd)) &&
987 (!(pcd->clientState == MINIMIZED_STATE)))
989 iconGC = FADE_ICON_TEXT_GC(pcd);
992 /* out with the old */
995 textBox.x, textBox.y,
996 (unsigned int) textBox.width, (unsigned int) textBox.height,
999 /* in with the new */
1001 WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd),
1002 ICON_APPEARANCE(pcd).fontList,
1003 pcd->iconTitle, iconGC,
1004 textBox.x, textBox.y, textBox.width, &textBox,
1007 WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd),
1008 ICON_APPEARANCE(pcd).fontList,
1009 pcd->iconTitle, iconGC,
1010 textBox.x, textBox.y, textBox.width, &textBox);
1014 * Erase & paint text in the active icon text window
1016 if ((wmGD.keyboardFocus == pcd) &&
1017 (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART))
1019 PaintActiveIconText (pcd, True);
1022 } /* END OF FUNCTION RedisplayIconTitle */
1026 /*************************************<->*************************************
1028 * GetIconDimensions (pSD, &pWidth, &pLabelHeight, &pImageHeight)
1033 * returns dimensions of icon frame parts
1038 * pSD - pointer to screen data
1039 * pWidth - pointer to width of frame
1040 * pLabelHeight - pointer to height of label part of icon
1041 * pImageHeight - pointer to height of image part of icon
1046 * *pWidth - width of frame
1047 * *pLabelHeight - height of label part of icon
1048 * *pImageHeight - height of image part of icon
1054 *************************************<->***********************************/
1055 void GetIconDimensions (WmScreenData *pSD, unsigned int *pWidth, unsigned int *pLabelHeight, unsigned int *pImageHeight)
1058 * The icon width is always keyed to the icon image maximum regardless
1059 * of whether an icon image part appears or not.
1061 *pWidth = pSD->iconImageMaximum.width +
1062 ((wmGD.frameStyle == WmSLAB) ? 2 : 0) +
1063 ICON_IMAGE_LEFT_PAD +
1064 ICON_IMAGE_RIGHT_PAD +
1065 2 * ICON_EXTERNAL_SHADOW_WIDTH +
1066 4 * ICON_INTERNAL_SHADOW_WIDTH;
1067 if (wmGD.frameStyle == WmSLAB)
1069 /* less beveling in this style */
1070 *pWidth -= 2 * ICON_INTERNAL_SHADOW_WIDTH;
1073 switch (pSD->iconDecoration & (ICON_IMAGE_PART | ICON_LABEL_PART))
1075 case ICON_LABEL_PART:
1078 *pLabelHeight = ICON_EXTERNAL_SHADOW_WIDTH +
1079 WM_TOP_TITLE_PADDING +
1080 TEXT_HEIGHT(pSD->iconAppearance.font) +
1081 WM_BOTTOM_TITLE_PADDING +
1082 ICON_EXTERNAL_SHADOW_WIDTH;
1085 case ICON_IMAGE_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_EXTERNAL_SHADOW_WIDTH;
1096 if (wmGD.frameStyle == WmSLAB)
1098 /* less beveling in this style */
1099 *pImageHeight -= 2 * ICON_INTERNAL_SHADOW_WIDTH;
1107 case (ICON_IMAGE_PART | ICON_LABEL_PART):
1108 *pImageHeight = ICON_EXTERNAL_SHADOW_WIDTH +
1109 ICON_IMAGE_TOP_PAD +
1110 ICON_INTERNAL_SHADOW_WIDTH +
1111 ICON_INTERNAL_SHADOW_WIDTH +
1112 pSD->iconImageMaximum.height +
1113 ((wmGD.frameStyle == WmSLAB) ? 2 : 0) +
1114 ICON_INTERNAL_SHADOW_WIDTH +
1115 ICON_INTERNAL_SHADOW_WIDTH +
1116 ICON_IMAGE_BOTTOM_PAD +
1117 ICON_INTERNAL_SHADOW_WIDTH;
1119 *pLabelHeight = ICON_INTERNAL_SHADOW_WIDTH +
1120 WM_TOP_TITLE_PADDING +
1121 TEXT_HEIGHT(pSD->iconAppearance.font) +
1122 WM_BOTTOM_TITLE_PADDING +
1123 ICON_EXTERNAL_SHADOW_WIDTH;
1124 if (wmGD.frameStyle == WmSLAB)
1127 * In this style there is less beveling and no
1128 * etching between the icon image and label.
1130 *pImageHeight -= 3 * ICON_INTERNAL_SHADOW_WIDTH;
1131 *pLabelHeight -= ICON_INTERNAL_SHADOW_WIDTH;
1137 *pLabelHeight = *pImageHeight = 0;
1144 /*************************************<->*************************************
1146 * InitIconSize (pSD)
1151 * set global icon size variables
1165 *************************************<->***********************************/
1166 void InitIconSize (WmScreenData *pSD)
1168 Cardinal label, image;
1170 GetIconDimensions (pSD, (unsigned int *)&(pSD->iconWidth),
1173 pSD->iconHeight = label+image;
1175 pSD->iconImageHeight = image;
1176 pSD->iconLabelHeight = label;
1179 iconShrinkX = IB_MARGIN_WIDTH
1180 + ICON_EXTERNAL_SHADOW_WIDTH
1181 + ICON_IMAGE_LEFT_PAD
1182 + 2 * ICON_INTERNAL_SHADOW_WIDTH;
1185 iconShrinkY = IB_MARGIN_HEIGHT
1186 + ICON_EXTERNAL_SHADOW_WIDTH
1187 + ((pSD->iconDecoration & ICON_IMAGE_PART)
1188 ? (ICON_IMAGE_TOP_PAD +
1189 (2 * ICON_INTERNAL_SHADOW_WIDTH))
1190 : (WM_TOP_TITLE_PADDING));
1191 if (wmGD.frameStyle == WmSLAB)
1193 /* less beveling in this style */
1194 iconShrinkX -= ICON_INTERNAL_SHADOW_WIDTH;
1195 iconShrinkY -= ICON_INTERNAL_SHADOW_WIDTH;
1199 iconShrinkWidth = pSD->iconImageMaximum.width ;
1200 if (wmGD.frameStyle == WmSLAB)
1202 iconShrinkWidth += 2;
1208 switch (pSD->iconDecoration & (ICON_IMAGE_PART | ICON_LABEL_PART))
1210 case ICON_LABEL_PART:
1211 iconShrinkHeight = TEXT_HEIGHT(pSD->iconAppearance.font);
1214 case ICON_IMAGE_PART:
1215 iconShrinkHeight = pSD->iconImageMaximum.height;
1219 case (ICON_IMAGE_PART | ICON_LABEL_PART):
1220 iconShrinkHeight = pSD->iconHeight
1221 - ICON_EXTERNAL_SHADOW_WIDTH
1222 - ICON_IMAGE_TOP_PAD
1223 - ICON_INTERNAL_SHADOW_WIDTH
1224 - ICON_INTERNAL_SHADOW_WIDTH
1225 - ICON_IMAGE_BOTTOM_PAD
1226 - WM_BOTTOM_TITLE_PADDING
1227 - ICON_EXTERNAL_SHADOW_WIDTH;
1228 if (wmGD.frameStyle == WmSLAB)
1230 /* adjust for less beveling in this style */
1231 iconShrinkHeight += ICON_INTERNAL_SHADOW_WIDTH;
1238 } /* END OF FUNCTION InitIconSize */
1241 /*************************************<->*************************************
1243 * ShowActiveIcon (pcd)
1248 * Paint the icon to indicate an "active" state
1253 * pcd - pointer to client data
1264 *************************************<->***********************************/
1266 void ShowActiveIcon (ClientData *pcd)
1268 unsigned long attr_mask;
1269 XSetWindowAttributes window_attribs;
1271 if (ICON_FRAME_WIN(pcd))
1274 * Use background pixmap if one is specified, otherwise set the
1275 * appropriate background color.
1278 if (ICON_APPEARANCE(pcd).activeBackgroundPixmap)
1280 attr_mask = CWBackPixmap;
1281 window_attribs.background_pixmap =
1282 ICON_APPEARANCE(pcd).activeBackgroundPixmap;
1286 attr_mask = CWBackPixel;
1287 window_attribs.background_pixel =
1288 ICON_APPEARANCE(pcd).activeBackground;
1292 /* set active window attributes */
1293 XChangeWindowAttributes (DISPLAY,
1294 ICON_FRAME_WIN(pcd),
1295 attr_mask, &window_attribs);
1297 /* clear the frame to the right background */
1298 if ((!ACTIVE_PSD->useIconBox) ||
1299 (P_ICON_BOX(pcd) == NULL))
1301 #ifndef MOTIF_ONE_DOT_ONE
1302 if (ICON_DECORATION(pcd) & ICON_IMAGE_PART)
1304 Dimension dheight, dwidth;
1306 dwidth = ICON_WIDTH(pcd) -
1307 2*ICON_EXTERNAL_SHADOW_WIDTH;
1308 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1310 dheight = ICON_IMAGE_HEIGHT(pcd) -
1311 ICON_EXTERNAL_SHADOW_WIDTH;
1315 dheight = ICON_IMAGE_HEIGHT(pcd) -
1316 2*ICON_EXTERNAL_SHADOW_WIDTH;
1318 if (wmGD.frameStyle == WmRECESSED)
1320 dheight -= ICON_INTERNAL_SHADOW_WIDTH;
1323 XmeClearBorder (DISPLAY, ICON_FRAME_WIN(pcd),
1324 ICON_EXTERNAL_SHADOW_WIDTH,
1325 ICON_EXTERNAL_SHADOW_WIDTH,
1328 ICON_IMAGE_TOP_PAD);
1331 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1333 XClearArea (DISPLAY,
1334 ICON_FRAME_WIN(pcd),
1336 ICON_IMAGE_HEIGHT(pcd),
1337 (unsigned int) ICON_WIDTH(pcd),
1338 (unsigned int) ICON_HEIGHT(pcd), False);
1341 XClearWindow (DISPLAY, ICON_FRAME_WIN(pcd));
1347 * clear only area of real frame, not highlight area
1350 XClearArea (DISPLAY,
1351 ICON_FRAME_WIN(pcd),
1354 (unsigned int) ICON_WIDTH(pcd),
1355 (unsigned int) ICON_HEIGHT(pcd), False);
1360 * Put up a big icon text label.
1363 if (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)
1366 if (wmGD.activeIconTextDisplayed)
1367 PaintActiveIconText(pcd, True);
1369 ShowActiveIconText(pcd);
1372 /* simulate exposure of window */
1373 #ifndef MOTIF_ONE_DOT_ONE
1374 IconExposureProc(pcd, False);
1376 IconExposureProc(pcd, True);
1381 } /* END OF FUNCTION ShowActiveIcon */
1385 /*************************************<->*************************************
1387 * ShowInactiveIcon (pcd, refresh)
1392 * Make the icon appear "inactive"
1397 * pcd - pointer to client data
1399 * refresh - if True redraw the icon
1401 *************************************<->***********************************/
1402 void ShowInactiveIcon (ClientData *pcd, Boolean refresh)
1404 unsigned long attr_mask = 0;
1405 XSetWindowAttributes window_attribs;
1407 /* turn off the active icon text */
1408 if (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)
1410 /* pass in screen to fix multiscreen bug [P3385] */
1411 HideActiveIconText(pcd->pSD);
1414 if (ICON_FRAME_WIN(pcd))
1417 * Use background pixmap if one is specified, otherwise set the
1418 * appropriate background color.
1421 if (ICON_APPEARANCE(pcd).backgroundPixmap)
1423 attr_mask |= CWBackPixmap;
1424 window_attribs.background_pixmap =
1425 ICON_APPEARANCE(pcd).backgroundPixmap;
1429 attr_mask |= CWBackPixel;
1430 window_attribs.background_pixel =
1431 ICON_APPEARANCE(pcd).background;
1435 /* set active window attributes */
1436 XChangeWindowAttributes (DISPLAY, ICON_FRAME_WIN(pcd), attr_mask,
1442 /* clear the frame to the right background */
1443 if ((!ACTIVE_PSD->useIconBox) ||
1444 (P_ICON_BOX(pcd) == NULL))
1446 #ifndef MOTIF_ONE_DOT_ONE
1447 XmeClearBorder (DISPLAY, ICON_FRAME_WIN(pcd),
1449 ICON_WIDTH(pcd), ICON_IMAGE_HEIGHT(pcd), 4);
1451 XClearArea (DISPLAY,
1452 ICON_FRAME_WIN(pcd),
1453 0, ICON_IMAGE_HEIGHT(pcd),
1454 (unsigned int) ICON_WIDTH(pcd),
1455 (unsigned int) ICON_HEIGHT(pcd), False);
1457 XClearWindow (DISPLAY, ICON_FRAME_WIN(pcd));
1463 * clear only area of real frame, not highlight area
1466 XClearArea (DISPLAY,
1467 ICON_FRAME_WIN(pcd),
1470 (unsigned int) ICON_WIDTH(pcd),
1471 (unsigned int) ICON_HEIGHT(pcd), False);
1475 /* simulate exposure of window */
1476 #ifndef MOTIF_ONE_DOT_ONE
1477 IconExposureProc(pcd, False);
1479 IconExposureProc(pcd, True);
1485 } /* END OF FUNTION ShowInactiveIcon */
1489 /*************************************<->*************************************
1491 * ReparentIconWindow (pcd, xOffset, yOffset)
1496 * Reparent the icon window in the center of the image area
1501 * pcd - pointer to client data
1502 * xOffset - adjusts for icons in the iconBox
1503 * yOffset - adjusts for icons in the iconBox
1513 *************************************<->***********************************/
1514 void ReparentIconWindow (ClientData *pcd, int xOffset, int yOffset)
1517 unsigned int width, height, bw, depth;
1519 XWindowChanges windowChanges;
1525 #endif /* PANELIST */
1527 * Check if window size is too big
1529 XGetGeometry (DISPLAY, pcd->iconWindow, &root, &x, &y, &width, &height,
1533 * strip off previous window border and set window geometry to
1534 * fit inside icon frame
1537 mask = CWBorderWidth;
1538 windowChanges.border_width = 0;
1545 if (width > ((ICON_IMAGE_MAXIMUM(pcd).width) +
1546 ((wmGD.frameStyle == WmSLAB) ? 2 : 0)))
1548 width = windowChanges.width = ICON_IMAGE_MAXIMUM(pcd).width +
1549 ((wmGD.frameStyle == WmSLAB) ? 2 : 0);
1552 else if (width < ICON_IMAGE_MINIMUM(pcd).width) {
1553 width = windowChanges.width = ICON_IMAGE_MINIMUM(pcd).width;
1557 if (height > ((ICON_IMAGE_MAXIMUM(pcd).height) +
1558 ((wmGD.frameStyle == WmSLAB) ? 2 : 0)))
1560 height = windowChanges.height = ICON_IMAGE_MAXIMUM(pcd).height +
1561 ((wmGD.frameStyle == WmSLAB) ? 2 : 0);
1564 else if (height < ICON_IMAGE_MINIMUM(pcd).height) {
1565 height = windowChanges.height = ICON_IMAGE_MINIMUM(pcd).height;
1570 XConfigureWindow (DISPLAY, pcd->iconWindow, mask, &windowChanges);
1573 * Reparent the icon window to the center of the icon image frame
1576 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1578 yOffset += ICON_INTERNAL_SHADOW_WIDTH;
1581 rpX = ((ICON_WIDTH(pcd) - width)/2) + xOffset;
1582 rpY = ((ICON_IMAGE_HEIGHT(pcd) - height)/2) + yOffset;
1587 XReparentWindow (DISPLAY, pcd->iconWindow, ICON_FRAME_WIN(pcd), rpX, rpY);
1588 pcd->clientFlags |= ICON_REPARENTED;
1591 * Map the icon window when the icon frame is mapped.
1594 } /* END if (!pcd->pECD) */
1595 #endif /* PANELIST */
1596 } /* END OF FUNCTION ReparentIconWindow */
1599 /*************************************<->*************************************
1601 * PutBoxOnScreen (screen, px, py, width, height)
1606 * Changes the position of the passed box so that it is all on screen
1611 * screen - screen we're talking about
1612 * px - pointer to x-coord
1613 * py - pointer to y-coord
1614 * width - width of box
1615 * height - height of box
1626 *************************************<->***********************************/
1627 void PutBoxOnScreen (int screen, int *px, int *py, unsigned int width, unsigned int height)
1630 * Place active label text nicely on screen
1633 if (*px+width+1 > DisplayWidth (DISPLAY, screen))
1634 *px -= (*px+width+1) - DisplayWidth (DISPLAY, screen);
1636 if (*py+height+1 > DisplayHeight (DISPLAY, screen))
1637 *py -= (*py+height+1) - DisplayHeight (DISPLAY, screen);
1639 if (*px < 1) *px = 1;
1641 if (*py < 1) *py = 1;
1643 } /* END OF FUNCTION PutBoxOnScreen */
1646 /*************************************<->*************************************
1648 * PutBoxInIconBox (pCD, px, py, width, height)
1653 * Changes the position of the passed box so that it is not
1654 * clipped by the bulletin board
1660 * pCD - pointer to client data
1661 * px - pointer to x-coord
1662 * py - pointer to y-coord
1663 * width - width of box
1664 * height - height of box
1675 *************************************<->***********************************/
1676 void PutBoxInIconBox (ClientData *pCD, int *px, int *py, unsigned int *width, unsigned int *height)
1681 Dimension bBoardWidth;
1682 Dimension bBoardHeight;
1689 XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &bBoardWidth ); i++;
1690 XtSetArg (getArgs[i], XmNheight, (XtArgVal) &bBoardHeight ); i++;
1691 XtGetValues (P_ICON_BOX(pCD)->bBoardWidget, getArgs, i);
1693 clipWidth = (int) bBoardWidth;
1694 clipHeight = (int) bBoardHeight;
1696 if (*px + *width-1 > clipWidth)
1697 *px -= (*px + *width-1) - clipWidth;
1699 if (*py + *height-1 > clipHeight)
1700 *py -= (*py + *height-1) - clipHeight;
1702 if (*px < 0) *px = 0;
1704 if (*py < 0) *py = 0;
1707 } /* END OF FUNCTION PutBoxInIconBox */
1710 /*************************************<->*************************************
1712 * CreateActiveIconTextWindow (pSD)
1717 * creates the window that's popped up when an icon is activated
1721 * pSD - pointer to screen data
1729 *************************************<->***********************************/
1731 void CreateActiveIconTextWindow (WmScreenData *pSD)
1733 XSetWindowAttributes window_attribs;
1734 unsigned long attr_mask;
1736 /* create active icon text window */
1737 attr_mask = CWEventMask| CWCursor;
1738 window_attribs.event_mask = ExposureMask;
1739 window_attribs.cursor = wmGD.workspaceCursor;
1742 * Use background pixmap if one is specified, otherwise set the
1743 * appropriate background color.
1746 if (pSD->iconAppearance.activeBackgroundPixmap)
1748 attr_mask |= CWBackPixmap;
1749 window_attribs.background_pixmap =
1750 pSD->iconAppearance.activeBackgroundPixmap;
1754 attr_mask |= CWBackPixel;
1755 window_attribs.background_pixel =
1756 pSD->iconAppearance.activeBackground;
1760 pSD->activeIconTextWin = XCreateWindow (DISPLAY,
1761 pSD->rootWindow, /* parent */
1763 1, 1, /* width, height */
1764 0, /* border width */
1765 CopyFromParent, /* depth */
1766 InputOutput, /* class */
1767 CopyFromParent, /* visual */
1772 pSD->activeLabelParent = pSD->rootWindow;
1774 } /* END OF FUNCTION CreateActiveIconTextWindow */
1778 /*************************************<->*************************************
1780 * PaintActiveIconText (pcd, erase)
1789 * pcd - pointer to client data
1790 * erase - if true, then erase the area before repainting
1799 *************************************<->***********************************/
1800 void PaintActiveIconText (ClientData *pcd, Boolean erase)
1803 GC iconGC, topGC, botGC;
1805 if (!(ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART))
1808 /* get appropriate GCs */
1809 iconGC = ICON_APPEARANCE(pcd).activeGC;
1810 topGC = ICON_APPEARANCE(pcd).activeTopShadowGC;
1811 botGC = ICON_APPEARANCE(pcd).activeBottomShadowGC;
1813 /* draw shadowing */
1815 if (pActiveIconTopRects) {
1816 XFillRectangles (DISPLAY,
1817 pcd->pSD->activeIconTextWin,
1819 pActiveIconTopRects->prect,
1820 pActiveIconTopRects->used);
1823 if (pActiveIconBotRects) {
1824 XFillRectangles (DISPLAY,
1825 pcd->pSD->activeIconTextWin,
1827 pActiveIconBotRects->prect,
1828 pActiveIconBotRects->used);
1831 /* paint the text */
1832 textBox.x = ICON_EXTERNAL_SHADOW_WIDTH;
1833 textBox.y = ICON_EXTERNAL_SHADOW_WIDTH;
1834 textBox.width = activeIconTextWidth - 2*ICON_EXTERNAL_SHADOW_WIDTH;
1835 textBox.height = activeIconTextHeight - 2*ICON_EXTERNAL_SHADOW_WIDTH;
1839 XClearArea (DISPLAY, pcd->pSD->activeIconTextWin, textBox.x, textBox.y,
1840 (unsigned int) textBox.width,
1841 (unsigned int) textBox.height,
1846 WmDrawXmString(DISPLAY, pcd->pSD->activeIconTextWin,
1847 ICON_APPEARANCE(pcd).fontList,
1848 pcd->iconTitle, iconGC,
1849 textBox.x, textBox.y, textBox.width, &textBox, True);
1851 WmDrawXmString(DISPLAY, pcd->pSD->activeIconTextWin,
1852 ICON_APPEARANCE(pcd).fontList,
1853 pcd->iconTitle, iconGC,
1854 textBox.x, textBox.y, textBox.width, &textBox);
1858 } /* END OF FUNCTION PaintActiveIconText */
1861 /*************************************<->*************************************
1863 * ShowActiveIconText (pcd)
1880 *************************************<->***********************************/
1881 void ShowActiveIconText (ClientData *pcd)
1883 XWindowAttributes iconFrameAttribs;
1884 XSetWindowAttributes window_attribs;
1885 XWindowChanges windowChanges;
1890 Dimension dWidth, dHeight;
1894 * put up a big icon text label
1896 if (pcd->pSD->activeIconTextWin) {
1897 /* copy event mask from icon frame window */
1898 XGetWindowAttributes (DISPLAY, ICON_FRAME_WIN(pcd), &iconFrameAttribs);
1900 /* set attributes of window */
1901 window_attribs.event_mask = iconFrameAttribs.your_event_mask;
1902 XChangeWindowAttributes (DISPLAY, pcd->pSD->activeIconTextWin,
1903 CWEventMask, &window_attribs);
1905 /* set up geometry for the window */
1907 XmStringExtent (ICON_APPEARANCE(pcd).fontList, pcd->iconTitle,
1910 activeIconTextHeight = (unsigned int) dHeight +
1911 WM_BOTTOM_TITLE_PADDING +
1912 2*ICON_EXTERNAL_SHADOW_WIDTH;
1914 activeIconTextWidth = (unsigned int) dWidth;
1916 if (activeIconTextWidth < (1.2 * ICON_WIDTH(pcd)))
1918 activeIconTextWidth = 1.2 * ICON_WIDTH(pcd);
1921 activeIconTextWidth += 2*ICON_EXTERNAL_SHADOW_WIDTH;
1923 XGetGeometry (DISPLAY,
1924 (Drawable) ICON_FRAME_WIN(pcd),
1926 &junk, &junk, &junk, &junk);
1929 y += ICON_IMAGE_HEIGHT(pcd);
1930 x -= (activeIconTextWidth - ICON_WIDTH(pcd))/2;
1934 if (!(P_ICON_BOX(pcd)))
1937 * This is a normal icon
1939 PutBoxOnScreen (SCREEN_FOR_CLIENT(pcd), &x, &y,
1940 activeIconTextWidth, activeIconTextHeight);
1941 if (ACTIVE_LABEL_PARENT(pcd) != root)
1943 XReparentWindow(DISPLAY, pcd->pSD->activeIconTextWin ,
1945 ACTIVE_LABEL_PARENT(pcd) = root;
1952 * This is an icon in an icon box
1954 x = x + IB_MARGIN_WIDTH;
1955 y = y + IB_MARGIN_HEIGHT;
1957 if(!(pcd->pSD->iconDecoration & ( ICON_LABEL_PART)))
1959 y -= activeIconTextHeight;
1962 PutBoxInIconBox (pcd, &x, &y,
1963 &activeIconTextWidth, &activeIconTextHeight);
1964 if (ACTIVE_LABEL_PARENT(pcd) != pcd->client)
1966 XReparentWindow(DISPLAY, pcd->pSD->activeIconTextWin ,
1967 XtWindow(P_ICON_BOX(pcd)->bBoardWidget),
1969 ACTIVE_LABEL_PARENT(pcd) = pcd->client;
1974 mask = CWX | CWY | CWWidth | CWHeight;
1975 windowChanges.x = x;
1976 windowChanges.y = y;
1977 windowChanges.width = activeIconTextWidth;
1978 windowChanges.height = activeIconTextHeight;
1979 XConfigureWindow (DISPLAY, pcd->pSD->activeIconTextWin, mask,
1982 /* bevel the rectangle around the edges */
1983 if ((pActiveIconTopRects && pActiveIconBotRects) ||
1984 ((pActiveIconTopRects =
1985 AllocateRList((unsigned)4*ICON_EXTERNAL_SHADOW_WIDTH)) &&
1986 (pActiveIconBotRects =
1987 AllocateRList((unsigned)4*ICON_EXTERNAL_SHADOW_WIDTH))))
1989 pActiveIconTopRects->used = 0;
1990 pActiveIconBotRects->used = 0;
1991 BevelRectangle (pActiveIconTopRects,
1992 pActiveIconBotRects,
1994 activeIconTextWidth,
1995 activeIconTextHeight,
1996 ICON_EXTERNAL_SHADOW_WIDTH,
1997 ICON_EXTERNAL_SHADOW_WIDTH,
1998 ICON_EXTERNAL_SHADOW_WIDTH,
1999 ICON_EXTERNAL_SHADOW_WIDTH);
2002 XMapRaised (DISPLAY, pcd->pSD->activeIconTextWin);
2003 wmGD.activeIconTextDisplayed = True;
2005 /* save context for this window */
2006 XSaveContext (DISPLAY, pcd->pSD->activeIconTextWin,
2007 wmGD.windowContextType, (caddr_t) pcd);
2009 } /* END OF FUNCTION ShowActiveIconText */
2012 /*************************************<->*************************************
2014 * HideActiveIconText ()
2019 * Hides the big label shown over the active icon.
2032 *************************************<->***********************************/
2033 void HideActiveIconText (WmScreenData *pSD)
2037 if ((pSD && pSD->activeIconTextWin) || ACTIVE_ICON_TEXT_WIN)
2039 /* disassociate the big label window with this client */
2040 XDeleteContext (DISPLAY,
2042 ? pSD->activeIconTextWin
2043 : ACTIVE_PSD->activeIconTextWin,
2044 wmGD.windowContextType);
2046 /* hide the big label */
2047 XUnmapWindow (DISPLAY,
2049 ? pSD->activeIconTextWin
2050 : ACTIVE_PSD->activeIconTextWin);
2051 wmGD.activeIconTextDisplayed = False;
2056 /*************************************<->*************************************
2058 * MoveActiveIconText (pcd)
2075 *************************************<->***********************************/
2076 void MoveActiveIconText (ClientData *pcd)
2081 Dimension dWidth, dHeight;
2085 * put up a big icon text label
2087 if (pcd->pSD->activeIconTextWin && wmGD.activeIconTextDisplayed) {
2088 /* set up geometry for the window */
2090 XmStringExtent (ICON_APPEARANCE(pcd).fontList, pcd->iconTitle,
2093 activeIconTextHeight = (unsigned int) dHeight +
2094 WM_BOTTOM_TITLE_PADDING +
2095 2 * ICON_EXTERNAL_SHADOW_WIDTH;
2097 activeIconTextWidth = (unsigned int) dWidth;
2099 if (activeIconTextWidth < (1.2 * ICON_WIDTH(pcd)))
2101 activeIconTextWidth = 1.2 * ICON_WIDTH(pcd);
2104 activeIconTextWidth += 2 * ICON_EXTERNAL_SHADOW_WIDTH;
2106 XGetGeometry (DISPLAY,
2107 (Drawable) ICON_FRAME_WIN(pcd),
2109 &junk, &junk, &junk, &junk);
2112 y += ICON_IMAGE_HEIGHT(pcd);
2113 x -= (activeIconTextWidth - ICON_WIDTH(pcd))/2;
2115 if (!(P_ICON_BOX(pcd)))
2117 /* This is a normal icon */
2118 PutBoxOnScreen (SCREEN_FOR_CLIENT(pcd), &x, &y,
2119 activeIconTextWidth, activeIconTextHeight);
2124 x = x + IB_MARGIN_WIDTH;
2125 y = y + IB_MARGIN_HEIGHT;
2127 if(!(pcd->pSD->iconDecoration & ( ICON_LABEL_PART)))
2129 y -= activeIconTextHeight;
2132 PutBoxInIconBox (pcd, &x, &y,
2133 &activeIconTextWidth, &activeIconTextHeight);
2136 XMoveWindow(DISPLAY, pcd->pSD->activeIconTextWin, x, y );
2139 } /* END OF FUNCTION MoveActiveIconText */