1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514 |
- /*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them under the terms of the GNU
- * Lesser General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * These libraries and programs are distributed in the hope that
- * they will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
- /*
- * (c) Copyright 1989, 1990, 1991, 1992, 1993, 1994 OPEN SOFTWARE FOUNDATION, INC.
- * ALL RIGHTS RESERVED
- */
- /*
- * Motif Release 1.2.4
- */
- /*
- * (c) Copyright 1987, 1988, 1989, 1990, 1993, 1994 Hewlett-Packard Company
- * (c) Copyright 1993, 1994 International Business Machines Corp.
- * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
- * (c) Copyright 1993, 1994 Novell, Inc.
- */
- /*
- * Included Files:
- */
- #include "WmGlobal.h"
- #include "WmHelp.h"
- #include <X11/StringDefs.h>
- #include <X11/Intrinsic.h>
- #include <X11/Shell.h>
- #include <X11/Xutil.h>
- #include <X11/Vendor.h>
- #include <X11/keysymdef.h>
- #include <X11/keysym.h>
- #include <Xm/Xm.h>
- #include <Xm/DialogS.h>
- #include <Xm/Frame.h>
- #include <Xm/Label.h>
- #include <Xm/PushB.h>
- #include <Xm/DrawnB.h>
- #include <Xm/ScrolledW.h>
- #include <Xm/BulletinB.h>
- #include <Xm/ToggleB.h>
- #define MWM_NEED_IIMAGE
- #define MWM_NEED_GREYED75
- #define MWM_NEED_SLANT2
- #include "WmIBitmap.h"
- #include "WmResNames.h"
- #include <stdio.h>
- /*
- * include extern functions
- */
- #include "WmIconBox.h"
- #include "WmCDInfo.h"
- #include "WmError.h"
- #include "WmEvent.h"
- #include "WmFunction.h"
- #include "WmIDecor.h"
- #include "WmIPlace.h"
- #include "WmImage.h"
- #include "WmPanelP.h" /* for typedef in WmManage.h */
- #include "WmManage.h"
- #include "WmMenu.h"
- #include "WmResParse.h"
- #include "WmResource.h"
- #include "WmWinInfo.h"
- #include "WmWrkspace.h"
- #ifndef MAX
- #define MAX(a,b) ((a)>(b)?(a):(b))
- #endif
- /*
- * Global Variables:
- */
- Pixel select_color;
- Pixmap greyedPixmap;
- int frameShadowThickness;
- int firstTime = 1;
- Cardinal insertPosition = 0;
- #define DEFAULT_ICON_BOX_TITLE "Icons"
- Const char *szhorizontal = "horizontal";
- Const char *szvertical = "vertical";
- /*************************************<->*************************************
- *
- * InitIconBox (pSD)
- *
- *
- * Description:
- * -----------
- * This function controls creation of icon boxes
- *
- *
- *************************************<->***********************************/
- void InitIconBox (WmScreenData *pSD)
- {
- int iws;
- /*
- * Start the process of making the icon boxes
- */
- /*
- * Manage a separate icon box in every workspace
- * on this screen.
- */
- for (iws = 0; iws < pSD->numWorkspaces; iws++)
- {
- AddIconBoxForWorkspace (&pSD->pWS[iws]);
- }
- if (pSD->fadeNormalIcon)
- {
- MakeFadeIconGC (pSD);
- }
- } /* END OF FUNCTION InitIconBox */
- /*************************************<->*************************************
- *
- * AddIconBoxForWorkspace (pWS)
- *
- *
- * Description:
- * -----------
- * This function adds an iconbox to a workspace
- *
- *
- *************************************<->***********************************/
- void AddIconBoxForWorkspace (WmWorkspaceData *pWS)
- {
- extern WmWorkspaceData *pIconBoxInitialWS;
- pIconBoxInitialWS = pWS;
- ManageWindow (pWS->pSD, None, MANAGEW_ICON_BOX);
- } /* END OF FUNCTION AddIconBoxForWorkspace */
- /*************************************<->*************************************
- *
- * MakeIconBox (pWS, pCD);
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- * pWS = pointer to workspace data
- * pCD = a pointer to ClientData
- *
- *
- * Outputs:
- * -------
- *
- * Return = (Boolean) True iff successful.
- *
- *
- * Comments:
- * --------
- * If fails, frees the ClientData structure pointed to by pCD.
- *
- *************************************<->***********************************/
- Boolean MakeIconBox (WmWorkspaceData *pWS, ClientData *pCD)
- {
- IconBoxData *pIBD;
- /*
- * Make an icon box and return the pCD
- */
- if (pCD)
- {
- if (!(pIBD = (IconBoxData *)XtMalloc (sizeof (IconBoxData))))
- {
- /*
- * We need a pointer to icon box data to add to the
- * list of icon boxes linked to pWS->pIconBox. If
- * we can't allocate space we need to free the space
- * allocated for the ClientData structure
- */
- Warning (((char *)GETMESSAGE(36, 1, "Insufficient memory to create icon box data")));
- XtFree ((char *)pCD);
- return (FALSE);
- }
- InitializeIconBoxData (pWS, pIBD);
- InitializeClientData (pCD, pIBD);
- if (!(pIBD->IPD.placeList =
- (IconInfo *)XtMalloc (pIBD->IPD.totalPlaces * sizeof (IconInfo))))
- {
- Warning (((char *)GETMESSAGE(36, 2, "Insufficient memory to create icon box data")));
- XtFree ((char *)pIBD);
- XtFree ((char *)pCD);
- return (FALSE);
- }
- memset (pIBD->IPD.placeList, 0,
- pIBD->IPD.totalPlaces * sizeof (IconInfo));
- /*
- * Make the top level shell for this icon box
- */
- MakeShell (pWS, pIBD);
- /*
- * Make the scrolled window for this icon box
- */
- MakeScrolledWindow (pWS, pIBD);
- /*
- * Make the row column manager for this icon box
- */
- MakeBulletinBoard (pWS, pIBD);
- /*
- * Realize the widget tree and set client data fields
- */
- RealizeIconBox (pWS, pIBD, pCD);
- /*
- * Link the new icon box to list of icon boxes
- */
- AddNewBox (pWS, pIBD);
- }
-
- return (TRUE);
- } /* END OF FUNCTION MakeIconBox */
- /*************************************<->*************************************
- *
- * DestroyIconBox (pWS)
- *
- *
- * Description:
- * -----------
- * Destroys an icon box
- *
- *
- * Inputs:
- * ------
- * pWS = pointer to workspace data
- *
- *
- * Outputs:
- * -------
- *
- * Return = none
- *
- *
- * Comments:
- * --------
- * Used when deleting a workspace
- * Should be called AFTER all clients have been removed from the
- * workspace -- there should be no icons in the icon box.
- *
- *************************************<->***********************************/
- void DestroyIconBox (WmWorkspaceData *pWS)
- {
- IconBoxData *pIBD;
- pIBD = pWS->pIconBox;
- XtDestroyWidget (pIBD->shellWidget);
- UnManageWindow (pIBD->pCD_iconBox);
- XtFree ((char *) pIBD);
-
- } /* END OF FUNCTION DestroyIconBox */
- /*************************************<->*************************************
- *
- * MakeShell (pWS, pIBD)
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- * pWS = pointer to workspace data
- *
- * pIBD = pointer to IconBoxData
- *
- * XXinput = ...
- *
- *
- * Outputs:
- * -------
- *
- * pIBD->shellWidget
- *
- *
- * Comments:
- * --------
- * XXComments ...
- *
- *************************************<->***********************************/
- void MakeShell (WmWorkspaceData *pWS, IconBoxData *pIBD)
- {
- Arg setArgs[20];
- int i;
- char *pchIBTitle = NULL;
- /*
- * Create top level application shell for icon box
- */
- i=0;
- XtSetArg (setArgs[i], XmNallowShellResize, (XtArgVal)True); i++;
-
- XtSetArg (setArgs[i], XmNborderWidth, (XtArgVal)0); i++;
- XtSetArg (setArgs[i], XmNkeyboardFocusPolicy, (XtArgVal)XmEXPLICIT); i++;
- if (pWS->pSD->iconBoxTitle)
- {
- pchIBTitle = WmXmStringToString (pWS->pSD->iconBoxTitle);
- XtSetArg (setArgs[i], XmNtitle, (XtArgVal)pchIBTitle); i++;
- XtSetArg (setArgs[i], XmNiconName, (XtArgVal)pchIBTitle); i++;
- }
- XtSetArg (setArgs[i], XmNmappedWhenManaged, (XtArgVal)False); i++;
- XtSetArg (setArgs[i], XmNdialogStyle, (XtArgVal)XmDIALOG_MODELESS); i++;
- XtSetArg (setArgs[i], XmNdepth,
- (XtArgVal) DefaultDepth (DISPLAY, pWS->pSD->screen)); i++;
- XtSetArg (setArgs[i], XmNscreen,
- (XtArgVal) ScreenOfDisplay (DISPLAY, pWS->pSD->screen)); i++;
- pIBD->shellWidget = (Widget) XtCreatePopupShell (WmNclient,
- topLevelShellWidgetClass,
- pWS->workspaceTopLevelW,
- (ArgList)setArgs, i);
- if (pchIBTitle != NULL) XtFree (pchIBTitle);
- } /* END OF FUNCTION MakeShell */
- /*************************************<->*************************************
- *
- * MakeScrolledWindow (pWS, pIBD)
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- * pWS = pointer to workspace data
- * pIBD = pointer to IconBoxData
- * XXinput = ...
- *
- *
- * Outputs:
- * -------
- *
- * Return = pIBD with the pIBD->scrolledWidget set
- *
- *
- * Comments:
- * --------
- * XXComments ...
- *
- *************************************<->***********************************/
- void MakeScrolledWindow (WmWorkspaceData *pWS, IconBoxData *pIBD)
- {
- Arg setArgs[20];
- int i;
- /*
- * Create frame widget to give the scrolled window
- * an external bevel
- */
- i=0;
- XtSetArg (setArgs[i], XmNborderWidth, (XtArgVal) 0 ); i++;
- XtSetArg (setArgs[i], XmNmarginWidth, (XtArgVal) 0 ); i++;
- XtSetArg (setArgs[i], XmNmarginHeight, (XtArgVal) 0 ); i++;
- XtSetArg (setArgs[i], XmNshadowType, (XtArgVal) XmSHADOW_OUT); i++;
- XtSetArg (setArgs[i], XmNshadowThickness,
- (XtArgVal) frameShadowThickness); i++;
- pIBD->frameWidget = XtCreateManagedWidget ("IBframe",
- xmFrameWidgetClass,
- pIBD->shellWidget,
- (ArgList)setArgs, i);
- XtAddCallback (pIBD->frameWidget, XmNhelpCallback,
- WmDtWmTopicHelpCB, WM_DT_ICONBOX_TOPIC);
- /*
- * Create scrolled window to hold row column manager
- */
- i=0;
- XtSetArg (setArgs[i], XmNscrollingPolicy , (XtArgVal) XmAUTOMATIC ); i++;
- XtSetArg (setArgs[i], XmNborderWidth , (XtArgVal) 0 ); i++;
- XtSetArg (setArgs[i], XmNspacing , (XtArgVal) IB_MARGIN_WIDTH ); i++;
- /*
- * do we want to get these from a resource or set it here
- * to control the appearance of the iconBox
- */
- XtSetArg (setArgs[i], XmNscrolledWindowMarginWidth, (XtArgVal) 3); i++;
- XtSetArg (setArgs[i], XmNscrolledWindowMarginHeight, (XtArgVal) 3); i++;
- XtSetArg (setArgs[i], XmNshadowThickness,
- (XtArgVal) FRAME_EXTERNAL_SHADOW_WIDTH); i++;
- XtSetArg (setArgs[i], XmNscrollBarDisplayPolicy,(XtArgVal) XmSTATIC ); i++;
- XtSetArg (setArgs[i], XmNvisualPolicy, (XtArgVal) XmVARIABLE ); i++;
- pIBD->scrolledWidget = XtCreateManagedWidget ("IBsWindow",
- xmScrolledWindowWidgetClass,
- pIBD->frameWidget,
- (ArgList)setArgs, i);
- XtAddCallback(pIBD->scrolledWidget, XmNtraverseObscuredCallback,
- (XtCallbackProc) IconScrollVisibleCallback, (caddr_t)NULL);
- XtAddEventHandler(pIBD->scrolledWidget,
- StructureNotifyMask,
- False,
- (XtEventHandler)UpdateIncrements,
- (XtPointer) pIBD);
- } /* END OF FUNCTION MakeScrolledWindow */
- /*************************************<->*************************************
- *
- * MakeBulletinBoard (pWS, pIBD)
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- * pWS = pointer to workspace data
- * pIBD = pointer to IconBoxData
- *
- * XXinput = ...
- *
- *
- * Outputs:
- * -------
- *
- * Return = pIBD with the pIBD->bBoardWidget
- *
- *
- * Comments:
- * --------
- * XXComments ...
- *
- *************************************<->***********************************/
- void MakeBulletinBoard (WmWorkspaceData *pWS, IconBoxData *pIBD)
- {
- int i;
- Arg setArgs[20];
- /*
- * Create bulletin board to hold icons
- */
- i=0;
- #ifdef DEBUG_ICON_BOX
- XtSetArg (setArgs[i], XmNborderWidth , 1); i++;
- #else
- XtSetArg (setArgs[i], XmNborderWidth , 0); i++;
- #endif /* DEBUG_ICON_BOX */
-
- XtSetArg (setArgs[i], XmNshadowThickness,(XtArgVal) 0); i++;
- XtSetArg (setArgs[i], XmNspacing , 0); i++;
- XtSetArg (setArgs[i], XmNmarginHeight , 0); i++;
- XtSetArg (setArgs[i], XmNmarginWidth , 0); i++;
- XtSetArg (setArgs[i], XmNdialogStyle, (XtArgVal) XmDIALOG_WORK_AREA); i++;
- XtSetArg (setArgs[i], XmNresizePolicy, (XtArgVal) XmRESIZE_NONE); i++;
- XtSetArg (setArgs[i], XmNdefaultPosition , (XtArgVal) False); i++;
- XtSetArg (setArgs[i], XtNinsertPosition , InsertPosition); i++;
- pIBD->bBoardWidget = XtCreateManagedWidget ("IBbBoard",
- xmBulletinBoardWidgetClass,
- pIBD->scrolledWidget,
- (ArgList)setArgs, i);
- } /* END OF FUNCTION MakeBulletinBoard */
- /*************************************<->*************************************
- *
- * RealizeIconBox (pWS, pIBD, pCD)
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- * pWS = pointer to workspace data
- *
- * pIBD = pointer to IconBoxData
- *
- * pCD = pointer to ClientData
- *
- *
- * Outputs:
- * -------
- *
- * Return = pIBD with the pIBD->shellWin set
- * Return = pIBD with the pIBD->scrolledWin set
- * Return = pIBD with the pIBD->bBoardWin set
- *
- * Return = pCD with appropriate fields set
- *
- *
- * Comments:
- * --------
- * XXComments ...
- *
- *************************************<->***********************************/
- void RealizeIconBox (WmWorkspaceData *pWS, IconBoxData *pIBD, ClientData *pCD)
- {
- int i;
- Arg getArgs[10];
- Arg setArgs[2];
- Widget clipWidget;
- Pixmap bgPixmap;
- Pixmap defaultImage;
-
- XtRealizeWidget (pIBD->shellWidget);
- pCD->client = XtWindow (pIBD->shellWidget);
- /*
- * This will set the scrolling granularity for the icon box
- */
- SetGeometry (pWS, pCD, pIBD);
- /*
- * Point to the iconBox
- */
- pIBD->pCD_iconBox = pCD;
- pCD->thisIconBox = pIBD;
- /*
- * get the background color of the bulletin board for
- * greyed icon work
- */
- i=0;
- XtSetArg (setArgs[i], XmNbackground, (XtArgVal) select_color ); i++;
- XtSetValues (pIBD->bBoardWidget, (ArgList) setArgs, i);
- i=0;
- XtSetArg (getArgs[i], XmNbackgroundPixmap, (XtArgVal) &bgPixmap ); i++;
- XtGetValues (pIBD->bBoardWidget, getArgs, i);
- i=0;
- XtSetArg (getArgs[i], XmNclipWindow, (XtArgVal) &clipWidget ); i++;
- XtGetValues (pIBD->scrolledWidget, getArgs, i);
- /*
- * Set the background of the clip window for the scrolled
- * window so the default widget background doesn't flash
- */
- i = 0;
- XtSetArg(setArgs[i], XmNbackground, (XtArgVal) select_color); i++;
- XtSetValues (clipWidget, (ArgList) setArgs, i);
- /*
- * Save the clipWidget id to use in constraining icon moves in box
- */
- pIBD->clipWidget = clipWidget;
- MakeShrinkWrapIconsGC (pWS->pSD, bgPixmap);
-
- if (pWS->pSD->iconDecoration & ICON_IMAGE_PART)
- {
- /*
- * Make a pixmap to use when iconWindows are unmapped
- */
- defaultImage = XCreateBitmapFromData (DISPLAY, pWS->pSD->rootWindow,
- (char*)iImage_bits, iImage_width,
- iImage_height);
-
- pWS->pSD->defaultPixmap = MakeIconPixmap (pCD,
- defaultImage,
- None, iImage_width,
- iImage_height, 1);
- }
-
-
- } /* END OF FUNCTION RealizeIconBox */
- /*************************************<->*************************************
- *
- * AddNewBox (pWS, pIBD)
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- * pWS = pointer to workspace data
- *
- * pIBD = pointer to IconBoxData
- *
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- * Finds the last iconbox on the list starting at pWS->pIconBox and
- * adds the new icon box to the end of the list.
- *
- *************************************<->***********************************/
- void AddNewBox (WmWorkspaceData *pWS, IconBoxData *pIBD)
- {
-
- IconBoxData *pibd;
- if (pWS->pIconBox)
- {
- pibd = pWS->pIconBox;
- while (pibd->pNextIconBox)
- {
- pibd = pibd->pNextIconBox;
- }
- pibd->pNextIconBox = pIBD;
- }
- else
- {
- pWS->pIconBox = pIBD;
- }
-
- } /* END OF FUNCTION AddNewBox */
- /*************************************<->*************************************
- *
- * InitializeIconBoxData (pWS, pIBD)
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- * pWS = pointer to Workspace Data
- *
- * pIBD = pointer to IconBoxData
- *
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- * Initializes all pIBD fields to NULL
- *
- *************************************<->***********************************/
- void InitializeIconBoxData (WmWorkspaceData *pWS, IconBoxData *pIBD)
- {
- int mask;
- int X;
- int Y;
- unsigned int width;
- unsigned int height;
- int sW, sH;
- frameShadowThickness = FRAME_INTERNAL_SHADOW_WIDTH;
- pIBD->numberOfIcons = 0;
- pIBD->currentRow = 0;
- pIBD->currentCol = 0;
- pIBD->lastRow = 0;
- pIBD->lastCol = 0;
- pIBD->IPD.placeList = NULL;
- pIBD->scrolledWidget = NULL;
- pIBD->bBoardWidget = NULL;
- pIBD->clipWidget = NULL;
- pIBD->wsID = pWS->id;
- ToLower (pWS->pSD->iconBoxSBDisplayPolicy);
-
- if (!((!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "all")) ||
- (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szvertical)) ||
- (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szhorizontal))))
- {
- strcpy(pWS->pSD->iconBoxSBDisplayPolicy, "all");
- }
-
- /*
- * this will be set by the iconPlacement resource if
- * iconBoxGeometry width and height are not specified
- */
- if (pWS->iconBoxGeometry == NULL) /* not set by user */
- {
- /*
- * Use the iconPlacement resource
- */
-
- if (pWS->pSD->iconPlacement &
- (ICON_PLACE_TOP_PRIMARY | ICON_PLACE_BOTTOM_PRIMARY))
- {
- pIBD->IPD.iconPlacement = ICON_PLACE_TOP_PRIMARY;
- pIBD->IPD.placementCols = 1;
- pIBD->IPD.placementRows = 6;
- }
- else
- {
- pIBD->IPD.iconPlacement = ICON_PLACE_LEFT_PRIMARY;
- pIBD->IPD.placementCols = 6;
- pIBD->IPD.placementRows = 1;
- }
- }
- else
- {
- mask = XParseGeometry(pWS->iconBoxGeometry, &X, &Y,
- &width, &height);
- if ((mask & WidthValue) && (width > 0))
- {
- pIBD->IPD.placementCols = (int)width;
- }
- else
- {
- pIBD->IPD.placementCols = 6;
- }
- if ((mask & HeightValue) && (height > 0))
- {
- pIBD->IPD.placementRows = (int)height;
- }
- else
- {
- pIBD->IPD.placementRows = 1;
- }
- /*
- * Set orientation
- */
- if (pIBD->IPD.placementRows <= pIBD->IPD.placementCols)
- {
- pIBD->IPD.iconPlacement = ICON_PLACE_LEFT_PRIMARY;
- }
- else
- {
- pIBD->IPD.iconPlacement = ICON_PLACE_TOP_PRIMARY;
- }
- }
- /*
- * Override orientation if iconBoxSBDisplayPolicy is set to
- * horizontal or vertical
- */
- if (!(strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szvertical)))
- {
- pIBD->IPD.iconPlacement = ICON_PLACE_LEFT_PRIMARY;
- }
- else if (!(strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szhorizontal)))
- {
- pIBD->IPD.iconPlacement = ICON_PLACE_TOP_PRIMARY;
- }
-
-
- /*
- * set initial size of placement space to size of screen
- */
- sW = DisplayWidth (DISPLAY, pWS->pSD->screen) / pWS->pSD->iconWidth;
- sH = DisplayHeight (DISPLAY, pWS->pSD->screen) / pWS->pSD->iconHeight;
- pIBD->IPD.totalPlaces = sW * sH;
- pIBD->IPD.onRootWindow = False;
- /*
- * The icon box does not live in an icon box in this version
- */
- pIBD->pNextIconBox =NULL;
-
- } /* END OF FUNCTION InitializeIconBoxData */
- /*************************************<->*************************************
- *
- * SetIconBoxInfo (pWS, pCD)
- *
- *
- * Description:
- * -----------
- *
- * Inputs:
- * ------
- * pCD
- *
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- void SetIconBoxInfo (WmWorkspaceData *pWS, ClientData *pCD)
- {
- pCD->clientClass = WmCIconBox;
- pCD->clientName = pWS->pSD->iconBoxName;
- ProcessClientResources (pCD);
- } /* END OF FUNCTION SetIconBoxInfo */
- /*************************************<->*************************************
- *
- * InitializeClientData (pCD)
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- * pCD
- *
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- * Initializes geometry, etc. fields
- *
- *************************************<->***********************************/
- void InitializeClientData (ClientData *pCD, IconBoxData *pIBD)
- {
- pCD->internalBevel = (wmGD.frameStyle == WmSLAB) ? 0 :
- FRAME_INTERNAL_SHADOW_WIDTH;
- pCD->clientX = 0;
- pCD->clientY = 0;
- pCD->clientFlags |= ICON_BOX ;
- pCD->widthInc = pIBD->IPD.iPlaceW = ICON_WIDTH(pCD)
- + IB_SPACING
- + (2 * IB_MARGIN_WIDTH);
- pCD->heightInc = pIBD->IPD.iPlaceH = ICON_HEIGHT(pCD)
- + IB_SPACING
- + (2 * IB_MARGIN_HEIGHT);
- pCD->clientWidth = pIBD->IPD.placementCols * pCD->widthInc;
- pCD->clientHeight = pIBD->IPD.placementRows * pCD->heightInc;
-
- if (!(pCD->pSD->iconBoxTitle))
- {
- #ifndef NO_MESSAGE_CATALOG
- pCD->pSD->iconBoxTitle =
- XmStringCreateLocalized(wmNLS.default_icon_box_title);
- #else
- pCD->pSD->iconBoxTitle =
- XmStringCreateLocalized(DEFAULT_ICON_BOX_TITLE);
- #endif
- }
- pCD->clientTitle = pCD->pSD->iconBoxTitle;
- pCD->iconTitle = pCD->pSD->iconBoxTitle;
-
- } /* END OF FUNCTION InitializeClientData */
- /*************************************<->*************************************
- *
- * MakeShrinkWrapIconsGC (pSD, bgPixmap)
- *
- *
- * Description:
- * -----------
- * Make an graphic context to shrink the icons in the icon box
- * box that are not in the MINIMIZED_STATE.
- *
- *
- * Inputs:
- * ------
- * pSD - pointer to screen data
- *
- * Outputs:
- * -------
- * Modifies global data
- *
- * Comments:
- * --------
- *
- *
- *************************************<->***********************************/
- void MakeShrinkWrapIconsGC (WmScreenData *pSD, Pixmap bgPixmap)
- {
- XtGCMask copyMask;
-
- if (!pSD->shrinkWrapGC)
- {
- pSD->shrinkWrapGC = XCreateGC (DISPLAY, pSD->rootWindow, 0,
- (XGCValues *) NULL);
- copyMask = ~0L;
- XCopyGC (DISPLAY, pSD->iconAppearance.inactiveGC,
- copyMask, pSD->shrinkWrapGC);
- if (bgPixmap != XmUNSPECIFIED_PIXMAP)
- {
- XSetTile (DISPLAY, pSD->shrinkWrapGC, bgPixmap);
- XSetFillStyle (DISPLAY, pSD->shrinkWrapGC, FillTiled);
- XSetBackground (DISPLAY, pSD->shrinkWrapGC, select_color);
- }
- else
- {
- XSetForeground (DISPLAY, pSD->shrinkWrapGC, select_color);
- }
- }
- } /* END OF FUNCTION MakeShrinkWrapIconsGC */
- /*************************************<->*************************************
- *
- * MakeFadeIconGC (pSD)
- *
- *
- * Description:
- * -----------
- * Make an graphic context for "greying" the icons in the icon
- * box that are not in the MINIMIZED_STATE.
- *
- *
- * Inputs:
- * ------
- * pSD = pointer to screen data
- *
- * Outputs:
- * -------
- * Modifies global data
- *
- * Comments:
- * --------
- *
- *
- *************************************<->***********************************/
- void MakeFadeIconGC (WmScreenData *pSD)
- {
- XtGCMask copyMask;
- static Pixmap tmpFontClipMask;
-
- pSD->fadeIconGC = XCreateGC (DISPLAY, pSD->rootWindow, 0,
- (XGCValues *) NULL);
- pSD->fadeIconTextGC = XCreateGC (DISPLAY, pSD->rootWindow, 0,
- (XGCValues *) NULL);
- copyMask = ~0L;
- XCopyGC (DISPLAY, pSD->iconAppearance.inactiveGC,
- copyMask, pSD->fadeIconGC);
- XCopyGC (DISPLAY, pSD->iconAppearance.inactiveGC,
- copyMask, pSD->fadeIconTextGC);
- tmpFontClipMask = XCreateBitmapFromData (DISPLAY, pSD->rootWindow,
- (char*)greyed75_bits, greyed75_width, greyed75_height);
- greyedPixmap = XCreateBitmapFromData (DISPLAY, pSD->rootWindow,
- (char*)slant2_bits, slant2_width, slant2_height);
- XSetStipple (DISPLAY, pSD->fadeIconTextGC, tmpFontClipMask);
- XSetFillStyle (DISPLAY, pSD->fadeIconTextGC, FillStippled);
- XSetStipple (DISPLAY, pSD->fadeIconGC, greyedPixmap);
- XSetFillStyle (DISPLAY, pSD->fadeIconGC, FillStippled);
- XSetForeground (DISPLAY, pSD->fadeIconGC, select_color);
- } /* END OF FUNCTION MakeFadeIconGC */
- /*************************************<->*************************************
- *
- * SetGeometry (pWS, pCD, pIBD)
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- * pIBD = pointer to IconBoxData
- * pCD = pointer to ClientData
- * XXinput = ...
- *
- *
- * Outputs:
- * -------
- *
- *
- *
- *
- * Comments:
- * --------
- * XXComments ...
- *
- *************************************<->***********************************/
- void SetGeometry (WmWorkspaceData *pWS, ClientData *pCD, IconBoxData *pIBD)
- {
- int i;
- Arg setArgs[10];
- int mask;
- int X;
- int Y;
- unsigned int width;
- unsigned int height;
- unsigned int boxdim, tmpMin;
- int diff;
- unsigned long decoration;
- /*
- * Set horizontal and vertical scrolling granularity
- */
- SetGranularity (pWS, pCD, pIBD );
- /*
- * Set the initial width and height of the icon box bulletin board
- */
- i=0;
- XtSetArg (setArgs[i], XmNwidth, (XtArgVal) pCD->clientWidth); i++;
- XtSetArg (setArgs[i], XmNheight, (XtArgVal) pCD->clientHeight); i++;
- XtSetValues (pIBD->bBoardWidget, (ArgList) setArgs, i);
- /*
- * Adjust icon box window height for height of
- * horizontal scroll bar etc.
- */
- pCD->clientHeight = pCD->clientHeight + pCD->baseHeight;
- pCD->oldMaxHeight = pCD->maxHeight = pCD->clientHeight;
- /*
- * Adjust iconbox window width for width of
- * vertical scroll bar etc.
- */
- pCD->clientWidth = pCD->clientWidth + pCD->baseWidth;
- pCD->oldMaxWidth = pCD->maxWidth = pCD->clientWidth;
- /*
- * Check that minWidth is large enough to disallow overlap
- * of title bar gadgets
- */
- /* compute for minimum frame size */
- if ((decoration = pCD->decor) & MWM_DECOR_TITLE)
- {
- boxdim = InitTitleBarHeight(pCD); /* macro not valid yet */
- tmpMin = boxdim +
- ((decoration & MWM_DECOR_MENU) ? boxdim : 0) +
- ((decoration & MWM_DECOR_MINIMIZE) ? boxdim : 0) +
- ((decoration & MWM_DECOR_MAXIMIZE) ? boxdim : 0) -
- 2*(pCD->matteWidth);
- }
- else {
- tmpMin = 0;
- }
- /* Make:
- * minWidth >= tmpMin
- * minWidth >= max (baseWidth, widthInc) > 0
- * & an integral number of widthInc from baseWidth.
- */
- if (pCD->minWidth < tmpMin)
- {
- if ((diff = ((tmpMin - pCD->baseWidth)%pCD->widthInc)) != 0)
- {
- pCD->minWidth = tmpMin + pCD->widthInc - diff;
- }
- else
- {
- pCD->minWidth = tmpMin;
- }
- }
- if (pCD->minWidth < pCD->baseWidth)
- {
- pCD->minWidth = pCD->baseWidth;
- }
- if (pCD->minWidth == 0)
- {
- pCD->minWidth = pCD->widthInc;
- }
- else if ((diff = ((pCD->minWidth - pCD->baseWidth)%pCD->widthInc)) != 0)
- {
- pCD->minWidth += pCD->widthInc - diff;
- }
- if (pCD->clientWidth < pCD->minWidth)
- {
- pCD->clientWidth = pCD->minWidth;
- }
- pIBD->IPD.placementCols = (int)((pCD->clientWidth - pCD->baseWidth)
- / pCD->widthInc);
- /*
- * Make:
- *
- * maxWidth >= minWidth
- * & an integral number of widthInc from baseWidth.
- */
- if (pCD->maxWidth < pCD->minWidth)
- {
- pCD->maxWidth = pCD->minWidth;
- }
- pCD->maxWidthLimit = pCD->maxWidth;
- pCD->maxWidth -= ((pCD->maxWidth - pCD->baseWidth)% pCD->widthInc);
- pCD->oldMaxWidth = pCD->maxWidth;
- pCD->maxHeightLimit = pCD->maxHeight;
- /*
- * Set the initial width and height of the icon box bulletin board
- */
- i=0;
- XtSetArg (setArgs[i], XmNwidth, (XtArgVal) pCD->clientWidth
- - pCD->baseWidth ); i++;
- XtSetArg (setArgs[i], XmNheight, (XtArgVal) pCD->clientHeight
- - pCD->baseHeight ); i++;
- XtSetValues (pIBD->bBoardWidget, (ArgList) setArgs, i);
- /*
- * Set the initial width and height of the icon box scrolled Window
- */
- i=0;
- XtSetArg (setArgs[i], XmNwidth, (XtArgVal)
- (pCD->clientWidth - (2 * frameShadowThickness))); i++;
- XtSetArg (setArgs[i], XmNheight, (XtArgVal)
- (pCD->clientHeight - (2 * frameShadowThickness))); i++;
- XtSetValues (pIBD->scrolledWidget, (ArgList) setArgs, i);
-
- /*
- * Call SetFrameInfo with fake X and Y so we can get clientOffset
- */
- pCD->xBorderWidth = 0;
- SetFrameInfo (pCD);
- /*
- * Set initial placement of icon box
- */
- mask = XParseGeometry(pWS->iconBoxGeometry, &X, &Y,
- &width, &height);
-
- if (mask & XValue)
- {
- if (mask & XNegative)
- {
- pCD->clientX = X
- + DisplayWidth(DISPLAY, SCREEN_FOR_CLIENT(pCD))
- - pCD->clientWidth
- - pCD->clientOffset.x;
- }
- else
- {
- pCD->clientX = X + pCD->clientOffset.x;
- }
- }
- else
- {
- pCD->clientX = pCD->clientOffset.x;
- }
- if (mask & YValue)
- {
- if (mask & YNegative)
- {
- pCD->clientY = Y
- + DisplayHeight(DISPLAY, SCREEN_FOR_CLIENT(pCD))
- - pCD->clientHeight
- - pCD->clientOffset.x ;
- }
- else
- {
- pCD->clientY = Y + pCD->clientOffset.y;
- }
- }
- else
- {
- pCD->clientY = pCD->clientOffset.x
- + DisplayHeight(DISPLAY, SCREEN_FOR_CLIENT(pCD))
- - pCD->clientHeight;
- }
- PlaceFrameOnScreen (pCD, &pCD->clientX, &pCD->clientY, pCD->clientWidth,
- pCD->clientHeight);
- pCD->clientX -= (wmGD.positionIsFrame
- ? pCD->clientOffset.x
- : 0);
-
- pCD->clientY -= (wmGD.positionIsFrame
- ? pCD->clientOffset.y
- : 0);
- i=0;
- XtSetArg (setArgs[i], XmNx, (XtArgVal) pCD->clientX); i++;
- XtSetArg (setArgs[i], XmNy, (XtArgVal) pCD->clientY); i++;
- XtSetValues (pIBD->shellWidget, (ArgList) setArgs, i);
- pCD->maxX = pCD->clientX;
- pCD->maxY = pCD->clientY;
- } /* END OF FUNCTION SetGeometry */
- /*************************************<->*************************************
- *
- * SetGranularity (pWS, pCD, pIBD )
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- * pIBD = pointer to IconBoxData
- * pCD = pointer to ClientData
- * XXinput = ...
- *
- *
- * Outputs:
- * -------
- *
- *
- *
- *
- * Comments:
- * --------
- * XXComments ...
- *
- *************************************<->***********************************/
- void SetGranularity (WmWorkspaceData *pWS, ClientData *pCD, IconBoxData *pIBD)
- {
- int i;
- Dimension hScrollBarHeight = 0;
- Dimension hBarHeight = 0;
- Dimension vScrollBarWidth = 0;
- Dimension vBarWidth = 0;
- Dimension spacing;
- short shadowThickness;
- short marginWidth;
- short marginHeight;
- short hShighlightThickness;
- short vShighlightThickness;
- Arg setArgs[10];
- Arg getArgs[10];
- i=0;
- XtSetArg(getArgs[i], XmNspacing, (XtArgVal) &spacing ); i++;
- XtSetArg(getArgs[i], XmNshadowThickness, (XtArgVal) &shadowThickness); i++;
- XtSetArg(getArgs[i], XmNscrolledWindowMarginWidth,
- (XtArgVal) &marginWidth); i++;
- XtSetArg(getArgs[i], XmNscrolledWindowMarginHeight,
- (XtArgVal) &marginHeight); i++;
- XtSetArg (getArgs[i], XmNverticalScrollBar,
- (XtArgVal) &pIBD->vScrollBar); i++;
- XtSetArg(getArgs[i], XmNhorizontalScrollBar,
- (XtArgVal) &pIBD->hScrollBar); i++;
- XtGetValues (pIBD->scrolledWidget, getArgs, i);
-
- if (strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szvertical))
- {
-
- /*
- * Set horizontal scrolling granularity
- */
- i=0;
- XtSetArg (getArgs[i], XmNheight, (XtArgVal) &hBarHeight ); i++;
- XtSetArg (getArgs[i], XmNhighlightThickness,
- (XtArgVal) &hShighlightThickness); i++;
- XtGetValues (pIBD->hScrollBar, getArgs, i);
- i=0;
- XtSetArg(setArgs[i], XmNincrement, (XtArgVal) pCD->widthInc); i++;
- XtSetArg (setArgs[i], XmNhighlightThickness ,
- IB_HIGHLIGHT_BORDER); i++;
- XtSetArg(setArgs[i], XmNheight,
- (XtArgVal) (hBarHeight - (2 * hShighlightThickness)) +
- (2 * IB_HIGHLIGHT_BORDER)); i++;
- XtSetValues (pIBD->hScrollBar, (ArgList) setArgs, i);
-
- /*
- * Get hScrollBarHeight and troughColor
- */
-
- i=0;
- XtSetArg (getArgs[i], XmNtroughColor, (XtArgVal) &select_color ); i++;
- XtSetArg (getArgs[i], XmNheight, (XtArgVal) &hScrollBarHeight ); i++;
- XtGetValues (pIBD->hScrollBar, getArgs, i);
- }
-
-
- if (strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szhorizontal))
- {
-
- /*
- * Set vertical scrolling granularity
- */
- i=0;
- XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &vBarWidth ); i++;
- XtSetArg (getArgs[i], XmNhighlightThickness,
- (XtArgVal) &vShighlightThickness); i++;
- XtGetValues (pIBD->vScrollBar, getArgs, i);
- i=0;
- XtSetArg (setArgs[i], XmNincrement, (XtArgVal) pCD->heightInc); i++;
- XtSetArg (setArgs[i], XmNhighlightThickness ,
- IB_HIGHLIGHT_BORDER); i++;
- XtSetArg(setArgs[i], XmNwidth,
- (XtArgVal) (vBarWidth - (2 * vShighlightThickness)) +
- (2 * IB_HIGHLIGHT_BORDER)); i++;
- XtSetValues (pIBD->vScrollBar, (ArgList) setArgs, i);
-
- /*
- * Get vScrollBarWidth
- */
-
- i=0;
- XtSetArg (getArgs[i], XmNtroughColor, (XtArgVal) &select_color ); i++;
- XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &vScrollBarWidth ); i++;
- XtGetValues (pIBD->vScrollBar, getArgs, i);
- }
-
-
-
- if (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szvertical))
- {
- XtUnmanageChild(pIBD->hScrollBar);
- hScrollBarHeight = 0;
-
- i=0;
- XtSetArg (setArgs[i], XmNscrollBarDisplayPolicy,
- (XtArgVal) XmAS_NEEDED ); i++;
- XtSetValues (pIBD->scrolledWidget, (ArgList) setArgs, i);
-
- }
- else if (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , szhorizontal))
- {
- XtUnmanageChild(pIBD->vScrollBar);
- vScrollBarWidth = 0;
-
- i=0;
- XtSetArg (setArgs[i], XmNscrollBarDisplayPolicy,
- (XtArgVal) XmAS_NEEDED ); i++;
- XtSetValues (pIBD->scrolledWidget, (ArgList) setArgs, i);
- }
-
-
-
-
- pCD->baseWidth = IB_SPACING
- + 2 * IB_HIGHLIGHT_BORDER
- #ifdef DEBUG_ICON_BOX
- + 2
- + spacing
- #endif /* DEBUG_ICON_BOX */
- + (int) vScrollBarWidth
- + 2 * frameShadowThickness
- + (int) 2 * marginWidth
- + (marginWidth > 0
- ? 2 * (int) shadowThickness
- : shadowThickness);
-
- pCD->baseHeight = IB_SPACING
- + 2 * IB_HIGHLIGHT_BORDER
- #ifdef DEBUG_ICON_BOX
- + 2
- #endif /* DEBUG_ICON_BOX */
- + spacing
- + (int) hScrollBarHeight
- + 2 * frameShadowThickness
- + (int) 2 * marginHeight
- + (marginHeight > 0
- ? 2 * (int) shadowThickness
- : shadowThickness);
- pCD->minWidth = pCD->baseWidth + pCD->widthInc;
- pCD->minHeight = pCD->baseHeight + pCD->heightInc;
- pCD->oldMaxWidth = pCD->maxWidth = pCD->minWidth;
- pCD->oldMaxHeight = pCD->maxHeight = pCD->minHeight;
- } /* END OF FUNCTION SetGranularity */
- /*************************************<->*************************************
- *
- * GetIconBoxMenuItems ()
- *
- *
- * Description:
- * -----------
- * XXDescription ...
- *
- *************************************<->***********************************/
- MenuItem *GetIconBoxMenuItems (WmScreenData *pSD)
- {
- return(ParseMwmMenuStr (pSD,
- (unsigned char *)((char *)GETMESSAGE(36, 3, "\"Pack Icons\" _P Alt Shift<Key>F7 f.pack_icons\n"))));
- } /* END OF FUNCTION GetIconBoxMenuItems */
- /*************************************<->*************************************
- *
- * MapIconBoxes ()
- *
- *
- * Description:
- * -----------
- *
- *
- *
- * Inputs:
- * ------
- *
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- * Maps all iconboxes on the list starting at pWS->pIconBox
- *
- *************************************<->***********************************/
- void MapIconBoxes (WmWorkspaceData *pWS)
- {
-
- IconBoxData *pibd;
- if (pWS->pIconBox)
- {
- pibd = pWS->pIconBox;
- while (pibd)
- {
- XtPopup(pibd->shellWidget, XtGrabNone);
- pibd = pibd->pNextIconBox;
- }
- }
-
- } /* END OF FUNCTION MapIconBoxes */
- /*************************************<->*************************************
- *
- * UnmapIconBoxes (pWS)
- *
- *
- * Description:
- * -----------
- * Unmaps all the iconboxes in the specified workspace
- *
- *
- * Inputs:
- * ------
- * pWS = pointer to workspace data
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- * Unmaps all iconboxes on the list starting at pWS->pIconBox
- * Does not do anything with icon windows.
- *
- *************************************<->***********************************/
- void UnmapIconBoxes (WmWorkspaceData *pWS)
- {
-
- IconBoxData *pibd;
- if (pWS->pIconBox)
- {
- pibd = pWS->pIconBox;
- while (pibd)
- {
- XUnmapWindow (DISPLAY, pibd->pCD_iconBox->clientFrameWin);
- pibd = pibd->pNextIconBox;
- }
- }
- } /* END OF FUNCTION UnmapIconBoxes */
- /******************************<->*************************************
- *
- * IconBoxShowing ()
- *
- * Description:
- * -----------
- * Returns True if an icon box tied to a front panel button is
- * showing.
- *
- * Inputs:
- * ------
- * pWS = pointer to workspace data
- * pCW = pointer to control window data (for front panel button )
- *
- * Outputs:
- * -------
- * Return = True if icon box is up, False if it's invisible
- *
- * Comments:
- * --------
- *
- ******************************<->***********************************/
-
- Boolean
- IconBoxShowing (WmWorkspaceData *pWS)
- {
- Boolean rval = False;
-
- if (pWS->pIconBox &&
- ClientInWorkspace (pWS, pWS->pIconBox->pCD_iconBox))
- {
- rval = True;
- }
- return (rval);
-
- } /* END OF FUNCTION IconBoxShowing */
- /******************************<->*************************************
- *
- * IconBoxPopUp (pWS, pCW, up)
- *
- * Description:
- * -----------
- * Sets the state of the icon box attached to a front panel control.
- *
- * Inputs:
- * ------
- * pWS = pointer to workspace data
- * pCW = pointer to control window data (for front panel button )
- * up = flag, if True, pop the icon box up; if False, hide it.
- *
- * Outputs:
- * -------
- * None
- *
- * Comments:
- * --------
- *
- ******************************<->***********************************/
-
- void
- IconBoxPopUp (WmWorkspaceData *pWS, Boolean up)
- {
-
- IconBoxData *pibd;
-
- if (pWS->pIconBox)
- {
- pibd = pWS->pIconBox;
-
- while (pibd)
- {
- if (up)
- {
- if (ClientInWorkspace(pWS, pibd->pCD_iconBox))
- {
- F_Raise (NULL, pibd->pCD_iconBox, (XEvent *)NULL);
- }
- else
- {
- AddClientToWorkspaces (pibd->pCD_iconBox,
- &pWS->id, 1);
- return;
- }
- }
- else if (!up && ClientInWorkspace (pWS, pibd->pCD_iconBox))
- {
- RemoveClientFromWorkspaces (pibd->pCD_iconBox,
- &pWS->id, 1);
- return;
- }
- pibd = pibd->pNextIconBox;
- }
-
- }
-
- } /* END OF FUNCTION IconBoxPopUp */
- /******************************<->*************************************
- *
- * InsertIconIntoBox
- *
- * Inputs
- * ------
- * pCD - pointer to data for client to insert
- *
- * Description:
- * -----------
- * XXDescription ...
- *
- *************************************<->***********************************/
- Boolean InsertIconIntoBox (IconBoxData *pIBD, ClientData *pCD)
- {
- Boolean rval = False;
- Arg setArgs[20];
- int i;
- int iconWidth, iconHeight;
- IconBoxData *tmpPointerToIconBox;
- Widget iconWidget;
- IconInfo *pIconInfo;
- static XmString dummyString = NULL;
- WsClientData *pWsc;
- WmWorkspaceData *pWS = GetWorkspaceData (pCD->pSD, pIBD->wsID);
- pWsc = GetWsClientData (pWS, pCD);
- /*
- * If we go to multiple icon boxes, find the box this client
- * wants to live in. For now, we only have one, so point to
- * the first one.
- */
- tmpPointerToIconBox = pIBD;
-
- if (pCD->client)
- {
- pWsc->pIconBox = tmpPointerToIconBox;
- iconWidth = ICON_WIDTH(pCD)
- + (2 * IB_MARGIN_WIDTH);
- iconHeight = ICON_HEIGHT(pCD)
- + (2 * IB_MARGIN_HEIGHT);
- pIconInfo = InsertIconInfo (pWsc->pIconBox, pCD, (Widget) NULL);
- if (pIconInfo)
- {
- pWsc->pIconBox->numberOfIcons++;
- i = 0;
- XtSetArg (setArgs[i], XmNbackground,
- (XtArgVal) ICON_APPEARANCE(pCD).background ); i++;
- XtSetArg (setArgs[i], XmNforeground,
- (XtArgVal) ICON_APPEARANCE(pCD).foreground ); i++;
- XtSetArg (setArgs[i], XmNx , (XtArgVal) pWsc->iconX); i++;
- XtSetArg (setArgs[i], XmNy , (XtArgVal) pWsc->iconY); i++;
- XtSetArg (setArgs[i], XmNwidth , (XtArgVal) iconWidth); i++;
- XtSetArg (setArgs[i], XmNheight , (XtArgVal) iconHeight); i++;
- XtSetArg (setArgs[i], XmNborderWidth , (XtArgVal) 0); i++;
- XtSetArg (setArgs[i], XmNhighlightThickness ,
- IB_HIGHLIGHT_BORDER); i++;
- XtSetArg (setArgs[i], XmNmarginHeight , (XtArgVal) 0); i++;
- XtSetArg (setArgs[i], XmNmarginWidth , (XtArgVal) 0); i++;
- /*
- * Use type XmString so we don't get a message from XmLabel
- */
- XtSetArg (setArgs[i], XmNlabelType, (XtArgVal) XmSTRING); i++;
- XtSetArg (setArgs[i], XmNrecomputeSize, (XtArgVal) False); i++;
- XtSetArg (setArgs[i], XmNtraversalOn, (XtArgVal) True); i++;
- XtSetArg (setArgs[i], XmNpushButtonEnabled, (XtArgVal) False); i++;
- XtSetArg (setArgs[i], XmNshadowThickness, (XtArgVal) 0); i++;
- iconWidget = XtCreateManagedWidget("iconInIconBox",
- xmDrawnButtonWidgetClass,
- pWsc->pIconBox->bBoardWidget,
- (ArgList)setArgs, i);
- if (dummyString == NULL)
- {
- dummyString =
- XmStringCreateLocalized("");
- }
- i = 0;
- XtSetArg (setArgs[i], XmNlabelString,
- (XtArgVal) dummyString); i++;
- XtSetValues (iconWidget, setArgs, i);
- pIconInfo->theWidget = iconWidget;
- pWsc->iconFrameWin = XtWindow (iconWidget);
- XtAddCallback (iconWidget, XmNactivateCallback,
- (XtCallbackProc)IconActivateCallback,
- (XtPointer)NULL);
- XtAddEventHandler(iconWidget,
- SELECT_BUTTON_MOTION_MASK,
- False,
- (XtEventHandler)HandleIconBoxButtonMotion,
- (XtPointer)NULL);
- XtAddEventHandler(iconWidget,
- DMANIP_BUTTON_MOTION_MASK,
- False,
- (XtEventHandler)HandleIconBoxButtonMotion,
- (XtPointer)NULL);
- XtAddEventHandler(iconWidget,
- KeyPressMask,
- False,
- (XtEventHandler)HandleIconBoxIconKeyPress,
- (XtPointer)NULL);
-
-
- if (ICON_DECORATION(pCD) & ICON_ACTIVE_LABEL_PART)
- {
- XtAddEventHandler(iconWidget,
- FocusChangeMask,
- False,
- (XtEventHandler)ChangeActiveIconboxIconText,
- (XtPointer)NULL);
- if (pCD->pSD->activeLabelParent != pCD->pSD->rootWindow)
- {
- XRaiseWindow (DISPLAY, pCD->pSD->activeIconTextWin);
- }
- }
- ResetIconBoxMaxSize(pWsc->pIconBox->pCD_iconBox,
- pWsc->pIconBox->bBoardWidget);
- ResetArrowButtonIncrements (pWsc->pIconBox->pCD_iconBox);
- rval = True;
- }
- }
- return(rval);
- } /* END FUNCTION InsertIconIntoBox() */
-
- /*************************************<->*************************************
- *
- * InsertIconInfo (pIBD, pCD, theWidget)
- *
- *
- * Description:
- * -----------
- * Finds next available spot and inserts the icon
- *
- *
- * Inputs:
- * ------
- * pIBD - pointer to icon box data
- * pCD - pointer to client data for this client
- * theWidget - widget containing the icon (may be null)
- *
- * Outputs:
- * -------
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- IconInfo *InsertIconInfo (IconBoxData *pIBD, ClientData *pCD, Widget theWidget)
- {
- IconInfo *pII;
- int place;
- int amt, i;
- Arg setArgs[3];
- Arg getArgs[4];
- Dimension clipWidth, clipHeight;
- WsClientData *pWsc;
- place = GetNextIconPlace (&pIBD->IPD);
- if (place == NO_ICON_PLACE)
- {
- if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
- {
- amt = pIBD->IPD.placementCols; /* add a new row */
- }
- else
- {
- amt = pIBD->IPD.placementRows; /* add a new column */
- }
- if (!ExtendIconList (pIBD, amt))
- {
- Warning (((char *)GETMESSAGE(36, 4, "Insufficient memory to create icon box data")));
- return (NULL);
- }
- if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
- {
- pIBD->IPD.placementRows++;
- }
- else
- {
- pIBD->IPD.placementCols++;
- }
- place = GetNextIconPlace (&pIBD->IPD);
- }
- insertPosition = place;
- /*
- * Update icon info values
- */
- pII = &pIBD->IPD.placeList[place];
- pII->theWidget = theWidget;
- pII->pCD = pCD;
- pWsc = GetWsClientData (GetWorkspaceData (pCD->pSD, pIBD->wsID), pCD);
- pWsc->iconPlace = place;
- CvtIconPlaceToPosition (&pIBD->IPD, pWsc->iconPlace,
- &pWsc->iconX, &pWsc->iconY);
- /* update next free position */
- pIBD->currentCol = pWsc->iconX / pIBD->pCD_iconBox->widthInc;
- pIBD->currentRow = pWsc->iconY / pIBD->pCD_iconBox->heightInc;
- /*
- * Increase bboard size if necessary
- */
- i = 0;
- XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &clipWidth ); i++;
- XtSetArg (getArgs[i], XmNheight, (XtArgVal) &clipHeight ); i++;
- XtGetValues (pIBD->clipWidget, getArgs, i);
- i = 0;
- if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
- {
- if (pIBD->currentCol > pIBD->lastCol)
- {
- pIBD->lastCol = pIBD->currentCol;
- }
- if (pIBD->currentRow > pIBD->lastRow)
- {
- pIBD->lastRow = pIBD->currentRow;
- if (clipHeight <= (Dimension) (pWsc->iconY +
- pIBD->pCD_iconBox->heightInc))
- {
- /*
- * Increase bulletin board height as needed.
- */
- XtSetArg (setArgs[i], XmNheight, (XtArgVal)
- pWsc->iconY + pIBD->pCD_iconBox->heightInc); i++;
- }
- }
- }
- else
- {
- if (pIBD->currentCol > pIBD->lastCol)
- {
- pIBD->lastCol = pIBD->currentCol;
- if (clipWidth <= (Dimension)
- (pWsc->iconX + pIBD->pCD_iconBox->widthInc))
- {
- /*
- * Increase bulletin board width as needed
- */
- XtSetArg (setArgs[i], XmNwidth,
- (XtArgVal) pWsc->iconX +
- pIBD->pCD_iconBox->widthInc); i++;
- }
- }
- if (pIBD->currentRow > pIBD->lastRow)
- {
- pIBD->lastRow = pIBD->currentRow;
- }
- }
- if (i > 0)
- {
- XtSetValues (pIBD->bBoardWidget, setArgs, i);
- }
- return(pII);
-
- } /* END OF FUNCTION InsertIconInfo */
- /*************************************<->*************************************
- *
- * DeleteIconFromBox
- *
- *
- * Description:
- * -----------
- * XXDescription ...
- *
- *************************************<->***********************************/
- void DeleteIconFromBox (IconBoxData *pIBD, ClientData *pCD)
- {
- Widget theChild;
- ClientData *pCD_tmp;
- Arg args[4];
- Dimension clipWidth, clipHeight;
- Dimension oldWidth, oldHeight;
- int newWidth, newHeight;
- int i, newCols, newRows;
- WmWorkspaceData *pWS = GetWorkspaceData (pCD->pSD, pIBD->wsID);
- WsClientData *pWsc;
- pWsc = GetWsClientData (pWS, pCD);
- i = 0;
- XtSetArg (args[i], XmNwidth, (XtArgVal) &oldWidth ); i++;
- XtSetArg (args[i], XmNheight, (XtArgVal) &oldHeight ); i++;
- XtGetValues (pIBD->bBoardWidget, args, i);
- i = 0;
- XtSetArg (args[i], XmNwidth, (XtArgVal) &clipWidth); i++;
- XtSetArg (args[i], XmNheight, (XtArgVal) &clipHeight ); i++;
- XtGetValues (pIBD->clipWidget, args, i);
- clipHeight /= (Dimension) pIBD->pCD_iconBox->heightInc;
- clipWidth /= (Dimension) pIBD->pCD_iconBox->widthInc;
- /*
- * find context of the activeIconTextWin to get pCD and then
- * if it is the same as this client, hide it.
- */
- if (!(XFindContext (DISPLAY, pCD->pSD->activeIconTextWin,
- wmGD.windowContextType, (caddr_t *)&pCD_tmp)))
- {
- if (pCD == pCD_tmp)
- {
- /* hide activeIconTextWin */
- HideActiveIconText ((WmScreenData *)NULL);
- }
- }
- DeleteIconInfo (pWsc->pIconBox, pCD);
- pWsc->pIconBox->numberOfIcons--;
- theChild = XtWindowToWidget (DISPLAY, pWsc->iconFrameWin);
- pWsc->pIconBox = NULL;
- pWsc->iconPlace = NO_ICON_PLACE;
- XtUnmanageChild (theChild);
- XtDestroyWidget (theChild);
- /* update last row and col */
- SetNewBounds (pIBD);
- /* resize Bulletin board (so scroll bars show correctly */
- i = 0;
- if (clipWidth <= (Dimension) (pIBD->lastCol + 1))
- {
- newWidth = (pIBD->lastCol + 1) * pIBD->pCD_iconBox->widthInc;
- XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++;
- newCols = newWidth / pIBD->pCD_iconBox->widthInc;
- }
- else
- {
- newWidth = clipWidth * pIBD->pCD_iconBox->widthInc;
- XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++;
- newCols = newWidth / pIBD->pCD_iconBox->widthInc;
- }
- if (clipHeight <= (Dimension) (pIBD->lastRow + 1))
- {
- /* set height of bboard */
- newHeight = (pIBD->lastRow + 1) * pIBD->pCD_iconBox->heightInc;
- XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++;
- newRows = newHeight / pIBD->pCD_iconBox->heightInc;
- }
- else
- {
- newHeight = clipHeight * pIBD->pCD_iconBox->heightInc;
- XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++;
- newRows = newHeight / pIBD->pCD_iconBox->heightInc;
- }
- if (i > 0 && ExpandVirtualSpace(pIBD, newWidth, newHeight))
- {
- XtSetValues (pIBD->bBoardWidget, args, i);
- RealignIconList (pIBD, newCols, newRows);
- pIBD->IPD.placementCols = newCols;
- pIBD->IPD.placementRows = newRows;
- }
- /* reset max size for icon box */
- ResetIconBoxMaxSize(pIBD->pCD_iconBox, pIBD->bBoardWidget);
-
- ResetArrowButtonIncrements (pIBD->pCD_iconBox);
- } /* END FUNCTION DeleteIconFromBox */
- /*************************************<->*************************************
- *
- * DeleteIconInfo (pIBD, pCD)
- *
- *
- * Description:
- * -----------
- * Deletes an icon info record from the icon box list based on the
- * client data pointer.
- *
- *
- * Inputs:
- * ------
- * pIBD - pointer to icon box data
- * pCD - pointer to client data
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- * o The deleted item is freed
- * o Is pCD the correct key???? !!!
- *
- *************************************<->***********************************/
- void DeleteIconInfo (IconBoxData *pIBD, ClientData *pCD)
- {
- int ix, count;
- IconInfo *pII;
- /* find first matching entry in list */
- pII = &pIBD->IPD.placeList[0];
- count = pIBD->IPD.totalPlaces;
- for (ix = 0; ix < count && pII->pCD != pCD; ix++, pII++)
- {
- }
- if (ix < count)
- {
- /* found it, zero the entry out */
- pII->theWidget = NULL;
- pII->pCD = NULL;
- }
- } /* END FUNCTION DeleteIconInfo */
- /*************************************<->*************************************
- *
- * ResetIconBoxMaxSize(pCD, bBoardWidget)
- *
- *
- * Description:
- * -----------
- * XXDescription ...
- *
- *************************************<->***********************************/
- void ResetIconBoxMaxSize (ClientData *pCD, Widget bBoardWidget)
- {
- int i;
- Arg getArgs[3];
- Dimension newWidth;
- Dimension newHeight;
- i=0;
- XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &newWidth ); i++;
- XtSetArg (getArgs[i], XmNheight, (XtArgVal) &newHeight ); i++;
- XtGetValues (bBoardWidget, getArgs, i);
- pCD->oldMaxWidth = pCD->maxWidth = newWidth + pCD->baseWidth;
- pCD->oldMaxHeight = pCD->maxHeight = newHeight + pCD->baseHeight;
- pCD->maxX = pCD->clientX;
- pCD->maxY = pCD->clientY;
- PlaceFrameOnScreen (pCD, &pCD->maxX, &pCD->maxY,
- pCD->maxWidth, pCD->maxHeight);
- } /* END OF FUNCTION ResetIconBoxMaxSize */
- /*************************************<->*************************************
- *
- * CheckIconBoxSize(pIBD)
- *
- *
- * Description:
- * -----------
- * XXDescription ...
- *
- *************************************<->***********************************/
- Boolean CheckIconBoxSize (IconBoxData *pIBD)
- {
- int i;
- Arg getArgs[3];
- Arg setArgs[3];
- Dimension oldWidth;
- Dimension oldHeight;
- Dimension newWidth;
- Dimension newHeight;
- int oldCol, oldRow;
- Boolean rval = True;
- i=0;
- XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &oldWidth ); i++;
- XtSetArg (getArgs[i], XmNheight, (XtArgVal) &oldHeight ); i++;
- XtGetValues (pIBD->bBoardWidget, getArgs, i);
- newWidth = oldWidth;
- newHeight = oldHeight;
- oldCol = oldWidth / (Dimension) pIBD->pCD_iconBox->widthInc;
- oldRow = oldHeight / (Dimension) pIBD->pCD_iconBox->heightInc;
- /*
- * Increase bboard size if necessary
- */
- i = 0;
- if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
- {
- if (oldRow < pIBD->lastRow + 1)
- {
- /*
- * increase bulletin board height as needed
- */
- newHeight = (pIBD->lastRow * pIBD->pCD_iconBox->heightInc)
- + pIBD->pCD_iconBox->heightInc;
- XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight); i++;
- }
- }
- else
- {
- if (oldCol < pIBD->lastCol + 1)
- {
- /*
- * increase bulletin board width as needed
- */
- newWidth = (pIBD->lastCol * pIBD->pCD_iconBox->widthInc)
- + pIBD->pCD_iconBox->widthInc;
- XtSetArg (setArgs[i], XmNwidth, newWidth); i++;
- }
- }
- if (i > 0)
- {
- if (! ExpandVirtualSpace(pIBD, newWidth, newHeight))
- {
- /*
- * The user has resized the iconbox larger than
- * memory will allow. Don't honor the resize request
- */
- rval = False;
- return(rval);
- }
- XtSetValues (pIBD->bBoardWidget, setArgs, i);
- }
- ResetIconBoxMaxSize(pIBD->pCD_iconBox, pIBD->bBoardWidget);
-
- return(rval);
- } /* END OF FUNCTION CheckIconBoxSize */
- /*************************************<->*************************************
- *
- * CheckIconBoxResize(pCD, changedValues)
- *
- *
- * Description:
- * -----------
- * XXDescription ...
- *
- *************************************<->***********************************/
- void CheckIconBoxResize (ClientData *pCD, unsigned int changedValues, int newWidth, int newHeight)
- {
- Boolean packVert = False;
- Boolean packHorz = False;
- WmScreenData *pSD;
- IconBoxData *pIBD;
- IconPlacementData *pIPD;
- int i, newCols, newRows;
- Arg getArgs[3];
- Arg setArgs[3];
- Dimension oldWidth;
- Dimension oldHeight;
- pIPD = &pCD->thisIconBox->IPD;
- pIBD = pCD->thisIconBox;
- pSD = &(wmGD.Screens[SCREEN_FOR_CLIENT(pCD)]);
-
- i=0;
- XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &oldWidth ); i++;
- XtSetArg (getArgs[i], XmNheight, (XtArgVal) &oldHeight ); i++;
- XtGetValues (pIBD->bBoardWidget, getArgs, i);
-
- newCols = pIPD->placementCols;
- newRows = pIPD->placementRows;
- newWidth = newWidth - pCD->baseWidth;
- newHeight = newHeight - pCD->baseHeight;
-
- i = 0;
-
- if (changedValues & CWWidth)
- {
- /*
- * There was a change in Width, see if we need to change the
- * bulletin board
- */
- if (newWidth > (int) oldWidth)
- {
- newCols = newWidth / pCD->widthInc;
- XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++;
- }
-
- if (newWidth < (int) oldWidth)
- {
- if ((!strcmp(pSD->iconBoxSBDisplayPolicy, szvertical)) &&
- (newWidth / pCD->widthInc < pIBD->lastCol + 1))
- {
- XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++;
- newCols = newWidth / pCD->widthInc;
- packVert = True;
- }
- else if (newWidth / pCD->widthInc < pIBD->lastCol + 1)
- {
- newWidth = (pIBD->lastCol +1) * pCD->widthInc;
- XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++;
- }
- else
- {
- newCols = newWidth / pCD->widthInc;
- XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++;
- }
- }
- }
- else
- {
- newWidth = oldWidth;
- }
-
- if (changedValues & CWHeight)
- {
- /*
- * There was a change in Height, see if we need to change the
- * bulletin board
- */
- if (newHeight > (int) oldHeight)
- {
- newRows = newHeight / pCD->heightInc;
- XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++;
- }
- if (newHeight < (int) oldHeight)
- {
- if ((!strcmp(pSD->iconBoxSBDisplayPolicy, szhorizontal)) &&
- (newHeight / pCD->heightInc < pIBD->lastRow + 1))
- {
- XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++;
- newRows = newHeight / pCD->heightInc;
- packHorz = True;
- }
- else if (newHeight / pCD->heightInc < pIBD->lastRow + 1)
- {
- newHeight = (pIBD->lastRow + 1) * pCD->heightInc;
- XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++;
- }
- else
- {
- newRows = newHeight / pCD->heightInc;
- XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++;
- }
- }
- }
- else
- {
- newHeight = oldHeight;
- }
-
- if ( i >0 && ExpandVirtualSpace(pIBD, newWidth, newHeight))
- {
- XtSetValues (pIBD->bBoardWidget, setArgs, i);
- }
- RealignIconList (pIBD, newCols, newRows);
- pIPD->placementCols = newCols;
- pIPD->placementRows = newRows;
-
- ResetIconBoxMaxSize(pCD, pIBD->bBoardWidget);
-
- /*
- * Pack the icon box if there are icons that can no longer
- * be scrolled to due to iconBoxSBDisplayPolicy.
- */
- if (packVert)
- {
- PackIconBox (pIBD, packVert, False , newWidth, 0);
- }
- else if (packHorz)
- {
- PackIconBox (pIBD, False, packHorz , 0, newHeight);
- }
- } /* END OF FUNCTION CheckIconBoxResize */
- /*************************************<->*************************************
- *
- * ExpandVirtualSpace (pIBD, newWidth, newHeight)
- *
- *
- * Description:
- * -----------
- * Add virtural space (really the icon list )
- *
- *
- * Inputs:
- * ------
- * pIBD - ptr to icon box data
- *
- *
- * Outputs:
- * -------
- * Return - True if successful, False otherwise
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- Boolean ExpandVirtualSpace (IconBoxData *pIBD, int newWidth, int newHeight)
- {
- Boolean rval = True;
- int newSize;
- int increment;
- newSize = (newWidth / pIBD->pCD_iconBox->widthInc) *
- (newHeight / pIBD->pCD_iconBox->heightInc);
- if (newSize > pIBD->IPD.totalPlaces )
- {
- increment = newSize - pIBD->IPD.totalPlaces;
- rval = ExtendIconList (pIBD, increment);
- }
- return (rval);
- } /* END OF FUNCTION ExpandVirtualSpace */
- /*************************************<->*************************************
- *
- * ExtendIconList (pIBD, incr);
- *
- *
- * Description:
- * -----------
- * Add space to the icon list
- *
- *
- * Inputs:
- * ------
- * pIBD - ptr to icon box data
- * incr - number of cells to add
- *
- *
- * Outputs:
- * -------
- * Return - True if successful, False otherwise
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- Boolean ExtendIconList (IconBoxData *pIBD, int incr)
- {
- Boolean rval;
- int newSize;
- IconInfo *pTmp;
- newSize = pIBD->IPD.totalPlaces + incr;
- if ((pTmp = (IconInfo *) XtMalloc (newSize*sizeof(IconInfo))) != NULL)
- {
- /* copy data */
- memcpy (pTmp, pIBD->IPD.placeList,
- pIBD->IPD.totalPlaces*sizeof(IconInfo));
- memset (&pTmp[pIBD->IPD.totalPlaces], 0, incr*sizeof(IconInfo));
- /* out with the old, in with the new */
- XtFree ((char *)pIBD->IPD.placeList);
- pIBD->IPD.placeList = pTmp;
- pIBD->IPD.totalPlaces = newSize;
- rval = True;
- }
- else
- {
- rval = False;
- }
- return (rval);
- } /* END OF FUNCTION ExtendIconList */
- /*************************************<->*************************************
- *
- * PackIconBox(pIBD, packVert, packHorz, passedInWidth, passedInHeight)
- *
- *
- * Description:
- * -----------
- * Packs the icons in the icon box
- *
- *
- * Inputs:
- * ------
- * pIBD - pointer to icon box data
- *
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- void PackIconBox (IconBoxData *pIBD, Boolean packVert, Boolean packHorz, int passedInWidth, int passedInHeight)
- {
- IconInfo *pII_2, *pII_1;
- int ix1, ix2;
- int count;
- int newX, newY;
- ClientData *pCD_tmp = NULL, *pMyCD;
- int hasActiveText = 1;
- Arg args[4];
- Dimension majorDimension, minorDimension;
- Dimension oldWidth, oldHeight;
- int newWidth, newHeight;
- int i;
- Boolean rippling = False;
- WsClientData *pWsc;
- WmWorkspaceData *pWS;
- i = 0;
- XtSetArg (args[i], XmNwidth, (XtArgVal) &oldWidth ); i++;
- XtSetArg (args[i], XmNheight, (XtArgVal) &oldHeight ); i++;
- XtGetValues (pIBD->bBoardWidget, args, i);
- /*
- * packing to visual space, first update IconBoxData
- */
- i = 0;
- if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
- {
- XtSetArg (args[i], XmNwidth, (XtArgVal) &majorDimension ); i++;
- XtSetArg (args[i], XmNheight, (XtArgVal) &minorDimension ); i++;
- XtGetValues (pIBD->clipWidget, args, i);
- if (packVert)
- {
- majorDimension = passedInWidth;
- }
-
- minorDimension /= (Dimension) pIBD->pCD_iconBox->heightInc;
- majorDimension /= (Dimension) pIBD->pCD_iconBox->widthInc;
- if (majorDimension != pIBD->IPD.placementCols)
- {
- pIBD->IPD.placementCols = majorDimension;
- }
- }
- else
- {
- XtSetArg (args[i], XmNheight, (XtArgVal) &majorDimension ); i++;
- XtSetArg (args[i], XmNwidth, (XtArgVal) &minorDimension ); i++;
- XtGetValues (pIBD->clipWidget, args, i);
- if (packHorz)
- {
- majorDimension = passedInHeight;
- }
- minorDimension /= (Dimension) pIBD->pCD_iconBox->widthInc;
- majorDimension /= (Dimension) pIBD->pCD_iconBox->heightInc;
- if (majorDimension != pIBD->IPD.placementRows)
- {
- pIBD->IPD.placementRows = majorDimension;
- }
- }
- /*
- * find context of the activeIconTextWin to get pCD and then
- * if it is the same as this client, hide it.
- */
- pMyCD = pIBD->pCD_iconBox;
- if (ICON_DECORATION(pMyCD) & ICON_ACTIVE_LABEL_PART)
- {
- if (XFindContext (DISPLAY, pMyCD->pSD->activeIconTextWin,
- wmGD.windowContextType, (caddr_t *)&pCD_tmp))
- {
- hasActiveText = 0;
- }
- }
- pII_2 = pII_1 = pIBD->IPD.placeList;
- ix1 = ix2 = 0;
- count = pIBD->IPD.totalPlaces;
- while (ix1 < count)
- {
- if (!rippling && (pII_2->pCD != NULL))
- {
- /*
- * We need to start rippling the icons into new positions if
- * their (x,y) position changed
- */
- pWS = GetWorkspaceData (pII_2->pCD->pSD, pIBD->wsID);
- pWsc = GetWsClientData (pWS, pII_2->pCD);
- CvtIconPlaceToPosition (&pIBD->IPD, pWsc->iconPlace,
- &newX, &newY);
- rippling = ((newX != pWsc->iconX) ||
- (newY != pWsc->iconY));
- }
- if ((pII_2->pCD == NULL) || rippling)
- {
- /* find next one to move */
- while ((ix1 < count) && (pII_1->pCD == NULL))
- {
- ix1++;
- pII_1++;
- }
- if ((ix1 < count) && (pII_1->pCD != NULL))
- {
- if (ix1 != ix2)
- {
- MoveIconInfo (&pIBD->IPD, ix1, ix2);
- }
- CvtIconPlaceToPosition (&pIBD->IPD, ix2, &newX, &newY);
- pWS = GetWorkspaceData (pII_2->pCD->pSD, pIBD->wsID);
- pWsc = GetWsClientData (pWS, pII_2->pCD);
- pWsc->iconX = newX;
- pWsc->iconY = newY;
- if (hasActiveText && (pII_2->pCD == pCD_tmp))
- {
- /* hide activeIconTextWin first */
- HideActiveIconText ((WmScreenData *)NULL);
- XtMoveWidget (pII_2->theWidget, newX, newY);
- ShowActiveIconText (pII_2->pCD);
- }
- else
- {
- XtMoveWidget (pII_2->theWidget, newX, newY);
- }
- }
- }
- if (ix1 < count)
- {
- ix2++;
- pII_2++;
- }
- ix1++;
- pII_1++;
- }
- /* update last row and col */
- SetNewBounds (pIBD);
- /* resize Bulletin board (so scroll bars show correctly */
- i = 0;
- if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)
- {
- if (majorDimension <= (Dimension) (pIBD->lastCol + 1))
- {
- newWidth = (pIBD->lastCol + 1) * pIBD->pCD_iconBox->widthInc;
- XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++;
- }
- else
- {
- newWidth = oldWidth;
- }
- if (minorDimension <= (Dimension) (pIBD->lastRow + 1))
- {
- /* set height of bboard */
- newHeight = (pIBD->lastRow + 1) * pIBD->pCD_iconBox->heightInc;
- XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++;
- }
- else
- {
- newHeight = minorDimension * pIBD->pCD_iconBox->heightInc;
- XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++;
- }
- }
- else
- {
- if (majorDimension <= (Dimension) (pIBD->lastRow + 1))
- {
- newHeight = (pIBD->lastRow + 1) * pIBD->pCD_iconBox->heightInc;
- XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++;
- }
- else
- {
- newHeight = oldHeight;
- }
- if (minorDimension <= (Dimension) (pIBD->lastCol + 1))
- {
- /* set width of bboard */
- newWidth = (pIBD->lastCol + 1) * pIBD->pCD_iconBox->widthInc;
- XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++;
- }
- else
- {
- newWidth = minorDimension * pIBD->pCD_iconBox->widthInc;
- XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++;
- }
- }
- if (i > 0 && ExpandVirtualSpace(pIBD, newWidth, newHeight))
- {
- XtSetValues (pIBD->bBoardWidget, args, i);
- }
- /* reset max size for icon box */
- ResetIconBoxMaxSize (pIBD->pCD_iconBox, pIBD->bBoardWidget);
-
- ResetArrowButtonIncrements (pIBD->pCD_iconBox);
- } /* END FUNCTION PackIconBox */
- /*************************************<->*************************************
- *
- * RealignIconList (pIBD, newRows, newCols)
- *
- *
- * Description:
- * -----------
- * Realigns the icon list according to the new virtual space dimensions
- *
- *
- * Inputs:
- * ------
- * pIBD - ptr to icon box data
- * newRows - new number of rows
- * newCols - new number of columns
- *
- *
- * Outputs:
- * -------
- *
- * Comments:
- * --------
- * o The placement data structure contains the old values.
- *
- *************************************<->***********************************/
- void RealignIconList (IconBoxData *pIBD, int newCols, int newRows)
- {
- int c1, c2, ix1, ix2;
- int oldRows, oldCols;
- IconPlacementData ipdNew;
- IconInfo *pII;
- /*
- * create new icon placement data for ease of calling conversion
- * routines.
- */
- ipdNew.onRootWindow = pIBD->IPD.onRootWindow;
- ipdNew.iconPlacement = pIBD->IPD.iconPlacement;
- ipdNew.placementRows = newRows;
- ipdNew.placementCols = newCols;
- ipdNew.iPlaceW = pIBD->IPD.iPlaceW;
- ipdNew.iPlaceH = pIBD->IPD.iPlaceH;
- ipdNew.placeList = pIBD->IPD.placeList;
- ipdNew.totalPlaces = pIBD->IPD.totalPlaces;
- oldRows = pIBD->IPD.placementRows;
- oldCols = pIBD->IPD.placementCols;
- /*
- * Use the new organization and placement discipline to
- * determine how to move the icon info data around.
- */
- if (((oldRows < newRows) &&
- (pIBD->IPD.iconPlacement & ICON_PLACE_TOP_PRIMARY)) ||
- ((oldCols < newCols) &&
- (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)))
- {
- /*
- * work backwards
- */
- for (ix1 = pIBD->IPD.totalPlaces - 1,
- pII = &pIBD->IPD.placeList[ix1]; ix1 >= 0; ix1--, pII--)
- {
- if (pII->pCD != NULL)
- {
- CvtIconPlaceToPosition (&pIBD->IPD, ix1, &c1, &c2);
- ix2 = CvtIconPositionToPlace (&ipdNew, c1, c2);
- if (ix1 != ix2)
- {
- MoveIconInfo (&pIBD->IPD, ix1, ix2);
- }
- }
- }
- }
- else
- if (((oldRows > newRows) &&
- (pIBD->IPD.iconPlacement & ICON_PLACE_TOP_PRIMARY)) ||
- ((oldCols > newCols) &&
- (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY)))
- {
- /*
- * work forwards
- */
- for (ix1 = 0, pII = &pIBD->IPD.placeList[ix1];
- ix1 < pIBD->IPD.totalPlaces; ix1++, pII++)
- {
- if (pII->pCD != NULL)
- {
- CvtIconPlaceToPosition (&pIBD->IPD, ix1, &c1, &c2);
- ix2 = CvtIconPositionToPlace (&ipdNew, c1, c2);
- if (ix1 != ix2)
- {
- MoveIconInfo (&pIBD->IPD, ix1, ix2);
- }
- }
- }
- }
- /*
- * update info in placement structure to reflect new reality
- */
- pIBD->IPD.placementRows = newRows;
- pIBD->IPD.placementCols = newCols;
- } /* END OF FUNCTION RealignIconList */
- /*************************************<->*************************************
- *
- * SetNewBounds (pIBD)
- *
- *
- * Description:
- * -----------
- *
- *
- * Inputs:
- * ------
- *
- *
- * Outputs:
- * -------
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- void SetNewBounds (IconBoxData *pIBD)
- {
- int i;
- int X = 0;
- int Y = 0;
- CompositeWidget cw;
- WidgetList children;
- cw = (CompositeWidget) pIBD->bBoardWidget;
- children = cw->composite.children;
- for (i = 0; i < cw->composite.num_children; i++)
- {
- if (children[i]->core.x > X)
- {
- X = children[i]->core.x;
- }
- if (children[i]->core.y > Y)
- {
- Y = children[i]->core.y;
- }
- }
- pIBD->lastCol = X / pIBD->pCD_iconBox->widthInc;
- pIBD->lastRow = Y / pIBD->pCD_iconBox->heightInc;
- } /* END OF FUNCTION SetNewBounds */
- /*************************************<->*************************************
- *
- * InsertPosition (w)
- *
- *
- * Description:
- * -----------
- * This procedure is passed to the bulletin board at create time
- * to be used when a child is inserted into the bulletin board
- *
- *
- *************************************<->***********************************/
- Cardinal InsertPosition (Widget w)
- {
- return (insertPosition);
- } /* END OF FUNCTION InsertPosition */
- /*************************************<->*************************************
- *
- * ShowClientIconState ();
- *
- *
- * Description:
- * -----------
- * XXDescription ...
- *
- *************************************<->***********************************/
- void ShowClientIconState (ClientData *pCD, int newState)
- {
- /*
- * Changing the appearance of an icon window in the box to
- * reflect the client's state
- */
- if ((newState == MINIMIZED_STATE) && (pCD->iconWindow))
- XMapRaised (DISPLAY, pCD->iconWindow);
- if (((newState == NORMAL_STATE) || (newState == MAXIMIZED_STATE ))
- && (pCD->iconWindow))
- {
- XUnmapWindow (DISPLAY, pCD->iconWindow);
- }
- } /* END FUNCTION ShowClientIconState */
- /*************************************<->*************************************
- *
- * IconScrollVisibleCallback
- *
- *
- * Description:
- * -----------
- * for each icon in the icon box
- *
- *************************************<->***********************************/
- void IconScrollVisibleCallback (Widget w, caddr_t client_data, XmAnyCallbackStruct *call_data)
- {
- XmTraverseObscuredCallbackStruct *vis_data;
- vis_data = (XmTraverseObscuredCallbackStruct *) call_data;
- XmScrollVisible(ACTIVE_WS->pIconBox->scrolledWidget,
- vis_data->traversal_destination,
- 0,0);
- /*
- IB_MARGIN_WIDTH, IB_MARGIN_HEIGHT);
- */
- } /* END OF FUNCTION IconScrollVisibleCallback */
- /*************************************<->*************************************
- *
- * IconActivateCallback
- *
- *
- * Description:
- * -----------
- * for each icon in the icon box
- *
- *************************************<->***********************************/
- void IconActivateCallback (Widget w, caddr_t client_data, XmAnyCallbackStruct *call_data)
- {
- ClientData *pCD;
- Window theIcon;
- theIcon = XtWindow(w);
- /*
- * find context to get pCD and then carry out
- * default action.
- */
- if (!(XFindContext (DISPLAY, theIcon,
- wmGD.windowContextType, (caddr_t *)&pCD)))
- {
- F_Restore_And_Raise ((String)NULL, pCD, (XEvent *)NULL );
- /* F_Normalize_And_Raise ((String)NULL, pCD, (XEvent *)NULL );
- */ }
- } /* END OF FUNCTION IconActivateCallback */
- /*************************************<->*************************************
- *
- * UpdateIncrements
- *
- *
- * Description:
- * -----------
- * XXDescription ...
- *
- *************************************<->***********************************/
- void UpdateIncrements (Widget sWidget, IconBoxData *pIBD, XConfigureEvent *event)
- {
- ResetArrowButtonIncrements (pIBD->pCD_iconBox);
-
- } /* END OF FUNCTION UpdateIncrements */
- /*************************************<->*************************************
- *
- * ResetArrowButtonIncrements(pCD)
- *
- *************************************<->***********************************/
- void ResetArrowButtonIncrements (ClientData *pCD)
- {
- int i;
- Arg setArgs[2];
-
- i=0;
- XtSetArg (setArgs[i], XmNincrement, (XtArgVal) pCD->heightInc); i++;
- XtSetValues (pCD->thisIconBox->vScrollBar, (ArgList) setArgs, i);
- i=0;
- XtSetArg (setArgs[i], XmNincrement, (XtArgVal) pCD->widthInc); i++;
- XtSetValues (pCD->thisIconBox->hScrollBar, (ArgList) setArgs, i);
-
- } /* END OF FUNCTION ResetArrowButtonIncrements */
- /*************************************<->*************************************
- *
- * ChangeActiveIconboxIconText
- *
- *
- * Description:
- * -----------
- * XXDescription ...
- *
- *************************************<->***********************************/
- void ChangeActiveIconboxIconText (Widget icon, caddr_t dummy, XFocusChangeEvent *event)
- {
- ClientData *pCD;
- Window theIcon;
- /*
- * find context to get pCD and then hide or show active icon text.
- * Show/hide the active icon text only if the icon box is not
- * iconified.
- */
- theIcon = XtWindow(icon);
- if (!(XFindContext (DISPLAY, theIcon,
- wmGD.windowContextType, (caddr_t *)&pCD)) &&
- P_ICON_BOX(pCD) &&
- P_ICON_BOX(pCD)->pCD_iconBox &&
- P_ICON_BOX(pCD)->pCD_iconBox->clientState != MINIMIZED_STATE)
- {
- if (event->type == FocusIn)
- {
- if (event->send_event)
- {
- ShowActiveIconText (pCD);
- }
- }
- else
- {
- if (event->send_event)
- {
- HideActiveIconText (pCD->pSD);
- }
- }
- }
- } /* END OF FUNCTION ChangeActiveIconboxIconText */
- /*************************************<->*************************************
- *
- * HandleIconBoxIconKeyPress
- *
- *
- * Description:
- * -----------
- * This event handler catches keyevents for icons in the icon box and
- * passes them on to the standard key handling routine for mwm.
- *
- *************************************<->***********************************/
- void HandleIconBoxIconKeyPress (Widget icon, caddr_t dummy, XKeyEvent *keyEvent)
- {
-
- Context context;
- ClientData *pCD;
- Window theIcon;
- /*
- * find context to get pCD and then post menu show active icon text.
- */
-
- theIcon = XtWindow(icon);
- if (!(XFindContext (DISPLAY, theIcon,
- wmGD.windowContextType, (caddr_t *)&pCD)))
- {
- SetClientWsIndex (pCD);
- keyEvent->window = ICON_FRAME_WIN(pCD);
- if (pCD->clientState == MINIMIZED_STATE)
- {
- context = F_SUBCONTEXT_IB_IICON;
- pCD->grabContext = F_SUBCONTEXT_IB_IICON;
- }
- else
- {
- context = F_SUBCONTEXT_IB_WICON;
- pCD->grabContext = F_SUBCONTEXT_IB_WICON;
- }
-
- if(!(HandleKeyPress (keyEvent, ACTIVE_PSD->keySpecs,
- True, context, False, pCD)))
- {
- keyEvent->window = 0;
- keyEvent->type = 0;
- }
- }
-
- } /* END OF FUNCTION HandleIconBoxIconKeyPress */
- /*************************************<->*************************************
- *
- * HandleIconBoxButtonMotion
- *
- *
- * Description:
- * -----------
- * Event handler for button motion events on icon frame window in
- * in icon box.
- *
- *
- * Inputs:
- * ------
- * icon - widget for icon frame
- * client_data - extra client data
- * pev - ptr to event
- *
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- * o This is added to make sure that ButtonXMotion gets added to the
- * event mask for icons in the icon box.
- *
- *************************************<->***********************************/
- void HandleIconBoxButtonMotion (Widget icon, caddr_t client_data, XEvent *pev)
- {
- } /* END OF FUNCTION HandleIconBoxButtonMotion */
- /*************************************<->*************************************
- *
- * GetIconBoxIconRootXY (pCD, pX, pY)
- *
- *
- * Description:
- * -----------
- *
- *
- * Inputs:
- * ------
- * pCD - pointer to client data
- * pX - pointer to X return value
- * pY - pointer to Y return value
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- * o returns root-window coords
- *
- *************************************<->***********************************/
- void GetIconBoxIconRootXY (ClientData *pCD, int *pX, int *pY)
- {
- Window child;
- WsClientData *pWsc = GetWsClientData (pCD->pSD->pActiveWS, pCD);
- if (pCD->pSD->useIconBox && pWsc->pIconBox)
- {
- XTranslateCoordinates(DISPLAY,
- XtWindow(pWsc->pIconBox->bBoardWidget),
- ROOT_FOR_CLIENT(pCD),
- pWsc->iconX + IB_MARGIN_WIDTH,
- pWsc->iconY + IB_MARGIN_HEIGHT,
- pX, pY, &child);
- }
- else
- {
- *pX = *pY = 0;
- }
- } /* END FUNCTION GetIconBoxIconRootXY */
- /*************************************<->*************************************
- *
- * IconVisible (pCD)
- *
- *
- * Description:
- * -----------
- *
- * Inputs:
- * ------
- * pCD - pointer to client data
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- Boolean IconVisible (ClientData *pCD)
- {
- /*
- * May use icon->core.visible field if that gets fixed and
- * we want to accept the Intrinsics idea of what is visible.
- */
- Boolean rval = True;
- WsClientData *pWsc = GetWsClientData (pCD->pSD->pActiveWS, pCD);
-
- int i;
- Arg getArgs[5];
- Dimension tmpWidth = 0;
- Dimension tmpHeight = 0;
- Position clipX = 0;
- Position clipY = 0;
- Position tmpX = 0;
- Position tmpY = 0;
- int iconX, iconY;
- i=0;
- XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &tmpWidth ); i++;
- XtSetArg (getArgs[i], XmNheight, (XtArgVal) &tmpHeight ); i++;
- XtSetArg (getArgs[i], XmNx, (XtArgVal) &tmpX ); i++;
- XtSetArg (getArgs[i], XmNy, (XtArgVal) &tmpY ); i++;
- XtGetValues (pWsc->pIconBox->clipWidget, getArgs, i);
- XtTranslateCoords(pWsc->pIconBox->scrolledWidget,
- tmpX, tmpY,
- &clipX, &clipY);
- GetIconBoxIconRootXY(pCD, &iconX, &iconY);
- /*
- * demand at least 2 pixels of the
- * real icon (not drawnButton) be showing
- */
-
- if (iconX + 2 > ((int)clipX + (int)tmpWidth))
- {
- return(False);
- }
- if (iconY + 2 > ((int)clipY + (int)tmpHeight))
- {
- return(False);
- }
- if ((iconX + (ICON_WIDTH(pCD) -2)) < (int)clipX)
- {
- return(False);
- }
- if ((iconY + (ICON_HEIGHT(pCD) -2)) < (int)clipY)
- {
- return(False);
- }
- return(rval);
- } /* END OF FUNCTION IconVisible */
- /*************************************<->*************************************
- *
- * WmXmStringToString (xmString
- *
- *
- * Description:
- * -----------
- *
- *
- * Inputs:
- * ------
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- * Return the ascii part of the first segment of an XmString
- * If xmString is NULL, then do nothing
- *
- *************************************<->***********************************/
- String WmXmStringToString (XmString xmString)
- {
- XmStringContext xmStrContext;
- char *asciiString = NULL;
- XmStringCharSet ibTitleCharset;
- XmStringDirection ibTitleDirection;
- Boolean separator;
-
- if (xmString)
- {
- XmStringInitContext (&xmStrContext, xmString);
-
- XmStringGetNextSegment (xmStrContext, &asciiString,
- &ibTitleCharset, &ibTitleDirection,
- &separator);
- if (ibTitleCharset != NULL)
- {
- XtFree ((char *)ibTitleCharset);
- }
- XmStringFreeContext (xmStrContext);
- }
-
- return(asciiString);
-
- } /* END OF FUNCTION WmXmStringToString */
|