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, 1993 OPEN SOFTWARE FOUNDATION, INC.
31 * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */
40 #include <Xm/DrawP.h> /* for XmeClearBorder */
42 * include extern functions
46 #include "WmGraphics.h"
47 #include "WmIconBox.h"
49 #include "WmWinInfo.h"
50 #include "WmWrkspace.h"
57 static unsigned int activeIconTextWidth = 1;
58 static unsigned int activeIconTextHeight = 1;
59 static RList *pActiveIconTopRects = NULL;
60 static RList *pActiveIconBotRects = NULL;
62 static int iconShrinkX;
63 static int iconShrinkY;
64 static unsigned int iconShrinkWidth;
65 static unsigned int iconShrinkHeight;
68 /*************************************<->*************************************
75 * Create an icon frame and fill it in as appropriate for the client.
80 * pWS - pointer to workspace data
81 * pcd - pointer to client data
86 * Return - TRUE if success, FALSE if failure.
93 *************************************<->***********************************/
95 Boolean MakeIcon (WmWorkspaceData *pWS, ClientData *pcd)
97 XSetWindowAttributes window_attribs;
98 unsigned long attr_mask;
101 WsClientData *pWsc = GetWsClientData (pWS, pcd);
105 * Common to all icons
108 /* compute dimensions of outer icon frame */
109 /* create icon frame window */
111 attr_mask = CWEventMask | CWCursor;
112 window_attribs.event_mask = (ButtonPressMask | ButtonReleaseMask |
113 SELECT_BUTTON_MOTION_MASK |
114 DMANIP_BUTTON_MOTION_MASK |
116 SubstructureRedirectMask |
118 window_attribs.cursor = wmGD.workspaceCursor;
120 if ((wmGD.keyboardFocusPolicy == KEYBOARD_FOCUS_POINTER) ||
121 (wmGD.colormapFocusPolicy == CMAP_FOCUS_POINTER))
123 window_attribs.event_mask |= EnterWindowMask | LeaveWindowMask;
127 * Use background pixmap if one is specified, otherwise set the
128 * appropriate background color.
131 if (ICON_APPEARANCE(pcd).backgroundPixmap)
133 attr_mask |= CWBackPixmap;
134 window_attribs.background_pixmap =
135 ICON_APPEARANCE(pcd).backgroundPixmap;
139 attr_mask |= CWBackPixel;
140 window_attribs.background_pixel =
141 ICON_APPEARANCE(pcd).background;
144 if ((!pcd->pSD->useIconBox) ||
145 (pcd->clientFlags & (CLIENT_WM_CLIENTS | FRONT_PANEL_BOX)))
147 pWsc->iconFrameWin = XCreateWindow (DISPLAY,
148 ROOT_FOR_CLIENT(pcd), /* parent */
151 (unsigned int) ICON_WIDTH(pcd),
152 (unsigned int) ICON_HEIGHT(pcd),
153 0, /* border width */
154 CopyFromParent, /* depth */
155 InputOutput, /* class */
156 CopyFromParent, /* visual */
164 * Insert the icon into the icon box.
165 * Don't make icon in the box for any icon box (or any WM window)
166 * OR any client that doesn't have the MWM_FUNC_MINIMIZE bit set
167 * in pcd->clientFunctions
170 if ((pcd->pSD->useIconBox) &&
171 (!(pcd->clientFlags & CLIENT_WM_CLIENTS)) &&
172 (pcd->clientFunctions & MWM_FUNC_MINIMIZE) )
174 if (!InsertIconIntoBox(pWS->pIconBox, pcd))
175 Warning(((char *)GETMESSAGE(30, 1, "Could not make icon to go in icon box")));
182 /* make space for the top/bottom changing shadow rectangles */
184 if ((pcd->piconTopShadows =
185 AllocateRList ((unsigned)NUM_BOTH_TOP_RECTS)) == NULL)
188 Warning (((char *)GETMESSAGE(30, 2, "Insufficient memory for icon creation")));
192 if ((pcd->piconBottomShadows =
193 AllocateRList ((unsigned)NUM_BOTH_BOTTOM_RECTS)) == NULL)
196 Warning (((char *)GETMESSAGE(30, 3, "Insufficient memory for icon creation")));
202 * Adjust for icons in the box
203 * Don't adjust the icon for the icon box itself
206 if (pWS->pIconBox && (pWS->pIconBox->pCD_iconBox != pcd) &&
207 !(pcd->clientFlags & FRONT_PANEL_BOX))
209 xOffset = IB_MARGIN_WIDTH;
210 yOffset = IB_MARGIN_HEIGHT;
220 * Reparent the icon window if there is one
222 if ((ICON_DECORATION(pcd) & ICON_IMAGE_PART) &&
225 ReparentIconWindow (pcd, xOffset, yOffset);
228 if (pcd->piconTopShadows->used == 0)
229 MakeIconShadows (pcd, xOffset, yOffset);
233 } /* END OF FUNCTION MakeIcon */
237 /*************************************<->*************************************
239 * MakeIconShadows (pcd, xOffset, yOffset)
244 *************************************<->***********************************/
246 void MakeIconShadows (ClientData *pcd, int xOffset, int yOffset)
250 * Handle different icon styles
253 switch (ICON_DECORATION(pcd) & (ICON_LABEL_PART | ICON_IMAGE_PART))
255 case ICON_LABEL_PART:
256 BevelRectangle (pcd->piconTopShadows, /* label */
257 pcd->piconBottomShadows,
258 0 + xOffset, (int)ICON_IMAGE_HEIGHT(pcd) + yOffset,
259 (unsigned int) ICON_WIDTH(pcd),
260 (unsigned int) ICON_LABEL_HEIGHT(pcd),
261 ICON_EXTERNAL_SHADOW_WIDTH,
262 ICON_EXTERNAL_SHADOW_WIDTH,
263 ICON_EXTERNAL_SHADOW_WIDTH,
264 ICON_EXTERNAL_SHADOW_WIDTH);
267 case ICON_IMAGE_PART:
268 BevelRectangle (pcd->piconTopShadows, /* image outside */
269 pcd->piconBottomShadows,
270 0 + xOffset, 0 + yOffset,
271 (unsigned int) ICON_WIDTH(pcd),
272 (unsigned int) ICON_IMAGE_HEIGHT(pcd),
273 ICON_EXTERNAL_SHADOW_WIDTH,
274 ICON_EXTERNAL_SHADOW_WIDTH,
275 ICON_EXTERNAL_SHADOW_WIDTH,
276 ICON_EXTERNAL_SHADOW_WIDTH);
278 if (wmGD.frameStyle == WmRECESSED)
279 BevelRectangle (pcd->piconBottomShadows, /* image inside */
280 pcd->piconTopShadows,
281 ICON_INNER_X_OFFSET + xOffset,
282 ICON_INNER_Y_OFFSET + yOffset,
283 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).width +
284 4*ICON_INTERNAL_SHADOW_WIDTH),
285 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).height +
286 4*ICON_INTERNAL_SHADOW_WIDTH),
287 ICON_INTERNAL_SHADOW_WIDTH,
288 ICON_INTERNAL_SHADOW_WIDTH,
289 ICON_INTERNAL_SHADOW_WIDTH,
290 ICON_INTERNAL_SHADOW_WIDTH);
294 case (ICON_IMAGE_PART | ICON_LABEL_PART):
295 if (wmGD.frameStyle == WmSLAB)
297 BevelRectangle (pcd->piconTopShadows, /* image outside */
298 pcd->piconBottomShadows,
299 0 + xOffset, 0 + yOffset,
300 (unsigned int) ICON_WIDTH(pcd),
301 (unsigned int) (ICON_IMAGE_HEIGHT(pcd) +
302 ICON_LABEL_HEIGHT(pcd)),
303 ICON_EXTERNAL_SHADOW_WIDTH,
304 ICON_EXTERNAL_SHADOW_WIDTH,
305 ICON_EXTERNAL_SHADOW_WIDTH,
306 ICON_EXTERNAL_SHADOW_WIDTH);
310 BevelRectangle (pcd->piconTopShadows, /* image outside */
311 pcd->piconBottomShadows,
312 0 + xOffset, 0 + yOffset,
313 (unsigned int) ICON_WIDTH(pcd),
314 (unsigned int) ICON_IMAGE_HEIGHT(pcd),
315 ICON_EXTERNAL_SHADOW_WIDTH,
316 ICON_EXTERNAL_SHADOW_WIDTH,
317 ICON_INTERNAL_SHADOW_WIDTH,
318 ICON_EXTERNAL_SHADOW_WIDTH);
321 if (wmGD.frameStyle == WmRECESSED)
322 BevelRectangle (pcd->piconBottomShadows, /* image inside */
323 pcd->piconTopShadows,
324 ICON_INNER_X_OFFSET + xOffset,
325 ICON_INNER_Y_OFFSET + yOffset,
326 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).width +
327 4*ICON_INTERNAL_SHADOW_WIDTH),
328 (unsigned int) (ICON_IMAGE_MAXIMUM(pcd).height +
329 4*ICON_INTERNAL_SHADOW_WIDTH),
330 ICON_INTERNAL_SHADOW_WIDTH,
331 ICON_INTERNAL_SHADOW_WIDTH,
332 ICON_INTERNAL_SHADOW_WIDTH,
333 ICON_INTERNAL_SHADOW_WIDTH);
335 if (wmGD.frameStyle == WmRECESSED)
336 BevelRectangle (pcd->piconTopShadows, /* label */
337 pcd->piconBottomShadows,
338 0 + xOffset, (int)ICON_IMAGE_HEIGHT(pcd) + yOffset,
339 (unsigned int) ICON_WIDTH(pcd),
340 (unsigned int) ICON_LABEL_HEIGHT(pcd),
341 ICON_INTERNAL_SHADOW_WIDTH,
342 ICON_EXTERNAL_SHADOW_WIDTH,
343 ICON_EXTERNAL_SHADOW_WIDTH,
344 ICON_EXTERNAL_SHADOW_WIDTH);
349 } /* END OF FUNCTION MakeIconShadows */
356 /*************************************<->*************************************
358 * IconExposureProc (pcd, expose)
368 * pcd - pointer to client data
377 *************************************<->***********************************/
379 void IconExposureProc (ClientData *pcd, Boolean expose)
386 unsigned int width, height;
387 GC iconGC, topGC, botGC;
388 static XRectangle shrinkRects[4];
393 * Adjust for icons in the iconBox
398 xOffset = IB_MARGIN_WIDTH;
399 yOffset = IB_MARGIN_HEIGHT;
407 /* get appropriate GCs */
409 if ((wmGD.keyboardFocus == pcd) && (pcd->clientState == MINIMIZED_STATE))
411 iconGC = ICON_APPEARANCE(pcd).activeGC;
412 topGC = ICON_APPEARANCE(pcd).activeTopShadowGC;
413 botGC = ICON_APPEARANCE(pcd).activeBottomShadowGC;
417 iconGC = ICON_APPEARANCE(pcd).inactiveGC;
418 topGC = ICON_APPEARANCE(pcd).inactiveTopShadowGC;
419 botGC = ICON_APPEARANCE(pcd).inactiveBottomShadowGC;
422 if (ACTIVE_PSD->useIconBox && P_ICON_BOX(pcd))
432 (unsigned int) ICON_WIDTH(pcd),
433 (unsigned int) ICON_HEIGHT(pcd), False);
436 if (pcd->clientState == MINIMIZED_STATE)
439 * This is the "raised" icon appearance
442 if (pcd->piconTopShadows)
445 XFillRectangles (DISPLAY,
448 pcd->piconTopShadows->prect,
449 pcd->piconTopShadows->used);
452 if (pcd->piconBottomShadows)
454 XFillRectangles (DISPLAY,
457 pcd->piconBottomShadows->prect,
458 pcd->piconBottomShadows->used);
463 shrinkRects[0].x = IB_MARGIN_WIDTH;
464 shrinkRects[0].y = IB_MARGIN_HEIGHT;
465 shrinkRects[0].width = (unsigned int) ICON_WIDTH(pcd);
466 shrinkRects[0].height = iconShrinkY - IB_MARGIN_HEIGHT;
468 shrinkRects[1].x = IB_MARGIN_WIDTH;
469 shrinkRects[1].y = iconShrinkY;
470 shrinkRects[1].width = iconShrinkX - IB_MARGIN_WIDTH;
471 shrinkRects[1].height = iconShrinkHeight;
473 shrinkRects[2].x = iconShrinkX + iconShrinkWidth;
474 shrinkRects[2].y = iconShrinkY;
475 shrinkRects[2].width = iconShrinkX - IB_MARGIN_WIDTH;
476 shrinkRects[2].height = iconShrinkHeight;
478 shrinkRects[3].x = IB_MARGIN_WIDTH;
479 shrinkRects[3].y = iconShrinkY + iconShrinkHeight;
480 shrinkRects[3].width = (unsigned int) ICON_WIDTH(pcd);
481 shrinkRects[3].height = iconShrinkY - IB_MARGIN_HEIGHT;
483 XFillRectangles (DISPLAY,
495 if (pcd->clientState == MINIMIZED_STATE)
498 * This is the "raised" icon appearance
501 if (pcd->piconTopShadows->prect)
504 XFillRectangles (DISPLAY,
507 pcd->piconTopShadows->prect,
508 pcd->piconTopShadows->used);
511 if (pcd->piconBottomShadows->prect)
513 XFillRectangles (DISPLAY,
516 pcd->piconBottomShadows->prect,
517 pcd->piconBottomShadows->used);
526 if ((ICON_DECORATION(pcd) & ICON_LABEL_PART) &&
527 (expose || !(ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)))
529 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
535 * Draw image if no icon window (client has to redraw that!)
536 * OR if using the iconbox, draw the default image where
537 * the icon window was.
541 ((!pcd->iconWindow && (ICON_DECORATION(pcd) & ICON_IMAGE_PART)) ||
542 (ACTIVE_PSD->useIconBox && P_ICON_BOX(pcd) &&
544 pcd->clientState != MINIMIZED_STATE &&
545 (ICON_DECORATION(pcd) & ICON_IMAGE_PART))))
549 image = DEFAULT_PIXMAP(pcd);
553 image = pcd->iconPixmap;
559 if ((ACTIVE_PSD->useIconBox) && (P_ICON_BOX(pcd)))
562 if (pcd->clientState != MINIMIZED_STATE)
564 dest_x = ICON_IMAGE_X_OFFSET
565 + ICON_INTERNAL_SHADOW_WIDTH
568 dest_y = ICON_IMAGE_Y_OFFSET
569 + ICON_INTERNAL_SHADOW_WIDTH
571 if (wmGD.frameStyle == WmSLAB)
573 /* less beveling in this style */
574 dest_x -= ICON_INTERNAL_SHADOW_WIDTH;
575 dest_y -= ICON_INTERNAL_SHADOW_WIDTH;
578 width = ICON_IMAGE_MAXIMUM(pcd).width;
579 height= ICON_IMAGE_MAXIMUM(pcd).height;
580 if (wmGD.frameStyle == WmSLAB)
585 XCopyArea (DISPLAY, image,
588 ICON_INTERNAL_SHADOW_WIDTH,
589 ICON_INTERNAL_SHADOW_WIDTH,
590 width, height, dest_x, dest_y);
592 if (FADE_NORMAL_ICON(pcd))
594 iconGC = FADE_ICON_GC(pcd);
595 XFillRectangle (DISPLAY,
605 dest_x = ICON_IMAGE_X_OFFSET
608 dest_y = ICON_IMAGE_Y_OFFSET
610 if (wmGD.frameStyle == WmSLAB)
612 /* less beveling in this style */
613 dest_x -= ICON_INTERNAL_SHADOW_WIDTH;
614 dest_y -= ICON_INTERNAL_SHADOW_WIDTH;
617 width = ICON_IMAGE_MAXIMUM(pcd).width
618 + (2 * ICON_INTERNAL_SHADOW_WIDTH);
619 height= ICON_IMAGE_MAXIMUM(pcd).height
620 + (2 * ICON_INTERNAL_SHADOW_WIDTH);
622 if (wmGD.frameStyle == WmSLAB)
627 XCopyArea (DISPLAY, image,
629 iconGC, 0, 0, width, height,
637 width = ICON_IMAGE_MAXIMUM(pcd).width +
638 2 * ICON_INTERNAL_SHADOW_WIDTH;
640 height= ICON_IMAGE_MAXIMUM(pcd).height +
641 2 * ICON_INTERNAL_SHADOW_WIDTH;
643 if (wmGD.frameStyle == WmSLAB)
645 dest_x = ICON_INNER_X_OFFSET;
646 dest_y = ICON_INNER_Y_OFFSET;
652 dest_x = ICON_INNER_X_OFFSET + ICON_INTERNAL_SHADOW_WIDTH;
653 dest_y = ICON_INNER_Y_OFFSET + ICON_INTERNAL_SHADOW_WIDTH;
655 XCopyArea (DISPLAY, image,
657 iconGC, 0, 0, width, height,
667 } /* END OF FUNCTION IconExposureProc */
672 /*************************************<->*************************************
674 * GetIconTitleBox (pcd, pBox)
679 * Returns a rectangle containing the icon text box
684 * pcd - pointer to client data
685 * pBox - pointer to an XRectangle structure that gets returned data
689 * pBox - returned data
694 *************************************<->***********************************/
696 void GetIconTitleBox (ClientData *pcd, XRectangle *pBox)
703 * Adjust for icons in the iconBox
708 xOffset = IB_MARGIN_WIDTH;
709 yOffset = IB_MARGIN_HEIGHT;
717 if ((P_ICON_BOX(pcd)) && (pcd->clientState != MINIMIZED_STATE))
719 /* move label up to enhance shrink wrap effect */
720 pBox->x = ICON_EXTERNAL_SHADOW_WIDTH
721 + ICON_IMAGE_LEFT_PAD
722 + (2 * ICON_INTERNAL_SHADOW_WIDTH)
723 + ICON_IMAGE_LEFT_PAD
726 pBox->y = ICON_IMAGE_HEIGHT(pcd)
728 + ((ICON_IMAGE_HEIGHT(pcd) > 0)
729 ? - ICON_IMAGE_BOTTOM_PAD
730 : ICON_EXTERNAL_SHADOW_WIDTH)
731 + ((ICON_IMAGE_HEIGHT(pcd) >0)
733 : WM_TOP_TITLE_PADDING );
735 if (wmGD.frameStyle == WmSLAB)
737 /* account for less beveling in this style */
738 pBox->x -= ICON_INTERNAL_SHADOW_WIDTH;
739 pBox->y -= ICON_INTERNAL_SHADOW_WIDTH;
744 pBox->width = ICON_IMAGE_MAXIMUM(pcd).width
745 + ((wmGD.frameStyle == WmSLAB) ? 2 : 0)
746 - ICON_IMAGE_LEFT_PAD
747 - ICON_EXTERNAL_SHADOW_WIDTH;
749 pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
752 else if ((P_ICON_BOX(pcd)) && (pcd->clientState == MINIMIZED_STATE))
754 pBox->x = ICON_EXTERNAL_SHADOW_WIDTH
755 + ICON_IMAGE_LEFT_PAD
756 + (2 * ICON_INTERNAL_SHADOW_WIDTH)
757 + ICON_IMAGE_LEFT_PAD
760 pBox->y = ICON_IMAGE_HEIGHT(pcd)
762 + ((ICON_IMAGE_HEIGHT(pcd) > 0)
763 ? ICON_INTERNAL_SHADOW_WIDTH
764 : ICON_EXTERNAL_SHADOW_WIDTH)
765 + WM_TOP_TITLE_PADDING ;
767 pBox->width = ICON_IMAGE_MAXIMUM(pcd).width
768 + ((wmGD.frameStyle == WmSLAB) ? 2 : 0)
769 - ICON_IMAGE_LEFT_PAD;
771 pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
773 if (wmGD.frameStyle == WmSLAB)
775 /* account for less beveling in this style */
776 pBox->x -= ICON_INTERNAL_SHADOW_WIDTH + 2*ICON_IMAGE_LEFT_PAD;
777 pBox->y -= 3 * ICON_INTERNAL_SHADOW_WIDTH;
778 pBox->width += ICON_IMAGE_LEFT_PAD + 2;
784 pBox->x = ICON_EXTERNAL_SHADOW_WIDTH
785 + WM_TOP_TITLE_PADDING
788 if (wmGD.frameStyle == WmSLAB)
790 /* account for less beveling in this style */
791 yOffset -= ICON_INTERNAL_SHADOW_WIDTH;
793 pBox->y = ICON_IMAGE_HEIGHT(pcd)
794 + WM_TOP_TITLE_PADDING
796 + ((ICON_IMAGE_HEIGHT(pcd) > 0)
797 ? ICON_INTERNAL_SHADOW_WIDTH
798 : ICON_EXTERNAL_SHADOW_WIDTH);
800 pBox->width = ICON_WIDTH(pcd) - 2 * ICON_EXTERNAL_SHADOW_WIDTH -
801 WM_TOP_TITLE_PADDING - WM_BOTTOM_TITLE_PADDING;
802 pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
807 } /* END OF FUNCTION GetIconTitleBox */
811 /*************************************<->*************************************
813 * DrawIconTitle (pcd)
818 * Draws the title in the Icon title area
823 * pcd - pointer to client data
831 *************************************<->***********************************/
833 void DrawIconTitle (ClientData *pcd)
839 GetIconTitleBox (pcd, &textBox);
841 /* get appropriate GCs */
842 if ((ACTIVE_PSD->useIconBox &&
843 !((pcd->dtwmBehaviors & (DtWM_BEHAVIOR_PANEL)) ||
844 (pcd->clientFlags & CLIENT_WM_CLIENTS))) ||
845 !(wmGD.keyboardFocus == pcd))
847 iconGC = ICON_APPEARANCE(pcd).inactiveGC;
851 iconGC = ICON_APPEARANCE(pcd).activeGC;
855 * Dim text if this is in the icon box and the client is mapped
858 if ((ACTIVE_PSD->useIconBox) &&
860 (FADE_NORMAL_ICON(pcd)) &&
861 (!(pcd->clientState == MINIMIZED_STATE)))
863 iconGC = FADE_ICON_TEXT_GC(pcd);
870 WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd), ICON_APPEARANCE(pcd).fontList,
871 pcd->iconTitle, iconGC,
872 textBox.x, textBox.y, textBox.width, &textBox, True);
874 } /* END OF FUNCTION DrawIconTitle */
879 /*************************************<->*************************************
881 * RedisplayIconTitle (pcd)
886 * Draws the title in the Icon title area
891 * pcd - pointer to client data
899 *************************************<->***********************************/
901 void RedisplayIconTitle (ClientData *pcd)
907 * only proceed if we've got the right icon parts to work on
910 if (ICON_DECORATION(pcd) & ICON_LABEL_PART && ICON_FRAME_WIN(pcd))
913 /* nothing to do if no labels */
914 if (!(ICON_DECORATION(pcd) & ICON_LABEL_PART))
917 /* get the box that the text sits in */
918 GetIconTitleBox (pcd, &textBox);
921 * Get appropriate GCs
922 * Dim text if this is in the icon box and the client is mapped
924 if ((ACTIVE_PSD->useIconBox && (P_ICON_BOX(pcd)) &&
925 !(pcd->clientFlags & CLIENT_WM_CLIENTS)) ||
926 !(wmGD.keyboardFocus == pcd))
928 iconGC = ICON_APPEARANCE(pcd).inactiveGC;
932 iconGC = ICON_APPEARANCE(pcd).activeGC;
935 if ((ACTIVE_PSD->useIconBox) &&
937 (FADE_NORMAL_ICON(pcd)) &&
938 (!(pcd->clientState == MINIMIZED_STATE)))
940 iconGC = FADE_ICON_TEXT_GC(pcd);
943 /* out with the old */
946 textBox.x, textBox.y,
947 (unsigned int) textBox.width, (unsigned int) textBox.height,
950 /* in with the new */
951 WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd),
952 ICON_APPEARANCE(pcd).fontList,
953 pcd->iconTitle, iconGC,
954 textBox.x, textBox.y, textBox.width, &textBox,
958 * Erase & paint text in the active icon text window
960 if ((wmGD.keyboardFocus == pcd) &&
961 (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART))
963 PaintActiveIconText (pcd, True);
966 } /* END OF FUNCTION RedisplayIconTitle */
970 /*************************************<->*************************************
972 * GetIconDimensions (pSD, &pWidth, &pLabelHeight, &pImageHeight)
977 * returns dimensions of icon frame parts
982 * pSD - pointer to screen data
983 * pWidth - pointer to width of frame
984 * pLabelHeight - pointer to height of label part of icon
985 * pImageHeight - pointer to height of image part of icon
990 * *pWidth - width of frame
991 * *pLabelHeight - height of label part of icon
992 * *pImageHeight - height of image part of icon
998 *************************************<->***********************************/
999 void GetIconDimensions (WmScreenData *pSD, unsigned int *pWidth, unsigned int *pLabelHeight, unsigned int *pImageHeight)
1002 * The icon width is always keyed to the icon image maximum regardless
1003 * of whether an icon image part appears or not.
1005 *pWidth = pSD->iconImageMaximum.width +
1006 ((wmGD.frameStyle == WmSLAB) ? 2 : 0) +
1007 ICON_IMAGE_LEFT_PAD +
1008 ICON_IMAGE_RIGHT_PAD +
1009 2 * ICON_EXTERNAL_SHADOW_WIDTH +
1010 4 * ICON_INTERNAL_SHADOW_WIDTH;
1011 if (wmGD.frameStyle == WmSLAB)
1013 /* less beveling in this style */
1014 *pWidth -= 2 * ICON_INTERNAL_SHADOW_WIDTH;
1017 switch (pSD->iconDecoration & (ICON_IMAGE_PART | ICON_LABEL_PART))
1019 case ICON_LABEL_PART:
1022 *pLabelHeight = ICON_EXTERNAL_SHADOW_WIDTH +
1023 WM_TOP_TITLE_PADDING +
1024 TEXT_HEIGHT(pSD->iconAppearance.font) +
1025 WM_BOTTOM_TITLE_PADDING +
1026 ICON_EXTERNAL_SHADOW_WIDTH;
1029 case ICON_IMAGE_PART:
1030 *pImageHeight = ICON_EXTERNAL_SHADOW_WIDTH +
1031 ICON_IMAGE_TOP_PAD +
1032 ICON_INTERNAL_SHADOW_WIDTH +
1033 ICON_INTERNAL_SHADOW_WIDTH +
1034 pSD->iconImageMaximum.height +
1035 ((wmGD.frameStyle == WmSLAB) ? 2 : 0) +
1036 ICON_INTERNAL_SHADOW_WIDTH +
1037 ICON_INTERNAL_SHADOW_WIDTH +
1038 ICON_IMAGE_BOTTOM_PAD +
1039 ICON_EXTERNAL_SHADOW_WIDTH;
1040 if (wmGD.frameStyle == WmSLAB)
1042 /* less beveling in this style */
1043 *pImageHeight -= 2 * ICON_INTERNAL_SHADOW_WIDTH;
1051 case (ICON_IMAGE_PART | ICON_LABEL_PART):
1052 *pImageHeight = ICON_EXTERNAL_SHADOW_WIDTH +
1053 ICON_IMAGE_TOP_PAD +
1054 ICON_INTERNAL_SHADOW_WIDTH +
1055 ICON_INTERNAL_SHADOW_WIDTH +
1056 pSD->iconImageMaximum.height +
1057 ((wmGD.frameStyle == WmSLAB) ? 2 : 0) +
1058 ICON_INTERNAL_SHADOW_WIDTH +
1059 ICON_INTERNAL_SHADOW_WIDTH +
1060 ICON_IMAGE_BOTTOM_PAD +
1061 ICON_INTERNAL_SHADOW_WIDTH;
1063 *pLabelHeight = ICON_INTERNAL_SHADOW_WIDTH +
1064 WM_TOP_TITLE_PADDING +
1065 TEXT_HEIGHT(pSD->iconAppearance.font) +
1066 WM_BOTTOM_TITLE_PADDING +
1067 ICON_EXTERNAL_SHADOW_WIDTH;
1068 if (wmGD.frameStyle == WmSLAB)
1071 * In this style there is less beveling and no
1072 * etching between the icon image and label.
1074 *pImageHeight -= 3 * ICON_INTERNAL_SHADOW_WIDTH;
1075 *pLabelHeight -= ICON_INTERNAL_SHADOW_WIDTH;
1081 *pLabelHeight = *pImageHeight = 0;
1088 /*************************************<->*************************************
1090 * InitIconSize (pSD)
1095 * set global icon size variables
1109 *************************************<->***********************************/
1110 void InitIconSize (WmScreenData *pSD)
1112 Cardinal label, image;
1114 GetIconDimensions (pSD, (unsigned int *)&(pSD->iconWidth),
1117 pSD->iconHeight = label+image;
1119 pSD->iconImageHeight = image;
1120 pSD->iconLabelHeight = label;
1123 iconShrinkX = IB_MARGIN_WIDTH
1124 + ICON_EXTERNAL_SHADOW_WIDTH
1125 + ICON_IMAGE_LEFT_PAD
1126 + 2 * ICON_INTERNAL_SHADOW_WIDTH;
1129 iconShrinkY = IB_MARGIN_HEIGHT
1130 + ICON_EXTERNAL_SHADOW_WIDTH
1131 + ((pSD->iconDecoration & ICON_IMAGE_PART)
1132 ? (ICON_IMAGE_TOP_PAD +
1133 (2 * ICON_INTERNAL_SHADOW_WIDTH))
1134 : (WM_TOP_TITLE_PADDING));
1135 if (wmGD.frameStyle == WmSLAB)
1137 /* less beveling in this style */
1138 iconShrinkX -= ICON_INTERNAL_SHADOW_WIDTH;
1139 iconShrinkY -= ICON_INTERNAL_SHADOW_WIDTH;
1143 iconShrinkWidth = pSD->iconImageMaximum.width ;
1144 if (wmGD.frameStyle == WmSLAB)
1146 iconShrinkWidth += 2;
1152 switch (pSD->iconDecoration & (ICON_IMAGE_PART | ICON_LABEL_PART))
1154 case ICON_LABEL_PART:
1155 iconShrinkHeight = TEXT_HEIGHT(pSD->iconAppearance.font);
1158 case ICON_IMAGE_PART:
1159 iconShrinkHeight = pSD->iconImageMaximum.height;
1163 case (ICON_IMAGE_PART | ICON_LABEL_PART):
1164 iconShrinkHeight = pSD->iconHeight
1165 - ICON_EXTERNAL_SHADOW_WIDTH
1166 - ICON_IMAGE_TOP_PAD
1167 - ICON_INTERNAL_SHADOW_WIDTH
1168 - ICON_INTERNAL_SHADOW_WIDTH
1169 - ICON_IMAGE_BOTTOM_PAD
1170 - WM_BOTTOM_TITLE_PADDING
1171 - ICON_EXTERNAL_SHADOW_WIDTH;
1172 if (wmGD.frameStyle == WmSLAB)
1174 /* adjust for less beveling in this style */
1175 iconShrinkHeight += ICON_INTERNAL_SHADOW_WIDTH;
1182 } /* END OF FUNCTION InitIconSize */
1185 /*************************************<->*************************************
1187 * ShowActiveIcon (pcd)
1192 * Paint the icon to indicate an "active" state
1197 * pcd - pointer to client data
1208 *************************************<->***********************************/
1210 void ShowActiveIcon (ClientData *pcd)
1212 unsigned long attr_mask;
1213 XSetWindowAttributes window_attribs;
1215 if (ICON_FRAME_WIN(pcd))
1218 * Use background pixmap if one is specified, otherwise set the
1219 * appropriate background color.
1222 if (ICON_APPEARANCE(pcd).activeBackgroundPixmap)
1224 attr_mask = CWBackPixmap;
1225 window_attribs.background_pixmap =
1226 ICON_APPEARANCE(pcd).activeBackgroundPixmap;
1230 attr_mask = CWBackPixel;
1231 window_attribs.background_pixel =
1232 ICON_APPEARANCE(pcd).activeBackground;
1236 /* set active window attributes */
1237 XChangeWindowAttributes (DISPLAY,
1238 ICON_FRAME_WIN(pcd),
1239 attr_mask, &window_attribs);
1241 /* clear the frame to the right background */
1242 if ((!ACTIVE_PSD->useIconBox) ||
1243 (P_ICON_BOX(pcd) == NULL))
1245 if (ICON_DECORATION(pcd) & ICON_IMAGE_PART)
1247 Dimension dheight, dwidth;
1249 dwidth = ICON_WIDTH(pcd) -
1250 2*ICON_EXTERNAL_SHADOW_WIDTH;
1251 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1253 dheight = ICON_IMAGE_HEIGHT(pcd) -
1254 ICON_EXTERNAL_SHADOW_WIDTH;
1258 dheight = ICON_IMAGE_HEIGHT(pcd) -
1259 2*ICON_EXTERNAL_SHADOW_WIDTH;
1261 if (wmGD.frameStyle == WmRECESSED)
1263 dheight -= ICON_INTERNAL_SHADOW_WIDTH;
1266 XmeClearBorder (DISPLAY, ICON_FRAME_WIN(pcd),
1267 ICON_EXTERNAL_SHADOW_WIDTH,
1268 ICON_EXTERNAL_SHADOW_WIDTH,
1271 ICON_IMAGE_TOP_PAD);
1274 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1276 XClearArea (DISPLAY,
1277 ICON_FRAME_WIN(pcd),
1279 ICON_IMAGE_HEIGHT(pcd),
1280 (unsigned int) ICON_WIDTH(pcd),
1281 (unsigned int) ICON_HEIGHT(pcd), False);
1287 * clear only area of real frame, not highlight area
1290 XClearArea (DISPLAY,
1291 ICON_FRAME_WIN(pcd),
1294 (unsigned int) ICON_WIDTH(pcd),
1295 (unsigned int) ICON_HEIGHT(pcd), False);
1300 * Put up a big icon text label.
1303 if (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)
1306 if (wmGD.activeIconTextDisplayed)
1307 PaintActiveIconText(pcd, True);
1309 ShowActiveIconText(pcd);
1312 /* simulate exposure of window */
1313 IconExposureProc(pcd, False);
1317 } /* END OF FUNCTION ShowActiveIcon */
1321 /*************************************<->*************************************
1323 * ShowInactiveIcon (pcd, refresh)
1328 * Make the icon appear "inactive"
1333 * pcd - pointer to client data
1335 * refresh - if True redraw the icon
1337 *************************************<->***********************************/
1338 void ShowInactiveIcon (ClientData *pcd, Boolean refresh)
1340 unsigned long attr_mask = 0;
1341 XSetWindowAttributes window_attribs;
1343 /* turn off the active icon text */
1344 if (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)
1346 /* pass in screen to fix multiscreen bug [P3385] */
1347 HideActiveIconText(pcd->pSD);
1350 if (ICON_FRAME_WIN(pcd))
1353 * Use background pixmap if one is specified, otherwise set the
1354 * appropriate background color.
1357 if (ICON_APPEARANCE(pcd).backgroundPixmap)
1359 attr_mask |= CWBackPixmap;
1360 window_attribs.background_pixmap =
1361 ICON_APPEARANCE(pcd).backgroundPixmap;
1365 attr_mask |= CWBackPixel;
1366 window_attribs.background_pixel =
1367 ICON_APPEARANCE(pcd).background;
1371 /* set active window attributes */
1372 XChangeWindowAttributes (DISPLAY, ICON_FRAME_WIN(pcd), attr_mask,
1378 /* clear the frame to the right background */
1379 if ((!ACTIVE_PSD->useIconBox) ||
1380 (P_ICON_BOX(pcd) == NULL))
1382 XmeClearBorder (DISPLAY, ICON_FRAME_WIN(pcd),
1384 ICON_WIDTH(pcd), ICON_IMAGE_HEIGHT(pcd), 4);
1386 XClearArea (DISPLAY,
1387 ICON_FRAME_WIN(pcd),
1388 0, ICON_IMAGE_HEIGHT(pcd),
1389 (unsigned int) ICON_WIDTH(pcd),
1390 (unsigned int) ICON_HEIGHT(pcd), False);
1395 * clear only area of real frame, not highlight area
1398 XClearArea (DISPLAY,
1399 ICON_FRAME_WIN(pcd),
1402 (unsigned int) ICON_WIDTH(pcd),
1403 (unsigned int) ICON_HEIGHT(pcd), False);
1407 /* simulate exposure of window */
1408 IconExposureProc(pcd, False);
1413 } /* END OF FUNTION ShowInactiveIcon */
1417 /*************************************<->*************************************
1419 * ReparentIconWindow (pcd, xOffset, yOffset)
1424 * Reparent the icon window in the center of the image area
1429 * pcd - pointer to client data
1430 * xOffset - adjusts for icons in the iconBox
1431 * yOffset - adjusts for icons in the iconBox
1441 *************************************<->***********************************/
1442 void ReparentIconWindow (ClientData *pcd, int xOffset, int yOffset)
1445 unsigned int width, height, bw, depth;
1447 XWindowChanges windowChanges;
1453 * Check if window size is too big
1455 XGetGeometry (DISPLAY, pcd->iconWindow, &root, &x, &y, &width, &height,
1459 * strip off previous window border and set window geometry to
1460 * fit inside icon frame
1463 mask = CWBorderWidth;
1464 windowChanges.border_width = 0;
1471 if (width > ((ICON_IMAGE_MAXIMUM(pcd).width) +
1472 ((wmGD.frameStyle == WmSLAB) ? 2 : 0)))
1474 width = windowChanges.width = ICON_IMAGE_MAXIMUM(pcd).width +
1475 ((wmGD.frameStyle == WmSLAB) ? 2 : 0);
1478 else if (width < ICON_IMAGE_MINIMUM(pcd).width) {
1479 width = windowChanges.width = ICON_IMAGE_MINIMUM(pcd).width;
1483 if (height > ((ICON_IMAGE_MAXIMUM(pcd).height) +
1484 ((wmGD.frameStyle == WmSLAB) ? 2 : 0)))
1486 height = windowChanges.height = ICON_IMAGE_MAXIMUM(pcd).height +
1487 ((wmGD.frameStyle == WmSLAB) ? 2 : 0);
1490 else if (height < ICON_IMAGE_MINIMUM(pcd).height) {
1491 height = windowChanges.height = ICON_IMAGE_MINIMUM(pcd).height;
1496 XConfigureWindow (DISPLAY, pcd->iconWindow, mask, &windowChanges);
1499 * Reparent the icon window to the center of the icon image frame
1502 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1504 yOffset += ICON_INTERNAL_SHADOW_WIDTH;
1507 rpX = ((ICON_WIDTH(pcd) - width)/2) + xOffset;
1508 rpY = ((ICON_IMAGE_HEIGHT(pcd) - height)/2) + yOffset;
1513 XReparentWindow (DISPLAY, pcd->iconWindow, ICON_FRAME_WIN(pcd), rpX, rpY);
1514 pcd->clientFlags |= ICON_REPARENTED;
1517 * Map the icon window when the icon frame is mapped.
1519 } /* END if (!pcd->pECD) */
1520 } /* END OF FUNCTION ReparentIconWindow */
1523 /*************************************<->*************************************
1525 * PutBoxOnScreen (screen, px, py, width, height)
1530 * Changes the position of the passed box so that it is all on screen
1535 * screen - screen we're talking about
1536 * px - pointer to x-coord
1537 * py - pointer to y-coord
1538 * width - width of box
1539 * height - height of box
1550 *************************************<->***********************************/
1551 void PutBoxOnScreen (int screen, int *px, int *py, unsigned int width, unsigned int height)
1554 * Place active label text nicely on screen
1557 if (*px+width+1 > DisplayWidth (DISPLAY, screen))
1558 *px -= (*px+width+1) - DisplayWidth (DISPLAY, screen);
1560 if (*py+height+1 > DisplayHeight (DISPLAY, screen))
1561 *py -= (*py+height+1) - DisplayHeight (DISPLAY, screen);
1563 if (*px < 1) *px = 1;
1565 if (*py < 1) *py = 1;
1567 } /* END OF FUNCTION PutBoxOnScreen */
1570 /*************************************<->*************************************
1572 * PutBoxInIconBox (pCD, px, py, width, height)
1577 * Changes the position of the passed box so that it is not
1578 * clipped by the bulletin board
1584 * pCD - pointer to client data
1585 * px - pointer to x-coord
1586 * py - pointer to y-coord
1587 * width - width of box
1588 * height - height of box
1599 *************************************<->***********************************/
1600 void PutBoxInIconBox (ClientData *pCD, int *px, int *py, unsigned int *width, unsigned int *height)
1605 Dimension bBoardWidth;
1606 Dimension bBoardHeight;
1613 XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &bBoardWidth ); i++;
1614 XtSetArg (getArgs[i], XmNheight, (XtArgVal) &bBoardHeight ); i++;
1615 XtGetValues (P_ICON_BOX(pCD)->bBoardWidget, getArgs, i);
1617 clipWidth = (int) bBoardWidth;
1618 clipHeight = (int) bBoardHeight;
1620 if (*px + *width-1 > clipWidth)
1621 *px -= (*px + *width-1) - clipWidth;
1623 if (*py + *height-1 > clipHeight)
1624 *py -= (*py + *height-1) - clipHeight;
1626 if (*px < 0) *px = 0;
1628 if (*py < 0) *py = 0;
1631 } /* END OF FUNCTION PutBoxInIconBox */
1634 /*************************************<->*************************************
1636 * CreateActiveIconTextWindow (pSD)
1641 * creates the window that's popped up when an icon is activated
1645 * pSD - pointer to screen data
1653 *************************************<->***********************************/
1655 void CreateActiveIconTextWindow (WmScreenData *pSD)
1657 XSetWindowAttributes window_attribs;
1658 unsigned long attr_mask;
1660 /* create active icon text window */
1661 attr_mask = CWEventMask| CWCursor;
1662 window_attribs.event_mask = ExposureMask;
1663 window_attribs.cursor = wmGD.workspaceCursor;
1666 * Use background pixmap if one is specified, otherwise set the
1667 * appropriate background color.
1670 if (pSD->iconAppearance.activeBackgroundPixmap)
1672 attr_mask |= CWBackPixmap;
1673 window_attribs.background_pixmap =
1674 pSD->iconAppearance.activeBackgroundPixmap;
1678 attr_mask |= CWBackPixel;
1679 window_attribs.background_pixel =
1680 pSD->iconAppearance.activeBackground;
1684 pSD->activeIconTextWin = XCreateWindow (DISPLAY,
1685 pSD->rootWindow, /* parent */
1687 1, 1, /* width, height */
1688 0, /* border width */
1689 CopyFromParent, /* depth */
1690 InputOutput, /* class */
1691 CopyFromParent, /* visual */
1696 pSD->activeLabelParent = pSD->rootWindow;
1698 } /* END OF FUNCTION CreateActiveIconTextWindow */
1702 /*************************************<->*************************************
1704 * PaintActiveIconText (pcd, erase)
1713 * pcd - pointer to client data
1714 * erase - if true, then erase the area before repainting
1723 *************************************<->***********************************/
1724 void PaintActiveIconText (ClientData *pcd, Boolean erase)
1727 GC iconGC, topGC, botGC;
1729 if (!(ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART))
1732 /* get appropriate GCs */
1733 iconGC = ICON_APPEARANCE(pcd).activeGC;
1734 topGC = ICON_APPEARANCE(pcd).activeTopShadowGC;
1735 botGC = ICON_APPEARANCE(pcd).activeBottomShadowGC;
1737 /* draw shadowing */
1739 if (pActiveIconTopRects) {
1740 XFillRectangles (DISPLAY,
1741 pcd->pSD->activeIconTextWin,
1743 pActiveIconTopRects->prect,
1744 pActiveIconTopRects->used);
1747 if (pActiveIconBotRects) {
1748 XFillRectangles (DISPLAY,
1749 pcd->pSD->activeIconTextWin,
1751 pActiveIconBotRects->prect,
1752 pActiveIconBotRects->used);
1755 /* paint the text */
1756 textBox.x = ICON_EXTERNAL_SHADOW_WIDTH;
1757 textBox.y = ICON_EXTERNAL_SHADOW_WIDTH;
1758 textBox.width = activeIconTextWidth - 2*ICON_EXTERNAL_SHADOW_WIDTH;
1759 textBox.height = activeIconTextHeight - 2*ICON_EXTERNAL_SHADOW_WIDTH;
1763 XClearArea (DISPLAY, pcd->pSD->activeIconTextWin, textBox.x, textBox.y,
1764 (unsigned int) textBox.width,
1765 (unsigned int) textBox.height,
1769 WmDrawXmString(DISPLAY, pcd->pSD->activeIconTextWin,
1770 ICON_APPEARANCE(pcd).fontList,
1771 pcd->iconTitle, iconGC,
1772 textBox.x, textBox.y, textBox.width, &textBox, True);
1775 } /* END OF FUNCTION PaintActiveIconText */
1778 /*************************************<->*************************************
1780 * ShowActiveIconText (pcd)
1797 *************************************<->***********************************/
1798 void ShowActiveIconText (ClientData *pcd)
1800 XWindowAttributes iconFrameAttribs;
1801 XSetWindowAttributes window_attribs;
1802 XWindowChanges windowChanges;
1807 Dimension dWidth, dHeight;
1811 * put up a big icon text label
1813 if (pcd->pSD->activeIconTextWin) {
1814 /* copy event mask from icon frame window */
1815 XGetWindowAttributes (DISPLAY, ICON_FRAME_WIN(pcd), &iconFrameAttribs);
1817 /* set attributes of window */
1818 window_attribs.event_mask = iconFrameAttribs.your_event_mask;
1819 XChangeWindowAttributes (DISPLAY, pcd->pSD->activeIconTextWin,
1820 CWEventMask, &window_attribs);
1822 /* set up geometry for the window */
1824 XmStringExtent (ICON_APPEARANCE(pcd).fontList, pcd->iconTitle,
1827 activeIconTextHeight = (unsigned int) dHeight +
1828 WM_BOTTOM_TITLE_PADDING +
1829 2*ICON_EXTERNAL_SHADOW_WIDTH;
1831 activeIconTextWidth = (unsigned int) dWidth;
1833 if (activeIconTextWidth < (1.2 * ICON_WIDTH(pcd)))
1835 activeIconTextWidth = 1.2 * ICON_WIDTH(pcd);
1838 activeIconTextWidth += 2*ICON_EXTERNAL_SHADOW_WIDTH;
1840 XGetGeometry (DISPLAY,
1841 (Drawable) ICON_FRAME_WIN(pcd),
1843 &junk, &junk, &junk, &junk);
1846 y += ICON_IMAGE_HEIGHT(pcd);
1847 x -= (activeIconTextWidth - ICON_WIDTH(pcd))/2;
1851 if (!(P_ICON_BOX(pcd)))
1854 * This is a normal icon
1856 PutBoxOnScreen (SCREEN_FOR_CLIENT(pcd), &x, &y,
1857 activeIconTextWidth, activeIconTextHeight);
1858 if (ACTIVE_LABEL_PARENT(pcd) != root)
1860 XReparentWindow(DISPLAY, pcd->pSD->activeIconTextWin ,
1862 ACTIVE_LABEL_PARENT(pcd) = root;
1869 * This is an icon in an icon box
1871 x = x + IB_MARGIN_WIDTH;
1872 y = y + IB_MARGIN_HEIGHT;
1874 if(!(pcd->pSD->iconDecoration & ( ICON_LABEL_PART)))
1876 y -= activeIconTextHeight;
1879 PutBoxInIconBox (pcd, &x, &y,
1880 &activeIconTextWidth, &activeIconTextHeight);
1881 if (ACTIVE_LABEL_PARENT(pcd) != pcd->client)
1883 XReparentWindow(DISPLAY, pcd->pSD->activeIconTextWin ,
1884 XtWindow(P_ICON_BOX(pcd)->bBoardWidget),
1886 ACTIVE_LABEL_PARENT(pcd) = pcd->client;
1891 mask = CWX | CWY | CWWidth | CWHeight;
1892 windowChanges.x = x;
1893 windowChanges.y = y;
1894 windowChanges.width = activeIconTextWidth;
1895 windowChanges.height = activeIconTextHeight;
1896 XConfigureWindow (DISPLAY, pcd->pSD->activeIconTextWin, mask,
1899 /* bevel the rectangle around the edges */
1900 if ((pActiveIconTopRects && pActiveIconBotRects) ||
1901 ((pActiveIconTopRects =
1902 AllocateRList((unsigned)4*ICON_EXTERNAL_SHADOW_WIDTH)) &&
1903 (pActiveIconBotRects =
1904 AllocateRList((unsigned)4*ICON_EXTERNAL_SHADOW_WIDTH))))
1906 pActiveIconTopRects->used = 0;
1907 pActiveIconBotRects->used = 0;
1908 BevelRectangle (pActiveIconTopRects,
1909 pActiveIconBotRects,
1911 activeIconTextWidth,
1912 activeIconTextHeight,
1913 ICON_EXTERNAL_SHADOW_WIDTH,
1914 ICON_EXTERNAL_SHADOW_WIDTH,
1915 ICON_EXTERNAL_SHADOW_WIDTH,
1916 ICON_EXTERNAL_SHADOW_WIDTH);
1919 XMapRaised (DISPLAY, pcd->pSD->activeIconTextWin);
1920 wmGD.activeIconTextDisplayed = True;
1922 /* save context for this window */
1923 XSaveContext (DISPLAY, pcd->pSD->activeIconTextWin,
1924 wmGD.windowContextType, (caddr_t) pcd);
1926 } /* END OF FUNCTION ShowActiveIconText */
1929 /*************************************<->*************************************
1931 * HideActiveIconText ()
1936 * Hides the big label shown over the active icon.
1949 *************************************<->***********************************/
1950 void HideActiveIconText (WmScreenData *pSD)
1954 if ((pSD && pSD->activeIconTextWin) || ACTIVE_ICON_TEXT_WIN)
1956 /* disassociate the big label window with this client */
1957 XDeleteContext (DISPLAY,
1959 ? pSD->activeIconTextWin
1960 : ACTIVE_PSD->activeIconTextWin,
1961 wmGD.windowContextType);
1963 /* hide the big label */
1964 XUnmapWindow (DISPLAY,
1966 ? pSD->activeIconTextWin
1967 : ACTIVE_PSD->activeIconTextWin);
1968 wmGD.activeIconTextDisplayed = False;
1973 /*************************************<->*************************************
1975 * MoveActiveIconText (pcd)
1992 *************************************<->***********************************/
1993 void MoveActiveIconText (ClientData *pcd)
1998 Dimension dWidth, dHeight;
2002 * put up a big icon text label
2004 if (pcd->pSD->activeIconTextWin && wmGD.activeIconTextDisplayed) {
2005 /* set up geometry for the window */
2007 XmStringExtent (ICON_APPEARANCE(pcd).fontList, pcd->iconTitle,
2010 activeIconTextHeight = (unsigned int) dHeight +
2011 WM_BOTTOM_TITLE_PADDING +
2012 2 * ICON_EXTERNAL_SHADOW_WIDTH;
2014 activeIconTextWidth = (unsigned int) dWidth;
2016 if (activeIconTextWidth < (1.2 * ICON_WIDTH(pcd)))
2018 activeIconTextWidth = 1.2 * ICON_WIDTH(pcd);
2021 activeIconTextWidth += 2 * ICON_EXTERNAL_SHADOW_WIDTH;
2023 XGetGeometry (DISPLAY,
2024 (Drawable) ICON_FRAME_WIN(pcd),
2026 &junk, &junk, &junk, &junk);
2029 y += ICON_IMAGE_HEIGHT(pcd);
2030 x -= (activeIconTextWidth - ICON_WIDTH(pcd))/2;
2032 if (!(P_ICON_BOX(pcd)))
2034 /* This is a normal icon */
2035 PutBoxOnScreen (SCREEN_FOR_CLIENT(pcd), &x, &y,
2036 activeIconTextWidth, activeIconTextHeight);
2041 x = x + IB_MARGIN_WIDTH;
2042 y = y + IB_MARGIN_HEIGHT;
2044 if(!(pcd->pSD->iconDecoration & ( ICON_LABEL_PART)))
2046 y -= activeIconTextHeight;
2049 PutBoxInIconBox (pcd, &x, &y,
2050 &activeIconTextWidth, &activeIconTextHeight);
2053 XMoveWindow(DISPLAY, pcd->pSD->activeIconTextWin, x, y );
2056 } /* END OF FUNCTION MoveActiveIconText */