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