Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtwm / WmIDecor.c
1 /* 
2  * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC. 
3  * ALL RIGHTS RESERVED 
4 */ 
5 /* 
6  * Motif Release 1.2.3
7 */ 
8 #ifdef REV_INFO
9 #ifndef lint
10 static char rcsid[] = "$XConsortium: WmIDecor.c /main/6 1996/06/20 09:38:43 rswiston $"
11 #endif
12 #endif
13 /*
14  * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */
15
16 /*
17  * Included Files:
18  */
19
20
21 #include "WmGlobal.h"
22 #include <Xm/Xm.h>
23 #include <Xm/DrawP.h>           /* for XmeClearBorder */
24 /*
25  * include extern functions
26  */
27 #include "WmIDecor.h"
28 #include "WmError.h"
29 #include "WmGraphics.h"
30 #include "WmIconBox.h"
31 #include "WmMenu.h"
32 #include "WmWinInfo.h"
33 #ifdef WSM
34 #include "WmWrkspace.h"
35 #endif /* WSM */
36
37
38
39 /*
40  * Global Variables:
41  */
42 static unsigned int activeIconTextWidth = 1;
43 static unsigned int activeIconTextHeight = 1;
44 static RList *pActiveIconTopRects = NULL;
45 static RList *pActiveIconBotRects = NULL;
46
47 static int  iconShrinkX; 
48 static int  iconShrinkY;
49 static unsigned int iconShrinkWidth;
50 static unsigned int iconShrinkHeight;
51
52 \f
53 /*************************************<->*************************************
54  *
55  *  MakeIcon (pWS, pcd)
56  *
57  *
58  *  Description:
59  *  -----------
60  *  Create an icon frame and fill it in as appropriate for the client.
61  *
62  *
63  *  Inputs:
64  *  ------
65  *  pWS         - pointer to workspace data
66  *  pcd         - pointer to client data
67  *
68  * 
69  *  Outputs:
70  *  -------
71  *  Return      - TRUE if success, FALSE if failure.
72  *
73  *
74  *  Comments:
75  *  --------
76  *  
77  * 
78  *************************************<->***********************************/
79
80 Boolean MakeIcon (WmWorkspaceData *pWS, ClientData *pcd)
81 {
82     XSetWindowAttributes window_attribs;
83     unsigned long attr_mask;
84     int xOffset;
85     int yOffset;
86 #ifdef WSM
87     WsClientData *pWsc = GetWsClientData (pWS, pcd);
88 #endif /* WSM */
89
90
91     /*
92      * Common to all icons
93      */
94
95     /* compute dimensions of outer icon frame */
96     /* create icon frame window */
97
98     attr_mask = CWEventMask | CWCursor;
99     window_attribs.event_mask = (ButtonPressMask | ButtonReleaseMask |
100                                  SELECT_BUTTON_MOTION_MASK |
101                                  DMANIP_BUTTON_MOTION_MASK |
102                                  ExposureMask |
103                                  SubstructureRedirectMask |
104                                  FocusChangeMask);
105     window_attribs.cursor = wmGD.workspaceCursor;
106
107     if ((wmGD.keyboardFocusPolicy == KEYBOARD_FOCUS_POINTER) ||
108         (wmGD.colormapFocusPolicy == CMAP_FOCUS_POINTER))
109     {
110         window_attribs.event_mask |= EnterWindowMask | LeaveWindowMask;
111     }
112
113     /* 
114      * Use background pixmap if one is specified, otherwise set the
115      * appropriate background color. 
116      */
117
118     if (ICON_APPEARANCE(pcd).backgroundPixmap)
119     {
120         attr_mask |= CWBackPixmap;
121         window_attribs.background_pixmap = 
122                             ICON_APPEARANCE(pcd).backgroundPixmap;
123     }
124     else
125     {
126         attr_mask |= CWBackPixel;
127         window_attribs.background_pixel = 
128                                 ICON_APPEARANCE(pcd).background;
129     }
130    
131 #ifdef WSM
132     if ((!pcd->pSD->useIconBox) || 
133         (pcd->clientFlags & (CLIENT_WM_CLIENTS | FRONT_PANEL_BOX)))
134 #else
135     if ((!pcd->pSD->useIconBox) || (pcd->clientFlags & ICON_BOX))
136 #endif /* WSM */
137     {
138 #ifdef WSM
139         pWsc->iconFrameWin = XCreateWindow (DISPLAY,
140                                ROOT_FOR_CLIENT(pcd),    /* parent */
141                                pWsc->iconX,
142                                pWsc->iconY,
143 #else /* WSM */
144         pcd->iconFrameWin = XCreateWindow (DISPLAY,
145                                ROOT_FOR_CLIENT(pcd),    /* parent */
146                                pcd->iconX,
147                                pcd->iconY,
148 #endif /* WSM */
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 */
155                                attr_mask,
156                                &window_attribs);
157
158     }
159     else
160     {
161         /*
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
166          */
167
168         if ((pcd->pSD->useIconBox) && 
169 #ifdef WSM
170             (!(pcd->clientFlags & CLIENT_WM_CLIENTS)) &&
171 #else
172             (!(pcd->clientFlags & ICON_BOX)) &&
173 #endif /* WSM */
174             (pcd->clientFunctions & MWM_FUNC_MINIMIZE) )
175         {
176             if (!InsertIconIntoBox(pWS->pIconBox, pcd))
177                 Warning(((char *)GETMESSAGE(30, 1, "Could not make icon to go in icon box")));
178
179         }
180
181     }
182
183
184     /* make space for the top/bottom changing shadow rectangles */
185
186     if ((pcd->piconTopShadows = 
187             AllocateRList ((unsigned)NUM_BOTH_TOP_RECTS)) == NULL)
188     {
189         /* Out of memory! */
190         Warning (((char *)GETMESSAGE(30, 2, "Insufficient memory for icon creation")));
191         return(FALSE);
192     }
193     
194     if ((pcd->piconBottomShadows = 
195          AllocateRList ((unsigned)NUM_BOTH_BOTTOM_RECTS)) == NULL)
196     {
197         /* Out of memory! */
198         Warning (((char *)GETMESSAGE(30, 3, "Insufficient memory for icon creation")));
199         return(FALSE);
200     }
201
202
203     /*
204      * Adjust for icons in the box 
205      * Don't adjust the icon for the icon box itself
206      */
207
208 #ifdef PANELIST
209     if (pWS->pIconBox && (pWS->pIconBox->pCD_iconBox != pcd) &&
210         !(pcd->clientFlags & FRONT_PANEL_BOX))
211 #else /* PANELIST */
212     if (pWS->pIconBox && (pWS->pIconBox->pCD_iconBox != pcd))
213 #endif /* PANELIST */
214     {
215         xOffset = IB_MARGIN_WIDTH;
216         yOffset = IB_MARGIN_HEIGHT;
217     }
218     else
219     {
220         xOffset = 0;
221         yOffset = 0;
222     }
223
224
225     /*
226      * Reparent the icon window if there is one
227      */
228     if ((ICON_DECORATION(pcd) & ICON_IMAGE_PART) && 
229         (pcd->iconWindow))
230     {
231         ReparentIconWindow (pcd, xOffset, yOffset);
232     }
233
234 #ifdef WSM
235     if (pcd->piconTopShadows->used == 0)
236 #endif /* WSM */
237     MakeIconShadows (pcd, xOffset, yOffset);
238
239     return(TRUE);
240
241 } /* END OF FUNCTION MakeIcon */
242
243
244 \f
245 /*************************************<->*************************************
246  *
247  *  MakeIconShadows (pcd, xOffset, yOffset)
248  *
249  *  Comments:
250  *  --------
251  * 
252  *************************************<->***********************************/
253
254 void MakeIconShadows (ClientData *pcd, int xOffset, int yOffset)
255 {        
256
257     /*
258      * Handle different icon styles
259      */
260     
261     switch (ICON_DECORATION(pcd) & (ICON_LABEL_PART | ICON_IMAGE_PART)) 
262     {
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);
273             break;
274
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);
285
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);
299
300             break;
301
302         case (ICON_IMAGE_PART | ICON_LABEL_PART):
303             if (wmGD.frameStyle == WmSLAB)
304             {
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);
315             }
316             else
317             {
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);
327             }
328
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);
342
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);
353
354             break;
355     }
356
357 } /* END OF FUNCTION MakeIconShadows */
358
359
360
361
362
363 \f
364 /*************************************<->*************************************
365  *
366  *  IconExposureProc (pcd, expose)
367  *
368  *
369  *  Description:
370  *  -----------
371  *  Repaint the icon.
372  *
373  *
374  *  Inputs:
375  *  ------
376  *  pcd         - pointer to client data
377  *
378  * 
379  *  Outputs:
380  *  -------
381  *
382  *  Comments:
383  *  --------
384  * 
385  *************************************<->***********************************/
386
387 void IconExposureProc (ClientData *pcd, Boolean expose)
388 {
389
390     Pixmap image;
391     int dest_x, dest_y;
392     int xOffset;
393     int yOffset;
394     unsigned int width, height;
395     GC iconGC, topGC, botGC;
396     static XRectangle   shrinkRects[4];
397
398
399
400     /*
401      * Adjust for icons in the iconBox
402      */
403
404     if (P_ICON_BOX(pcd))
405     {
406         xOffset = IB_MARGIN_WIDTH;
407         yOffset = IB_MARGIN_HEIGHT;
408     }
409     else
410     {
411         xOffset = 0;
412         yOffset = 0;
413     }
414     
415     /* get appropriate GCs */
416
417     if ((wmGD.keyboardFocus == pcd) && (pcd->clientState == MINIMIZED_STATE))
418     {
419         iconGC = ICON_APPEARANCE(pcd).activeGC;
420         topGC = ICON_APPEARANCE(pcd).activeTopShadowGC;
421         botGC = ICON_APPEARANCE(pcd).activeBottomShadowGC;
422     }
423     else
424     {
425         iconGC = ICON_APPEARANCE(pcd).inactiveGC;
426         topGC = ICON_APPEARANCE(pcd).inactiveTopShadowGC;
427         botGC = ICON_APPEARANCE(pcd).inactiveBottomShadowGC;
428     }
429
430     if (ACTIVE_PSD->useIconBox && P_ICON_BOX(pcd))
431     {
432         /* draw shadowing */
433
434         if (expose)
435         {
436             XClearArea (DISPLAY, 
437                             ICON_FRAME_WIN(pcd), 
438                             IB_MARGIN_WIDTH, 
439                             IB_MARGIN_HEIGHT, 
440                             (unsigned int) ICON_WIDTH(pcd), 
441                             (unsigned int) ICON_HEIGHT(pcd), False);
442         }
443
444         if (pcd->clientState == MINIMIZED_STATE)
445         {
446             /*
447              * This is the "raised" icon appearance
448              */
449
450             if (pcd->piconTopShadows)
451             {
452
453                 XFillRectangles (DISPLAY, 
454                                     ICON_FRAME_WIN(pcd), 
455                                     topGC,
456                                     pcd->piconTopShadows->prect,
457                                     pcd->piconTopShadows->used);
458             }
459
460             if (pcd->piconBottomShadows)
461             { 
462                 XFillRectangles (DISPLAY,
463                                     ICON_FRAME_WIN(pcd), 
464                                     botGC,
465                                     pcd->piconBottomShadows->prect,
466                                     pcd->piconBottomShadows->used);
467             }
468         }
469         else 
470         {
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;
475
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;
480
481             shrinkRects[2].x = iconShrinkX + iconShrinkWidth;
482             shrinkRects[2].y = iconShrinkY;
483             shrinkRects[2].width = iconShrinkX - IB_MARGIN_WIDTH;
484             shrinkRects[2].height = iconShrinkHeight;
485
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;
490
491             XFillRectangles (DISPLAY, 
492                             ICON_FRAME_WIN(pcd), 
493                             SHRINK_WRAP_GC(pcd),
494                             &shrinkRects[0], 4);
495                             
496         }
497
498     }
499     else 
500     {
501         /* draw shadowing */
502
503         if (pcd->clientState == MINIMIZED_STATE)
504         {
505             /*
506              * This is the "raised" icon appearance
507              */
508
509             if (pcd->piconTopShadows->prect)
510             {
511
512                 XFillRectangles (DISPLAY, 
513                                 ICON_FRAME_WIN(pcd), 
514                                 topGC,
515                                 pcd->piconTopShadows->prect,
516                                 pcd->piconTopShadows->used);
517             }
518
519             if (pcd->piconBottomShadows->prect)
520             { 
521                 XFillRectangles (DISPLAY,
522                                 ICON_FRAME_WIN(pcd), 
523                                 botGC,
524                                 pcd->piconBottomShadows->prect,
525                                 pcd->piconBottomShadows->used);
526             }
527
528         }
529     }
530
531
532     /* draw icon text */
533 /*
534     if ((ICON_DECORATION(pcd) & ICON_LABEL_PART) &&
535         (expose || !(ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)))
536 */
537     if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
538     {
539         DrawIconTitle (pcd);
540     }
541
542     /* 
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.
546      */
547
548     if (expose &&
549         ((!pcd->iconWindow && (ICON_DECORATION(pcd) & ICON_IMAGE_PART)) ||
550          (ACTIVE_PSD->useIconBox && P_ICON_BOX(pcd) &&
551                 pcd->iconWindow && 
552                 pcd->clientState != MINIMIZED_STATE &&
553                 (ICON_DECORATION(pcd) & ICON_IMAGE_PART))))
554     {
555         if (pcd->iconWindow)
556         {
557             image = DEFAULT_PIXMAP(pcd);
558         }
559         else
560         {
561             image = pcd->iconPixmap;
562         }
563
564         if (image)
565         {
566
567             if ((ACTIVE_PSD->useIconBox) && (P_ICON_BOX(pcd)))
568             {
569
570                 if (pcd->clientState != MINIMIZED_STATE)
571                 {
572                     dest_x = ICON_IMAGE_X_OFFSET 
573                             + ICON_INTERNAL_SHADOW_WIDTH
574                             + xOffset;
575
576                     dest_y = ICON_IMAGE_Y_OFFSET 
577                             + ICON_INTERNAL_SHADOW_WIDTH
578                             + yOffset;
579                     if (wmGD.frameStyle == WmSLAB)
580                     {
581                         /* less beveling in this style */
582                         dest_x -= ICON_INTERNAL_SHADOW_WIDTH;
583                         dest_y -= ICON_INTERNAL_SHADOW_WIDTH;
584                     } 
585
586                     width = ICON_IMAGE_MAXIMUM(pcd).width;
587                     height= ICON_IMAGE_MAXIMUM(pcd).height;
588                     if (wmGD.frameStyle == WmSLAB)
589                     {
590                         width += 2;
591                         height += 2;
592                     } 
593                     XCopyArea (DISPLAY, image, 
594                                 ICON_FRAME_WIN(pcd), 
595                                 iconGC,
596                                 ICON_INTERNAL_SHADOW_WIDTH, 
597                                 ICON_INTERNAL_SHADOW_WIDTH, 
598                                 width, height, dest_x, dest_y);
599
600                     if (FADE_NORMAL_ICON(pcd))
601                     {
602                         iconGC = FADE_ICON_GC(pcd);
603                         XFillRectangle (DISPLAY, 
604                                     ICON_FRAME_WIN(pcd), 
605                                     iconGC,
606                                     dest_x, dest_y,
607                                     width, height);
608                     }
609
610                 }
611                 else
612                 {
613                     dest_x = ICON_IMAGE_X_OFFSET 
614                             + xOffset;
615
616                     dest_y = ICON_IMAGE_Y_OFFSET 
617                             + yOffset;
618                     if (wmGD.frameStyle == WmSLAB)
619                     {
620                         /* less beveling in this style */
621                         dest_x -= ICON_INTERNAL_SHADOW_WIDTH;
622                         dest_y -= ICON_INTERNAL_SHADOW_WIDTH;
623                     } 
624
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);
629
630                     if (wmGD.frameStyle == WmSLAB)
631                     {
632                         width += 2;
633                         height += 2;
634                     } 
635                     XCopyArea (DISPLAY, image, 
636                                 ICON_FRAME_WIN(pcd), 
637                                 iconGC, 0, 0, width, height, 
638                                 dest_x, dest_y);
639
640                 }
641             }
642             else
643
644             {
645                 width = ICON_IMAGE_MAXIMUM(pcd).width +
646                         2 * ICON_INTERNAL_SHADOW_WIDTH;
647
648                 height= ICON_IMAGE_MAXIMUM(pcd).height +
649                         2 * ICON_INTERNAL_SHADOW_WIDTH;
650
651                 if (wmGD.frameStyle == WmSLAB)
652                 {
653                     dest_x = ICON_INNER_X_OFFSET;
654                     dest_y = ICON_INNER_Y_OFFSET;
655                     width += 2;
656                     height += 2;
657                 } 
658                 else 
659                 {
660                     dest_x = ICON_INNER_X_OFFSET + ICON_INTERNAL_SHADOW_WIDTH;
661                     dest_y = ICON_INNER_Y_OFFSET + ICON_INTERNAL_SHADOW_WIDTH;
662                 }
663                 XCopyArea (DISPLAY, image, 
664                             ICON_FRAME_WIN(pcd), 
665                             iconGC, 0, 0, width, height, 
666                             dest_x, dest_y);
667
668
669             }
670
671         }
672     }
673
674
675 } /* END OF FUNCTION IconExposureProc */
676
677
678
679 \f
680 /*************************************<->*************************************
681  *
682  *  GetIconTitleBox (pcd, pBox)
683  *
684  *
685  *  Description:
686  *  -----------
687  *  Returns a rectangle containing the icon text box
688  *
689  *
690  *  Inputs:
691  *  ------
692  *  pcd - pointer to client data
693  *  pBox - pointer to an XRectangle structure that gets returned data
694  *
695  *  Outputs:
696  *  -------
697  *  pBox - returned data
698  *
699  *  Comments:
700  *  --------
701  * 
702  *************************************<->***********************************/
703
704 void GetIconTitleBox (ClientData *pcd, XRectangle *pBox)
705 {
706     int xOffset;
707     int yOffset;
708
709
710     /*
711      * Adjust for icons in the iconBox
712      */
713
714     if (P_ICON_BOX(pcd))
715     {
716         xOffset = IB_MARGIN_WIDTH;
717         yOffset = IB_MARGIN_HEIGHT;
718     }
719     else
720     {
721         xOffset = 0;
722         yOffset = 0;
723     }
724
725     if ((P_ICON_BOX(pcd)) && (pcd->clientState != MINIMIZED_STATE))
726     {
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
732                 + xOffset;
733
734         pBox->y = ICON_IMAGE_HEIGHT(pcd) 
735                 +  yOffset
736                 + ((ICON_IMAGE_HEIGHT(pcd) > 0) 
737                         ? - ICON_IMAGE_BOTTOM_PAD
738                         : ICON_EXTERNAL_SHADOW_WIDTH)
739                 +  ((ICON_IMAGE_HEIGHT(pcd) >0)
740                         ? 0
741                         : WM_TOP_TITLE_PADDING );
742
743         if (wmGD.frameStyle == WmSLAB)
744         {
745             /* account for less beveling in this style */
746             pBox->x -= ICON_INTERNAL_SHADOW_WIDTH;
747             pBox->y -= ICON_INTERNAL_SHADOW_WIDTH;
748         }
749
750
751
752         pBox->width = ICON_IMAGE_MAXIMUM(pcd).width 
753                         + ((wmGD.frameStyle == WmSLAB) ? 2 : 0) 
754                         - ICON_IMAGE_LEFT_PAD
755                         - ICON_EXTERNAL_SHADOW_WIDTH;
756
757         pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
758
759     }
760     else if ((P_ICON_BOX(pcd)) && (pcd->clientState == MINIMIZED_STATE))
761     {
762         pBox->x = ICON_EXTERNAL_SHADOW_WIDTH 
763                 + ICON_IMAGE_LEFT_PAD
764                 + (2 * ICON_INTERNAL_SHADOW_WIDTH)
765                 + ICON_IMAGE_LEFT_PAD
766                 + xOffset;
767
768         pBox->y = ICON_IMAGE_HEIGHT(pcd) 
769                 +  yOffset
770                 + ((ICON_IMAGE_HEIGHT(pcd) > 0) 
771                         ? ICON_INTERNAL_SHADOW_WIDTH 
772                         : ICON_EXTERNAL_SHADOW_WIDTH)
773                 +  WM_TOP_TITLE_PADDING ;
774
775         pBox->width = ICON_IMAGE_MAXIMUM(pcd).width 
776                         + ((wmGD.frameStyle == WmSLAB) ? 2 : 0) 
777                         - ICON_IMAGE_LEFT_PAD;
778
779         pBox->height = TEXT_HEIGHT(ICON_APPEARANCE(pcd).font);
780
781         if (wmGD.frameStyle == WmSLAB)
782         {
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;
787         }
788
789     }
790     else
791     {
792         pBox->x = ICON_EXTERNAL_SHADOW_WIDTH 
793                 + WM_TOP_TITLE_PADDING
794                 + xOffset;
795
796         if (wmGD.frameStyle == WmSLAB)
797         {
798             /* account for less beveling in this style */
799             yOffset -= ICON_INTERNAL_SHADOW_WIDTH;
800         }
801         pBox->y = ICON_IMAGE_HEIGHT(pcd) 
802                 +  WM_TOP_TITLE_PADDING 
803                 +  yOffset
804                 + ((ICON_IMAGE_HEIGHT(pcd) > 0) 
805                         ? ICON_INTERNAL_SHADOW_WIDTH 
806                         : ICON_EXTERNAL_SHADOW_WIDTH);
807
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);
811
812     }
813
814
815 } /* END OF FUNCTION GetIconTitleBox */
816
817
818 \f
819 /*************************************<->*************************************
820  *
821  *  DrawIconTitle (pcd)
822  *
823  *
824  *  Description:
825  *  -----------
826  *  Draws the title in the Icon title area
827  *
828  *
829  *  Inputs:
830  *  ------
831  *  pcd - pointer to client data
832  *
833  *  Outputs:
834  *  -------
835  *
836  *  Comments:
837  *  --------
838  * 
839  *************************************<->***********************************/
840
841 void DrawIconTitle (ClientData *pcd)
842 {
843     XRectangle textBox;
844     GC iconGC;
845     
846     
847     GetIconTitleBox (pcd, &textBox);
848
849     /* get appropriate GCs */
850 #ifdef WSM
851 #ifdef PANELIST
852     if ((ACTIVE_PSD->useIconBox && 
853         !((pcd->dtwmBehaviors & (DtWM_BEHAVIOR_PANEL)) ||
854           (pcd->clientFlags & CLIENT_WM_CLIENTS))) ||
855 #else /* PANELIST */
856     if ((ACTIVE_PSD->useIconBox && !(pcd->clientFlags & CLIENT_WM_CLIENTS)) || 
857 #endif /* PANELIST */
858 #else
859     if ((ACTIVE_PSD->useIconBox && !(pcd->clientFlags & ICON_BOX)) || 
860 #endif /* WSM */
861         !(wmGD.keyboardFocus == pcd)) 
862     {
863         iconGC = ICON_APPEARANCE(pcd).inactiveGC;
864     }
865     else 
866     {
867         iconGC = ICON_APPEARANCE(pcd).activeGC;
868     }
869
870     /* 
871      * Dim text if this is in the icon box and the client is mapped 
872      */
873
874     if ((ACTIVE_PSD->useIconBox) && 
875         (P_ICON_BOX(pcd)) &&
876         (FADE_NORMAL_ICON(pcd)) && 
877         (!(pcd->clientState == MINIMIZED_STATE)))
878     {
879             iconGC = FADE_ICON_TEXT_GC(pcd);
880     }
881
882
883
884
885     /* paint the text */
886 #ifdef WSM
887     WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd), ICON_APPEARANCE(pcd).fontList,
888                    pcd->iconTitle, iconGC, 
889                    textBox.x, textBox.y, textBox.width, &textBox, True);
890 #else /* WSM */
891     WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd), ICON_APPEARANCE(pcd).fontList,
892                    pcd->iconTitle, iconGC, 
893                    textBox.x, textBox.y, textBox.width, &textBox);
894 #endif /* WSM */
895
896 } /* END OF FUNCTION DrawIconTitle */
897
898
899
900 \f
901 /*************************************<->*************************************
902  *
903  *  RedisplayIconTitle (pcd)
904  *
905  *
906  *  Description:
907  *  -----------
908  *  Draws the title in the Icon title area
909  *
910  *
911  *  Inputs:
912  *  ------
913  *  pcd - pointer to client data
914  *
915  *  Outputs:
916  *  -------
917  *
918  *  Comments:
919  *  --------
920  * 
921  *************************************<->***********************************/
922
923 void RedisplayIconTitle (ClientData *pcd)
924 {
925     XRectangle textBox;
926     GC iconGC;
927
928     /*
929      * only proceed if we've got the right icon parts to work on
930      */
931
932     if (ICON_DECORATION(pcd) & ICON_LABEL_PART && ICON_FRAME_WIN(pcd))
933     {
934
935         /* nothing to do if no labels */
936         if (!(ICON_DECORATION(pcd) & ICON_LABEL_PART))
937             return;
938
939         /* get the box that the text sits in */
940         GetIconTitleBox (pcd, &textBox);
941
942         /* 
943          * Get appropriate GCs 
944          * Dim text if this is in the icon box and the client is mapped 
945          */
946 #ifdef WSM
947         if ((ACTIVE_PSD->useIconBox && (P_ICON_BOX(pcd)) &&
948             !(pcd->clientFlags & CLIENT_WM_CLIENTS)) || 
949 #else
950         if ((ACTIVE_PSD->useIconBox && (P_ICON_BOX(pcd)) &&
951             !(pcd->clientFlags & ICON_BOX)) || 
952 #endif /* WSM */
953             !(wmGD.keyboardFocus == pcd)) 
954         {
955             iconGC = ICON_APPEARANCE(pcd).inactiveGC;
956         }
957         else 
958         {
959             iconGC = ICON_APPEARANCE(pcd).activeGC;
960         }
961
962         if ((ACTIVE_PSD->useIconBox) && 
963             (P_ICON_BOX(pcd)) &&
964             (FADE_NORMAL_ICON(pcd)) && 
965             (!(pcd->clientState == MINIMIZED_STATE)))
966         {
967             iconGC = FADE_ICON_TEXT_GC(pcd);
968         }
969
970         /* out with the old */
971         XClearArea (DISPLAY, 
972             ICON_FRAME_WIN(pcd), 
973             textBox.x, textBox.y,
974             (unsigned int) textBox.width, (unsigned int) textBox.height, 
975             FALSE);
976
977         /* in with the new */
978 #ifdef WSM
979         WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd), 
980                        ICON_APPEARANCE(pcd).fontList,
981                        pcd->iconTitle, iconGC, 
982                        textBox.x, textBox.y, textBox.width, &textBox,
983                        True);
984 #else /* WSM */
985         WmDrawXmString(DISPLAY, ICON_FRAME_WIN(pcd), 
986                        ICON_APPEARANCE(pcd).fontList,
987                        pcd->iconTitle, iconGC, 
988                        textBox.x, textBox.y, textBox.width, &textBox);
989 #endif /* WSM */
990
991         /* 
992          * Erase & paint text in the active icon text window
993          */
994         if ((wmGD.keyboardFocus == pcd) && 
995             (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART))
996         {
997             PaintActiveIconText (pcd, True);
998         }
999     }
1000 } /* END OF FUNCTION  RedisplayIconTitle */
1001
1002
1003 \f
1004 /*************************************<->*************************************
1005  *
1006  *  GetIconDimensions (pSD, &pWidth, &pLabelHeight, &pImageHeight)
1007  *
1008  *
1009  *  Description:
1010  *  -----------
1011  *  returns dimensions of icon frame parts
1012  *
1013  *
1014  *  Inputs:
1015  *  ------
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 
1020  *
1021  * 
1022  *  Outputs:
1023  *  -------
1024  *  *pWidth       - width of frame
1025  *  *pLabelHeight - height of label part of icon
1026  *  *pImageHeight - height of image part of icon 
1027  *
1028  *
1029  *  Comments:
1030  *  --------
1031  * 
1032  *************************************<->***********************************/
1033 void GetIconDimensions (WmScreenData *pSD, unsigned int *pWidth, unsigned int *pLabelHeight, unsigned int *pImageHeight)
1034 {
1035     /*
1036      * The icon width is always keyed to the icon image maximum regardless
1037      * of whether an icon image part appears or not.
1038      */
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)
1046     {
1047         /* less beveling in this style */
1048         *pWidth -= 2 * ICON_INTERNAL_SHADOW_WIDTH;
1049     }
1050
1051     switch (pSD->iconDecoration & (ICON_IMAGE_PART | ICON_LABEL_PART)) 
1052     {
1053         case ICON_LABEL_PART:
1054             *pImageHeight = 0;
1055
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;
1061             break;
1062
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)
1075             {
1076                 /* less beveling in this style */
1077                 *pImageHeight -= 2 * ICON_INTERNAL_SHADOW_WIDTH;
1078             }
1079
1080
1081             *pLabelHeight = 0;
1082
1083             break;
1084
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;
1096
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)
1103             {
1104                 /*
1105                  * In this style there is less beveling and no 
1106                  * etching between the icon image and label.
1107                  */
1108                 *pImageHeight -= 3 * ICON_INTERNAL_SHADOW_WIDTH;
1109                 *pLabelHeight -= ICON_INTERNAL_SHADOW_WIDTH;
1110             }
1111
1112             break;
1113
1114         default:
1115             *pLabelHeight = *pImageHeight = 0;
1116             break;
1117             
1118     }
1119 }
1120
1121 \f
1122 /*************************************<->*************************************
1123  *
1124  *  InitIconSize (pSD)
1125  *
1126  *
1127  *  Description:
1128  *  -----------
1129  *  set global icon size variables
1130  *
1131  *
1132  *  Inputs:
1133  *  ------
1134  *
1135  * 
1136  *  Outputs:
1137  *  -------
1138  *
1139  *
1140  *  Comments:
1141  *  --------
1142  * 
1143  *************************************<->***********************************/
1144 void InitIconSize (WmScreenData *pSD)
1145 {
1146     Cardinal label, image;
1147
1148     GetIconDimensions (pSD, (unsigned int *)&(pSD->iconWidth), 
1149         &label, &image);
1150     
1151     pSD->iconHeight = label+image;
1152
1153     pSD->iconImageHeight = image;
1154     pSD->iconLabelHeight = label;
1155
1156
1157     iconShrinkX =   IB_MARGIN_WIDTH 
1158                   + ICON_EXTERNAL_SHADOW_WIDTH
1159                   + ICON_IMAGE_LEFT_PAD
1160                   + 2 * ICON_INTERNAL_SHADOW_WIDTH;
1161
1162                 
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)
1170     {
1171         /* less beveling in this style */
1172         iconShrinkX -= ICON_INTERNAL_SHADOW_WIDTH;
1173         iconShrinkY -= ICON_INTERNAL_SHADOW_WIDTH;
1174     }
1175
1176
1177     iconShrinkWidth  =  pSD->iconImageMaximum.width ;
1178     if (wmGD.frameStyle == WmSLAB)
1179     {
1180         iconShrinkWidth  += 2;
1181     }
1182
1183
1184
1185
1186     switch (pSD->iconDecoration & (ICON_IMAGE_PART | ICON_LABEL_PART)) 
1187     {
1188         case ICON_LABEL_PART:
1189             iconShrinkHeight = TEXT_HEIGHT(pSD->iconAppearance.font);
1190             break;
1191
1192         case ICON_IMAGE_PART:
1193             iconShrinkHeight = pSD->iconImageMaximum.height;
1194
1195             break;
1196
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)
1207             {
1208                 /* adjust for less beveling in this style */
1209                 iconShrinkHeight += ICON_INTERNAL_SHADOW_WIDTH;
1210             }
1211             break;
1212
1213     }
1214
1215     
1216 } /* END OF FUNCTION InitIconSize */
1217
1218 \f
1219 /*************************************<->*************************************
1220  *
1221  *  ShowActiveIcon (pcd)
1222  *
1223  *
1224  *  Description:
1225  *  -----------
1226  *  Paint the icon to indicate an "active" state
1227  *
1228  *
1229  *  Inputs:
1230  *  ------
1231  *  pcd         - pointer to client data
1232  *
1233  * 
1234  *  Outputs:
1235  *  -------
1236  *
1237  *
1238  *  Comments:
1239  *  --------
1240  *  
1241  * 
1242  *************************************<->***********************************/
1243
1244 void ShowActiveIcon (ClientData *pcd)
1245 {
1246     unsigned long attr_mask;
1247     XSetWindowAttributes window_attribs;
1248
1249     if (ICON_FRAME_WIN(pcd))
1250     {
1251         /* 
1252          * Use background pixmap if one is specified, otherwise set the
1253          * appropriate background color. 
1254          */
1255
1256         if (ICON_APPEARANCE(pcd).activeBackgroundPixmap)
1257         {
1258             attr_mask = CWBackPixmap;
1259             window_attribs.background_pixmap = 
1260                                 ICON_APPEARANCE(pcd).activeBackgroundPixmap;
1261         }
1262         else
1263         {
1264             attr_mask = CWBackPixel;
1265             window_attribs.background_pixel = 
1266                                 ICON_APPEARANCE(pcd).activeBackground;
1267         }
1268         
1269
1270         /* set active window attributes */
1271         XChangeWindowAttributes (DISPLAY, 
1272                                 ICON_FRAME_WIN(pcd), 
1273                                 attr_mask, &window_attribs);
1274
1275         /* clear the frame to the right background */
1276         if ((!ACTIVE_PSD->useIconBox) || 
1277             (P_ICON_BOX(pcd) == NULL))
1278         {
1279 #ifndef MOTIF_ONE_DOT_ONE
1280             if (ICON_DECORATION(pcd) & ICON_IMAGE_PART)
1281             {
1282                 Dimension dheight, dwidth;
1283
1284                 dwidth = ICON_WIDTH(pcd) -
1285                         2*ICON_EXTERNAL_SHADOW_WIDTH;
1286                 if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1287                 {
1288                     dheight =   ICON_IMAGE_HEIGHT(pcd) -
1289                                 ICON_EXTERNAL_SHADOW_WIDTH;
1290                 }
1291                 else
1292                 {
1293                     dheight =   ICON_IMAGE_HEIGHT(pcd) -
1294                                 2*ICON_EXTERNAL_SHADOW_WIDTH;
1295                 }
1296                 if (wmGD.frameStyle == WmRECESSED)
1297                 {
1298                     dheight -=  ICON_INTERNAL_SHADOW_WIDTH;
1299                 }
1300
1301                 XmeClearBorder (DISPLAY, ICON_FRAME_WIN(pcd),
1302                                 ICON_EXTERNAL_SHADOW_WIDTH, 
1303                                 ICON_EXTERNAL_SHADOW_WIDTH,
1304                                 dwidth,
1305                                 dheight,
1306                                 ICON_IMAGE_TOP_PAD);
1307             }
1308
1309             if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1310             {
1311                 XClearArea (DISPLAY, 
1312                             ICON_FRAME_WIN(pcd), 
1313                             0, 
1314                             ICON_IMAGE_HEIGHT(pcd),
1315                             (unsigned int) ICON_WIDTH(pcd), 
1316                             (unsigned int) ICON_HEIGHT(pcd), False);
1317             }
1318 #else
1319             XClearWindow (DISPLAY, ICON_FRAME_WIN(pcd));
1320 #endif
1321         }
1322         else
1323         {
1324             /*
1325              * clear only area of real frame, not highlight area
1326              */
1327
1328             XClearArea (DISPLAY, 
1329                             ICON_FRAME_WIN(pcd), 
1330                             IB_MARGIN_WIDTH,
1331                             IB_MARGIN_HEIGHT,
1332                             (unsigned int) ICON_WIDTH(pcd), 
1333                             (unsigned int) ICON_HEIGHT(pcd), False);
1334         }
1335
1336
1337         /* 
1338          * Put up a big icon text label.
1339          */
1340
1341         if (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)
1342             
1343         {
1344             if (wmGD.activeIconTextDisplayed)
1345                 PaintActiveIconText(pcd, True);
1346             else
1347                 ShowActiveIconText(pcd);
1348         }
1349
1350         /* simulate exposure of window */
1351 #ifndef MOTIF_ONE_DOT_ONE
1352         IconExposureProc(pcd, False);
1353 #else
1354         IconExposureProc(pcd, True);
1355 #endif
1356
1357     }
1358
1359 } /* END OF FUNCTION ShowActiveIcon */
1360
1361
1362 \f
1363 /*************************************<->*************************************
1364  *
1365  *  ShowInactiveIcon (pcd, refresh)
1366  *
1367  *
1368  *  Description:
1369  *  -----------
1370  *  Make the icon appear "inactive"
1371  *
1372  *
1373  *  Inputs:
1374  *  ------
1375  *  pcd         - pointer to client data
1376  *
1377  *  refresh     - if True redraw the icon
1378  *
1379  *************************************<->***********************************/
1380 void ShowInactiveIcon (ClientData *pcd, Boolean refresh)
1381 {
1382     unsigned long attr_mask = 0;
1383     XSetWindowAttributes window_attribs;
1384
1385     /* turn off the active icon text */
1386     if (ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART)
1387     {
1388         /* pass in screen to fix multiscreen bug [P3385] */
1389         HideActiveIconText(pcd->pSD);
1390     }
1391    
1392     if (ICON_FRAME_WIN(pcd))
1393     {
1394         /* 
1395          * Use background pixmap if one is specified, otherwise set the
1396          * appropriate background color. 
1397          */
1398
1399         if (ICON_APPEARANCE(pcd).backgroundPixmap)
1400         {
1401             attr_mask |= CWBackPixmap;
1402             window_attribs.background_pixmap = 
1403                                 ICON_APPEARANCE(pcd).backgroundPixmap;
1404         }
1405         else
1406         {
1407             attr_mask |= CWBackPixel;
1408             window_attribs.background_pixel = 
1409                                 ICON_APPEARANCE(pcd).background;
1410         }
1411         
1412
1413         /* set active window attributes */
1414         XChangeWindowAttributes (DISPLAY, ICON_FRAME_WIN(pcd), attr_mask, 
1415                                  &window_attribs);
1416
1417
1418         if (refresh)
1419         {
1420             /* clear the frame to the right background */
1421             if ((!ACTIVE_PSD->useIconBox) || 
1422                 (P_ICON_BOX(pcd) == NULL))
1423             {
1424 #ifndef MOTIF_ONE_DOT_ONE
1425                 XmeClearBorder (DISPLAY, ICON_FRAME_WIN(pcd),
1426                                 0, 0,
1427                                 ICON_WIDTH(pcd), ICON_IMAGE_HEIGHT(pcd), 4);
1428
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);
1434 #else
1435                 XClearWindow (DISPLAY, ICON_FRAME_WIN(pcd));
1436 #endif
1437             }
1438             else
1439             {
1440                 /*
1441                  * clear only area of real frame, not highlight area
1442                  */
1443
1444                 XClearArea (DISPLAY, 
1445                             ICON_FRAME_WIN(pcd), 
1446                             IB_MARGIN_WIDTH,
1447                             IB_MARGIN_HEIGHT,
1448                             (unsigned int) ICON_WIDTH(pcd), 
1449                             (unsigned int) ICON_HEIGHT(pcd), False);
1450             }
1451         
1452
1453         /* simulate exposure of window */
1454 #ifndef MOTIF_ONE_DOT_ONE
1455             IconExposureProc(pcd, False);
1456 #else
1457             IconExposureProc(pcd, True);
1458 #endif
1459         }
1460
1461     }
1462
1463 } /* END OF FUNTION ShowInactiveIcon  */
1464
1465
1466 \f
1467 /*************************************<->*************************************
1468  *
1469  *  ReparentIconWindow (pcd, xOffset, yOffset)
1470  *
1471  *
1472  *  Description:
1473  *  -----------
1474  *  Reparent the icon window in the center of the image area
1475  *
1476  *
1477  *  Inputs:
1478  *  ------
1479  *  pcd         - pointer to client data
1480  *  xOffset     - adjusts for icons in the iconBox
1481  *  yOffset     - adjusts for icons in the iconBox
1482  *
1483  * 
1484  *  Outputs:
1485  *  -------
1486  *
1487  *
1488  *  Comments:
1489  *  --------
1490  * 
1491  *************************************<->***********************************/
1492 void ReparentIconWindow (ClientData *pcd, int xOffset, int yOffset)
1493 {
1494     int x, y, rpX, rpY;
1495     unsigned int width, height, bw, depth;
1496     Window root;
1497     XWindowChanges windowChanges;
1498     unsigned int mask;
1499
1500 #ifdef PANELIST
1501     if (!pcd->pECD)
1502     {
1503 #endif /* PANELIST */
1504     /*
1505      * Check if window size is too big
1506      */
1507     XGetGeometry (DISPLAY, pcd->iconWindow, &root, &x, &y, &width, &height, 
1508                   &bw, &depth);
1509
1510     /*
1511      * strip off previous window border and set window geometry to 
1512      * fit inside icon frame
1513      */
1514     if (width != 0) {
1515         mask = CWBorderWidth;
1516         windowChanges.border_width = 0;
1517     }
1518     else
1519     {
1520         mask = 0;
1521     }
1522
1523     if (width > ((ICON_IMAGE_MAXIMUM(pcd).width) +
1524                  ((wmGD.frameStyle == WmSLAB) ? 2 : 0)))
1525     {
1526         width = windowChanges.width = ICON_IMAGE_MAXIMUM(pcd).width +
1527                                      ((wmGD.frameStyle == WmSLAB) ? 2 : 0);
1528         mask |= CWWidth;
1529     }
1530     else if (width < ICON_IMAGE_MINIMUM(pcd).width) {
1531         width = windowChanges.width = ICON_IMAGE_MINIMUM(pcd).width;
1532         mask |= CWWidth;
1533     }
1534
1535     if (height > ((ICON_IMAGE_MAXIMUM(pcd).height) +
1536                  ((wmGD.frameStyle == WmSLAB) ? 2 : 0)))
1537     {
1538         height = windowChanges.height = ICON_IMAGE_MAXIMUM(pcd).height +
1539                                      ((wmGD.frameStyle == WmSLAB) ? 2 : 0);
1540         mask |= CWHeight;
1541     }
1542     else if (height < ICON_IMAGE_MINIMUM(pcd).height) {
1543         height = windowChanges.height = ICON_IMAGE_MINIMUM(pcd).height;
1544         mask |= CWHeight;
1545     }
1546
1547     if (mask)
1548         XConfigureWindow (DISPLAY, pcd->iconWindow, mask, &windowChanges);
1549
1550     /*
1551      * Reparent the icon window to the center of the icon image frame
1552      */
1553
1554     if (ICON_DECORATION(pcd) & ICON_LABEL_PART)
1555     {
1556         yOffset += ICON_INTERNAL_SHADOW_WIDTH;
1557     }
1558
1559     rpX = ((ICON_WIDTH(pcd) - width)/2)    + xOffset;
1560     rpY = ((ICON_IMAGE_HEIGHT(pcd) - height)/2) + yOffset;
1561
1562
1563
1564
1565     XReparentWindow (DISPLAY, pcd->iconWindow, ICON_FRAME_WIN(pcd), rpX, rpY);
1566     pcd->clientFlags  |= ICON_REPARENTED;
1567
1568     /*
1569      * Map the icon window when the icon frame is mapped.
1570      */
1571 #ifdef PANELIST
1572     } /* END if (!pcd->pECD) */
1573 #endif /* PANELIST */
1574 } /* END OF FUNCTION ReparentIconWindow */
1575
1576 \f
1577 /*************************************<->*************************************
1578  *
1579  *  PutBoxOnScreen (screen, px, py, width, height)
1580  *
1581  *
1582  *  Description:
1583  *  -----------
1584  *  Changes the position of the passed box so that it is all on screen
1585  *
1586  *
1587  *  Inputs:
1588  *  ------
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
1594  * 
1595  *  Outputs:
1596  *  -------
1597  *  *px         - new x-coord
1598  *  *py         - new y-coord
1599  *
1600  *
1601  *  Comments:
1602  *  --------
1603  * 
1604  *************************************<->***********************************/
1605 void PutBoxOnScreen (int screen, int *px, int *py, unsigned int width, unsigned int height)
1606 {
1607     /*
1608      * Place active label text nicely on screen
1609      */
1610
1611     if (*px+width+1 > DisplayWidth (DISPLAY, screen))
1612         *px -= (*px+width+1) - DisplayWidth (DISPLAY, screen);
1613
1614     if (*py+height+1 > DisplayHeight (DISPLAY, screen))
1615         *py -= (*py+height+1) - DisplayHeight (DISPLAY, screen);
1616
1617     if (*px < 1) *px = 1;
1618
1619     if (*py < 1) *py = 1;
1620
1621 } /* END OF FUNCTION PutBoxOnScreen */
1622
1623 \f
1624 /*************************************<->*************************************
1625  *
1626  *  PutBoxInIconBox (pCD, px, py, width, height)
1627  *
1628  *
1629  *  Description:
1630  *  -----------
1631  *  Changes the position of the passed box so that it is not
1632  *  clipped by the bulletin board
1633  *  
1634  *
1635  *
1636  *  Inputs:
1637  *  ------
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
1643  * 
1644  *  Outputs:
1645  *  -------
1646  *  *px         - new x-coord
1647  *  *py         - new y-coord
1648  *
1649  *
1650  *  Comments:
1651  *  --------
1652  * 
1653  *************************************<->***********************************/
1654 void PutBoxInIconBox (ClientData *pCD, int *px, int *py, unsigned int *width, unsigned int *height)
1655 {
1656
1657     int i;
1658     Arg getArgs[3];
1659     Dimension bBoardWidth;
1660     Dimension bBoardHeight;
1661
1662     int clipWidth;
1663     int clipHeight;
1664
1665
1666     i=0;
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);
1670
1671     clipWidth = (int) bBoardWidth;
1672     clipHeight = (int) bBoardHeight;
1673
1674     if (*px + *width-1 > clipWidth)
1675         *px -= (*px + *width-1) - clipWidth;
1676
1677     if (*py + *height-1 > clipHeight)
1678         *py -= (*py + *height-1) - clipHeight;
1679
1680     if (*px < 0) *px = 0;
1681
1682     if (*py < 0) *py = 0;
1683
1684
1685 } /* END OF FUNCTION PutBoxInIconBox */
1686
1687 \f
1688 /*************************************<->*************************************
1689  *
1690  *  CreateActiveIconTextWindow (pSD)
1691  *
1692  *
1693  *  Description:
1694  *  -----------
1695  *  creates the window that's popped up when an icon is activated
1696  *
1697  *  Inputs:
1698  *  ------
1699  *  pSD         - pointer to screen data
1700  * 
1701  *  Outputs:
1702  *  -------
1703  *
1704  *  Comments:
1705  *  --------
1706  * 
1707  *************************************<->***********************************/
1708
1709 void CreateActiveIconTextWindow (WmScreenData *pSD)
1710 {
1711     XSetWindowAttributes window_attribs;
1712     unsigned long attr_mask;
1713
1714     /* create active icon text window */
1715     attr_mask = CWEventMask| CWCursor;
1716     window_attribs.event_mask =  ExposureMask;
1717     window_attribs.cursor = wmGD.workspaceCursor;
1718
1719     /* 
1720      * Use background pixmap if one is specified, otherwise set the
1721      * appropriate background color. 
1722      */
1723
1724     if (pSD->iconAppearance.activeBackgroundPixmap)
1725     {
1726         attr_mask |= CWBackPixmap;
1727         window_attribs.background_pixmap = 
1728                                 pSD->iconAppearance.activeBackgroundPixmap;
1729     }
1730     else
1731     {
1732         attr_mask |= CWBackPixel;
1733         window_attribs.background_pixel = 
1734                                 pSD->iconAppearance.activeBackground;
1735     }
1736         
1737
1738     pSD->activeIconTextWin = XCreateWindow (DISPLAY,
1739                                        pSD->rootWindow, /* parent */
1740                                        0, 0,            /* x, y */
1741                                        1, 1,            /* width, height */
1742                                        0,               /* border width */
1743                                        CopyFromParent,  /* depth */
1744                                        InputOutput,     /* class */
1745                                        CopyFromParent,  /* visual */
1746                                        attr_mask,
1747                                        &window_attribs);
1748
1749     
1750     pSD->activeLabelParent = pSD->rootWindow;
1751
1752 } /* END OF FUNCTION CreateActiveIconTextWindow */
1753
1754
1755 \f
1756 /*************************************<->*************************************
1757  *
1758  *  PaintActiveIconText (pcd, erase)
1759  *
1760  *
1761  *  Description:
1762  *  -----------
1763  *
1764  *
1765  *  Inputs:
1766  *  ------
1767  *  pcd         - pointer to client data
1768  *  erase       - if true, then erase the area before repainting
1769  * 
1770  *  Outputs:
1771  *  -------
1772  *
1773  *
1774  *  Comments:
1775  *  --------
1776  * 
1777  *************************************<->***********************************/
1778 void PaintActiveIconText (ClientData *pcd, Boolean erase)
1779 {
1780     XRectangle textBox;
1781     GC iconGC, topGC, botGC;
1782
1783     if (!(ICON_DECORATION(pcd) & ICON_ACTIVE_LABEL_PART))
1784         return;
1785
1786     /* get appropriate GCs */
1787     iconGC = ICON_APPEARANCE(pcd).activeGC;
1788     topGC = ICON_APPEARANCE(pcd).activeTopShadowGC;
1789     botGC = ICON_APPEARANCE(pcd).activeBottomShadowGC;
1790
1791     /* draw shadowing */
1792
1793     if (pActiveIconTopRects) {
1794         XFillRectangles (DISPLAY, 
1795                          pcd->pSD->activeIconTextWin,
1796                          topGC,
1797                          pActiveIconTopRects->prect,
1798                          pActiveIconTopRects->used);
1799     }
1800
1801     if (pActiveIconBotRects) {
1802         XFillRectangles (DISPLAY,
1803                          pcd->pSD->activeIconTextWin,
1804                          botGC,
1805                          pActiveIconBotRects->prect,
1806                          pActiveIconBotRects->used);
1807     }
1808
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;
1814
1815     if (erase)
1816     {
1817         XClearArea (DISPLAY, pcd->pSD->activeIconTextWin, textBox.x, textBox.y,
1818                     (unsigned int) textBox.width, 
1819                     (unsigned int) textBox.height, 
1820                     FALSE);
1821     }
1822
1823 #ifdef WSM
1824     WmDrawXmString(DISPLAY, pcd->pSD->activeIconTextWin, 
1825                    ICON_APPEARANCE(pcd).fontList,
1826                    pcd->iconTitle, iconGC, 
1827                    textBox.x, textBox.y, textBox.width, &textBox, True);
1828 #else /* WSM */
1829     WmDrawXmString(DISPLAY, pcd->pSD->activeIconTextWin, 
1830                    ICON_APPEARANCE(pcd).fontList,
1831                    pcd->iconTitle, iconGC, 
1832                    textBox.x, textBox.y, textBox.width, &textBox);
1833 #endif /* WSM */
1834
1835
1836 } /* END OF FUNCTION PaintActiveIconText */
1837
1838 \f
1839 /*************************************<->*************************************
1840  *
1841  *  ShowActiveIconText (pcd)
1842  *
1843  *
1844  *  Description:
1845  *  -----------
1846  *
1847  *
1848  *  Inputs:
1849  *  ------
1850  * 
1851  *  Outputs:
1852  *  -------
1853  *
1854  *
1855  *  Comments:
1856  *  --------
1857  * 
1858  *************************************<->***********************************/
1859 void ShowActiveIconText (ClientData *pcd)
1860 {
1861     XWindowAttributes iconFrameAttribs;
1862     XSetWindowAttributes window_attribs;
1863     XWindowChanges windowChanges;
1864     unsigned int mask;
1865     int x, y; 
1866     unsigned int junk;
1867     Window root;
1868     Dimension dWidth, dHeight;
1869
1870
1871     /* 
1872      * put up a big icon text label
1873      */
1874     if (pcd->pSD->activeIconTextWin) {
1875         /* copy event mask from icon frame window */
1876         XGetWindowAttributes (DISPLAY, ICON_FRAME_WIN(pcd), &iconFrameAttribs);
1877
1878         /* set attributes of window */
1879         window_attribs.event_mask =  iconFrameAttribs.your_event_mask;
1880         XChangeWindowAttributes (DISPLAY, pcd->pSD->activeIconTextWin,
1881                                  CWEventMask, &window_attribs);
1882
1883         /* set up geometry for the window */
1884
1885         XmStringExtent (ICON_APPEARANCE(pcd).fontList, pcd->iconTitle,
1886                         &dWidth, &dHeight);
1887
1888         activeIconTextHeight =  (unsigned int) dHeight + 
1889                   WM_BOTTOM_TITLE_PADDING +
1890                   2*ICON_EXTERNAL_SHADOW_WIDTH;
1891
1892         activeIconTextWidth = (unsigned int) dWidth;
1893
1894         if (activeIconTextWidth < (1.2 * ICON_WIDTH(pcd))) 
1895         {
1896             activeIconTextWidth = 1.2 * ICON_WIDTH(pcd);
1897         }
1898
1899         activeIconTextWidth += 2*ICON_EXTERNAL_SHADOW_WIDTH;
1900
1901         XGetGeometry (DISPLAY, 
1902                         (Drawable) ICON_FRAME_WIN(pcd), 
1903                         &root, &x, &y, 
1904                         &junk, &junk, &junk, &junk);
1905
1906
1907         y += ICON_IMAGE_HEIGHT(pcd);
1908         x -= (activeIconTextWidth - ICON_WIDTH(pcd))/2;
1909
1910
1911
1912         if (!(P_ICON_BOX(pcd)))
1913         {
1914             /* 
1915              * This is a normal icon
1916              */
1917             PutBoxOnScreen (SCREEN_FOR_CLIENT(pcd), &x, &y, 
1918                     activeIconTextWidth, activeIconTextHeight);
1919             if (ACTIVE_LABEL_PARENT(pcd) != root)
1920             {
1921                 XReparentWindow(DISPLAY, pcd->pSD->activeIconTextWin , 
1922                                 root, x, y );
1923                 ACTIVE_LABEL_PARENT(pcd) = root;
1924             }
1925             
1926         }
1927         else
1928         {
1929             /* 
1930              * This is an icon in an icon box
1931              */
1932             x = x + IB_MARGIN_WIDTH;
1933             y = y + IB_MARGIN_HEIGHT;
1934
1935             if(!(pcd->pSD->iconDecoration & ( ICON_LABEL_PART)))
1936             {
1937                 y -= activeIconTextHeight;
1938             }
1939
1940             PutBoxInIconBox (pcd, &x, &y, 
1941                                 &activeIconTextWidth, &activeIconTextHeight);
1942             if (ACTIVE_LABEL_PARENT(pcd) != pcd->client)
1943             {
1944                 XReparentWindow(DISPLAY, pcd->pSD->activeIconTextWin , 
1945                     XtWindow(P_ICON_BOX(pcd)->bBoardWidget),
1946                     x, y );
1947                 ACTIVE_LABEL_PARENT(pcd) = pcd->client;
1948             }
1949         }
1950
1951
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, 
1958                           &windowChanges);
1959
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))))
1966         {
1967             pActiveIconTopRects->used = 0;
1968             pActiveIconBotRects->used = 0;
1969             BevelRectangle (pActiveIconTopRects,        
1970                             pActiveIconBotRects, 
1971                             0, 0, 
1972                             activeIconTextWidth, 
1973                             activeIconTextHeight,
1974                             ICON_EXTERNAL_SHADOW_WIDTH,
1975                             ICON_EXTERNAL_SHADOW_WIDTH,
1976                             ICON_EXTERNAL_SHADOW_WIDTH,
1977                             ICON_EXTERNAL_SHADOW_WIDTH);
1978         }
1979
1980         XMapRaised (DISPLAY, pcd->pSD->activeIconTextWin);
1981         wmGD.activeIconTextDisplayed = True;
1982
1983         /* save context for this window */
1984         XSaveContext (DISPLAY, pcd->pSD->activeIconTextWin, 
1985             wmGD.windowContextType, (caddr_t) pcd);
1986     }
1987 } /* END OF FUNCTION ShowActiveIconText */
1988
1989 \f
1990 /*************************************<->*************************************
1991  *
1992  *  HideActiveIconText ()
1993  *
1994  *
1995  *  Description:
1996  *  -----------
1997  *  Hides the big label shown over the active icon.
1998  *
1999  *
2000  *  Inputs:
2001  *  ------
2002  * 
2003  *  Outputs:
2004  *  -------
2005  *
2006  *
2007  *  Comments:
2008  *  --------
2009  * 
2010  *************************************<->***********************************/
2011 void HideActiveIconText (WmScreenData *pSD)
2012 {
2013
2014
2015     if ((pSD && pSD->activeIconTextWin) || ACTIVE_ICON_TEXT_WIN)
2016     {
2017         /* disassociate the big label window with this client */
2018         XDeleteContext (DISPLAY, 
2019                         pSD 
2020                          ? pSD->activeIconTextWin
2021                          : ACTIVE_PSD->activeIconTextWin, 
2022                         wmGD.windowContextType);
2023
2024         /* hide the big label */
2025         XUnmapWindow (DISPLAY,
2026                       pSD 
2027                        ? pSD->activeIconTextWin
2028                        : ACTIVE_PSD->activeIconTextWin);
2029         wmGD.activeIconTextDisplayed = False;
2030     }
2031 }
2032
2033 \f
2034 /*************************************<->*************************************
2035  *
2036  *  MoveActiveIconText (pcd)
2037  *
2038  *
2039  *  Description:
2040  *  -----------
2041  *
2042  *
2043  *  Inputs:
2044  *  ------
2045  * 
2046  *  Outputs:
2047  *  -------
2048  *
2049  *
2050  *  Comments:
2051  *  --------
2052  * 
2053  *************************************<->***********************************/
2054 void MoveActiveIconText (ClientData *pcd)
2055 {
2056     int x, y; 
2057     unsigned int junk;
2058     Window root;
2059     Dimension dWidth, dHeight;
2060     
2061     
2062     /* 
2063      * put up a big icon text label
2064      */
2065     if (pcd->pSD->activeIconTextWin && wmGD.activeIconTextDisplayed) {
2066         /* set up geometry for the window */
2067
2068         XmStringExtent (ICON_APPEARANCE(pcd).fontList, pcd->iconTitle,
2069                         &dWidth, &dHeight);
2070
2071         activeIconTextHeight =  (unsigned int) dHeight +
2072                   WM_BOTTOM_TITLE_PADDING +
2073                   2 * ICON_EXTERNAL_SHADOW_WIDTH;
2074         
2075         activeIconTextWidth = (unsigned int) dWidth;
2076
2077         if (activeIconTextWidth < (1.2 * ICON_WIDTH(pcd))) 
2078         {
2079             activeIconTextWidth = 1.2 * ICON_WIDTH(pcd);
2080         }
2081         
2082         activeIconTextWidth += 2 * ICON_EXTERNAL_SHADOW_WIDTH;
2083
2084         XGetGeometry (DISPLAY, 
2085                         (Drawable) ICON_FRAME_WIN(pcd), 
2086                         &root, &x, &y, 
2087                         &junk, &junk, &junk, &junk);
2088
2089         
2090         y += ICON_IMAGE_HEIGHT(pcd);
2091         x -= (activeIconTextWidth - ICON_WIDTH(pcd))/2;
2092
2093         if (!(P_ICON_BOX(pcd)))
2094         {
2095             /* This is a normal icon */
2096             PutBoxOnScreen (SCREEN_FOR_CLIENT(pcd), &x, &y, 
2097                 activeIconTextWidth, activeIconTextHeight);
2098         }
2099         else 
2100         {
2101             /* icon box */
2102             x = x + IB_MARGIN_WIDTH;
2103             y = y + IB_MARGIN_HEIGHT;
2104
2105             if(!(pcd->pSD->iconDecoration & ( ICON_LABEL_PART)))
2106             {
2107                 y -= activeIconTextHeight;
2108             }
2109
2110             PutBoxInIconBox (pcd, &x, &y, 
2111                              &activeIconTextWidth, &activeIconTextHeight);
2112         }
2113         
2114         XMoveWindow(DISPLAY, pcd->pSD->activeIconTextWin, x, y );
2115
2116     }
2117 }  /* END OF FUNCTION  MoveActiveIconText */
2118
2119