1 /*
2 * Motif
3 *
4 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
5 *
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)
10 * any later version.
11 *
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
16 * details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
22 */
23 /*
24 * Motif Release 1.2.4
25 */
26 #ifdef HAVE_CONFIG_H
27 #include <config.h>
28 #endif
29
30
31 #ifdef REV_INFO
32 #ifndef lint
33 static char rcsid[] = "$TOG: WmIconBox.c /main/7 1999/05/20 16:35:12 mgreess $"
34 #endif
35 #endif
36
37 /*
38 * Included Files:
39 */
40
41 #include "WmGlobal.h"
42 #ifdef WSM
43 #include "WmHelp.h"
44 #endif /* WSM */
45 #include <X11/StringDefs.h>
46 #include <X11/Intrinsic.h>
47 #include <X11/Shell.h>
48 #include <X11/Xutil.h>
49 #include <X11/Vendor.h>
50
51 #include <X11/keysymdef.h>
52 #include <X11/keysym.h>
53
54
55 #include <Xm/Xm.h>
56 #include <Xm/DialogS.h>
57 #include <Xm/Frame.h>
58 #include <Xm/Label.h>
59 #include <Xm/PushB.h>
60 #include <Xm/DrawnB.h>
61 #include <Xm/ScrolledW.h>
62 #include <Xm/BulletinB.h>
63 #include <Xm/ToggleB.h>
64
65 #define MWM_NEED_IIMAGE
66 #define MWM_NEED_GREYED75
67 #define MWM_NEED_SLANT2
68 #include "WmIBitmap.h"
69
70 #include "WmResNames.h"
71
72 #include <stdio.h>
73
74 /*
75 * include extern functions
76 */
77
78 #include "WmIconBox.h"
79 #include "WmCDInfo.h"
80 #include "WmError.h"
81 #include "WmEvent.h"
82 #include "WmFunction.h"
83 #include "WmIDecor.h"
84 #include "WmIPlace.h"
85 #include "WmImage.h"
86 #ifdef PANELIST
87 #include "WmPanelP.h" /* for typedef in WmManage.h */
88 #endif /* PANELIST */
89 #include "WmManage.h"
90 #include "WmMenu.h"
91 #include "WmResParse.h"
92 #include "WmResource.h"
93 #include "WmWinInfo.h"
94 #ifdef WSM
95 #include "WmWrkspace.h"
96 #endif /* WSM */
97
98 #ifndef MAX
99 #define MAX(a,b) ((a)>(b)?(a):(b))
100 #endif
101
102
103
104 /*
105 * Global Variables:
106 */
107
108
109 Pixel select_color;
110 Pixmap greyedPixmap;
111
112 int frameShadowThickness;
113 int firstTime = 1;
114 Cardinal insertPosition = 0;
115 #define DEFAULT_ICON_BOX_TITLE "Icons"
116 Const char *szhorizontal = "horizontal";
117 Const char *szvertical = "vertical";
118
119
120 /*************************************<->*************************************
121 *
122 * InitIconBox (pSD)
123 *
124 *
125 * Description:
126 * -----------
127 * This function controls creation of icon boxes
128 *
129 *
130 *************************************<->***********************************/
InitIconBox(WmScreenData * pSD)131 void InitIconBox (WmScreenData *pSD)
132
133 {
134 #ifdef WSM
135 int iws;
136 #endif /* WSM */
137 /*
138 * Start the process of making the icon boxes
139 */
140
141
142
143 #ifdef WSM
144 /*
145 * Manage a separate icon box in every workspace
146 * on this screen.
147 */
148 for (iws = 0; iws < pSD->numWorkspaces; iws++)
149 {
150 AddIconBoxForWorkspace (&pSD->pWS[iws]);
151 }
152
153 #else /* WSM */
154 ManageWindow (pSD, None, MANAGEW_ICON_BOX);
155 #endif /* WSM */
156
157 if (pSD->fadeNormalIcon)
158 {
159 MakeFadeIconGC (pSD);
160 }
161
162
163 } /* END OF FUNCTION InitIconBox */
164
165 #ifdef WSM
166
167 /*************************************<->*************************************
168 *
169 * AddIconBoxForWorkspace (pWS)
170 *
171 *
172 * Description:
173 * -----------
174 * This function adds an iconbox to a workspace
175 *
176 *
177 *************************************<->***********************************/
AddIconBoxForWorkspace(WmWorkspaceData * pWS)178 void AddIconBoxForWorkspace (WmWorkspaceData *pWS)
179
180 {
181 extern WmWorkspaceData *pIconBoxInitialWS;
182
183 pIconBoxInitialWS = pWS;
184 ManageWindow (pWS->pSD, NULL, MANAGEW_ICON_BOX);
185
186 } /* END OF FUNCTION AddIconBoxForWorkspace */
187 #endif /* WSM */
188
189
190 /*************************************<->*************************************
191 *
192 * MakeIconBox (pWS, pCD);
193 *
194 *
195 * Description:
196 * -----------
197 *
198 *
199 *
200 * Inputs:
201 * ------
202 * pWS = pointer to workspace data
203 * pCD = a pointer to ClientData
204 *
205 *
206 * Outputs:
207 * -------
208 *
209 * Return = (Boolean) True iff successful.
210 *
211 *
212 * Comments:
213 * --------
214 * If fails, frees the ClientData structure pointed to by pCD.
215 *
216 *************************************<->***********************************/
217
MakeIconBox(WmWorkspaceData * pWS,ClientData * pCD)218 Boolean MakeIconBox (WmWorkspaceData *pWS, ClientData *pCD)
219 {
220 IconBoxData *pIBD;
221
222
223 /*
224 * Make an icon box and return the pCD
225 */
226
227 if (pCD)
228 {
229 if (!(pIBD = (IconBoxData *)XtMalloc (sizeof (IconBoxData))))
230 {
231 /*
232 * We need a pointer to icon box data to add to the
233 * list of icon boxes linked to pWS->pIconBox. If
234 * we can't allocate space we need to free the space
235 * allocated for the ClientData structure
236 */
237
238 Warning (((char *)GETMESSAGE(36, 1, "Insufficient memory to create icon box data")));
239 XtFree ((char *)pCD);
240 return (FALSE);
241 }
242
243 InitializeIconBoxData (pWS, pIBD);
244 InitializeClientData (pCD, pIBD);
245
246 if (!(pIBD->IPD.placeList =
247 (IconInfo *)XtMalloc (pIBD->IPD.totalPlaces * sizeof (IconInfo))))
248 {
249 Warning (((char *)GETMESSAGE(36, 2, "Insufficient memory to create icon box data")));
250 XtFree ((char *)pIBD);
251 XtFree ((char *)pCD);
252 return (FALSE);
253 }
254 memset (pIBD->IPD.placeList, 0,
255 pIBD->IPD.totalPlaces * sizeof (IconInfo));
256
257 /*
258 * Make the top level shell for this icon box
259 */
260 MakeShell (pWS, pIBD);
261
262 /*
263 * Make the scrolled window for this icon box
264 */
265
266 MakeScrolledWindow (pWS, pIBD);
267
268 /*
269 * Make the row column manager for this icon box
270 */
271 MakeBulletinBoard (pWS, pIBD);
272
273 /*
274 * Realize the widget tree and set client data fields
275 */
276
277 RealizeIconBox (pWS, pIBD, pCD);
278
279 /*
280 * Link the new icon box to list of icon boxes
281 */
282 AddNewBox (pWS, pIBD);
283 }
284
285 return (TRUE);
286
287 } /* END OF FUNCTION MakeIconBox */
288
289 #ifdef WSM
290
291 /*************************************<->*************************************
292 *
293 * DestroyIconBox (pWS)
294 *
295 *
296 * Description:
297 * -----------
298 * Destroys an icon box
299 *
300 *
301 * Inputs:
302 * ------
303 * pWS = pointer to workspace data
304 *
305 *
306 * Outputs:
307 * -------
308 *
309 * Return = none
310 *
311 *
312 * Comments:
313 * --------
314 * Used when deleting a workspace
315 * Should be called AFTER all clients have been removed from the
316 * workspace -- there should be no icons in the icon box.
317 *
318 *************************************<->***********************************/
319
DestroyIconBox(WmWorkspaceData * pWS)320 void DestroyIconBox (WmWorkspaceData *pWS)
321 {
322 IconBoxData *pIBD;
323
324 pIBD = pWS->pIconBox;
325
326 XtDestroyWidget (pIBD->shellWidget);
327
328 UnManageWindow (pIBD->pCD_iconBox);
329
330 XtFree ((char *) pIBD);
331
332 } /* END OF FUNCTION DestroyIconBox */
333 #endif /* WSM */
334
335
336 /*************************************<->*************************************
337 *
338 * MakeShell (pWS, pIBD)
339 *
340 *
341 * Description:
342 * -----------
343 *
344 *
345 *
346 * Inputs:
347 * ------
348 * pWS = pointer to workspace data
349 *
350 * pIBD = pointer to IconBoxData
351 *
352 * XXinput = ...
353 *
354 *
355 * Outputs:
356 * -------
357 *
358 * pIBD->shellWidget
359 *
360 *
361 * Comments:
362 * --------
363 * XXComments ...
364 *
365 *************************************<->***********************************/
366
MakeShell(WmWorkspaceData * pWS,IconBoxData * pIBD)367 void MakeShell (WmWorkspaceData *pWS, IconBoxData *pIBD)
368 {
369
370 Arg setArgs[20];
371 int i;
372 #ifdef WSM
373 char *pchIBTitle = NULL;
374 #endif /* WSM */
375
376 /*
377 * Create top level application shell for icon box
378 */
379
380 i=0;
381
382 XtSetArg (setArgs[i], XmNallowShellResize, (XtArgVal)True); i++;
383
384 XtSetArg (setArgs[i], XmNborderWidth, (XtArgVal)0); i++;
385
386 XtSetArg (setArgs[i], XmNkeyboardFocusPolicy, (XtArgVal)XmEXPLICIT); i++;
387
388 #ifndef WSM
389 if (!(Monochrome (XtScreen (pWS->pSD->screenTopLevelW))))
390 {
391 XtSetArg (setArgs[i], XmNbackground,
392 (XtArgVal) pWS->pSD->clientAppearance.background ); i++;
393 XtSetArg (setArgs[i], XmNforeground,
394 (XtArgVal) pWS->pSD->clientAppearance.foreground ); i++;
395 }
396 #else /* WSM */
397 if (pWS->pSD->iconBoxTitle)
398 {
399 pchIBTitle = WmXmStringToString (pWS->pSD->iconBoxTitle);
400
401 XtSetArg (setArgs[i], XmNtitle, (XtArgVal)pchIBTitle); i++;
402 XtSetArg (setArgs[i], XmNiconName, (XtArgVal)pchIBTitle); i++;
403 }
404 #endif /* WSM */
405 XtSetArg (setArgs[i], XmNmappedWhenManaged, (XtArgVal)False); i++;
406 XtSetArg (setArgs[i], XmNdialogStyle, (XtArgVal)XmDIALOG_MODELESS); i++;
407 XtSetArg (setArgs[i], XmNdepth,
408 (XtArgVal) DefaultDepth (DISPLAY, pWS->pSD->screen)); i++;
409 XtSetArg (setArgs[i], XmNscreen,
410 (XtArgVal) ScreenOfDisplay (DISPLAY, pWS->pSD->screen)); i++;
411
412 #ifdef WSM
413 pIBD->shellWidget = (Widget) XtCreatePopupShell (WmNclient,
414 topLevelShellWidgetClass,
415 pWS->workspaceTopLevelW,
416 (ArgList)setArgs, i);
417
418 if (pchIBTitle != NULL) XtFree (pchIBTitle);
419 #else /* WSM */
420 pIBD->shellWidget = (Widget) XtCreatePopupShell (WmNiconBox,
421 topLevelShellWidgetClass,
422 pWS->workspaceTopLevelW,
423 (ArgList)setArgs, i);
424 #endif /* WSM */
425
426 } /* END OF FUNCTION MakeShell */
427
428
429
430 /*************************************<->*************************************
431 *
432 * MakeScrolledWindow (pWS, pIBD)
433 *
434 *
435 * Description:
436 * -----------
437 *
438 *
439 *
440 * Inputs:
441 * ------
442 * pWS = pointer to workspace data
443 * pIBD = pointer to IconBoxData
444 * XXinput = ...
445 *
446 *
447 * Outputs:
448 * -------
449 *
450 * Return = pIBD with the pIBD->scrolledWidget set
451 *
452 *
453 * Comments:
454 * --------
455 * XXComments ...
456 *
457 *************************************<->***********************************/
458
MakeScrolledWindow(WmWorkspaceData * pWS,IconBoxData * pIBD)459 void MakeScrolledWindow (WmWorkspaceData *pWS, IconBoxData *pIBD)
460 {
461
462 Arg setArgs[20];
463 int i;
464
465 /*
466 * Create frame widget to give the scrolled window
467 * an external bevel
468 */
469
470 i=0;
471 #ifndef WSM
472 /*
473 if (!(Monochrome (XtScreen (pWS->pSD->screenTopLevelW))))
474 {
475 XtSetArg (setArgs[i], XmNbackground,
476 (XtArgVal) pWS->pSD->clientAppearance.background ); i++;
477 XtSetArg (setArgs[i], XmNforeground,
478 (XtArgVal) pWS->pSD->clientAppearance.foreground ); i++;
479 }
480 */
481 #endif /* WSM */
482 XtSetArg (setArgs[i], XmNborderWidth, (XtArgVal) 0 ); i++;
483 XtSetArg (setArgs[i], XmNmarginWidth, (XtArgVal) 0 ); i++;
484 XtSetArg (setArgs[i], XmNmarginHeight, (XtArgVal) 0 ); i++;
485 XtSetArg (setArgs[i], XmNshadowType, (XtArgVal) XmSHADOW_OUT); i++;
486 XtSetArg (setArgs[i], XmNshadowThickness,
487 (XtArgVal) frameShadowThickness); i++;
488 pIBD->frameWidget = XtCreateManagedWidget ("IBframe",
489 xmFrameWidgetClass,
490 pIBD->shellWidget,
491 (ArgList)setArgs, i);
492
493 #ifdef WSM
494 XtAddCallback (pIBD->frameWidget, XmNhelpCallback,
495 WmDtWmTopicHelpCB, WM_DT_ICONBOX_TOPIC);
496
497 #endif /* WSM */
498 /*
499 * Create scrolled window to hold row column manager
500 */
501
502 i=0;
503
504 XtSetArg (setArgs[i], XmNscrollingPolicy , (XtArgVal) XmAUTOMATIC ); i++;
505
506 XtSetArg (setArgs[i], XmNborderWidth , (XtArgVal) 0 ); i++;
507 XtSetArg (setArgs[i], XmNspacing , (XtArgVal) IB_MARGIN_WIDTH ); i++;
508 #ifndef WSM
509
510 if (!(Monochrome (XtScreen (pWS->pSD->screenTopLevelW))))
511 {
512 XtSetArg (setArgs[i], XmNbackground,
513 (XtArgVal) pWS->pSD->clientAppearance.background ); i++;
514 XtSetArg (setArgs[i], XmNforeground,
515 (XtArgVal) pWS->pSD->clientAppearance.foreground ); i++;
516 }
517 #endif /* WSM */
518 /*
519 * do we want to get these from a resource or set it here
520 * to control the appearance of the iconBox
521 */
522
523 XtSetArg (setArgs[i], XmNscrolledWindowMarginWidth, (XtArgVal) 3); i++;
524 XtSetArg (setArgs[i], XmNscrolledWindowMarginHeight, (XtArgVal) 3); i++;
525 XtSetArg (setArgs[i], XmNshadowThickness,
526 (XtArgVal) FRAME_EXTERNAL_SHADOW_WIDTH); i++;
527
528 XtSetArg (setArgs[i], XmNscrollBarDisplayPolicy,(XtArgVal) XmSTATIC ); i++;
529 XtSetArg (setArgs[i], XmNvisualPolicy, (XtArgVal) XmVARIABLE ); i++;
530
531 pIBD->scrolledWidget = XtCreateManagedWidget ("IBsWindow",
532 xmScrolledWindowWidgetClass,
533 pIBD->frameWidget,
534 (ArgList)setArgs, i);
535
536 #ifndef MOTIF_ONE_DOT_ONE
537 XtAddCallback(pIBD->scrolledWidget, XmNtraverseObscuredCallback,
538 (XtCallbackProc) IconScrollVisibleCallback, (caddr_t)NULL);
539 #endif
540
541 XtAddEventHandler(pIBD->scrolledWidget,
542 StructureNotifyMask,
543 False,
544 (XtEventHandler)UpdateIncrements,
545 (XtPointer) pIBD);
546
547
548
549 } /* END OF FUNCTION MakeScrolledWindow */
550
551
552
553 /*************************************<->*************************************
554 *
555 * MakeBulletinBoard (pWS, pIBD)
556 *
557 *
558 * Description:
559 * -----------
560 *
561 *
562 *
563 * Inputs:
564 * ------
565 * pWS = pointer to workspace data
566 * pIBD = pointer to IconBoxData
567 *
568 * XXinput = ...
569 *
570 *
571 * Outputs:
572 * -------
573 *
574 * Return = pIBD with the pIBD->bBoardWidget
575 *
576 *
577 * Comments:
578 * --------
579 * XXComments ...
580 *
581 *************************************<->***********************************/
582
MakeBulletinBoard(WmWorkspaceData * pWS,IconBoxData * pIBD)583 void MakeBulletinBoard (WmWorkspaceData *pWS, IconBoxData *pIBD)
584 {
585
586 int i;
587 Arg setArgs[20];
588
589 /*
590 * Create bulletin board to hold icons
591 */
592
593 i=0;
594 #ifdef DEBUG_ICON_BOX
595 XtSetArg (setArgs[i], XmNborderWidth , 1); i++;
596 #else
597 XtSetArg (setArgs[i], XmNborderWidth , 0); i++;
598 #endif /* DEBUG_ICON_BOX */
599
600 XtSetArg (setArgs[i], XmNshadowThickness,(XtArgVal) 0); i++;
601 #ifndef WSM
602 if (!(Monochrome (XtScreen (pWS->pSD->screenTopLevelW))))
603 {
604 XtSetArg (setArgs[i], XmNforeground,
605 (XtArgVal) pWS->pSD->clientAppearance.background ); i++;
606 XtSetArg (setArgs[i], XmNbottomShadowColor,
607 (XtArgVal) pWS->pSD->clientAppearance.bottomShadowColor ); i++;
608 XtSetArg (setArgs[i], XmNtopShadowColor,
609 (XtArgVal) pWS->pSD->clientAppearance.topShadowColor ); i++;
610 }
611 #endif /* WSM */
612
613 XtSetArg (setArgs[i], XmNspacing , 0); i++;
614 XtSetArg (setArgs[i], XmNmarginHeight , 0); i++;
615 XtSetArg (setArgs[i], XmNmarginWidth , 0); i++;
616
617 XtSetArg (setArgs[i], XmNdialogStyle, (XtArgVal) XmDIALOG_WORK_AREA); i++;
618
619 XtSetArg (setArgs[i], XmNresizePolicy, (XtArgVal) XmRESIZE_NONE); i++;
620 XtSetArg (setArgs[i], XmNdefaultPosition , (XtArgVal) False); i++;
621
622 XtSetArg (setArgs[i], XtNinsertPosition , InsertPosition); i++;
623
624 pIBD->bBoardWidget = XtCreateManagedWidget ("IBbBoard",
625 xmBulletinBoardWidgetClass,
626 pIBD->scrolledWidget,
627 (ArgList)setArgs, i);
628
629 } /* END OF FUNCTION MakeBulletinBoard */
630
631
632
633 /*************************************<->*************************************
634 *
635 * RealizeIconBox (pWS, pIBD, pCD)
636 *
637 *
638 * Description:
639 * -----------
640 *
641 *
642 *
643 * Inputs:
644 * ------
645 * pWS = pointer to workspace data
646 *
647 * pIBD = pointer to IconBoxData
648 *
649 * pCD = pointer to ClientData
650 *
651 *
652 * Outputs:
653 * -------
654 *
655
656 * Return = pIBD with the pIBD->shellWin set
657 * Return = pIBD with the pIBD->scrolledWin set
658 * Return = pIBD with the pIBD->bBoardWin set
659
660 *
661 * Return = pCD with appropriate fields set
662 *
663 *
664 * Comments:
665 * --------
666 * XXComments ...
667 *
668 *************************************<->***********************************/
669
RealizeIconBox(WmWorkspaceData * pWS,IconBoxData * pIBD,ClientData * pCD)670 void RealizeIconBox (WmWorkspaceData *pWS, IconBoxData *pIBD, ClientData *pCD)
671 {
672
673 int i;
674 Arg getArgs[10];
675 Arg setArgs[2];
676 Widget clipWidget;
677 Pixmap bgPixmap;
678 Pixmap defaultImage;
679
680
681 XtRealizeWidget (pIBD->shellWidget);
682
683 pCD->client = XtWindow (pIBD->shellWidget);
684
685 /*
686 * This will set the scrolling granularity for the icon box
687 */
688
689 SetGeometry (pWS, pCD, pIBD);
690
691 /*
692 * Point to the iconBox
693 */
694
695 pIBD->pCD_iconBox = pCD;
696 pCD->thisIconBox = pIBD;
697 /*
698 * get the background color of the bulletin board for
699 * greyed icon work
700 */
701
702 i=0;
703 XtSetArg (setArgs[i], XmNbackground, (XtArgVal) select_color ); i++;
704 XtSetValues (pIBD->bBoardWidget, (ArgList) setArgs, i);
705
706
707 i=0;
708 XtSetArg (getArgs[i], XmNbackgroundPixmap, (XtArgVal) &bgPixmap ); i++;
709 XtGetValues (pIBD->bBoardWidget, getArgs, i);
710
711 i=0;
712 XtSetArg (getArgs[i], XmNclipWindow, (XtArgVal) &clipWidget ); i++;
713 XtGetValues (pIBD->scrolledWidget, getArgs, i);
714
715 /*
716 * Set the background of the clip window for the scrolled
717 * window so the default widget background doesn't flash
718 */
719
720 i = 0;
721 XtSetArg(setArgs[i], XmNbackground, (XtArgVal) select_color); i++;
722 XtSetValues (clipWidget, (ArgList) setArgs, i);
723
724
725 /*
726 * Save the clipWidget id to use in constraining icon moves in box
727 */
728
729 pIBD->clipWidget = clipWidget;
730
731 MakeShrinkWrapIconsGC (pWS->pSD, bgPixmap);
732
733
734 if (pWS->pSD->iconDecoration & ICON_IMAGE_PART)
735 {
736 /*
737 * Make a pixmap to use when iconWindows are unmapped
738 */
739 defaultImage = XCreateBitmapFromData (DISPLAY, pWS->pSD->rootWindow,
740 (char*)iImage_bits, iImage_width,
741 iImage_height);
742
743 pWS->pSD->defaultPixmap = MakeIconPixmap (pCD,
744 defaultImage,
745 None, iImage_width,
746 iImage_height, 1);
747 }
748
749
750 } /* END OF FUNCTION RealizeIconBox */
751
752
753
754 /*************************************<->*************************************
755 *
756 * AddNewBox (pWS, pIBD)
757 *
758 *
759 * Description:
760 * -----------
761 *
762 *
763 *
764 * Inputs:
765 * ------
766 * pWS = pointer to workspace data
767 *
768 * pIBD = pointer to IconBoxData
769 *
770 *
771 * Outputs:
772 * -------
773 *
774 *
775 * Comments:
776 * --------
777 * Finds the last iconbox on the list starting at pWS->pIconBox and
778 * adds the new icon box to the end of the list.
779 *
780 *************************************<->***********************************/
781
AddNewBox(WmWorkspaceData * pWS,IconBoxData * pIBD)782 void AddNewBox (WmWorkspaceData *pWS, IconBoxData *pIBD)
783 {
784
785 IconBoxData *pibd;
786
787 if (pWS->pIconBox)
788 {
789 pibd = pWS->pIconBox;
790
791 while (pibd->pNextIconBox)
792 {
793 pibd = pibd->pNextIconBox;
794 }
795
796 pibd->pNextIconBox = pIBD;
797 }
798 else
799 {
800 pWS->pIconBox = pIBD;
801 }
802
803
804 } /* END OF FUNCTION AddNewBox */
805
806
807
808 /*************************************<->*************************************
809 *
810 * InitializeIconBoxData (pWS, pIBD)
811 *
812 *
813 * Description:
814 * -----------
815 *
816 *
817 *
818 * Inputs:
819 * ------
820 * pWS = pointer to Workspace Data
821 *
822 * pIBD = pointer to IconBoxData
823 *
824 *
825 * Outputs:
826 * -------
827 *
828 *
829 * Comments:
830 * --------
831 * Initializes all pIBD fields to NULL
832 *
833 *************************************<->***********************************/
834
InitializeIconBoxData(WmWorkspaceData * pWS,IconBoxData * pIBD)835 void InitializeIconBoxData (WmWorkspaceData *pWS, IconBoxData *pIBD)
836 {
837 int mask;
838 int X;
839 int Y;
840 unsigned int width;
841 unsigned int height;
842 int sW, sH;
843
844 frameShadowThickness = FRAME_INTERNAL_SHADOW_WIDTH;
845
846 pIBD->numberOfIcons = 0;
847 pIBD->currentRow = 0;
848 pIBD->currentCol = 0;
849 pIBD->lastRow = 0;
850 pIBD->lastCol = 0;
851 pIBD->IPD.placeList = NULL;
852
853 pIBD->scrolledWidget = NULL;
854 pIBD->bBoardWidget = NULL;
855 pIBD->clipWidget = NULL;
856 #ifdef WSM
857 pIBD->wsID = pWS->id;
858 #endif /* WSM */
859
860 ToLower ((unsigned char *) pWS->pSD->iconBoxSBDisplayPolicy);
861
862 if (!((!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "all")) ||
863 (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szvertical)) ||
864 (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szhorizontal))))
865 {
866 strcpy(pWS->pSD->iconBoxSBDisplayPolicy, "all");
867 }
868
869
870
871 /*
872 * this will be set by the iconPlacement resource if
873 * iconBoxGeometry width and height are not specified
874 */
875
876 #ifdef WSM
877 if (pWS->iconBoxGeometry == NULL) /* not set by user */
878 #else /* WSM */
879 if (pWS->pSD->iconBoxGeometry == NULL) /* not set by user */
880 #endif /* WSM */
881 {
882 /*
883 * Use the iconPlacement resource
884 */
885
886 if (pWS->pSD->iconPlacement &
887 (ICON_PLACE_TOP_PRIMARY | ICON_PLACE_BOTTOM_PRIMARY))
888 {
889 pIBD->IPD.iconPlacement = ICON_PLACE_TOP_PRIMARY;
890 pIBD->IPD.placementCols = 1;
891 pIBD->IPD.placementRows = 6;
892 }
893 else
894 {
895 pIBD->IPD.iconPlacement = ICON_PLACE_LEFT_PRIMARY;
896 pIBD->IPD.placementCols = 6;
897 pIBD->IPD.placementRows = 1;
898 }
899
900 }
901 else
902 {
903 #ifdef WSM
904 mask = XParseGeometry(pWS->iconBoxGeometry, &X, &Y,
905 &width, &height);
906 #else /* WSM */
907 mask = XParseGeometry(pWS->pSD->iconBoxGeometry, &X, &Y,
908 &width, &height);
909 #endif /* WSM */
910
911 if ((mask & WidthValue) && (width > 0))
912 {
913 pIBD->IPD.placementCols = (int)width;
914 }
915 else
916 {
917 pIBD->IPD.placementCols = 6;
918 }
919
920 if ((mask & HeightValue) && (height > 0))
921 {
922 pIBD->IPD.placementRows = (int)height;
923 }
924 else
925 {
926 pIBD->IPD.placementRows = 1;
927 }
928
929 /*
930 * Set orientation
931 */
932
933 if (pIBD->IPD.placementRows <= pIBD->IPD.placementCols)
934 {
935 pIBD->IPD.iconPlacement = ICON_PLACE_LEFT_PRIMARY;
936 }
937 else
938 {
939 pIBD->IPD.iconPlacement = ICON_PLACE_TOP_PRIMARY;
940 }
941 }
942
943
944 /*
945 * Override orientation if iconBoxSBDisplayPolicy is set to
946 * horizontal or vertical
947 */
948
949 if (!(strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szvertical)))
950 {
951 pIBD->IPD.iconPlacement = ICON_PLACE_LEFT_PRIMARY;
952 }
953 else if (!(strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szhorizontal)))
954 {
955 pIBD->IPD.iconPlacement = ICON_PLACE_TOP_PRIMARY;
956 }
957
958
959
960
961 /*
962 * set initial size of placement space to size of screen
963 */
964
965 sW = DisplayWidth (DISPLAY, pWS->pSD->screen) / pWS->pSD->iconWidth;
966 sH = DisplayHeight (DISPLAY, pWS->pSD->screen) / pWS->pSD->iconHeight;
967
968 pIBD->IPD.totalPlaces = sW * sH;
969
970 pIBD->IPD.onRootWindow = False;
971
972 /*
973 * The icon box does not live in an icon box in this version
974 */
975
976 pIBD->pNextIconBox =NULL;
977
978
979 } /* END OF FUNCTION InitializeIconBoxData */
980
981
982
983 /*************************************<->*************************************
984 *
985 * SetIconBoxInfo (pWS, pCD)
986 *
987 *
988 * Description:
989 * -----------
990 *
991 * Inputs:
992 * ------
993 * pCD
994 *
995 *
996 * Comments:
997 * --------
998 *
999 *************************************<->***********************************/
1000
SetIconBoxInfo(WmWorkspaceData * pWS,ClientData * pCD)1001 void SetIconBoxInfo (WmWorkspaceData *pWS, ClientData *pCD)
1002 {
1003 pCD->clientClass = WmCIconBox;
1004 pCD->clientName = pWS->pSD->iconBoxName;
1005 ProcessClientResources (pCD);
1006
1007 } /* END OF FUNCTION SetIconBoxInfo */
1008
1009
1010
1011 /*************************************<->*************************************
1012 *
1013 * InitializeClientData (pCD)
1014 *
1015 *
1016 * Description:
1017 * -----------
1018 *
1019 *
1020 *
1021 * Inputs:
1022 * ------
1023 * pCD
1024 *
1025 *
1026 * Outputs:
1027 * -------
1028 *
1029 *
1030 * Comments:
1031 * --------
1032 * Initializes geometry, etc. fields
1033 *
1034 *************************************<->***********************************/
1035
InitializeClientData(ClientData * pCD,IconBoxData * pIBD)1036 void InitializeClientData (ClientData *pCD, IconBoxData *pIBD)
1037 {
1038 pCD->internalBevel = (wmGD.frameStyle == WmSLAB) ? 0 :
1039 FRAME_INTERNAL_SHADOW_WIDTH;
1040
1041 pCD->clientX = 0;
1042 pCD->clientY = 0;
1043
1044 pCD->clientFlags |= ICON_BOX ;
1045
1046 pCD->widthInc = pIBD->IPD.iPlaceW = ICON_WIDTH(pCD)
1047 + IB_SPACING
1048 + (2 * IB_MARGIN_WIDTH);
1049
1050 pCD->heightInc = pIBD->IPD.iPlaceH = ICON_HEIGHT(pCD)
1051 + IB_SPACING
1052 + (2 * IB_MARGIN_HEIGHT);
1053
1054 pCD->clientWidth = pIBD->IPD.placementCols * pCD->widthInc;
1055 pCD->clientHeight = pIBD->IPD.placementRows * pCD->heightInc;
1056
1057 if (!(pCD->pSD->iconBoxTitle))
1058 {
1059 #ifndef NO_MESSAGE_CATALOG
1060 pCD->pSD->iconBoxTitle =
1061 XmStringCreateLocalized(wmNLS.default_icon_box_title);
1062 #else
1063 pCD->pSD->iconBoxTitle =
1064 XmStringCreateLocalized(DEFAULT_ICON_BOX_TITLE);
1065 #endif
1066 }
1067
1068 pCD->clientTitle = pCD->pSD->iconBoxTitle;
1069 pCD->iconTitle = pCD->pSD->iconBoxTitle;
1070
1071 } /* END OF FUNCTION InitializeClientData */
1072
1073
1074
1075 /*************************************<->*************************************
1076 *
1077 * MakeShrinkWrapIconsGC (pSD, bgPixmap)
1078 *
1079 *
1080 * Description:
1081 * -----------
1082 * Make an graphic context to shrink the icons in the icon box
1083 * box that are not in the MINIMIZED_STATE.
1084 *
1085 *
1086 * Inputs:
1087 * ------
1088 * pSD - pointer to screen data
1089 *
1090 * Outputs:
1091 * -------
1092 * Modifies global data
1093 *
1094 * Comments:
1095 * --------
1096 *
1097 *
1098 *************************************<->***********************************/
1099
MakeShrinkWrapIconsGC(WmScreenData * pSD,Pixmap bgPixmap)1100 void MakeShrinkWrapIconsGC (WmScreenData *pSD, Pixmap bgPixmap)
1101 {
1102
1103 XtGCMask copyMask;
1104
1105
1106 if (!pSD->shrinkWrapGC)
1107 {
1108 pSD->shrinkWrapGC = XCreateGC (DISPLAY, pSD->rootWindow, 0,
1109 (XGCValues *) NULL);
1110
1111 copyMask = ~0L;
1112
1113 XCopyGC (DISPLAY, pSD->iconAppearance.inactiveGC,
1114 copyMask, pSD->shrinkWrapGC);
1115
1116 if (bgPixmap != XmUNSPECIFIED_PIXMAP)
1117 {
1118 XSetTile (DISPLAY, pSD->shrinkWrapGC, bgPixmap);
1119 XSetFillStyle (DISPLAY, pSD->shrinkWrapGC, FillTiled);
1120 XSetBackground (DISPLAY, pSD->shrinkWrapGC, select_color);
1121 }
1122 else
1123 {
1124 XSetForeground (DISPLAY, pSD->shrinkWrapGC, select_color);
1125 }
1126 }
1127
1128 } /* END OF FUNCTION MakeShrinkWrapIconsGC */
1129
1130
1131
1132 /*************************************<->*************************************
1133 *
1134 * MakeFadeIconGC (pSD)
1135 *
1136 *
1137 * Description:
1138 * -----------
1139 * Make an graphic context for "greying" the icons in the icon
1140 * box that are not in the MINIMIZED_STATE.
1141 *
1142 *
1143 * Inputs:
1144 * ------
1145 * pSD = pointer to screen data
1146 *
1147 * Outputs:
1148 * -------
1149 * Modifies global data
1150 *
1151 * Comments:
1152 * --------
1153 *
1154 *
1155 *************************************<->***********************************/
1156
MakeFadeIconGC(WmScreenData * pSD)1157 void MakeFadeIconGC (WmScreenData *pSD)
1158 {
1159
1160 XtGCMask copyMask;
1161 static Pixmap tmpFontClipMask;
1162
1163
1164 pSD->fadeIconGC = XCreateGC (DISPLAY, pSD->rootWindow, 0,
1165 (XGCValues *) NULL);
1166 pSD->fadeIconTextGC = XCreateGC (DISPLAY, pSD->rootWindow, 0,
1167 (XGCValues *) NULL);
1168
1169 copyMask = ~0L;
1170
1171 XCopyGC (DISPLAY, pSD->iconAppearance.inactiveGC,
1172 copyMask, pSD->fadeIconGC);
1173
1174 XCopyGC (DISPLAY, pSD->iconAppearance.inactiveGC,
1175 copyMask, pSD->fadeIconTextGC);
1176
1177 tmpFontClipMask = XCreateBitmapFromData (DISPLAY, pSD->rootWindow,
1178 (char*)greyed75_bits, greyed75_width, greyed75_height);
1179
1180 greyedPixmap = XCreateBitmapFromData (DISPLAY, pSD->rootWindow,
1181 (char*)slant2_bits, slant2_width, slant2_height);
1182
1183 XSetStipple (DISPLAY, pSD->fadeIconTextGC, tmpFontClipMask);
1184 XSetFillStyle (DISPLAY, pSD->fadeIconTextGC, FillStippled);
1185
1186 XSetStipple (DISPLAY, pSD->fadeIconGC, greyedPixmap);
1187 XSetFillStyle (DISPLAY, pSD->fadeIconGC, FillStippled);
1188 XSetForeground (DISPLAY, pSD->fadeIconGC, select_color);
1189
1190 } /* END OF FUNCTION MakeFadeIconGC */
1191
1192
1193
1194 /*************************************<->*************************************
1195 *
1196 * SetGeometry (pWS, pCD, pIBD)
1197 *
1198 *
1199 * Description:
1200 * -----------
1201 *
1202 *
1203 *
1204 * Inputs:
1205 * ------
1206 * pIBD = pointer to IconBoxData
1207 * pCD = pointer to ClientData
1208 * XXinput = ...
1209 *
1210 *
1211 * Outputs:
1212 * -------
1213 *
1214 *
1215 *
1216 *
1217 * Comments:
1218 * --------
1219 * XXComments ...
1220 *
1221 *************************************<->***********************************/
1222
SetGeometry(WmWorkspaceData * pWS,ClientData * pCD,IconBoxData * pIBD)1223 void SetGeometry (WmWorkspaceData *pWS, ClientData *pCD, IconBoxData *pIBD)
1224 {
1225
1226 int i;
1227 Arg setArgs[10];
1228
1229 int mask;
1230 int X;
1231 int Y;
1232 unsigned int width;
1233 unsigned int height;
1234 unsigned int boxdim, tmpMin;
1235 int diff;
1236 unsigned long decoration;
1237
1238 /*
1239 * Set horizontal and vertical scrolling granularity
1240 */
1241
1242 SetGranularity (pWS, pCD, pIBD );
1243
1244 /*
1245 * Set the initial width and height of the icon box bulletin board
1246 */
1247
1248 i=0;
1249 XtSetArg (setArgs[i], XmNwidth, (XtArgVal) pCD->clientWidth); i++;
1250 XtSetArg (setArgs[i], XmNheight, (XtArgVal) pCD->clientHeight); i++;
1251 XtSetValues (pIBD->bBoardWidget, (ArgList) setArgs, i);
1252
1253 /*
1254 * Adjust icon box window height for height of
1255 * horizontal scroll bar etc.
1256 */
1257
1258 pCD->clientHeight = pCD->clientHeight + pCD->baseHeight;
1259 pCD->oldMaxHeight = pCD->maxHeight = pCD->clientHeight;
1260
1261 /*
1262 * Adjust iconbox window width for width of
1263 * vertical scroll bar etc.
1264 */
1265
1266 pCD->clientWidth = pCD->clientWidth + pCD->baseWidth;
1267 pCD->oldMaxWidth = pCD->maxWidth = pCD->clientWidth;
1268
1269
1270 /*
1271 * Check that minWidth is large enough to disallow overlap
1272 * of title bar gadgets
1273 */
1274
1275 /* compute for minimum frame size */
1276 if ((decoration = pCD->decor) & MWM_DECOR_TITLE)
1277 {
1278 boxdim = InitTitleBarHeight(pCD); /* macro not valid yet */
1279 tmpMin = boxdim +
1280 ((decoration & MWM_DECOR_MENU) ? boxdim : 0) +
1281 ((decoration & MWM_DECOR_MINIMIZE) ? boxdim : 0) +
1282 ((decoration & MWM_DECOR_MAXIMIZE) ? boxdim : 0) -
1283 2*(pCD->matteWidth);
1284 }
1285 else {
1286 tmpMin = 0;
1287 }
1288
1289 /* Make:
1290 * minWidth >= tmpMin
1291 * minWidth >= max (baseWidth, widthInc) > 0
1292 * & an integral number of widthInc from baseWidth.
1293 */
1294
1295 if (pCD->minWidth < tmpMin)
1296 {
1297 if ((diff = ((tmpMin - pCD->baseWidth)%pCD->widthInc)) != 0)
1298 {
1299 pCD->minWidth = tmpMin + pCD->widthInc - diff;
1300 }
1301 else
1302 {
1303 pCD->minWidth = tmpMin;
1304 }
1305 }
1306
1307 if (pCD->minWidth < pCD->baseWidth)
1308 {
1309 pCD->minWidth = pCD->baseWidth;
1310 }
1311
1312 if (pCD->minWidth == 0)
1313 {
1314 pCD->minWidth = pCD->widthInc;
1315 }
1316 else if ((diff = ((pCD->minWidth - pCD->baseWidth)%pCD->widthInc)) != 0)
1317 {
1318 pCD->minWidth += pCD->widthInc - diff;
1319 }
1320
1321
1322
1323 if (pCD->clientWidth < pCD->minWidth)
1324 {
1325 pCD->clientWidth = pCD->minWidth;
1326 }
1327
1328 pIBD->IPD.placementCols = (int)((pCD->clientWidth - pCD->baseWidth)
1329 / pCD->widthInc);
1330
1331
1332 /*
1333 * Make:
1334 *
1335 * maxWidth >= minWidth
1336 * & an integral number of widthInc from baseWidth.
1337 */
1338
1339 if (pCD->maxWidth < pCD->minWidth)
1340 {
1341 pCD->maxWidth = pCD->minWidth;
1342 }
1343
1344 pCD->maxWidthLimit = pCD->maxWidth;
1345
1346 pCD->maxWidth -= ((pCD->maxWidth - pCD->baseWidth)% pCD->widthInc);
1347 pCD->oldMaxWidth = pCD->maxWidth;
1348
1349 pCD->maxHeightLimit = pCD->maxHeight;
1350
1351
1352 /*
1353 * Set the initial width and height of the icon box bulletin board
1354 */
1355
1356 i=0;
1357 XtSetArg (setArgs[i], XmNwidth, (XtArgVal) pCD->clientWidth
1358 - pCD->baseWidth ); i++;
1359 XtSetArg (setArgs[i], XmNheight, (XtArgVal) pCD->clientHeight
1360 - pCD->baseHeight ); i++;
1361 XtSetValues (pIBD->bBoardWidget, (ArgList) setArgs, i);
1362
1363
1364 /*
1365 * Set the initial width and height of the icon box scrolled Window
1366 */
1367
1368 i=0;
1369 XtSetArg (setArgs[i], XmNwidth, (XtArgVal)
1370 (pCD->clientWidth - (2 * frameShadowThickness))); i++;
1371 XtSetArg (setArgs[i], XmNheight, (XtArgVal)
1372 (pCD->clientHeight - (2 * frameShadowThickness))); i++;
1373
1374 XtSetValues (pIBD->scrolledWidget, (ArgList) setArgs, i);
1375
1376
1377
1378 /*
1379 * Call SetFrameInfo with fake X and Y so we can get clientOffset
1380 */
1381
1382 pCD->xBorderWidth = 0;
1383 SetFrameInfo (pCD);
1384
1385
1386 /*
1387 * Set initial placement of icon box
1388 */
1389
1390 #ifdef WSM
1391 mask = XParseGeometry(pWS->iconBoxGeometry, &X, &Y,
1392 &width, &height);
1393 #else /* WSM */
1394 mask = XParseGeometry(pCD->pSD->iconBoxGeometry,
1395 &X, &Y, &width, &height);
1396 #endif /* WSM */
1397
1398 if (mask & XValue)
1399 {
1400 if (mask & XNegative)
1401 {
1402 pCD->clientX = X
1403 + DisplayWidth(DISPLAY, SCREEN_FOR_CLIENT(pCD))
1404 - pCD->clientWidth
1405 - pCD->clientOffset.x;
1406 }
1407 else
1408 {
1409 pCD->clientX = X + pCD->clientOffset.x;
1410 }
1411 }
1412 else
1413 {
1414 pCD->clientX = pCD->clientOffset.x;
1415 }
1416
1417 if (mask & YValue)
1418 {
1419 if (mask & YNegative)
1420 {
1421 pCD->clientY = Y
1422 + DisplayHeight(DISPLAY, SCREEN_FOR_CLIENT(pCD))
1423 - pCD->clientHeight
1424 - pCD->clientOffset.x ;
1425 }
1426 else
1427 {
1428 pCD->clientY = Y + pCD->clientOffset.y;
1429 }
1430 }
1431 else
1432 {
1433 pCD->clientY = pCD->clientOffset.x
1434 + DisplayHeight(DISPLAY, SCREEN_FOR_CLIENT(pCD))
1435 - pCD->clientHeight;
1436 }
1437
1438
1439 PlaceFrameOnScreen (pCD, &pCD->clientX, &pCD->clientY, pCD->clientWidth,
1440 pCD->clientHeight);
1441 pCD->clientX -= (wmGD.positionIsFrame
1442 ? pCD->clientOffset.x
1443 : 0);
1444
1445 pCD->clientY -= (wmGD.positionIsFrame
1446 ? pCD->clientOffset.y
1447 : 0);
1448
1449
1450 i=0;
1451
1452 XtSetArg (setArgs[i], XmNx, (XtArgVal) pCD->clientX); i++;
1453 XtSetArg (setArgs[i], XmNy, (XtArgVal) pCD->clientY); i++;
1454
1455 XtSetValues (pIBD->shellWidget, (ArgList) setArgs, i);
1456
1457 pCD->maxX = pCD->clientX;
1458 pCD->maxY = pCD->clientY;
1459
1460
1461 } /* END OF FUNCTION SetGeometry */
1462
1463
1464
1465 /*************************************<->*************************************
1466 *
1467 * SetGranularity (pWS, pCD, pIBD )
1468 *
1469 *
1470 * Description:
1471 * -----------
1472 *
1473 *
1474 *
1475 * Inputs:
1476 * ------
1477 * pIBD = pointer to IconBoxData
1478 * pCD = pointer to ClientData
1479 * XXinput = ...
1480 *
1481 *
1482 * Outputs:
1483 * -------
1484 *
1485 *
1486 *
1487 *
1488 * Comments:
1489 * --------
1490 * XXComments ...
1491 *
1492 *************************************<->***********************************/
1493
SetGranularity(WmWorkspaceData * pWS,ClientData * pCD,IconBoxData * pIBD)1494 void SetGranularity (WmWorkspaceData *pWS, ClientData *pCD, IconBoxData *pIBD)
1495 {
1496
1497 int i;
1498 Dimension hScrollBarHeight = 0;
1499 Dimension hBarHeight = 0;
1500 Dimension vScrollBarWidth = 0;
1501 Dimension vBarWidth = 0;
1502
1503 Dimension spacing;
1504 short shadowThickness;
1505 short marginWidth;
1506 short marginHeight;
1507
1508 short hShighlightThickness;
1509 short vShighlightThickness;
1510
1511 Arg setArgs[10];
1512 Arg getArgs[10];
1513
1514 i=0;
1515
1516
1517
1518 XtSetArg(getArgs[i], XmNspacing, (XtArgVal) &spacing ); i++;
1519 XtSetArg(getArgs[i], XmNshadowThickness, (XtArgVal) &shadowThickness); i++;
1520 XtSetArg(getArgs[i], XmNscrolledWindowMarginWidth,
1521 (XtArgVal) &marginWidth); i++;
1522 XtSetArg(getArgs[i], XmNscrolledWindowMarginHeight,
1523 (XtArgVal) &marginHeight); i++;
1524 XtSetArg (getArgs[i], XmNverticalScrollBar,
1525 (XtArgVal) &pIBD->vScrollBar); i++;
1526 XtSetArg(getArgs[i], XmNhorizontalScrollBar,
1527 (XtArgVal) &pIBD->hScrollBar); i++;
1528 XtGetValues (pIBD->scrolledWidget, getArgs, i);
1529
1530
1531 if (strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szvertical))
1532 {
1533
1534 /*
1535 * Set horizontal scrolling granularity
1536 */
1537 i=0;
1538 XtSetArg (getArgs[i], XmNheight, (XtArgVal) &hBarHeight ); i++;
1539 XtSetArg (getArgs[i], XmNhighlightThickness,
1540 (XtArgVal) &hShighlightThickness); i++;
1541 XtGetValues (pIBD->hScrollBar, getArgs, i);
1542
1543
1544 i=0;
1545 XtSetArg(setArgs[i], XmNincrement, (XtArgVal) pCD->widthInc); i++;
1546 XtSetArg (setArgs[i], XmNhighlightThickness ,
1547 IB_HIGHLIGHT_BORDER); i++;
1548 XtSetArg(setArgs[i], XmNheight,
1549 (XtArgVal) (hBarHeight - (2 * hShighlightThickness)) +
1550 (2 * IB_HIGHLIGHT_BORDER)); i++;
1551
1552 XtSetValues (pIBD->hScrollBar, (ArgList) setArgs, i);
1553
1554 /*
1555 * Get hScrollBarHeight and troughColor
1556 */
1557
1558 i=0;
1559 XtSetArg (getArgs[i], XmNtroughColor, (XtArgVal) &select_color ); i++;
1560 XtSetArg (getArgs[i], XmNheight, (XtArgVal) &hScrollBarHeight ); i++;
1561 XtGetValues (pIBD->hScrollBar, getArgs, i);
1562
1563 }
1564
1565
1566 if (strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szhorizontal))
1567 {
1568
1569 /*
1570 * Set vertical scrolling granularity
1571 */
1572 i=0;
1573 XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &vBarWidth ); i++;
1574 XtSetArg (getArgs[i], XmNhighlightThickness,
1575 (XtArgVal) &vShighlightThickness); i++;
1576 XtGetValues (pIBD->vScrollBar, getArgs, i);
1577
1578
1579 i=0;
1580 XtSetArg (setArgs[i], XmNincrement, (XtArgVal) pCD->heightInc); i++;
1581 XtSetArg (setArgs[i], XmNhighlightThickness ,
1582 IB_HIGHLIGHT_BORDER); i++;
1583 XtSetArg(setArgs[i], XmNwidth,
1584 (XtArgVal) (vBarWidth - (2 * vShighlightThickness)) +
1585 (2 * IB_HIGHLIGHT_BORDER)); i++;
1586
1587 XtSetValues (pIBD->vScrollBar, (ArgList) setArgs, i);
1588
1589 /*
1590 * Get vScrollBarWidth
1591 */
1592
1593 i=0;
1594 XtSetArg (getArgs[i], XmNtroughColor, (XtArgVal) &select_color ); i++;
1595 XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &vScrollBarWidth ); i++;
1596 XtGetValues (pIBD->vScrollBar, getArgs, i);
1597 }
1598
1599
1600
1601 if (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szvertical))
1602 {
1603 XtUnmanageChild(pIBD->hScrollBar);
1604 hScrollBarHeight = 0;
1605
1606 i=0;
1607 XtSetArg (setArgs[i], XmNscrollBarDisplayPolicy,
1608 (XtArgVal) XmAS_NEEDED ); i++;
1609 XtSetValues (pIBD->scrolledWidget, (ArgList) setArgs, i);
1610
1611 }
1612 else if (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szhorizontal))
1613 {
1614 XtUnmanageChild(pIBD->vScrollBar);
1615 vScrollBarWidth = 0;
1616
1617 i=0;
1618 XtSetArg (setArgs[i], XmNscrollBarDisplayPolicy,
1619 (XtArgVal) XmAS_NEEDED ); i++;
1620 XtSetValues (pIBD->scrolledWidget, (ArgList) setArgs, i);
1621 }
1622
1623
1624
1625
1626 pCD->baseWidth = IB_SPACING
1627 + 2 * IB_HIGHLIGHT_BORDER
1628 #ifdef DEBUG_ICON_BOX
1629 + 2
1630 + spacing
1631 #endif /* DEBUG_ICON_BOX */
1632 + (int) vScrollBarWidth
1633 + 2 * frameShadowThickness
1634 + (int) 2 * marginWidth
1635 + (marginWidth > 0
1636 ? 2 * (int) shadowThickness
1637 : shadowThickness);
1638
1639
1640
1641 pCD->baseHeight = IB_SPACING
1642 + 2 * IB_HIGHLIGHT_BORDER
1643 #ifdef DEBUG_ICON_BOX
1644 + 2
1645 #endif /* DEBUG_ICON_BOX */
1646 + spacing
1647 + (int) hScrollBarHeight
1648 + 2 * frameShadowThickness
1649 + (int) 2 * marginHeight
1650 + (marginHeight > 0
1651 ? 2 * (int) shadowThickness
1652 : shadowThickness);
1653
1654 pCD->minWidth = pCD->baseWidth + pCD->widthInc;
1655 pCD->minHeight = pCD->baseHeight + pCD->heightInc;
1656
1657 pCD->oldMaxWidth = pCD->maxWidth = pCD->minWidth;
1658
1659 pCD->oldMaxHeight = pCD->maxHeight = pCD->minHeight;
1660
1661 } /* END OF FUNCTION SetGranularity */
1662
1663
1664
1665 /*************************************<->*************************************
1666 *
1667 * GetIconBoxMenuItems ()
1668 *
1669 *
1670 * Description:
1671 * -----------
1672 * XXDescription ...
1673 *
1674 *************************************<->***********************************/
1675
GetIconBoxMenuItems(pSD)1676 MenuItem *GetIconBoxMenuItems (pSD)
1677
1678 WmScreenData *pSD;
1679
1680 {
1681
1682 return(ParseMwmMenuStr (pSD,
1683 (unsigned char *)((char *)GETMESSAGE(36, 3, "\"Pack Icons\" _P Alt Shift<Key>F7 f.pack_icons\n"))));
1684
1685 } /* END OF FUNCTION GetIconBoxMenuItems */
1686
1687
1688
1689 /*************************************<->*************************************
1690 *
1691 * MapIconBoxes ()
1692 *
1693 *
1694 * Description:
1695 * -----------
1696 *
1697 *
1698 *
1699 * Inputs:
1700 * ------
1701 *
1702 *
1703 * Outputs:
1704 * -------
1705 *
1706 *
1707 * Comments:
1708 * --------
1709 * Maps all iconboxes on the list starting at pWS->pIconBox
1710 *
1711 *************************************<->***********************************/
1712
MapIconBoxes(WmWorkspaceData * pWS)1713 void MapIconBoxes (WmWorkspaceData *pWS)
1714 {
1715
1716 IconBoxData *pibd;
1717
1718 if (pWS->pIconBox)
1719 {
1720 pibd = pWS->pIconBox;
1721
1722 while (pibd)
1723 {
1724 XtPopup(pibd->shellWidget, XtGrabNone);
1725 #ifndef WSM
1726 F_Raise (NULL, pibd->pCD_iconBox, (XEvent *)NULL);
1727 XMapWindow (DISPLAY, pibd->pCD_iconBox->clientFrameWin);
1728 #endif /* WSM */
1729 pibd = pibd->pNextIconBox;
1730 }
1731 }
1732
1733
1734 } /* END OF FUNCTION MapIconBoxes */
1735
1736 #ifdef WSM
1737
1738 /*************************************<->*************************************
1739 *
1740 * UnmapIconBoxes (pWS)
1741 *
1742 *
1743 * Description:
1744 * -----------
1745 * Unmaps all the iconboxes in the specified workspace
1746 *
1747 *
1748 * Inputs:
1749 * ------
1750 * pWS = pointer to workspace data
1751 *
1752 * Outputs:
1753 * -------
1754 *
1755 *
1756 * Comments:
1757 * --------
1758 * Unmaps all iconboxes on the list starting at pWS->pIconBox
1759 * Does not do anything with icon windows.
1760 *
1761 *************************************<->***********************************/
1762
UnmapIconBoxes(WmWorkspaceData * pWS)1763 void UnmapIconBoxes (WmWorkspaceData *pWS)
1764 {
1765
1766 IconBoxData *pibd;
1767
1768 if (pWS->pIconBox)
1769 {
1770 pibd = pWS->pIconBox;
1771
1772 while (pibd)
1773 {
1774 XUnmapWindow (DISPLAY, pibd->pCD_iconBox->clientFrameWin);
1775 pibd = pibd->pNextIconBox;
1776 }
1777 }
1778
1779 } /* END OF FUNCTION UnmapIconBoxes */
1780 #endif /* WSM */
1781
1782 #if defined(PANELIST)
1783
1784 /******************************<->*************************************
1785 *
1786 * IconBoxShowing ()
1787 *
1788 * Description:
1789 * -----------
1790 * Returns True if an icon box tied to a front panel button is
1791 * showing.
1792 *
1793 * Inputs:
1794 * ------
1795 * pWS = pointer to workspace data
1796 * pCW = pointer to control window data (for front panel button )
1797 *
1798 * Outputs:
1799 * -------
1800 * Return = True if icon box is up, False if it's invisible
1801 *
1802 * Comments:
1803 * --------
1804 *
1805 ******************************<->***********************************/
1806
1807
1808 #ifdef PANELIST
1809 Boolean
IconBoxShowing(WmWorkspaceData * pWS)1810 IconBoxShowing (WmWorkspaceData *pWS)
1811 #else /* PANELIST */
1812 Boolean
1813 IconBoxShowing (WmWorkspaceData *pWS, ControlWindowStruct *pCW)
1814 #endif /* PANELIST */
1815 {
1816 Boolean rval = False;
1817 int wsIndex = GetCurrentWorkspaceIndex (pWS->pSD);
1818
1819 #ifdef PANELIST
1820 if (pWS->pIconBox &&
1821 ClientInWorkspace (pWS, pWS->pIconBox->pCD_iconBox))
1822 {
1823 rval = True;
1824 }
1825 #else /* PANELIST */
1826 if (pWS->pIconBox &&
1827 ClientInWorkspace (pWS, pWS->pIconBox->pCD_iconBox) &&
1828 (pCW->pWsStatus[wsIndex].wsClientStatus == CLIENT_WINDOW_OPEN))
1829 {
1830 rval = True;
1831 }
1832 #endif /* PANELIST */
1833
1834 return (rval);
1835
1836 } /* END OF FUNCTION IconBoxShowing */
1837
1838
1839
1840 /******************************<->*************************************
1841 *
1842 * IconBoxPopUp (pWS, pCW, up)
1843 *
1844 * Description:
1845 * -----------
1846 * Sets the state of the icon box attached to a front panel control.
1847 *
1848 * Inputs:
1849 * ------
1850 * pWS = pointer to workspace data
1851 * pCW = pointer to control window data (for front panel button )
1852 * up = flag, if True, pop the icon box up; if False, hide it.
1853 *
1854 * Outputs:
1855 * -------
1856 * None
1857 *
1858 * Comments:
1859 * --------
1860 *
1861 ******************************<->***********************************/
1862
1863 #ifdef PANELIST
1864 void
IconBoxPopUp(WmWorkspaceData * pWS,Boolean up)1865 IconBoxPopUp (WmWorkspaceData *pWS, Boolean up)
1866 #else /* PANELIST */
1867 void
1868 IconBoxPopUp (WmWorkspaceData *pWS,
1869 ControlWindowStruct *pCW, Boolean up)
1870 #endif /* PANELIST */
1871 {
1872
1873 IconBoxData *pibd;
1874 int wsIndex = GetCurrentWorkspaceIndex (pWS->pSD);
1875
1876 if (pWS->pIconBox)
1877 {
1878 pibd = pWS->pIconBox;
1879
1880 while (pibd)
1881 {
1882 if (up)
1883 {
1884 if (ClientInWorkspace(pWS, pibd->pCD_iconBox))
1885 {
1886 F_Raise (NULL, pibd->pCD_iconBox, (XEvent *)NULL);
1887 }
1888 else
1889 {
1890 AddClientToWorkspaces (pibd->pCD_iconBox,
1891 &pWS->id, 1);
1892 return;
1893 }
1894 }
1895 else if (!up && ClientInWorkspace (pWS, pibd->pCD_iconBox))
1896 {
1897 RemoveClientFromWorkspaces (pibd->pCD_iconBox,
1898 &pWS->id, 1);
1899 return;
1900 }
1901 pibd = pibd->pNextIconBox;
1902 }
1903
1904 }
1905
1906 } /* END OF FUNCTION IconBoxPopUp */
1907 #endif /* PANELIST */
1908
1909
1910
1911
1912 /******************************<->*************************************
1913 *
1914 * InsertIconIntoBox
1915 *
1916 * Inputs
1917 * ------
1918 * pCD - pointer to data for client to insert
1919 *
1920 * Description:
1921 * -----------
1922 * XXDescription ...
1923 *
1924 *************************************<->***********************************/
1925
InsertIconIntoBox(IconBoxData * pIBD,ClientData * pCD)1926 Boolean InsertIconIntoBox (IconBoxData *pIBD, ClientData *pCD)
1927 {
1928
1929 Boolean rval = False;
1930 Arg setArgs[20];
1931 int i;
1932 int iconWidth, iconHeight;
1933 IconBoxData *tmpPointerToIconBox;
1934 Widget iconWidget;
1935 IconInfo *pIconInfo;
1936 static XmString dummyString = NULL;
1937 #ifdef WSM
1938 WsClientData *pWsc;
1939 WmWorkspaceData *pWS = GetWorkspaceData (pCD->pSD, pIBD->wsID);
1940
1941 pWsc = GetWsClientData (pWS, pCD);
1942 #endif /* WSM */
1943
1944 /*
1945 * If we go to multiple icon boxes, find the box this client
1946 * wants to live in. For now, we only have one, so point to
1947 * the first one.
1948 */
1949
1950 tmpPointerToIconBox = pIBD;
1951
1952 if (pCD->client)
1953 {
1954
1955 #ifdef WSM
1956 pWsc->pIconBox = tmpPointerToIconBox;
1957 #else /* WSM */
1958 P_ICON_BOX(pCD) = tmpPointerToIconBox;
1959 #endif /* WSM */
1960
1961 iconWidth = ICON_WIDTH(pCD)
1962 + (2 * IB_MARGIN_WIDTH);
1963
1964 iconHeight = ICON_HEIGHT(pCD)
1965 + (2 * IB_MARGIN_HEIGHT);
1966
1967 #ifdef WSM
1968 pIconInfo = InsertIconInfo (pWsc->pIconBox, pCD, (Widget) NULL);
1969 #else /* WSM */
1970 pIconInfo = InsertIconInfo (P_ICON_BOX(pCD), pCD, (Widget) NULL);
1971 #endif /* WSM */
1972
1973 if (pIconInfo)
1974 {
1975 #ifdef WSM
1976 pWsc->pIconBox->numberOfIcons++;
1977 #else /* WSM */
1978 P_ICON_BOX(pCD)->numberOfIcons++;
1979 #endif /* WSM */
1980
1981 i = 0;
1982 XtSetArg (setArgs[i], XmNbackground,
1983 (XtArgVal) ICON_APPEARANCE(pCD).background ); i++;
1984 XtSetArg (setArgs[i], XmNforeground,
1985 (XtArgVal) ICON_APPEARANCE(pCD).foreground ); i++;
1986
1987 #ifdef WSM
1988 XtSetArg (setArgs[i], XmNx , (XtArgVal) pWsc->iconX); i++;
1989 XtSetArg (setArgs[i], XmNy , (XtArgVal) pWsc->iconY); i++;
1990 #else /* WSM */
1991 XtSetArg (setArgs[i], XmNx , (XtArgVal) ICON_X(pCD)); i++;
1992 XtSetArg (setArgs[i], XmNy , (XtArgVal) ICON_Y(pCD)); i++;
1993 #endif /* WSM */
1994
1995 XtSetArg (setArgs[i], XmNwidth , (XtArgVal) iconWidth); i++;
1996 XtSetArg (setArgs[i], XmNheight , (XtArgVal) iconHeight); i++;
1997
1998 XtSetArg (setArgs[i], XmNborderWidth , (XtArgVal) 0); i++;
1999
2000 XtSetArg (setArgs[i], XmNhighlightThickness ,
2001 IB_HIGHLIGHT_BORDER); i++;
2002
2003 XtSetArg (setArgs[i], XmNmarginHeight , (XtArgVal) 0); i++;
2004 XtSetArg (setArgs[i], XmNmarginWidth , (XtArgVal) 0); i++;
2005 /*
2006 * Use type XmString so we don't get a message from XmLabel
2007 */
2008 XtSetArg (setArgs[i], XmNlabelType, (XtArgVal) XmSTRING); i++;
2009
2010 XtSetArg (setArgs[i], XmNrecomputeSize, (XtArgVal) False); i++;
2011
2012 XtSetArg (setArgs[i], XmNtraversalOn, (XtArgVal) True); i++;
2013
2014 XtSetArg (setArgs[i], XmNpushButtonEnabled, (XtArgVal) False); i++;
2015
2016 XtSetArg (setArgs[i], XmNshadowThickness, (XtArgVal) 0); i++;
2017
2018 iconWidget = XtCreateManagedWidget("iconInIconBox",
2019 xmDrawnButtonWidgetClass,
2020 #ifdef WSM
2021 pWsc->pIconBox->bBoardWidget,
2022 #else /* WSM */
2023 P_ICON_BOX(pCD)->bBoardWidget,
2024 #endif /* WSM */
2025 (ArgList)setArgs, i);
2026
2027 if (dummyString == NULL)
2028 {
2029 dummyString =
2030 XmStringCreateLocalized("");
2031 }
2032
2033 i = 0;
2034 XtSetArg (setArgs[i], XmNlabelString,
2035 (XtArgVal) dummyString); i++;
2036
2037 XtSetValues (iconWidget, setArgs, i);
2038
2039 pIconInfo->theWidget = iconWidget;
2040
2041 #ifdef WSM
2042 pWsc->iconFrameWin = XtWindow (iconWidget);
2043 #else /* WSM */
2044 ICON_FRAME_WIN(pCD) = XtWindow (iconWidget);
2045 #endif /* WSM */
2046
2047 XtAddCallback (iconWidget, XmNactivateCallback,
2048 (XtCallbackProc)IconActivateCallback,
2049 (XtPointer)NULL);
2050
2051 XtAddEventHandler(iconWidget,
2052 SELECT_BUTTON_MOTION_MASK,
2053 False,
2054 (XtEventHandler)HandleIconBoxButtonMotion,
2055 (XtPointer)NULL);
2056
2057 XtAddEventHandler(iconWidget,
2058 DMANIP_BUTTON_MOTION_MASK,
2059 False,
2060 (XtEventHandler)HandleIconBoxButtonMotion,
2061 (XtPointer)NULL);
2062
2063 XtAddEventHandler(iconWidget,
2064 KeyPressMask,
2065 False,
2066 (XtEventHandler)HandleIconBoxIconKeyPress,
2067 (XtPointer)NULL);
2068
2069
2070
2071 if (ICON_DECORATION(pCD) & ICON_ACTIVE_LABEL_PART)
2072 {
2073 XtAddEventHandler(iconWidget,
2074 FocusChangeMask,
2075 False,
2076 (XtEventHandler)ChangeActiveIconboxIconText,
2077 (XtPointer)NULL);
2078
2079 if (pCD->pSD->activeLabelParent != pCD->pSD->rootWindow)
2080 {
2081 XRaiseWindow (DISPLAY, pCD->pSD->activeIconTextWin);
2082 }
2083 }
2084
2085 #ifdef WSM
2086 ResetIconBoxMaxSize(pWsc->pIconBox->pCD_iconBox,
2087 pWsc->pIconBox->bBoardWidget);
2088
2089 ResetArrowButtonIncrements (pWsc->pIconBox->pCD_iconBox);
2090
2091 #else /* WSM */
2092 ResetIconBoxMaxSize(P_ICON_BOX(pCD)->pCD_iconBox,
2093 P_ICON_BOX(pCD)->bBoardWidget);
2094
2095 ResetArrowButtonIncrements (P_ICON_BOX(pCD)->pCD_iconBox);
2096
2097 #endif /* WSM */
2098 rval = True;
2099 }
2100 }
2101 return(rval);
2102
2103 } /* END FUNCTION InsertIconIntoBox() */
2104
2105
2106
2107 /*************************************<->*************************************
2108 *
2109 * InsertIconInfo (pIBD, pCD, theWidget)
2110 *
2111 *
2112 * Description:
2113 * -----------
2114 * Finds next available spot and inserts the icon
2115 *
2116 *
2117 * Inputs:
2118 * ------
2119 * pIBD - pointer to icon box data
2120 * pCD - pointer to client data for this client
2121 * theWidget - widget containing the icon (may be null)
2122 *
2123 * Outputs:
2124 * -------
2125 *
2126 * Comments:
2127 * --------
2128 *
2129 *************************************<->***********************************/
2130
InsertIconInfo(pIBD,pCD,theWidget)2131 IconInfo *InsertIconInfo (pIBD, pCD, theWidget)
2132
2133 IconBoxData *pIBD;
2134 ClientData *pCD;
2135 Widget theWidget;
2136
2137 {
2138 IconInfo *pII;
2139 int place;
2140 int amt, i;
2141 Arg setArgs[3];
2142 Arg getArgs[4];
2143 Dimension clipWidth, clipHeight;
2144 #ifdef WSM
2145 WsClientData *pWsc;
2146 #endif /* WSM */
2147
2148 place = GetNextIconPlace (&pIBD->IPD);
2149 if (place == NO_ICON_PLACE)
2150 {
2151 if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
2152 {
2153 amt = pIBD->IPD.placementCols; /* add a new row */
2154 }
2155 else
2156 {
2157 amt = pIBD->IPD.placementRows; /* add a new column */
2158 }
2159
2160 if (!ExtendIconList (pIBD, amt))
2161 {
2162 Warning (((char *)GETMESSAGE(36, 4, "Insufficient memory to create icon box data")));
2163 return (NULL);
2164 }
2165
2166 if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
2167 {
2168 pIBD->IPD.placementRows++;
2169 }
2170 else
2171 {
2172 pIBD->IPD.placementCols++;
2173 }
2174 place = GetNextIconPlace (&pIBD->IPD);
2175 }
2176
2177 insertPosition = place;
2178
2179 /*
2180 * Update icon info values
2181 */
2182
2183 pII = &pIBD->IPD.placeList[place];
2184 pII->theWidget = theWidget;
2185
2186 pII->pCD = pCD;
2187
2188 #ifdef WSM
2189 pWsc = GetWsClientData (GetWorkspaceData (pCD->pSD, pIBD->wsID), pCD);
2190 pWsc->iconPlace = place;
2191
2192 CvtIconPlaceToPosition (&pIBD->IPD, pWsc->iconPlace,
2193 &pWsc->iconX, &pWsc->iconY);
2194
2195
2196 /* update next free position */
2197
2198 pIBD->currentCol = pWsc->iconX / pIBD->pCD_iconBox->widthInc;
2199 pIBD->currentRow = pWsc->iconY / pIBD->pCD_iconBox->heightInc;
2200
2201 #else /* WSM */
2202 ICON_PLACE(pCD) = place;
2203
2204 CvtIconPlaceToPosition (&pIBD->IPD, ICON_PLACE(pCD),
2205 &ICON_X(pCD), &ICON_Y(pCD));
2206
2207
2208 /* update next free position */
2209
2210 pIBD->currentCol = ICON_X(pCD) / pIBD->pCD_iconBox->widthInc;
2211 pIBD->currentRow = ICON_Y(pCD) / pIBD->pCD_iconBox->heightInc;
2212
2213 #endif /* WSM */
2214
2215 /*
2216 * Increase bboard size if necessary
2217 */
2218 i = 0;
2219 XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &clipWidth ); i++;
2220 XtSetArg (getArgs[i], XmNheight, (XtArgVal) &clipHeight ); i++;
2221 XtGetValues (pIBD->clipWidget, getArgs, i);
2222
2223 i = 0;
2224 if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
2225 {
2226 if (pIBD->currentCol > pIBD->lastCol)
2227 {
2228 pIBD->lastCol = pIBD->currentCol;
2229 }
2230
2231 if (pIBD->currentRow > pIBD->lastRow)
2232 {
2233 pIBD->lastRow = pIBD->currentRow;
2234 #ifdef WSM
2235 if (clipHeight <= (Dimension) (pWsc->iconY +
2236 pIBD->pCD_iconBox->heightInc))
2237 {
2238 /*
2239 * Increase bulletin board height as needed.
2240 */
2241 XtSetArg (setArgs[i], XmNheight, (XtArgVal)
2242 pWsc->iconY + pIBD->pCD_iconBox->heightInc); i++;
2243 }
2244 #else /* WSM */
2245 if (clipHeight <= (pII->pCD->iconY + pIBD->pCD_iconBox->heightInc))
2246 {
2247 /*
2248 * Increase bulletin board height as needed.
2249 */
2250 XtSetArg (setArgs[i], XmNheight, (XtArgVal)
2251 pII->pCD->iconY + pIBD->pCD_iconBox->heightInc); i++;
2252 }
2253 #endif /* WSM */
2254 }
2255 }
2256 else
2257 {
2258 if (pIBD->currentCol > pIBD->lastCol)
2259 {
2260 pIBD->lastCol = pIBD->currentCol;
2261 #ifdef WSM
2262 if (clipWidth <= (Dimension)
2263 (pWsc->iconX + pIBD->pCD_iconBox->widthInc))
2264 {
2265 /*
2266 * Increase bulletin board width as needed
2267 */
2268 XtSetArg (setArgs[i], XmNwidth,
2269 (XtArgVal) pWsc->iconX +
2270 pIBD->pCD_iconBox->widthInc); i++;
2271 }
2272 #else /* WSM */
2273 if (clipWidth <= (pII->pCD->iconX + pIBD->pCD_iconBox->widthInc))
2274 {
2275 /*
2276 * Increase bulletin board width as needed
2277 */
2278 XtSetArg (setArgs[i], XmNwidth,
2279 (XtArgVal) pII->pCD->iconX +
2280 pIBD->pCD_iconBox->widthInc); i++;
2281 }
2282 #endif /* WSM */
2283 }
2284
2285 if (pIBD->currentRow > pIBD->lastRow)
2286 {
2287 pIBD->lastRow = pIBD->currentRow;
2288 }
2289 }
2290
2291 if (i > 0)
2292 {
2293 XtSetValues (pIBD->bBoardWidget, setArgs, i);
2294 }
2295
2296 return(pII);
2297
2298
2299
2300 } /* END OF FUNCTION InsertIconInfo */
2301
2302
2303
2304 /*************************************<->*************************************
2305 *
2306 * DeleteIconFromBox
2307 *
2308 *
2309 * Description:
2310 * -----------
2311 * XXDescription ...
2312 *
2313 *************************************<->***********************************/
2314
DeleteIconFromBox(IconBoxData * pIBD,ClientData * pCD)2315 void DeleteIconFromBox (IconBoxData *pIBD, ClientData *pCD)
2316 {
2317 Widget theChild;
2318 ClientData *pCD_tmp;
2319 Arg args[4];
2320 Dimension clipWidth, clipHeight;
2321 Dimension oldWidth, oldHeight;
2322 int newWidth, newHeight;
2323 int i, newCols, newRows;
2324 #ifdef WSM
2325 WmWorkspaceData *pWS = GetWorkspaceData (pCD->pSD, pIBD->wsID);
2326 WsClientData *pWsc;
2327
2328 pWsc = GetWsClientData (pWS, pCD);
2329 #endif /* WSM */
2330
2331 i = 0;
2332 XtSetArg (args[i], XmNwidth, (XtArgVal) &oldWidth ); i++;
2333 XtSetArg (args[i], XmNheight, (XtArgVal) &oldHeight ); i++;
2334 XtGetValues (pIBD->bBoardWidget, args, i);
2335
2336 i = 0;
2337 XtSetArg (args[i], XmNwidth, (XtArgVal) &clipWidth); i++;
2338 XtSetArg (args[i], XmNheight, (XtArgVal) &clipHeight ); i++;
2339 XtGetValues (pIBD->clipWidget, args, i);
2340
2341 clipHeight /= (Dimension) pIBD->pCD_iconBox->heightInc;
2342 clipWidth /= (Dimension) pIBD->pCD_iconBox->widthInc;
2343
2344 /*
2345 * find context of the activeIconTextWin to get pCD and then
2346 * if it is the same as this client, hide it.
2347 */
2348
2349 if (!(XFindContext (DISPLAY, pCD->pSD->activeIconTextWin,
2350 wmGD.windowContextType, (caddr_t *)&pCD_tmp)))
2351 {
2352 if (pCD == pCD_tmp)
2353 {
2354 /* hide activeIconTextWin */
2355 HideActiveIconText ((WmScreenData *)NULL);
2356 }
2357 }
2358
2359 #ifdef WSM
2360 DeleteIconInfo (pWsc->pIconBox, pCD);
2361
2362 pWsc->pIconBox->numberOfIcons--;
2363
2364 theChild = XtWindowToWidget (DISPLAY, pWsc->iconFrameWin);
2365
2366 pWsc->pIconBox = NULL;
2367 pWsc->iconPlace = NO_ICON_PLACE;
2368 #else /* WSM */
2369 DeleteIconInfo (P_ICON_BOX(pCD), pCD);
2370
2371 pCD->pIconBox->numberOfIcons--;
2372
2373 theChild = XtWindowToWidget (DISPLAY, ICON_FRAME_WIN(pCD));
2374 #endif /* WSM */
2375 XtUnmanageChild (theChild);
2376
2377 XtDestroyWidget (theChild);
2378
2379 /* update last row and col */
2380
2381 SetNewBounds (pIBD);
2382
2383 /* resize Bulletin board (so scroll bars show correctly */
2384 i = 0;
2385
2386 if (clipWidth <= (Dimension) (pIBD->lastCol + 1))
2387 {
2388 newWidth = (pIBD->lastCol + 1) * pIBD->pCD_iconBox->widthInc;
2389 XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++;
2390 newCols = newWidth / pIBD->pCD_iconBox->widthInc;
2391 }
2392 else
2393 {
2394 newWidth = clipWidth * pIBD->pCD_iconBox->widthInc;
2395 XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++;
2396 newCols = newWidth / pIBD->pCD_iconBox->widthInc;
2397 }
2398
2399 if (clipHeight <= (Dimension) (pIBD->lastRow + 1))
2400 {
2401 /* set height of bboard */
2402 newHeight = (pIBD->lastRow + 1) * pIBD->pCD_iconBox->heightInc;
2403 XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++;
2404 newRows = newHeight / pIBD->pCD_iconBox->heightInc;
2405 }
2406 else
2407 {
2408 newHeight = clipHeight * pIBD->pCD_iconBox->heightInc;
2409 XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++;
2410 newRows = newHeight / pIBD->pCD_iconBox->heightInc;
2411 }
2412
2413 if (i > 0 && ExpandVirtualSpace(pIBD, newWidth, newHeight))
2414 {
2415 XtSetValues (pIBD->bBoardWidget, args, i);
2416 RealignIconList (pIBD, newCols, newRows);
2417 pIBD->IPD.placementCols = newCols;
2418 pIBD->IPD.placementRows = newRows;
2419 }
2420
2421
2422 /* reset max size for icon box */
2423 ResetIconBoxMaxSize(pIBD->pCD_iconBox, pIBD->bBoardWidget);
2424
2425 ResetArrowButtonIncrements (pIBD->pCD_iconBox);
2426
2427 } /* END FUNCTION DeleteIconFromBox */
2428
2429
2430
2431 /*************************************<->*************************************
2432 *
2433 * DeleteIconInfo (pIBD, pCD)
2434 *
2435 *
2436 * Description:
2437 * -----------
2438 * Deletes an icon info record from the icon box list based on the
2439 * client data pointer.
2440 *
2441 *
2442 * Inputs:
2443 * ------
2444 * pIBD - pointer to icon box data
2445 * pCD - pointer to client data
2446 *
2447 * Outputs:
2448 * -------
2449 *
2450 *
2451 * Comments:
2452 * --------
2453 * o The deleted item is freed
2454 * o Is pCD the correct key???? !!!
2455 *
2456 *************************************<->***********************************/
DeleteIconInfo(IconBoxData * pIBD,ClientData * pCD)2457 void DeleteIconInfo (IconBoxData *pIBD, ClientData *pCD)
2458 {
2459 int ix, count;
2460 IconInfo *pII;
2461
2462 /* find first matching entry in list */
2463
2464 pII = &pIBD->IPD.placeList[0];
2465 count = pIBD->IPD.totalPlaces;
2466
2467 for (ix = 0; ix < count && pII->pCD != pCD; ix++, pII++)
2468 {
2469 }
2470
2471 if (ix < count)
2472 {
2473 /* found it, zero the entry out */
2474 pII->theWidget = NULL;
2475 pII->pCD = NULL;
2476 }
2477
2478
2479 } /* END FUNCTION DeleteIconInfo */
2480
2481
2482
2483 /*************************************<->*************************************
2484 *
2485 * ResetIconBoxMaxSize(pCD, bBoardWidget)
2486 *
2487 *
2488 * Description:
2489 * -----------
2490 * XXDescription ...
2491 *
2492 *************************************<->***********************************/
2493
ResetIconBoxMaxSize(ClientData * pCD,Widget bBoardWidget)2494 void ResetIconBoxMaxSize (ClientData *pCD, Widget bBoardWidget)
2495 {
2496 int i;
2497 Arg getArgs[3];
2498 Dimension newWidth;
2499 Dimension newHeight;
2500
2501 i=0;
2502 XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &newWidth ); i++;
2503 XtSetArg (getArgs[i], XmNheight, (XtArgVal) &newHeight ); i++;
2504 XtGetValues (bBoardWidget, getArgs, i);
2505
2506 pCD->oldMaxWidth = pCD->maxWidth = newWidth + pCD->baseWidth;
2507
2508 pCD->oldMaxHeight = pCD->maxHeight = newHeight + pCD->baseHeight;
2509
2510 pCD->maxX = pCD->clientX;
2511 pCD->maxY = pCD->clientY;
2512 PlaceFrameOnScreen (pCD, &pCD->maxX, &pCD->maxY,
2513 pCD->maxWidth, pCD->maxHeight);
2514
2515 } /* END OF FUNCTION ResetIconBoxMaxSize */
2516
2517
2518
2519 /*************************************<->*************************************
2520 *
2521 * CheckIconBoxSize(pIBD)
2522 *
2523 *
2524 * Description:
2525 * -----------
2526 * XXDescription ...
2527 *
2528 *************************************<->***********************************/
2529
CheckIconBoxSize(IconBoxData * pIBD)2530 Boolean CheckIconBoxSize (IconBoxData *pIBD)
2531 {
2532 int i;
2533 Arg getArgs[3];
2534 Arg setArgs[3];
2535 Dimension oldWidth;
2536 Dimension oldHeight;
2537 Dimension newWidth;
2538 Dimension newHeight;
2539 int oldCol, oldRow;
2540 Boolean rval = True;
2541
2542 i=0;
2543 XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &oldWidth ); i++;
2544 XtSetArg (getArgs[i], XmNheight, (XtArgVal) &oldHeight ); i++;
2545 XtGetValues (pIBD->bBoardWidget, getArgs, i);
2546
2547 newWidth = oldWidth;
2548 newHeight = oldHeight;
2549 oldCol = oldWidth / (Dimension) pIBD->pCD_iconBox->widthInc;
2550 oldRow = oldHeight / (Dimension) pIBD->pCD_iconBox->heightInc;
2551
2552 /*
2553 * Increase bboard size if necessary
2554 */
2555
2556 i = 0;
2557 if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
2558 {
2559 if (oldRow < pIBD->lastRow + 1)
2560 {
2561 /*
2562 * increase bulletin board height as needed
2563 */
2564 newHeight = (pIBD->lastRow * pIBD->pCD_iconBox->heightInc)
2565 + pIBD->pCD_iconBox->heightInc;
2566
2567 XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight); i++;
2568 }
2569 }
2570 else
2571 {
2572 if (oldCol < pIBD->lastCol + 1)
2573 {
2574 /*
2575 * increase bulletin board width as needed
2576 */
2577 newWidth = (pIBD->lastCol * pIBD->pCD_iconBox->widthInc)
2578 + pIBD->pCD_iconBox->widthInc;
2579
2580 XtSetArg (setArgs[i], XmNwidth, newWidth); i++;
2581 }
2582 }
2583
2584 if (i > 0)
2585 {
2586 if (! ExpandVirtualSpace(pIBD, newWidth, newHeight))
2587 {
2588 /*
2589 * The user has resized the iconbox larger than
2590 * memory will allow. Don't honor the resize request
2591 */
2592 rval = False;
2593 return(rval);
2594 }
2595 XtSetValues (pIBD->bBoardWidget, setArgs, i);
2596 }
2597
2598 ResetIconBoxMaxSize(pIBD->pCD_iconBox, pIBD->bBoardWidget);
2599
2600
2601 return(rval);
2602
2603 } /* END OF FUNCTION CheckIconBoxSize */
2604
2605
2606
2607 /*************************************<->*************************************
2608 *
2609 * CheckIconBoxResize(pCD, changedValues)
2610 *
2611 *
2612 * Description:
2613 * -----------
2614 * XXDescription ...
2615 *
2616 *************************************<->***********************************/
2617
CheckIconBoxResize(ClientData * pCD,unsigned int changedValues,int newWidth,int newHeight)2618 void CheckIconBoxResize (ClientData *pCD, unsigned int changedValues, int newWidth, int newHeight)
2619 {
2620
2621 Boolean packVert = False;
2622 Boolean packHorz = False;
2623 WmScreenData *pSD;
2624
2625 IconBoxData *pIBD;
2626 IconPlacementData *pIPD;
2627 int i, newCols, newRows;
2628 Arg getArgs[3];
2629 Arg setArgs[3];
2630 Dimension oldWidth;
2631 Dimension oldHeight;
2632
2633 pIPD = &pCD->thisIconBox->IPD;
2634 pIBD = pCD->thisIconBox;
2635
2636 pSD = &(wmGD.Screens[SCREEN_FOR_CLIENT(pCD)]);
2637
2638
2639 i=0;
2640 XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &oldWidth ); i++;
2641 XtSetArg (getArgs[i], XmNheight, (XtArgVal) &oldHeight ); i++;
2642 XtGetValues (pIBD->bBoardWidget, getArgs, i);
2643
2644 newCols = pIPD->placementCols;
2645 newRows = pIPD->placementRows;
2646 newWidth = newWidth - pCD->baseWidth;
2647 newHeight = newHeight - pCD->baseHeight;
2648
2649 i = 0;
2650
2651 if (changedValues & CWWidth)
2652 {
2653 /*
2654 * There was a change in Width, see if we need to change the
2655 * bulletin board
2656 */
2657 if (newWidth > (int) oldWidth)
2658 {
2659 newCols = newWidth / pCD->widthInc;
2660 XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++;
2661 }
2662
2663 if (newWidth < (int) oldWidth)
2664 {
2665 if ((!strcmp(pSD->iconBoxSBDisplayPolicy, szvertical)) &&
2666 (newWidth / pCD->widthInc < pIBD->lastCol + 1))
2667 {
2668 XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++;
2669 newCols = newWidth / pCD->widthInc;
2670 packVert = True;
2671 }
2672 else if (newWidth / pCD->widthInc < pIBD->lastCol + 1)
2673 {
2674 newWidth = (pIBD->lastCol +1) * pCD->widthInc;
2675 XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++;
2676 }
2677 else
2678 {
2679 newCols = newWidth / pCD->widthInc;
2680 XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++;
2681 }
2682 }
2683 }
2684 else
2685 {
2686 newWidth = oldWidth;
2687 }
2688
2689 if (changedValues & CWHeight)
2690 {
2691 /*
2692 * There was a change in Height, see if we need to change the
2693 * bulletin board
2694 */
2695 if (newHeight > (int) oldHeight)
2696 {
2697 newRows = newHeight / pCD->heightInc;
2698 XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++;
2699 }
2700
2701 if (newHeight < (int) oldHeight)
2702 {
2703 if ((!strcmp(pSD->iconBoxSBDisplayPolicy, szhorizontal)) &&
2704 (newHeight / pCD->heightInc < pIBD->lastRow + 1))
2705 {
2706 XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++;
2707 newRows = newHeight / pCD->heightInc;
2708 packHorz = True;
2709 }
2710 else if (newHeight / pCD->heightInc < pIBD->lastRow + 1)
2711 {
2712 newHeight = (pIBD->lastRow + 1) * pCD->heightInc;
2713 XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++;
2714 }
2715 else
2716 {
2717 newRows = newHeight / pCD->heightInc;
2718 XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++;
2719 }
2720 }
2721 }
2722 else
2723 {
2724 newHeight = oldHeight;
2725 }
2726
2727 if ( i >0 && ExpandVirtualSpace(pIBD, newWidth, newHeight))
2728 {
2729 XtSetValues (pIBD->bBoardWidget, setArgs, i);
2730 }
2731
2732 RealignIconList (pIBD, newCols, newRows);
2733
2734 pIPD->placementCols = newCols;
2735 pIPD->placementRows = newRows;
2736
2737 ResetIconBoxMaxSize(pCD, pIBD->bBoardWidget);
2738
2739 /*
2740 * Pack the icon box if there are icons that can no longer
2741 * be scrolled to due to iconBoxSBDisplayPolicy.
2742 */
2743 if (packVert)
2744 {
2745 PackIconBox (pIBD, packVert, False , newWidth, 0);
2746 }
2747 else if (packHorz)
2748 {
2749 PackIconBox (pIBD, False, packHorz , 0, newHeight);
2750 }
2751
2752
2753 } /* END OF FUNCTION CheckIconBoxResize */
2754
2755
2756
2757 /*************************************<->*************************************
2758 *
2759 * ExpandVirtualSpace (pIBD, newWidth, newHeight)
2760 *
2761 *
2762 * Description:
2763 * -----------
2764 * Add virtural space (really the icon list )
2765 *
2766 *
2767 * Inputs:
2768 * ------
2769 * pIBD - ptr to icon box data
2770 *
2771 *
2772 * Outputs:
2773 * -------
2774 * Return - True if successful, False otherwise
2775 *
2776 * Comments:
2777 * --------
2778 *
2779 *************************************<->***********************************/
2780
ExpandVirtualSpace(IconBoxData * pIBD,int newWidth,int newHeight)2781 Boolean ExpandVirtualSpace (IconBoxData *pIBD, int newWidth, int newHeight)
2782 {
2783 Boolean rval = True;
2784 int newSize;
2785 int increment;
2786
2787 newSize = (newWidth / pIBD->pCD_iconBox->widthInc) *
2788 (newHeight / pIBD->pCD_iconBox->heightInc);
2789
2790 if (newSize > pIBD->IPD.totalPlaces )
2791 {
2792 increment = newSize - pIBD->IPD.totalPlaces;
2793 rval = ExtendIconList (pIBD, increment);
2794 }
2795
2796 return (rval);
2797
2798 } /* END OF FUNCTION ExpandVirtualSpace */
2799
2800
2801
2802 /*************************************<->*************************************
2803 *
2804 * ExtendIconList (pIBD, incr);
2805 *
2806 *
2807 * Description:
2808 * -----------
2809 * Add space to the icon list
2810 *
2811 *
2812 * Inputs:
2813 * ------
2814 * pIBD - ptr to icon box data
2815 * incr - number of cells to add
2816 *
2817 *
2818 * Outputs:
2819 * -------
2820 * Return - True if successful, False otherwise
2821 *
2822 * Comments:
2823 * --------
2824 *
2825 *************************************<->***********************************/
2826
ExtendIconList(IconBoxData * pIBD,int incr)2827 Boolean ExtendIconList (IconBoxData *pIBD, int incr)
2828 {
2829 Boolean rval;
2830 int newSize;
2831 IconInfo *pTmp;
2832
2833 newSize = pIBD->IPD.totalPlaces + incr;
2834
2835 if ((pTmp = (IconInfo *) XtMalloc (newSize*sizeof(IconInfo))) != NULL)
2836 {
2837 /* copy data */
2838 memcpy (pTmp, pIBD->IPD.placeList,
2839 pIBD->IPD.totalPlaces*sizeof(IconInfo));
2840 memset (&pTmp[pIBD->IPD.totalPlaces], 0, incr*sizeof(IconInfo));
2841
2842 /* out with the old, in with the new */
2843 XtFree ((char *)pIBD->IPD.placeList);
2844 pIBD->IPD.placeList = pTmp;
2845 pIBD->IPD.totalPlaces = newSize;
2846 rval = True;
2847 }
2848 else
2849 {
2850 rval = False;
2851 }
2852
2853 return (rval);
2854 } /* END OF FUNCTION ExtendIconList */
2855
2856
2857
2858 /*************************************<->*************************************
2859 *
2860 * PackIconBox(pIBD, packVert, packHorz, passedInWidth, passedInHeight)
2861 *
2862 *
2863 * Description:
2864 * -----------
2865 * Packs the icons in the icon box
2866 *
2867 *
2868 * Inputs:
2869 * ------
2870 * pIBD - pointer to icon box data
2871 *
2872 *
2873 * Outputs:
2874 * -------
2875 *
2876 *
2877 * Comments:
2878 * --------
2879 *
2880 *************************************<->***********************************/
PackIconBox(IconBoxData * pIBD,Boolean packVert,Boolean packHorz,int passedInWidth,int passedInHeight)2881 void PackIconBox (IconBoxData *pIBD, Boolean packVert, Boolean packHorz, int passedInWidth, int passedInHeight)
2882 {
2883 IconInfo *pII_2, *pII_1;
2884 int ix1, ix2;
2885 int count;
2886 int newX, newY;
2887 ClientData *pCD_tmp, *pMyCD;
2888 int hasActiveText = 1;
2889 Arg args[4];
2890 Dimension majorDimension, minorDimension;
2891 Dimension oldWidth, oldHeight;
2892 int newWidth, newHeight;
2893 int i;
2894 Boolean rippling = False;
2895 #ifdef WSM
2896 WsClientData *pWsc;
2897 WmWorkspaceData *pWS;
2898 #endif /* WSM */
2899
2900 i = 0;
2901 XtSetArg (args[i], XmNwidth, (XtArgVal) &oldWidth ); i++;
2902 XtSetArg (args[i], XmNheight, (XtArgVal) &oldHeight ); i++;
2903 XtGetValues (pIBD->bBoardWidget, args, i);
2904
2905 /*
2906 * packing to visual space, first update IconBoxData
2907 */
2908
2909 i = 0;
2910
2911 if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
2912 {
2913 XtSetArg (args[i], XmNwidth, (XtArgVal) &majorDimension ); i++;
2914 XtSetArg (args[i], XmNheight, (XtArgVal) &minorDimension ); i++;
2915 XtGetValues (pIBD->clipWidget, args, i);
2916 if (packVert)
2917 {
2918 majorDimension = passedInWidth;
2919 }
2920
2921 minorDimension /= (Dimension) pIBD->pCD_iconBox->heightInc;
2922 majorDimension /= (Dimension) pIBD->pCD_iconBox->widthInc;
2923 if (majorDimension != pIBD->IPD.placementCols)
2924 {
2925 pIBD->IPD.placementCols = majorDimension;
2926 if (pIBD->IPD.placementCols == 0) pIBD->IPD.placementCols++;
2927 }
2928 }
2929 else
2930 {
2931 XtSetArg (args[i], XmNheight, (XtArgVal) &majorDimension ); i++;
2932 XtSetArg (args[i], XmNwidth, (XtArgVal) &minorDimension ); i++;
2933 XtGetValues (pIBD->clipWidget, args, i);
2934 if (packHorz)
2935 {
2936 majorDimension = passedInHeight;
2937 }
2938
2939 minorDimension /= (Dimension) pIBD->pCD_iconBox->widthInc;
2940 majorDimension /= (Dimension) pIBD->pCD_iconBox->heightInc;
2941 if (majorDimension != pIBD->IPD.placementRows)
2942 {
2943 pIBD->IPD.placementRows = majorDimension;
2944 if (pIBD->IPD.placementRows == 0) pIBD->IPD.placementRows++;
2945 }
2946 }
2947
2948 /*
2949 * find context of the activeIconTextWin to get pCD and then
2950 * if it is the same as this client, hide it.
2951 */
2952
2953 pMyCD = pIBD->pCD_iconBox;
2954 if (ICON_DECORATION(pMyCD) & ICON_ACTIVE_LABEL_PART)
2955 {
2956 if (XFindContext (DISPLAY, pMyCD->pSD->activeIconTextWin,
2957 wmGD.windowContextType, (caddr_t *)&pCD_tmp))
2958 {
2959 hasActiveText = 0;
2960 }
2961 }
2962
2963 pII_2 = pII_1 = pIBD->IPD.placeList;
2964 ix1 = ix2 = 0;
2965 count = pIBD->IPD.totalPlaces;
2966
2967 while (ix1 < count)
2968 {
2969 if (!rippling && (pII_2->pCD != NULL))
2970 {
2971 /*
2972 * We need to start rippling the icons into new positions if
2973 * their (x,y) position changed
2974 */
2975 #ifdef WSM
2976 pWS = GetWorkspaceData (pII_2->pCD->pSD, pIBD->wsID);
2977 pWsc = GetWsClientData (pWS, pII_2->pCD);
2978 CvtIconPlaceToPosition (&pIBD->IPD, pWsc->iconPlace,
2979 &newX, &newY);
2980
2981 rippling = ((newX != pWsc->iconX) ||
2982 (newY != pWsc->iconY));
2983 #else /* WSM */
2984 CvtIconPlaceToPosition (&pIBD->IPD, pII_2->pCD->iconPlace,
2985 &newX, &newY);
2986
2987 rippling = ((newX != pII_2->pCD->iconX) ||
2988 (newY != pII_2->pCD->iconY));
2989 #endif /* WSM */
2990 }
2991
2992 if ((pII_2->pCD == NULL) || rippling)
2993 {
2994 /* find next one to move */
2995 while ((ix1 < count) && (pII_1->pCD == NULL))
2996 {
2997 ix1++;
2998 pII_1++;
2999 }
3000
3001 if ((ix1 < count) && (pII_1->pCD != NULL))
3002 {
3003 if (ix1 != ix2)
3004 {
3005 MoveIconInfo (&pIBD->IPD, ix1, ix2);
3006 }
3007
3008 CvtIconPlaceToPosition (&pIBD->IPD, ix2, &newX, &newY);
3009
3010 #ifdef WSM
3011 pWS = GetWorkspaceData (pII_2->pCD->pSD, pIBD->wsID);
3012 pWsc = GetWsClientData (pWS, pII_2->pCD);
3013 pWsc->iconX = newX;
3014 pWsc->iconY = newY;
3015 #else /* WSM */
3016 pII_2->pCD->iconX = newX;
3017 pII_2->pCD->iconY = newY;
3018 #endif /* WSM */
3019
3020 if (hasActiveText && (pII_2->pCD == pCD_tmp))
3021 {
3022 /* hide activeIconTextWin first */
3023 HideActiveIconText ((WmScreenData *)NULL);
3024 XtMoveWidget (pII_2->theWidget, newX, newY);
3025 ShowActiveIconText (pII_2->pCD);
3026 }
3027 else
3028 {
3029 XtMoveWidget (pII_2->theWidget, newX, newY);
3030 }
3031 }
3032 }
3033
3034 if (ix1 < count)
3035 {
3036 ix2++;
3037 pII_2++;
3038 }
3039
3040 ix1++;
3041 pII_1++;
3042 }
3043
3044 /* update last row and col */
3045
3046 SetNewBounds (pIBD);
3047
3048 /* resize Bulletin board (so scroll bars show correctly */
3049 i = 0;
3050 if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
3051 {
3052 if (majorDimension <= (Dimension) (pIBD->lastCol + 1))
3053 {
3054 newWidth = (pIBD->lastCol + 1) * pIBD->pCD_iconBox->widthInc;
3055 XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++;
3056 }
3057 else
3058 {
3059 newWidth = oldWidth;
3060 }
3061
3062 if (minorDimension <= (Dimension) (pIBD->lastRow + 1))
3063 {
3064 /* set height of bboard */
3065 newHeight = (pIBD->lastRow + 1) * pIBD->pCD_iconBox->heightInc;
3066 XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++;
3067 }
3068 else
3069 {
3070 newHeight = minorDimension * pIBD->pCD_iconBox->heightInc;
3071 XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++;
3072 }
3073 }
3074 else
3075 {
3076 if (majorDimension <= (Dimension) (pIBD->lastRow + 1))
3077 {
3078 newHeight = (pIBD->lastRow + 1) * pIBD->pCD_iconBox->heightInc;
3079 XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++;
3080 }
3081 else
3082 {
3083 newHeight = oldHeight;
3084 }
3085
3086 if (minorDimension <= (Dimension) (pIBD->lastCol + 1))
3087 {
3088 /* set width of bboard */
3089 newWidth = (pIBD->lastCol + 1) * pIBD->pCD_iconBox->widthInc;
3090 XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++;
3091 }
3092 else
3093 {
3094 newWidth = minorDimension * pIBD->pCD_iconBox->widthInc;
3095 XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++;
3096 }
3097 }
3098
3099 if (i > 0 && ExpandVirtualSpace(pIBD, newWidth, newHeight))
3100 {
3101 XtSetValues (pIBD->bBoardWidget, args, i);
3102 }
3103
3104
3105 /* reset max size for icon box */
3106
3107 ResetIconBoxMaxSize (pIBD->pCD_iconBox, pIBD->bBoardWidget);
3108
3109 ResetArrowButtonIncrements (pIBD->pCD_iconBox);
3110
3111 } /* END FUNCTION PackIconBox */
3112
3113
3114 /*************************************<->*************************************
3115 *
3116 * RealignIconList (pIBD, newRows, newCols)
3117 *
3118 *
3119 * Description:
3120 * -----------
3121 * Realigns the icon list according to the new virtual space dimensions
3122 *
3123 *
3124 * Inputs:
3125 * ------
3126 * pIBD - ptr to icon box data
3127 * newRows - new number of rows
3128 * newCols - new number of columns
3129 *
3130 *
3131 * Outputs:
3132 * -------
3133 *
3134 * Comments:
3135 * --------
3136 * o The placement data structure contains the old values.
3137 *
3138 *************************************<->***********************************/
3139
RealignIconList(IconBoxData * pIBD,int newCols,int newRows)3140 void RealignIconList (IconBoxData *pIBD, int newCols, int newRows)
3141 {
3142 int c1, c2, ix1, ix2;
3143 int oldRows, oldCols;
3144 IconPlacementData ipdNew;
3145 IconInfo *pII;
3146
3147 /*
3148 * create new icon placement data for ease of calling conversion
3149 * routines.
3150 */
3151 ipdNew.onRootWindow = pIBD->IPD.onRootWindow;
3152 ipdNew.iconPlacement = pIBD->IPD.iconPlacement;
3153 ipdNew.placementRows = newRows;
3154 ipdNew.placementCols = newCols;
3155 ipdNew.iPlaceW = pIBD->IPD.iPlaceW;
3156 ipdNew.iPlaceH = pIBD->IPD.iPlaceH;
3157 ipdNew.placeList = pIBD->IPD.placeList;
3158 ipdNew.totalPlaces = pIBD->IPD.totalPlaces;
3159
3160 oldRows = pIBD->IPD.placementRows;
3161 oldCols = pIBD->IPD.placementCols;
3162
3163 /*
3164 * Use the new organization and placement discipline to
3165 * determine how to move the icon info data around.
3166 */
3167 if (((oldRows < newRows) &&
3168 (pIBD->IPD.iconPlacement & ICON_PLACE_TOP_PRIMARY)) ||
3169 ((oldCols < newCols) &&
3170 (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)))
3171 {
3172 /*
3173 * work backwards
3174 */
3175 for (ix1 = pIBD->IPD.totalPlaces - 1,
3176 pII = &pIBD->IPD.placeList[ix1]; ix1 >= 0; ix1--, pII--)
3177 {
3178 if (pII->pCD != NULL)
3179 {
3180 CvtIconPlaceToPosition (&pIBD->IPD, ix1, &c1, &c2);
3181 ix2 = CvtIconPositionToPlace (&ipdNew, c1, c2);
3182 if (ix1 != ix2)
3183 {
3184 MoveIconInfo (&pIBD->IPD, ix1, ix2);
3185 }
3186 }
3187 }
3188 }
3189 else
3190 if (((oldRows > newRows) &&
3191 (pIBD->IPD.iconPlacement & ICON_PLACE_TOP_PRIMARY)) ||
3192 ((oldCols > newCols) &&
3193 (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)))
3194 {
3195 /*
3196 * work forwards
3197 */
3198 for (ix1 = 0, pII = &pIBD->IPD.placeList[ix1];
3199 ix1 < pIBD->IPD.totalPlaces; ix1++, pII++)
3200 {
3201 if (pII->pCD != NULL)
3202 {
3203 CvtIconPlaceToPosition (&pIBD->IPD, ix1, &c1, &c2);
3204 ix2 = CvtIconPositionToPlace (&ipdNew, c1, c2);
3205 if (ix1 != ix2)
3206 {
3207 MoveIconInfo (&pIBD->IPD, ix1, ix2);
3208 }
3209 }
3210 }
3211 }
3212
3213 /*
3214 * update info in placement structure to reflect new reality
3215 */
3216 pIBD->IPD.placementRows = newRows;
3217 pIBD->IPD.placementCols = newCols;
3218
3219 } /* END OF FUNCTION RealignIconList */
3220
3221
3222
3223
3224 /*************************************<->*************************************
3225 *
3226 * SetNewBounds (pIBD)
3227 *
3228 *
3229 * Description:
3230 * -----------
3231 *
3232 *
3233 * Inputs:
3234 * ------
3235 *
3236 *
3237 * Outputs:
3238 * -------
3239 *
3240 * Comments:
3241 * --------
3242 *
3243 *************************************<->***********************************/
3244
SetNewBounds(IconBoxData * pIBD)3245 void SetNewBounds (IconBoxData *pIBD)
3246 {
3247
3248 int i;
3249 int X = 0;
3250 int Y = 0;
3251 CompositeWidget cw;
3252 WidgetList children;
3253
3254 cw = (CompositeWidget) pIBD->bBoardWidget;
3255 children = cw->composite.children;
3256
3257 for (i = 0; i < cw->composite.num_children; i++)
3258 {
3259 if (children[i]->core.x > X)
3260 {
3261 X = children[i]->core.x;
3262 }
3263 if (children[i]->core.y > Y)
3264 {
3265 Y = children[i]->core.y;
3266 }
3267 }
3268
3269 pIBD->lastCol = X / pIBD->pCD_iconBox->widthInc;
3270 pIBD->lastRow = Y / pIBD->pCD_iconBox->heightInc;
3271
3272 } /* END OF FUNCTION SetNewBounds */
3273
3274
3275
3276 /*************************************<->*************************************
3277 *
3278 * InsertPosition (w)
3279 *
3280 *
3281 * Description:
3282 * -----------
3283 * This procedure is passed to the bulletin board at create time
3284 * to be used when a child is inserted into the bulletin board
3285 *
3286 *
3287 *************************************<->***********************************/
InsertPosition(Widget w)3288 Cardinal InsertPosition (Widget w)
3289 {
3290 return (insertPosition);
3291
3292 } /* END OF FUNCTION InsertPosition */
3293
3294
3295
3296 /*************************************<->*************************************
3297 *
3298 * ShowClientIconState ();
3299 *
3300 *
3301 * Description:
3302 * -----------
3303 * XXDescription ...
3304 *
3305 *************************************<->***********************************/
3306
ShowClientIconState(ClientData * pCD,int newState)3307 void ShowClientIconState (ClientData *pCD, int newState)
3308 {
3309
3310 /*
3311 * Changing the appearance of an icon window in the box to
3312 * reflect the client's state
3313 */
3314
3315 if ((newState == MINIMIZED_STATE) && (pCD->iconWindow))
3316 XMapRaised (DISPLAY, pCD->iconWindow);
3317
3318 if (((newState == NORMAL_STATE) || (newState == MAXIMIZED_STATE ))
3319 && (pCD->iconWindow))
3320 {
3321 XUnmapWindow (DISPLAY, pCD->iconWindow);
3322 }
3323
3324 } /* END FUNCTION ShowClientIconState */
3325
3326
3327
3328 #ifndef MOTIF_ONE_DOT_ONE
3329 /*************************************<->*************************************
3330 *
3331 * IconScrollVisibleCallback
3332 *
3333 *
3334 * Description:
3335 * -----------
3336 * for each icon in the icon box
3337 *
3338 *************************************<->***********************************/
3339
IconScrollVisibleCallback(Widget w,caddr_t client_data,XmAnyCallbackStruct * call_data)3340 void IconScrollVisibleCallback (Widget w, caddr_t client_data, XmAnyCallbackStruct *call_data)
3341 {
3342 XmTraverseObscuredCallbackStruct *vis_data;
3343
3344 vis_data = (XmTraverseObscuredCallbackStruct *) call_data;
3345
3346 XmScrollVisible(ACTIVE_WS->pIconBox->scrolledWidget,
3347 vis_data->traversal_destination,
3348 0,0);
3349 /*
3350 IB_MARGIN_WIDTH, IB_MARGIN_HEIGHT);
3351 */
3352 } /* END OF FUNCTION IconScrollVisibleCallback */
3353
3354 #endif
3355
3356
3357 /*************************************<->*************************************
3358 *
3359 * IconActivateCallback
3360 *
3361 *
3362 * Description:
3363 * -----------
3364 * for each icon in the icon box
3365 *
3366 *************************************<->***********************************/
3367
IconActivateCallback(Widget w,caddr_t client_data,XmAnyCallbackStruct * call_data)3368 void IconActivateCallback (Widget w, caddr_t client_data, XmAnyCallbackStruct *call_data)
3369 {
3370 ClientData *pCD;
3371 Window theIcon;
3372
3373 theIcon = XtWindow(w);
3374
3375 /*
3376 * find context to get pCD and then carry out
3377 * default action.
3378 */
3379
3380 if (!(XFindContext (DISPLAY, theIcon,
3381 wmGD.windowContextType, (caddr_t *)&pCD)))
3382 {
3383 F_Restore_And_Raise ((String)NULL, pCD, (XEvent *)NULL );
3384 /* F_Normalize_And_Raise ((String)NULL, pCD, (XEvent *)NULL );
3385 */ }
3386
3387 } /* END OF FUNCTION IconActivateCallback */
3388
3389
3390
3391 /*************************************<->*************************************
3392 *
3393 * UpdateIncrements
3394 *
3395 *
3396 * Description:
3397 * -----------
3398 * XXDescription ...
3399 *
3400 *************************************<->***********************************/
3401
UpdateIncrements(Widget sWidget,IconBoxData * pIBD,XConfigureEvent * event)3402 void UpdateIncrements (Widget sWidget, IconBoxData *pIBD, XConfigureEvent *event)
3403 {
3404 ResetArrowButtonIncrements (pIBD->pCD_iconBox);
3405
3406 } /* END OF FUNCTION UpdateIncrements */
3407
3408
3409 /*************************************<->*************************************
3410 *
3411 * ResetArrowButtonIncrements(pCD)
3412 *
3413 *************************************<->***********************************/
3414
ResetArrowButtonIncrements(ClientData * pCD)3415 void ResetArrowButtonIncrements (ClientData *pCD)
3416 {
3417 int i;
3418 Arg setArgs[2];
3419
3420 i=0;
3421 XtSetArg (setArgs[i], XmNincrement, (XtArgVal) pCD->heightInc); i++;
3422 XtSetValues (pCD->thisIconBox->vScrollBar, (ArgList) setArgs, i);
3423
3424 i=0;
3425 XtSetArg (setArgs[i], XmNincrement, (XtArgVal) pCD->widthInc); i++;
3426 XtSetValues (pCD->thisIconBox->hScrollBar, (ArgList) setArgs, i);
3427
3428 } /* END OF FUNCTION ResetArrowButtonIncrements */
3429
3430
3431
3432 /*************************************<->*************************************
3433 *
3434 * ChangeActiveIconboxIconText
3435 *
3436 *
3437 * Description:
3438 * -----------
3439 * XXDescription ...
3440 *
3441 *************************************<->***********************************/
3442
ChangeActiveIconboxIconText(Widget icon,caddr_t dummy,XFocusChangeEvent * event)3443 void ChangeActiveIconboxIconText (Widget icon, caddr_t dummy, XFocusChangeEvent *event)
3444 {
3445
3446 ClientData *pCD;
3447 Window theIcon;
3448
3449 /*
3450 * find context to get pCD and then hide or show active icon text.
3451 * Show/hide the active icon text only if the icon box is not
3452 * iconified.
3453 */
3454
3455 theIcon = XtWindow(icon);
3456
3457 if (!(XFindContext (DISPLAY, theIcon,
3458 wmGD.windowContextType, (caddr_t *)&pCD)) &&
3459 P_ICON_BOX(pCD) &&
3460 P_ICON_BOX(pCD)->pCD_iconBox &&
3461 P_ICON_BOX(pCD)->pCD_iconBox->clientState != MINIMIZED_STATE)
3462 {
3463 if (event->type == FocusIn)
3464 {
3465 if (event->send_event)
3466 {
3467 ShowActiveIconText (pCD);
3468 }
3469 }
3470 else
3471 {
3472 if (event->send_event)
3473 {
3474 HideActiveIconText (pCD->pSD);
3475 }
3476 }
3477 }
3478
3479 } /* END OF FUNCTION ChangeActiveIconboxIconText */
3480
3481
3482
3483 /*************************************<->*************************************
3484 *
3485 * HandleIconBoxIconKeyPress
3486 *
3487 *
3488 * Description:
3489 * -----------
3490 * This event handler catches keyevents for icons in the icon box and
3491 * passes them on to the standard key handling routine for mwm.
3492 *
3493 *************************************<->***********************************/
3494
HandleIconBoxIconKeyPress(Widget icon,caddr_t dummy,XKeyEvent * keyEvent)3495 void HandleIconBoxIconKeyPress (Widget icon, caddr_t dummy, XKeyEvent *keyEvent)
3496 {
3497
3498 Context context;
3499 ClientData *pCD;
3500 Window theIcon;
3501
3502 /*
3503 * find context to get pCD and then post menu show active icon text.
3504 */
3505
3506 theIcon = XtWindow(icon);
3507 if (!(XFindContext (DISPLAY, theIcon,
3508 wmGD.windowContextType, (caddr_t *)&pCD)))
3509 {
3510 #ifdef WSM
3511 SetClientWsIndex (pCD);
3512 #endif /* WSM */
3513 keyEvent->window = ICON_FRAME_WIN(pCD);
3514
3515 if (pCD->clientState == MINIMIZED_STATE)
3516 {
3517 context = F_SUBCONTEXT_IB_IICON;
3518 pCD->grabContext = F_SUBCONTEXT_IB_IICON;
3519 }
3520 else
3521 {
3522 context = F_SUBCONTEXT_IB_WICON;
3523 pCD->grabContext = F_SUBCONTEXT_IB_WICON;
3524 }
3525
3526 if(!(HandleKeyPress (keyEvent, ACTIVE_PSD->keySpecs,
3527 True, context, False, pCD)))
3528 {
3529 keyEvent->window = 0;
3530 keyEvent->type = 0;
3531 }
3532
3533 }
3534
3535 } /* END OF FUNCTION HandleIconBoxIconKeyPress */
3536
3537
3538 /*************************************<->*************************************
3539 *
3540 * HandleIconBoxButtonMotion
3541 *
3542 *
3543 * Description:
3544 * -----------
3545 * Event handler for button motion events on icon frame window in
3546 * in icon box.
3547 *
3548 *
3549 * Inputs:
3550 * ------
3551 * icon - widget for icon frame
3552 * client_data - extra client data
3553 * pev - ptr to event
3554 *
3555 *
3556 * Outputs:
3557 * -------
3558 *
3559 *
3560 * Comments:
3561 * --------
3562 * o This is added to make sure that ButtonXMotion gets added to the
3563 * event mask for icons in the icon box.
3564 *
3565 *************************************<->***********************************/
3566
HandleIconBoxButtonMotion(Widget icon,caddr_t client_data,XEvent * pev)3567 void HandleIconBoxButtonMotion (Widget icon, caddr_t client_data, XEvent *pev)
3568 {
3569
3570 } /* END OF FUNCTION HandleIconBoxButtonMotion */
3571
3572
3573
3574 /*************************************<->*************************************
3575 *
3576 * GetIconBoxIconRootXY (pCD, pX, pY)
3577 *
3578 *
3579 * Description:
3580 * -----------
3581 *
3582 *
3583 * Inputs:
3584 * ------
3585 * pCD - pointer to client data
3586 * pX - pointer to X return value
3587 * pY - pointer to Y return value
3588 *
3589 * Outputs:
3590 * -------
3591 *
3592 *
3593 * Comments:
3594 * --------
3595 * o returns root-window coords
3596 *
3597 *************************************<->***********************************/
GetIconBoxIconRootXY(ClientData * pCD,int * pX,int * pY)3598 void GetIconBoxIconRootXY (ClientData *pCD, int *pX, int *pY)
3599 {
3600
3601 Window child;
3602 #ifdef WSM
3603 WsClientData *pWsc = GetWsClientData (pCD->pSD->pActiveWS, pCD);
3604 #endif /* WSM */
3605
3606 #ifdef WSM
3607 if (pCD->pSD->useIconBox && pWsc->pIconBox)
3608 #else /* WSM */
3609 if (pCD->pSD->useIconBox && P_ICON_BOX(pCD))
3610 #endif /* WSM */
3611 {
3612 #ifdef WSM
3613 XTranslateCoordinates(DISPLAY,
3614 XtWindow(pWsc->pIconBox->bBoardWidget),
3615 ROOT_FOR_CLIENT(pCD),
3616 pWsc->iconX + IB_MARGIN_WIDTH,
3617 pWsc->iconY + IB_MARGIN_HEIGHT,
3618 pX, pY, &child);
3619 #else /* WSM */
3620 XTranslateCoordinates(DISPLAY,
3621 XtWindow(P_ICON_BOX(pCD)->bBoardWidget),
3622 ROOT_FOR_CLIENT(pCD),
3623 ICON_X(pCD) + IB_MARGIN_WIDTH,
3624 ICON_Y(pCD) + IB_MARGIN_HEIGHT,
3625 pX, pY, &child);
3626 #endif /* WSM */
3627
3628 }
3629 else
3630 {
3631 *pX = *pY = 0;
3632 }
3633 } /* END FUNCTION GetIconBoxIconRootXY */
3634
3635
3636 /*************************************<->*************************************
3637 *
3638 * IconVisible (pCD)
3639 *
3640 *
3641 * Description:
3642 * -----------
3643 *
3644 * Inputs:
3645 * ------
3646 * pCD - pointer to client data
3647 *
3648 * Outputs:
3649 * -------
3650 *
3651 *
3652 * Comments:
3653 * --------
3654 *
3655 *************************************<->***********************************/
IconVisible(ClientData * pCD)3656 Boolean IconVisible (ClientData *pCD)
3657 {
3658
3659 /*
3660 * May use icon->core.visible field if that gets fixed and
3661 * we want to accept the Intrinsics idea of what is visible.
3662 */
3663
3664 Boolean rval = True;
3665 #ifdef WSM
3666 WsClientData *pWsc = GetWsClientData (pCD->pSD->pActiveWS, pCD);
3667 #endif /* WSM */
3668
3669
3670
3671 int i;
3672 Arg getArgs[5];
3673
3674 Dimension tmpWidth = 0;
3675 Dimension tmpHeight = 0;
3676 Position clipX = 0;
3677 Position clipY = 0;
3678 Position tmpX = 0;
3679 Position tmpY = 0;
3680 int iconX, iconY;
3681
3682 i=0;
3683 XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &tmpWidth ); i++;
3684 XtSetArg (getArgs[i], XmNheight, (XtArgVal) &tmpHeight ); i++;
3685 XtSetArg (getArgs[i], XmNx, (XtArgVal) &tmpX ); i++;
3686 XtSetArg (getArgs[i], XmNy, (XtArgVal) &tmpY ); i++;
3687 #ifdef WSM
3688 XtGetValues (pWsc->pIconBox->clipWidget, getArgs, i);
3689 XtTranslateCoords(pWsc->pIconBox->scrolledWidget,
3690 tmpX, tmpY,
3691 &clipX, &clipY);
3692 #else /* WSM */
3693 XtGetValues (P_ICON_BOX(pCD)->clipWidget, getArgs, i);
3694 XtTranslateCoords(P_ICON_BOX(pCD)->scrolledWidget,
3695 tmpX, tmpY,
3696 &clipX, &clipY);
3697 #endif /* WSM */
3698
3699 GetIconBoxIconRootXY(pCD, &iconX, &iconY);
3700
3701
3702 /*
3703 * demand at least 2 pixels of the
3704 * real icon (not drawnButton) be showing
3705 */
3706
3707 if (iconX + 2 > ((int)clipX + (int)tmpWidth))
3708 {
3709 return(False);
3710 }
3711 if (iconY + 2 > ((int)clipY + (int)tmpHeight))
3712 {
3713 return(False);
3714 }
3715
3716 if ((iconX + (ICON_WIDTH(pCD) -2)) < (int)clipX)
3717 {
3718 return(False);
3719 }
3720 if ((iconY + (ICON_HEIGHT(pCD) -2)) < (int)clipY)
3721 {
3722 return(False);
3723 }
3724
3725 return(rval);
3726
3727 } /* END OF FUNCTION IconVisible */
3728
3729 /*************************************<->*************************************
3730 *
3731 * WmXmStringToString (xmString
3732 *
3733 *
3734 * Description:
3735 * -----------
3736 *
3737 *
3738 * Inputs:
3739 * ------
3740 *
3741 * Outputs:
3742 * -------
3743 *
3744 *
3745 * Comments:
3746 * --------
3747 * Return the ascii part of the first segment of an XmString
3748 * If xmString is NULL, then do nothing
3749 *
3750 *************************************<->***********************************/
3751
WmXmStringToString(XmString xmString)3752 String WmXmStringToString (XmString xmString)
3753 {
3754 XmStringContext xmStrContext;
3755 char *asciiString = NULL;
3756 XmStringCharSet ibTitleCharset;
3757 XmStringDirection ibTitleDirection;
3758 Boolean separator;
3759
3760 if (xmString)
3761 {
3762 XmStringInitContext (&xmStrContext, xmString);
3763
3764 XmStringGetNextSegment (xmStrContext, &asciiString,
3765 &ibTitleCharset, &ibTitleDirection,
3766 &separator);
3767
3768 if (ibTitleCharset != NULL)
3769 {
3770 XtFree ((char *)ibTitleCharset);
3771 }
3772
3773 XmStringFreeContext (xmStrContext);
3774 }
3775
3776 return(asciiString);
3777
3778 } /* END OF FUNCTION WmXmStringToString */
3779