WmIDecor.c 47 KB

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