WmResource.c 147 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288
  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, 1993, 1994 HEWLETT-PACKARD COMPANY
  32. * (c) Copyright 1993, 1994 International Business Machines Corp.
  33. * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  34. * (c) Copyright 1993, 1994 Novell, Inc.
  35. */
  36. /*
  37. * Included Files:
  38. */
  39. #include "WmGlobal.h"
  40. #include "WmResNames.h"
  41. #define MWM_NEED_IIMAGE
  42. #include "WmIBitmap.h"
  43. #include <stdio.h>
  44. #include <Xm/XmP.h>
  45. #include <Xm/RowColumn.h>
  46. #include <Xm/ScreenP.h> /* for XmGetXmScreen and screen.moveOpaque */
  47. /*
  48. * include extern functions
  49. */
  50. #include "WmResource.h"
  51. #include "WmError.h"
  52. #include "WmGraphics.h"
  53. #include "WmMenu.h"
  54. #include "WmResParse.h"
  55. #include "WmBackdrop.h"
  56. #include "WmIconBox.h"
  57. #include "WmWrkspace.h"
  58. #include <Dt/GetDispRes.h>
  59. #define cfileP (wmGD.pWmPB->pFile) /* fopen'ed configuration file or NULL */
  60. #include "WmXSMP.h"
  61. /*
  62. * Function Declarations:
  63. */
  64. XmColorData *_WmGetDefaultColors ();
  65. void _WmTopShadowPixmapDefault (Widget widget, int offset, XrmValue *value);
  66. void _WmIconImageFDefault (Widget widget, int offset, XrmValue *value);
  67. void _WmIconImageBDefault (Widget widget, int offset, XrmValue *value);
  68. void _WmIconImageBSCDefault (Widget widget, int offset, XrmValue *value);
  69. void _WmIconImageBSPDefault (Widget widget, int offset, XrmValue *value);
  70. void _WmIconImageTSCDefault (Widget widget, int offset, XrmValue *value);
  71. void _WmIconImageTSPDefault (Widget widget, int offset, XrmValue *value);
  72. void _WmMatteFDefault (Widget widget, int offset, XrmValue *value);
  73. void _WmMatteBDefault (Widget widget, int offset, XrmValue *value);
  74. void _WmMatteBSCDefault (Widget widget, int offset, XrmValue *value);
  75. void _WmMatteBSPDefault (Widget widget, int offset, XrmValue *value);
  76. void _WmMatteTSCDefault (Widget widget, int offset, XrmValue *value);
  77. void _WmMatteTSPDefault (Widget widget, int offset, XrmValue *value);
  78. void _WmBackgroundDefault (Widget widget, int offset, XrmValue *value);
  79. void _WmForegroundDefault (Widget widget, int offset, XrmValue *value);
  80. void _WmBackgroundPixmapDefault (Widget widget, int offset, XrmValue *value);
  81. void _WmBottomShadowColorDefault (Widget widget, int offset, XrmValue *value);
  82. void _WmTopShadowColorDefault (Widget widget, int offset, XrmValue *value);
  83. void _WmABackgroundDefault (Widget widget, int offset, XrmValue *value);
  84. void _WmAForegroundDefault (Widget widget, int offset, XrmValue *value);
  85. void _WmABackgroundPixmapDefault (Widget widget, int offset, XrmValue *value);
  86. void _WmABottomShadowColorDefault (Widget widget, int offset, XrmValue *value);
  87. void _WmATopShadowColorDefault (Widget widget, int offset, XrmValue *value);
  88. void _WmATopShadowPixmapDefault (Widget widget, int offset, XrmValue *value);
  89. void _WmFocusAutoRaiseDefault (Widget widget, int offset, XrmValue *value);
  90. void _WmMultiClickTimeDefault (Widget widget, int offset, XrmValue *value);
  91. void ProcessWmResources (void);
  92. void ProcessGlobalScreenResources (void);
  93. void SetStdGlobalResourceValues (void);
  94. void ProcessScreenListResource (void);
  95. void ProcessAppearanceResources (WmScreenData *pSD);
  96. void MakeAppearanceResources (WmScreenData *pSD, AppearanceData *pAData, Boolean makeActiveResources);
  97. void GetAppearanceGCs (WmScreenData *pSD, Pixel fg, Pixel bg, XFontStruct *font, Pixmap bg_pixmap, Pixel ts_color, Pixmap ts_pixmap, Pixel bs_color, Pixmap bs_pixmap, GC *pGC, GC *ptsGC, GC *pbsGC);
  98. void ProcessScreenResources (WmScreenData *pSD, unsigned char *screenName);
  99. void ProcessWorkspaceResources (WmWorkspaceData *pWS);
  100. void ProcessClientResources (ClientData *pCD);
  101. void SetStdClientResourceValues (ClientData *pCD);
  102. void SetStdScreenResourceValues (WmScreenData *pSD);
  103. GC GetHighlightGC (WmScreenData *pSD, Pixel fg, Pixel bg, Pixmap pixmap);
  104. static void WriteOutXrmColors (WmScreenData *pSD);
  105. void ProcessPresenceResources (WmScreenData *pSD);
  106. void ProcessDefaultBackdropImages (WmScreenData *pSD);
  107. void _WmBackdropBgDefault (Widget widget, int offset, XrmValue *value);
  108. void _WmBackdropFgDefault (Widget widget, int offset, XrmValue *value);
  109. void _WmBackdropColorSetDefault (Widget widget, int offset, XrmValue *value);
  110. void _WmIconImageMaximumDefault (Widget widget, int offset, XrmValue *value);
  111. void _WmSecondariesOnTopDefault (Widget widget, int offset, XrmValue *value);
  112. int DefaultWsColorSetId (WmWorkspaceData *pWS);
  113. void _WmGetDynamicDefault (Widget widget, unsigned char type, String defaultColor, Pixel newBackground, XrmValue *value);
  114. Boolean SimilarAppearanceData (AppearanceData *pAD1, AppearanceData *pAD2);
  115. /*
  116. * Global Variables:
  117. */
  118. /* builtin window menu specification */
  119. #ifndef NO_MESSAGE_CATALOG
  120. /*
  121. * Use the same name as builtin to let the message catalog menu
  122. * take precedence over any menus that might match in sys.mwmrc
  123. */
  124. char defaultSystemMenuName[] = "_MwmWindowMenu_";
  125. #else
  126. char defaultSystemMenuName[] = "DefaultWindowMenu";
  127. #endif /* NO_MESSAGE_CATALOG */
  128. char builtinSystemMenuName[] = "_MwmWindowMenu_";
  129. #define BUILTINSYSTEMMENU "_MwmWindowMenu_\n\
  130. {\n\
  131. Restore _R Alt<Key>F5 f.restore\n\
  132. Move _M Alt<Key>F7 f.move\n\
  133. Size _S Alt<Key>F8 f.resize\n\
  134. Minimize _n Alt<Key>F9 f.minimize\n\
  135. Maximize _x Alt<Key>F10 f.maximize\n\
  136. Lower _L Alt<Key>F3 f.lower\n\
  137. no-label f.separator\n\
  138. Close _C Alt<Key>F4 f.kill\n\
  139. }"
  140. #ifdef NO_MESSAGE_CATALOG
  141. char builtinSystemMenu[] = BUILTINSYSTEMMENU;
  142. #else /* !defined(NO_MESSAGE_CATALOG)*/
  143. char *builtinSystemMenu = BUILTINSYSTEMMENU;
  144. #define DEFAULT_DTWM_SYSTEMMENU "_MwmWindowMenu_\n\
  145. {\n\
  146. Restore _R f.restore\n\
  147. Move _M f.move\n\
  148. Size _S f.resize\n\
  149. Minimize _n f.minimize\n\
  150. Maximize _x f.maximize\n\
  151. Lower _L f.lower\n\
  152. no-label f.separator\n\
  153. \"Occupy Workspace...\" _O f.workspace_presence\n\
  154. \"Occupy All Workspaces\" _A f.occupy_all\n\
  155. \"Unoccupy Workspace\" _U f.remove\n\
  156. no-label f.separator\n\
  157. Close _C Alt<Key>F4 f.kill\n\
  158. }"
  159. void InitBuiltinSystemMenu(void)
  160. {
  161. char * tmpString;
  162. char *ResString = NULL;
  163. char *MovString = NULL;
  164. char *SizString = NULL;
  165. char *MinString = NULL;
  166. char *MaxString = NULL;
  167. char *LowString = NULL;
  168. char *OcpString = NULL;
  169. char *OcaString = NULL;
  170. char *RemString = NULL;
  171. char *CloString = NULL;
  172. char dsm[2048];
  173. char dsmtemp[sizeof(dsm)];
  174. Boolean gotItAll;
  175. gotItAll = True;
  176. if(gotItAll)
  177. {
  178. #ifdef sun
  179. tmpString = ((char *)GETMESSAGE(62, 60, "Restore _R Alt<Key>F5 f.restore"));
  180. #else
  181. tmpString = ((char *)GETMESSAGE(62, 49, "Restore _R f.restore"));
  182. #endif
  183. if ((ResString =
  184. (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
  185. {
  186. Warning (((char *)GETMESSAGE(62, 2, "Insufficient memory for local default menu.")));
  187. gotItAll = False;
  188. }
  189. else
  190. {
  191. strcpy(ResString, tmpString);
  192. }
  193. }
  194. if(gotItAll)
  195. {
  196. #ifdef sun
  197. tmpString = ((char *)GETMESSAGE(62, 61, "Move _M Alt<Key>F7 f.move"));
  198. #else
  199. tmpString = ((char *)GETMESSAGE(62, 50, "Move _M f.move"));
  200. #endif
  201. if ((MovString =
  202. (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
  203. {
  204. Warning (((char *)GETMESSAGE(62, 4, "Insufficient memory for local default menu.")));
  205. gotItAll = False;
  206. }
  207. else
  208. {
  209. strcpy(MovString, tmpString);
  210. }
  211. }
  212. if(gotItAll)
  213. {
  214. #ifdef sun
  215. tmpString = ((char *)GETMESSAGE(62, 62, "Size _S Alt<Key>F8 f.resize"));
  216. #else
  217. tmpString = ((char *)GETMESSAGE(62, 51, "Size _S f.resize"));
  218. #endif
  219. if ((SizString =
  220. (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
  221. {
  222. Warning (((char *)GETMESSAGE(62, 6, "Insufficient memory for local default menu.")));
  223. gotItAll = False;
  224. }
  225. else
  226. {
  227. strcpy(SizString, tmpString);
  228. }
  229. }
  230. if(gotItAll)
  231. {
  232. #ifdef sun
  233. tmpString = ((char *)GETMESSAGE(62, 63, "Minimize _n Alt<Key>F9 f.minimize"));
  234. #else
  235. tmpString = ((char *)GETMESSAGE(62, 52, "Minimize _n f.minimize"));
  236. #endif
  237. if ((MinString =
  238. (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
  239. {
  240. Warning (((char *)GETMESSAGE(62, 8, "Insufficient memory for local default menu.")));
  241. gotItAll = False;
  242. }
  243. else
  244. {
  245. strcpy(MinString, tmpString);
  246. }
  247. }
  248. if(gotItAll)
  249. {
  250. #ifdef sun
  251. tmpString = ((char *)GETMESSAGE(62, 64, "Maximize _x Alt<Key>F10 f.maximize"));
  252. #else
  253. tmpString = ((char *)GETMESSAGE(62, 53, "Maximize _x f.maximize"));
  254. #endif
  255. if ((MaxString =
  256. (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
  257. {
  258. Warning (((char *)GETMESSAGE(62, 10, "Insufficient memory for local default menu.")));
  259. gotItAll = False;
  260. }
  261. else
  262. {
  263. strcpy(MaxString, tmpString);
  264. }
  265. }
  266. if(gotItAll)
  267. {
  268. #ifdef sun
  269. tmpString = ((char *)GETMESSAGE(62, 65, "Lower _L Alt<Key>F3 f.lower"));
  270. #else
  271. tmpString = ((char *)GETMESSAGE(62, 54, "Lower _L f.lower"));
  272. #endif
  273. if ((LowString =
  274. (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
  275. {
  276. Warning (((char *)GETMESSAGE(62, 12, "Insufficient memory for local default menu.")));
  277. gotItAll = False;
  278. }
  279. else
  280. {
  281. strcpy(LowString, tmpString);
  282. }
  283. }
  284. if (DtwmBehavior)
  285. {
  286. if(gotItAll)
  287. {
  288. tmpString = ((char *)GETMESSAGE(62, 55, "Occupy\\ Workspace\\.\\.\\. _O f.workspace_presence"));
  289. if ((OcpString =
  290. (char *)XtMalloc ((unsigned int)
  291. (strlen(tmpString) + 1))) == NULL)
  292. {
  293. Warning (((char *)GETMESSAGE(62, 14, "Insufficient memory for local default menu.")));
  294. gotItAll = False;
  295. }
  296. else
  297. {
  298. strcpy(OcpString, tmpString);
  299. }
  300. }
  301. if(gotItAll)
  302. {
  303. tmpString = ((char *)GETMESSAGE(62, 56, "Occupy\\ All\\ Workspaces _A f.occupy_all"));
  304. if ((OcaString =
  305. (char *)XtMalloc ((unsigned int)
  306. (strlen(tmpString) + 1))) == NULL)
  307. {
  308. Warning (((char *)GETMESSAGE(62, 16, "Insufficient memory for local default menu.")));
  309. gotItAll = False;
  310. }
  311. else
  312. {
  313. strcpy(OcaString, tmpString);
  314. }
  315. }
  316. if(gotItAll)
  317. {
  318. tmpString = ((char *)GETMESSAGE(62, 57, "Unoccupy\\ Workspace _U f.remove"));
  319. if ((RemString =
  320. (char *)XtMalloc ((unsigned int)
  321. (strlen(tmpString) + 1))) == NULL)
  322. {
  323. Warning (((char *)GETMESSAGE(62, 18, "Insufficient memory for local default menu.")));
  324. gotItAll = False;
  325. }
  326. else
  327. {
  328. strcpy(RemString, tmpString);
  329. }
  330. }
  331. } /* if DTWM */
  332. if(gotItAll)
  333. {
  334. tmpString = ((char *)GETMESSAGE(62, 48, "Close _C Alt<Key>F4 f.kill"));
  335. if ((CloString =
  336. (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
  337. {
  338. Warning (((char *)GETMESSAGE(62, 20, "Insufficient memory for local default menu.")));
  339. gotItAll = False;
  340. }
  341. else
  342. {
  343. strcpy(CloString, tmpString);
  344. }
  345. }
  346. if (!gotItAll)
  347. {
  348. if (DtwmBehavior)
  349. {
  350. builtinSystemMenu = (char *)
  351. XtNewString((String)DEFAULT_DTWM_SYSTEMMENU);
  352. }
  353. else
  354. {
  355. builtinSystemMenu = (char *)
  356. XtNewString((String)BUILTINSYSTEMMENU);
  357. }
  358. }
  359. else
  360. {
  361. /* put it together */
  362. snprintf(dsm, sizeof(dsm), "%s\n{\n%s\n%s\n%s\n%s\n%s\n%s\n no-label f.separator\n",
  363. defaultSystemMenuName, ResString, MovString,
  364. SizString, MinString, MaxString, LowString);
  365. if (DtwmBehavior)
  366. {
  367. snprintf(dsmtemp, sizeof(dsmtemp), "%s%s\n%s\n%s\n no-label f.separator\n",
  368. dsm, OcpString, OcaString, RemString);
  369. strcpy(dsm, dsmtemp);
  370. }
  371. snprintf(dsmtemp, sizeof(dsmtemp), "%s%s\n}", dsm, CloString);
  372. strcpy(dsm, dsmtemp);
  373. if ((builtinSystemMenu =
  374. (char *)XtMalloc ((unsigned int) (strlen(dsm) + 1))) == NULL)
  375. {
  376. Warning (((char *)GETMESSAGE(62, 21, "Insufficient memory for localized default system menu")));
  377. if (DtwmBehavior)
  378. {
  379. builtinSystemMenu = (char *)
  380. XtNewString((String)DEFAULT_DTWM_SYSTEMMENU);
  381. }
  382. else
  383. {
  384. builtinSystemMenu = (char *)
  385. XtNewString((String)BUILTINSYSTEMMENU);
  386. }
  387. }
  388. else
  389. {
  390. strcpy(builtinSystemMenu, dsm);
  391. }
  392. }
  393. if (ResString != NULL)
  394. XtFree(ResString);
  395. if (MovString != NULL)
  396. XtFree(MovString);
  397. if (SizString != NULL)
  398. XtFree(SizString);
  399. if (MinString != NULL)
  400. XtFree(MinString);
  401. if (MaxString != NULL)
  402. XtFree(MaxString);
  403. if (LowString != NULL)
  404. XtFree(LowString);
  405. if (OcpString != NULL)
  406. XtFree(OcpString);
  407. if (OcaString != NULL)
  408. XtFree(OcaString);
  409. if (RemString != NULL)
  410. XtFree(RemString);
  411. if (CloString != NULL)
  412. XtFree(CloString);
  413. } /* END OF FUNCTION InitBuiltinSystemMenu */
  414. #endif /* NO_MESSAGE_CATALOG */
  415. #define HARD_CODED_PRIMARY 3
  416. char defaultRootMenuName[] = "DefaultRootMenu";
  417. char builtinRootMenuName[] = "_MwmRootMenu_";
  418. #define BUILTINROOTMENU "DefaultRootMenu\n\
  419. {\n\
  420. \"Root Menu\" f.title\n\
  421. \"New Window\" f.exec \"xterm &\"\n\
  422. \"Shuffle Up\" f.circle_up\n\
  423. \"Shuffle Down\" f.circle_down\n\
  424. \"Refresh\" f.refresh\n\
  425. \"Pack Icons\" f.pack_icons\n\
  426. no-label f.separator\n\
  427. \"Restart...\" f.restart\n\
  428. }";
  429. char builtinRootMenu[] = BUILTINROOTMENU
  430. /* builtin key bindings specification */
  431. char defaultKeyBindingsName[] = "DefaultKeyBindings";
  432. char builtinKeyBindingsName[] = "_MwmKeyBindings_";
  433. #define BUILTINKEYBINDINGS "_MwmKeyBindings_\n\
  434. {\n\
  435. Shift<Key>Escape window|icon f.post_wmenu\n\
  436. Alt<Key>space window|icon f.post_wmenu\n\
  437. Alt<Key>Tab root|icon|window f.next_key\n\
  438. Alt Shift<Key>Tab root|icon|window f.prev_key\n\
  439. Alt<Key>Escape root|icon|window f.circle_down\n\
  440. Alt Shift<Key>Escape root|icon|window f.circle_up\n\
  441. Alt Shift Ctrl<Key>exclam root|icon|window f.set_behavior\n\
  442. Alt Ctrl<Key>1 root|icon|window f.set_behavior\n\
  443. Alt<Key>F6 window f.next_key transient\n\
  444. Alt Shift<Key>F6 window f.prev_key transient\n\
  445. Shift<Key>F10 icon f.post_wmenu\n\
  446. }";
  447. char builtinKeyBindings[] = BUILTINKEYBINDINGS
  448. /*
  449. * NOTE: Default Toggle Behavior key bindings. There are TWO key bindings as
  450. * of 1.1.4 and 1.2. Make sure you make any modify builtinKeyBindings (above)
  451. * whenever modifying behaviorKeyBindings.
  452. */
  453. char behaviorKeyBindingName[] = "_MwmBehaviorKey_";
  454. #define BEHAVIORKEYBINDINGS "_MwmBehaviorKey_\n\
  455. {\n\
  456. Alt Shift Ctrl<Key>exclam root|icon|window f.set_behavior\n\
  457. Alt Ctrl<Key>1 root|icon|window f.set_behavior\n\
  458. }";
  459. char behaviorKeyBindings[] = BEHAVIORKEYBINDINGS
  460. /* default button bindings specification */
  461. /* note - the %s will be replaced by the real DefaultRootMenu */
  462. char defaultButtonBindingsName[] = "DefaultButtonBindings";
  463. char builtinButtonBindingsName[] = "_MwmButtonBindings_";
  464. # define BUILTINBUTTONBINDINGS "_MwmButtonBindings_\n\
  465. {\n\
  466. <Btn1Down> icon|frame f.raise\n\
  467. <Btn3Down> icon|frame f.post_wmenu\n\
  468. <Btn3Down> root f.menu DefaultRootMenu\n\
  469. }";
  470. char builtinButtonBindings[] = BUILTINBUTTONBINDINGS
  471. static ClientData *_pCD;
  472. static String _defaultBackground;
  473. static String _defaultActiveBackground;
  474. static AppearanceData *_pAppearanceData;
  475. static WmWorkspaceData *pResWS;
  476. static WmScreenData *pResSD;
  477. static char _defaultColor1HEX[] = "#A8A8A8A8A8A8";
  478. static char _defaultColor2HEX[] = "#5F5F92929E9E";
  479. static char _defaultColor1[] = "LightGrey";
  480. static char _defaultColor2[] = "CadetBlue";
  481. #define DEFAULT_COLOR_NONE NULL
  482. Const char _foreground[] = "foreground";
  483. Const char _75_foreground[] = "75_foreground";
  484. Const char _50_foreground[] = "50_foreground";
  485. Const char _25_foreground[] = "25_foreground";
  486. Const char *_Dither = XmCO_DITHER;
  487. Const char *_NoDither = XmCO_NO_DITHER;
  488. Const char CLIENT_FRAME_PART[] = "client";
  489. Const char ICON_FRAME_PART[] = "icon";
  490. Const char FEEDBACK_FRAME_PART[] = "feedback";
  491. Const char MENU_ITEM_PART[] = "menu";
  492. #define WmBGC XmBACKGROUND
  493. #define WmFGC XmFOREGROUND
  494. #define WmTSC XmTOP_SHADOW
  495. #define WmBSC XmBOTTOM_SHADOW
  496. #define MAX_SHORT 0xffff
  497. #ifndef BITMAPDIR
  498. #define BITMAPDIR "/usr/include/X11/bitmaps/"
  499. #endif
  500. /*************************************<->*************************************
  501. *
  502. * wmGlobalResources
  503. *
  504. *
  505. * Description:
  506. * -----------
  507. * This data structure is used in the processing of mwm general
  508. * appearance and behavior resources. These resources are specified
  509. * with the following syntax:
  510. *
  511. * "Mwm*<resource_identifier>".
  512. *
  513. *************************************<->***********************************/
  514. XtResource wmGlobalResources[] =
  515. {
  516. {
  517. WmNautoKeyFocus,
  518. WmCAutoKeyFocus,
  519. XtRBoolean,
  520. sizeof (Boolean),
  521. XtOffsetOf(WmGlobalData, autoKeyFocus),
  522. XtRImmediate,
  523. (XtPointer)True
  524. },
  525. {
  526. WmNautoRaiseDelay,
  527. WmCAutoRaiseDelay,
  528. XtRInt,
  529. sizeof (int),
  530. XtOffsetOf(WmGlobalData, autoRaiseDelay),
  531. XtRImmediate,
  532. (XtPointer)500
  533. },
  534. {
  535. WmNbitmapDirectory,
  536. WmCBitmapDirectory,
  537. XtRString,
  538. sizeof (String),
  539. XtOffsetOf(WmGlobalData, bitmapDirectory),
  540. XtRString,
  541. (XtPointer)BITMAPDIR
  542. },
  543. {
  544. WmNblinkOnExec,
  545. WmCBlinkOnExec,
  546. XtRBoolean,
  547. sizeof (Boolean),
  548. XtOffsetOf(WmGlobalData, blinkOnExec),
  549. XtRImmediate,
  550. (XtPointer)False
  551. },
  552. {
  553. WmNframeStyle,
  554. WmCFrameStyle,
  555. WmRFrameStyle,
  556. sizeof (FrameStyle),
  557. XtOffsetOf(WmGlobalData, frameStyle),
  558. XtRImmediate,
  559. (XtPointer)WmRECESSED
  560. },
  561. {
  562. WmNclientAutoPlace,
  563. WmCClientAutoPlace,
  564. XtRBoolean,
  565. sizeof (Boolean),
  566. XtOffsetOf(WmGlobalData, clientAutoPlace),
  567. XtRImmediate,
  568. (XtPointer)True
  569. },
  570. {
  571. WmNcolormapFocusPolicy,
  572. WmCColormapFocusPolicy,
  573. WmRCFocusPolicy,
  574. sizeof (int),
  575. XtOffsetOf(WmGlobalData, colormapFocusPolicy),
  576. XtRImmediate,
  577. (XtPointer)CMAP_FOCUS_KEYBOARD
  578. },
  579. {
  580. WmNconfigFile,
  581. WmCConfigFile,
  582. XtRString,
  583. sizeof (String),
  584. XtOffsetOf(WmGlobalData, configFile),
  585. XtRImmediate,
  586. (XtPointer)NULL
  587. },
  588. {
  589. WmNcppCommand,
  590. WmCCppCommand,
  591. XtRString,
  592. sizeof (String),
  593. XtOffsetOf(WmGlobalData, cppCommand),
  594. XtRImmediate,
  595. (XtPointer)NULL
  596. },
  597. {
  598. WmNdeiconifyKeyFocus,
  599. WmCDeiconifyKeyFocus,
  600. XtRBoolean,
  601. sizeof (Boolean),
  602. XtOffsetOf(WmGlobalData, deiconifyKeyFocus),
  603. XtRImmediate,
  604. (XtPointer)True
  605. },
  606. {
  607. WmNdoubleClickTime,
  608. WmCDoubleClickTime,
  609. XtRInt,
  610. sizeof (int),
  611. XtOffsetOf(WmGlobalData, doubleClickTime),
  612. XtRCallProc,
  613. (XtPointer)_WmMultiClickTimeDefault
  614. },
  615. {
  616. WmNenableWarp,
  617. WmCEnableWarp,
  618. XtRBoolean,
  619. sizeof (Boolean),
  620. XtOffsetOf(WmGlobalData, enableWarp),
  621. XtRImmediate,
  622. (XtPointer)True
  623. },
  624. {
  625. WmNenforceKeyFocus,
  626. WmCEnforceKeyFocus,
  627. XtRBoolean,
  628. sizeof (Boolean),
  629. XtOffsetOf(WmGlobalData, enforceKeyFocus),
  630. XtRImmediate,
  631. (XtPointer)True
  632. },
  633. {
  634. WmNframeExternalShadowWidth,
  635. WmCFrameExternalShadowWidth,
  636. XtRDimension,
  637. sizeof (Dimension),
  638. XtOffsetOf(WmGlobalData, frameExternalShadowWidth),
  639. XtRImmediate,
  640. (XtPointer)2
  641. },
  642. {
  643. WmNfreezeOnConfig,
  644. WmCFreezeOnConfig,
  645. XtRBoolean,
  646. sizeof (Boolean),
  647. XtOffsetOf(WmGlobalData, freezeOnConfig),
  648. XtRImmediate,
  649. (XtPointer)True
  650. },
  651. {
  652. WmNuseWindowOutline,
  653. WmCUseWindowOutline,
  654. XtRBoolean,
  655. sizeof (Boolean),
  656. XtOffsetOf(WmGlobalData, useWindowOutline),
  657. XtRImmediate,
  658. (XtPointer)False
  659. },
  660. {
  661. WmNiconAutoPlace,
  662. WmCIconAutoPlace,
  663. XtRBoolean,
  664. sizeof (Boolean),
  665. XtOffsetOf(WmGlobalData, iconAutoPlace),
  666. XtRImmediate,
  667. (XtPointer)True
  668. },
  669. {
  670. WmNiconExternalShadowWidth,
  671. WmCIconExternalShadowWidth,
  672. XtRDimension,
  673. sizeof (Dimension),
  674. XtOffsetOf(WmGlobalData, iconExternalShadowWidth),
  675. XtRImmediate,
  676. (XtPointer)2
  677. },
  678. {
  679. WmNiconClick,
  680. WmCIconClick,
  681. XtRBoolean,
  682. sizeof (Boolean),
  683. XtOffsetOf(WmGlobalData, iconClick),
  684. XtRImmediate,
  685. (XtPointer)True
  686. },
  687. {
  688. WmNinteractivePlacement,
  689. WmCInteractivePlacement,
  690. XtRBoolean,
  691. sizeof (Boolean),
  692. XtOffsetOf(WmGlobalData, interactivePlacement),
  693. XtRImmediate,
  694. (XtPointer)False
  695. },
  696. {
  697. WmNkeyboardFocusPolicy,
  698. WmCKeyboardFocusPolicy,
  699. WmRKFocusPolicy,
  700. sizeof (int),
  701. XtOffsetOf(WmGlobalData, keyboardFocusPolicy),
  702. XtRImmediate,
  703. #if defined(sun)
  704. (XtPointer)KEYBOARD_FOCUS_POINTER
  705. #else
  706. (XtPointer)KEYBOARD_FOCUS_EXPLICIT
  707. #endif
  708. },
  709. {
  710. WmNlowerOnIconify,
  711. WmCLowerOnIconify,
  712. XtRBoolean,
  713. sizeof (Boolean),
  714. XtOffsetOf(WmGlobalData, lowerOnIconify),
  715. XtRImmediate,
  716. (XtPointer)True
  717. },
  718. {
  719. WmNmarqueeSelectGranularity,
  720. WmCMarqueeSelectGranularity,
  721. XtRInt,
  722. sizeof (int),
  723. XtOffsetOf(WmGlobalData, marqueeSelectGranularity),
  724. XtRImmediate,
  725. (XtPointer)0
  726. },
  727. {
  728. WmNmoveThreshold,
  729. WmCMoveThreshold,
  730. XtRInt,
  731. sizeof (int),
  732. XtOffsetOf(WmGlobalData, moveThreshold),
  733. XtRImmediate,
  734. (XtPointer)4
  735. },
  736. {
  737. WmNpassButtons,
  738. WmCPassButtons,
  739. XtRBoolean,
  740. sizeof (Boolean),
  741. XtOffsetOf(WmGlobalData, passButtons),
  742. XtRImmediate,
  743. (XtPointer)False
  744. },
  745. {
  746. WmNpassSelectButton,
  747. WmCPassSelectButton,
  748. XtRBoolean,
  749. sizeof (Boolean),
  750. XtOffsetOf(WmGlobalData, passSelectButton),
  751. XtRImmediate,
  752. (XtPointer)True
  753. },
  754. {
  755. WmNpositionIsFrame,
  756. WmCPositionIsFrame,
  757. XtRBoolean,
  758. sizeof (Boolean),
  759. XtOffsetOf(WmGlobalData, positionIsFrame),
  760. XtRImmediate,
  761. (XtPointer)True
  762. },
  763. {
  764. WmNpositionOnScreen,
  765. WmCPositionOnScreen,
  766. XtRBoolean,
  767. sizeof (Boolean),
  768. XtOffsetOf(WmGlobalData, positionOnScreen),
  769. XtRImmediate,
  770. (XtPointer)True
  771. },
  772. {
  773. WmNquitTimeout,
  774. WmCQuitTimeout,
  775. XtRInt,
  776. sizeof (int),
  777. XtOffsetOf(WmGlobalData, quitTimeout),
  778. XtRImmediate,
  779. (XtPointer)1000
  780. },
  781. {
  782. WmNraiseKeyFocus,
  783. WmCRaiseKeyFocus,
  784. XtRBoolean,
  785. sizeof (Boolean),
  786. XtOffsetOf(WmGlobalData, raiseKeyFocus),
  787. XtRImmediate,
  788. (XtPointer)False
  789. },
  790. {
  791. WmNrefreshByClearing,
  792. WmCRefreshByClearing,
  793. XtRBoolean,
  794. sizeof (Boolean),
  795. XtOffsetOf(WmGlobalData, refreshByClearing),
  796. XtRImmediate,
  797. (XtPointer)True
  798. },
  799. {
  800. WmNrootButtonClick,
  801. WmCRootButtonClick,
  802. XtRBoolean,
  803. sizeof (Boolean),
  804. XtOffsetOf(WmGlobalData, rootButtonClick),
  805. XtRImmediate,
  806. (XtPointer)True
  807. },
  808. {
  809. WmNshowFeedback,
  810. WmCShowFeedback,
  811. WmRShowFeedback,
  812. sizeof (int),
  813. XtOffsetOf(WmGlobalData, showFeedback),
  814. XtRImmediate,
  815. (XtPointer)(WM_SHOW_FB_DEFAULT)
  816. },
  817. {
  818. WmNstartupKeyFocus,
  819. WmCStartupKeyFocus,
  820. XtRBoolean,
  821. sizeof (Boolean),
  822. XtOffsetOf(WmGlobalData, startupKeyFocus),
  823. XtRImmediate,
  824. (XtPointer)True
  825. },
  826. {
  827. WmNsystemButtonClick,
  828. WmCSystemButtonClick,
  829. XtRBoolean,
  830. sizeof (Boolean),
  831. XtOffsetOf(WmGlobalData, systemButtonClick),
  832. XtRImmediate,
  833. (XtPointer)True
  834. },
  835. {
  836. WmNsystemButtonClick2,
  837. WmCSystemButtonClick2,
  838. XtRBoolean,
  839. sizeof (Boolean),
  840. XtOffsetOf(WmGlobalData, systemButtonClick2),
  841. XtRImmediate,
  842. (XtPointer)True
  843. },
  844. {
  845. WmNuseFrontPanel,
  846. WmCUseFrontPanel,
  847. XtRBoolean,
  848. sizeof (Boolean),
  849. XtOffsetOf(WmGlobalData, useFrontPanel),
  850. XtRImmediate,
  851. (XtPointer)True
  852. },
  853. {
  854. WmNhelpDirectory,
  855. WmCHelpDirectory,
  856. XtRString,
  857. sizeof (String),
  858. XtOffsetOf(WmGlobalData, helpDirectory),
  859. XtRImmediate,
  860. (XtPointer)"DT/Dtwm/"
  861. },
  862. {
  863. WmNdtLite,
  864. WmCDtLite,
  865. XtRBoolean,
  866. sizeof (Boolean),
  867. XtOffsetOf(WmGlobalData, dtLite),
  868. XtRImmediate,
  869. (XtPointer)False
  870. }
  871. }; /* END OF wmGlobalResources[] */
  872. /*
  873. * These determine the screens to manage at startup.
  874. * These are broken out to enhance startup performance.
  875. */
  876. XtResource wmGlobalScreenResources[] =
  877. {
  878. {
  879. WmNmultiScreen,
  880. WmCMultiScreen,
  881. XtRBoolean,
  882. sizeof (Boolean),
  883. XtOffsetOf(WmGlobalData, multiScreen),
  884. XtRImmediate,
  885. (XtPointer)True
  886. },
  887. {
  888. WmNscreens,
  889. WmCScreens,
  890. XtRString,
  891. sizeof (String),
  892. XtOffsetOf(WmGlobalData, screenList),
  893. XtRImmediate,
  894. (XtPointer)NULL
  895. },
  896. { WmNbackdropDirectories,
  897. WmCBackdropDirectories,
  898. XmRString,
  899. sizeof(char *),
  900. XtOffsetOf(WmGlobalData, backdropDirs),
  901. XmRString,
  902. DEFAULT_BACKDROP_DIR
  903. },
  904. };
  905. /******************************<->*************************************
  906. *
  907. * wmStdGlobalResources
  908. *
  909. *
  910. * Description:
  911. * -----------
  912. * This data structure is used in the processing of mwm general appearance
  913. * and behavior resources that are not automatically set for the standard
  914. * (default) behavior. These resources are specified with the following
  915. * syntax:
  916. *
  917. * "Mwm*<resource_identifier>".
  918. *
  919. ******************************<->***********************************/
  920. XtResource wmStdGlobalResources[] =
  921. {
  922. {
  923. WmNbitmapDirectory,
  924. WmCBitmapDirectory,
  925. XtRString,
  926. sizeof (String),
  927. XtOffsetOf(WmGlobalData, bitmapDirectory),
  928. XtRString,
  929. (XtPointer)BITMAPDIR
  930. },
  931. {
  932. WmNconfigFile,
  933. WmCConfigFile,
  934. XtRString,
  935. sizeof (String),
  936. XtOffsetOf(WmGlobalData, configFile),
  937. XtRImmediate,
  938. (XtPointer)NULL
  939. },
  940. {
  941. WmNframeStyle,
  942. WmCFrameStyle,
  943. WmRFrameStyle,
  944. sizeof (FrameStyle),
  945. XtOffsetOf(WmGlobalData, frameStyle),
  946. XtRImmediate,
  947. (XtPointer)WmRECESSED
  948. },
  949. {
  950. WmNiconAutoPlace,
  951. WmCIconAutoPlace,
  952. XtRBoolean,
  953. sizeof (Boolean),
  954. XtOffsetOf(WmGlobalData, iconAutoPlace),
  955. XtRImmediate,
  956. (XtPointer)True
  957. },
  958. {
  959. WmNmoveThreshold,
  960. WmCMoveThreshold,
  961. XtRInt,
  962. sizeof (int),
  963. XtOffsetOf(WmGlobalData, moveThreshold),
  964. XtRImmediate,
  965. (XtPointer)4
  966. },
  967. {
  968. WmNpositionIsFrame,
  969. WmCPositionIsFrame,
  970. XtRBoolean,
  971. sizeof (Boolean),
  972. XtOffsetOf(WmGlobalData, positionIsFrame),
  973. XtRImmediate,
  974. (XtPointer)True
  975. },
  976. {
  977. WmNpositionOnScreen,
  978. WmCPositionOnScreen,
  979. XtRBoolean,
  980. sizeof (Boolean),
  981. XtOffsetOf(WmGlobalData, positionOnScreen),
  982. XtRImmediate,
  983. (XtPointer)True
  984. },
  985. {
  986. WmNquitTimeout,
  987. WmCQuitTimeout,
  988. XtRInt,
  989. sizeof (int),
  990. XtOffsetOf(WmGlobalData, quitTimeout),
  991. XtRImmediate,
  992. (XtPointer)1000
  993. },
  994. {
  995. WmNshowFeedback,
  996. WmCShowFeedback,
  997. WmRShowFeedback,
  998. sizeof (int),
  999. XtOffsetOf(WmGlobalData, showFeedback),
  1000. XtRImmediate,
  1001. (XtPointer)(WM_SHOW_FB_DEFAULT)
  1002. },
  1003. };
  1004. /******************************<->*************************************
  1005. *
  1006. * wmScreenResources
  1007. *
  1008. *
  1009. * Description:
  1010. * -----------
  1011. * This data structure is used in the processing of mwm screen specific
  1012. * appearance and behavior resources. These resources are specified
  1013. * with the following syntax:
  1014. *
  1015. * "Mwm*screen<#>*<resource_identifier>".
  1016. *
  1017. ******************************<->***********************************/
  1018. XtResource wmScreenResources[] =
  1019. {
  1020. {
  1021. WmNbuttonBindings,
  1022. WmCButtonBindings,
  1023. XtRString,
  1024. sizeof (String),
  1025. XtOffsetOf (WmScreenData, buttonBindings),
  1026. XtRString,
  1027. (XtPointer)defaultButtonBindingsName
  1028. },
  1029. {
  1030. WmNcleanText,
  1031. WmCCleanText,
  1032. XtRBoolean,
  1033. sizeof (Boolean),
  1034. XtOffsetOf (WmScreenData, cleanText),
  1035. XtRImmediate,
  1036. (XtPointer)True
  1037. },
  1038. {
  1039. WmNfeedbackGeometry,
  1040. WmCFeedbackGeometry,
  1041. XtRString,
  1042. sizeof (String),
  1043. XtOffsetOf (WmScreenData, feedbackGeometry),
  1044. XtRString,
  1045. (XtPointer)NULL
  1046. },
  1047. {
  1048. WmNfadeNormalIcon,
  1049. WmCFadeNormalIcon,
  1050. XtRBoolean,
  1051. sizeof (Boolean),
  1052. XtOffsetOf (WmScreenData, fadeNormalIcon),
  1053. XtRImmediate,
  1054. (XtPointer)False
  1055. },
  1056. {
  1057. WmNiconDecoration,
  1058. WmCIconDecoration,
  1059. WmRIconDecor,
  1060. sizeof (int),
  1061. XtOffsetOf (WmScreenData, iconDecoration),
  1062. XtRImmediate,
  1063. (XtPointer)USE_ICON_DEFAULT_APPEARANCE
  1064. },
  1065. {
  1066. WmNiconImageMaximum,
  1067. WmCIconImageMaximum,
  1068. WmRSize,
  1069. sizeof (WHSize),
  1070. XtOffsetOf (WmScreenData, iconImageMaximum),
  1071. XtRCallProc,
  1072. (XtPointer) _WmIconImageMaximumDefault
  1073. },
  1074. {
  1075. WmNiconImageMinimum,
  1076. WmCIconImageMinimum,
  1077. WmRSize,
  1078. sizeof (WHSize),
  1079. XtOffsetOf (WmScreenData, iconImageMinimum),
  1080. XtRString,
  1081. "16x16"
  1082. },
  1083. {
  1084. WmNiconPlacement,
  1085. WmCIconPlacement,
  1086. WmRIconPlacement,
  1087. sizeof (int),
  1088. XtOffsetOf (WmScreenData, iconPlacement),
  1089. XtRImmediate,
  1090. (XtPointer)(ICON_PLACE_LEFT_PRIMARY | ICON_PLACE_BOTTOM_SECONDARY)
  1091. },
  1092. {
  1093. WmNiconPlacementMargin,
  1094. WmCIconPlacementMargin,
  1095. XtRInt,
  1096. sizeof (int),
  1097. XtOffsetOf (WmScreenData, iconPlacementMargin),
  1098. XtRImmediate,
  1099. (XtPointer)-1
  1100. },
  1101. {
  1102. WmNkeyBindings,
  1103. WmCKeyBindings,
  1104. XtRString,
  1105. sizeof (String),
  1106. XtOffsetOf (WmScreenData, keyBindings),
  1107. XtRString,
  1108. (XtPointer)defaultKeyBindingsName
  1109. },
  1110. {
  1111. WmNframeBorderWidth,
  1112. WmCFrameBorderWidth,
  1113. XtRInt,
  1114. sizeof (int),
  1115. XtOffsetOf (WmScreenData, frameBorderWidth),
  1116. XtRImmediate,
  1117. (XtPointer) BIGSIZE
  1118. },
  1119. {
  1120. WmNiconBoxName,
  1121. WmCIconBoxName,
  1122. XtRString,
  1123. sizeof (String),
  1124. XtOffsetOf (WmScreenData, iconBoxName),
  1125. XtRString,
  1126. (XtPointer)"iconbox"
  1127. },
  1128. {
  1129. WmNiconBoxSBDisplayPolicy,
  1130. WmCIconBoxSBDisplayPolicy,
  1131. XtRString,
  1132. sizeof (String),
  1133. XtOffsetOf (WmScreenData, iconBoxSBDisplayPolicy),
  1134. XtRString,
  1135. (XtPointer)"all"
  1136. },
  1137. {
  1138. WmNiconBoxScheme,
  1139. WmCIconBoxScheme,
  1140. XtRInt,
  1141. sizeof (int),
  1142. XtOffsetOf (WmScreenData, iconBoxScheme),
  1143. XtRImmediate,
  1144. (XtPointer)0
  1145. },
  1146. {
  1147. WmNiconBoxTitle,
  1148. WmCIconBoxTitle,
  1149. XmRXmString,
  1150. sizeof (XmString),
  1151. XtOffsetOf (WmScreenData, iconBoxTitle),
  1152. XmRXmString,
  1153. (XtPointer)NULL
  1154. },
  1155. {
  1156. WmNlimitResize,
  1157. WmCLimitResize,
  1158. XtRBoolean,
  1159. sizeof (Boolean),
  1160. XtOffsetOf (WmScreenData, limitResize),
  1161. XtRImmediate,
  1162. (XtPointer)True
  1163. },
  1164. {
  1165. WmNmaximumMaximumSize,
  1166. WmCMaximumMaximumSize,
  1167. WmRSize,
  1168. sizeof (WHSize),
  1169. XtOffsetOf (WmScreenData, maximumMaximumSize),
  1170. XtRString,
  1171. "0x0"
  1172. },
  1173. {
  1174. WmNresizeBorderWidth,
  1175. WmCFrameBorderWidth,
  1176. XtRInt,
  1177. sizeof (int),
  1178. XtOffsetOf (WmScreenData, resizeBorderWidth),
  1179. XtRImmediate,
  1180. (XtPointer) BIGSIZE
  1181. },
  1182. {
  1183. WmNresizeCursors,
  1184. WmCResizeCursors,
  1185. XtRBoolean,
  1186. sizeof (Boolean),
  1187. XtOffsetOf (WmScreenData, resizeCursors),
  1188. XtRImmediate,
  1189. (XtPointer)True
  1190. },
  1191. {
  1192. WmNtransientDecoration,
  1193. WmCTransientDecoration,
  1194. WmRClientDecor,
  1195. sizeof (int),
  1196. XtOffsetOf (WmScreenData, transientDecoration),
  1197. XtRImmediate,
  1198. (XtPointer)(WM_DECOR_SYSTEM | WM_DECOR_RESIZEH)
  1199. },
  1200. {
  1201. WmNtransientFunctions,
  1202. WmCTransientFunctions,
  1203. WmRClientFunction,
  1204. sizeof (int),
  1205. XtOffsetOf (WmScreenData, transientFunctions),
  1206. XtRImmediate,
  1207. (XtPointer)(WM_FUNC_ALL & ~(MWM_FUNC_MAXIMIZE | MWM_FUNC_MINIMIZE))
  1208. },
  1209. {
  1210. WmNsubpanelDecoration,
  1211. WmCSubpanelDecoration,
  1212. WmRClientDecor,
  1213. sizeof (int),
  1214. XtOffsetOf (WmScreenData, subpanelDecoration),
  1215. XtRImmediate,
  1216. (XtPointer)(WM_DECOR_SYSTEM)
  1217. },
  1218. {
  1219. WmNsubpanelResources,
  1220. WmCSubpanelResources,
  1221. XtRString,
  1222. sizeof (String),
  1223. XtOffsetOf (WmScreenData, subpanelResources),
  1224. XtRString,
  1225. (XtPointer)NULL
  1226. },
  1227. {
  1228. WmNuseIconBox,
  1229. WmCUseIconBox,
  1230. XtRBoolean,
  1231. sizeof (Boolean),
  1232. XtOffsetOf (WmScreenData, useIconBox),
  1233. XtRImmediate,
  1234. (XtPointer)False
  1235. },
  1236. {
  1237. WmNmoveOpaque,
  1238. WmCMoveOpaque,
  1239. XtRBoolean,
  1240. sizeof (Boolean),
  1241. XtOffsetOf (WmScreenData, moveOpaque),
  1242. XtRImmediate,
  1243. (XtPointer)False
  1244. },
  1245. {
  1246. WmNhelpResources,
  1247. WmCHelpResources,
  1248. XtRString,
  1249. sizeof (String),
  1250. XtOffsetOf (WmScreenData, helpResources),
  1251. XtRString,
  1252. (XtPointer)NULL
  1253. },
  1254. {
  1255. WmNinitialWorkspace,
  1256. WmCInitialWorkspace,
  1257. XtRString,
  1258. sizeof (String),
  1259. XtOffsetOf (WmScreenData, initialWorkspace),
  1260. XtRString,
  1261. (XtPointer)NULL
  1262. },
  1263. {
  1264. WmNworkspaceList,
  1265. WmCWorkspaceList,
  1266. XtRString,
  1267. sizeof (String),
  1268. XtOffsetOf (WmScreenData, workspaceList),
  1269. XtRImmediate,
  1270. (XtPointer)NULL
  1271. },
  1272. {
  1273. WmNworkspaceCount,
  1274. WmCWorkspaceCount,
  1275. XtRInt,
  1276. sizeof (int),
  1277. XtOffsetOf (WmScreenData, numWorkspaces),
  1278. XtRImmediate,
  1279. (XtPointer)0
  1280. }
  1281. };
  1282. /******************************<->*************************************
  1283. *
  1284. * wmStdScreenResources
  1285. *
  1286. *
  1287. * Description:
  1288. * -----------
  1289. * This data structure is used in the processing of mwm screen specific
  1290. * appearance and behavior resources that are not automatically set for
  1291. * the standard (default) behavior. These resources are specified with
  1292. * the following syntax:
  1293. *
  1294. * "Mwm*screen<#>*<resource_identifier>".
  1295. *
  1296. ******************************<->***********************************/
  1297. XtResource wmStdScreenResources[] =
  1298. {
  1299. {
  1300. WmNframeBorderWidth,
  1301. WmCFrameBorderWidth,
  1302. XtRInt,
  1303. sizeof (int),
  1304. XtOffsetOf (WmScreenData, frameBorderWidth),
  1305. XtRImmediate,
  1306. (XtPointer) BIGSIZE
  1307. },
  1308. {
  1309. WmNiconImageMaximum,
  1310. WmCIconImageMaximum,
  1311. WmRSize,
  1312. sizeof (WHSize),
  1313. XtOffsetOf (WmScreenData, iconImageMaximum),
  1314. XtRCallProc,
  1315. (XtPointer) _WmIconImageMaximumDefault
  1316. },
  1317. {
  1318. WmNiconImageMinimum,
  1319. WmCIconImageMinimum,
  1320. WmRSize,
  1321. sizeof (WHSize),
  1322. XtOffsetOf (WmScreenData, iconImageMinimum),
  1323. XtRString,
  1324. "32x32"
  1325. },
  1326. {
  1327. WmNiconPlacementMargin,
  1328. WmCIconPlacementMargin,
  1329. XtRInt,
  1330. sizeof (int),
  1331. XtOffsetOf (WmScreenData, iconPlacementMargin),
  1332. XtRImmediate,
  1333. (XtPointer)-1
  1334. },
  1335. {
  1336. WmNmaximumMaximumSize,
  1337. WmCMaximumMaximumSize,
  1338. WmRSize,
  1339. sizeof (WHSize),
  1340. XtOffsetOf (WmScreenData, maximumMaximumSize),
  1341. XtRString,
  1342. "0x0"
  1343. },
  1344. {
  1345. WmNresizeBorderWidth,
  1346. WmCFrameBorderWidth,
  1347. XtRInt,
  1348. sizeof (int),
  1349. XtOffsetOf (WmScreenData, resizeBorderWidth),
  1350. XtRImmediate,
  1351. (XtPointer) BIGSIZE
  1352. }
  1353. };
  1354. /******************************<->*************************************
  1355. *
  1356. * wmWorkspaceResources
  1357. *
  1358. *
  1359. * Description:
  1360. * -----------
  1361. * This data structure is used in the processing of mwm workspace
  1362. * specific appearance and behavior resources. These resources are
  1363. * specified with the following syntax:
  1364. *
  1365. * "Mwm*[screen<#>*]<workspace>*<resource_identifier>".
  1366. *
  1367. ******************************<->***********************************/
  1368. XtResource wmWorkspaceResources[] =
  1369. {
  1370. {
  1371. WmNiconBoxGeometry,
  1372. WmCIconBoxGeometry,
  1373. XtRString,
  1374. sizeof (String),
  1375. XtOffsetOf (WmWorkspaceData, iconBoxGeometry),
  1376. XtRString,
  1377. (XtPointer)NULL
  1378. },
  1379. {
  1380. WmNtitle,
  1381. WmCTitle,
  1382. XmRXmString,
  1383. sizeof (XmString),
  1384. XtOffsetOf (WmWorkspaceData, title),
  1385. XmRXmString,
  1386. (XtPointer)NULL
  1387. }
  1388. };
  1389. /******************************<->*************************************
  1390. *
  1391. * wmStdWorkspaceResources
  1392. *
  1393. *
  1394. * Description:
  1395. * -----------
  1396. * This data structure is used in the processing of mwm workspace specific
  1397. * appearance and behavior resources that are not automatically set for
  1398. * the standard (default) behavior. These resources are specified with
  1399. * the following syntax:
  1400. *
  1401. * "Mwm*[screen<#>*]<workspace>*<resource_identifier>".
  1402. *
  1403. *************************************<->***********************************/
  1404. XtResource wmStdWorkspaceResources[] =
  1405. {
  1406. {
  1407. WmNtitle,
  1408. WmCTitle,
  1409. XmRXmString,
  1410. sizeof (XmString),
  1411. XtOffsetOf (WmWorkspaceData, title),
  1412. XmRXmString,
  1413. (XtPointer)NULL
  1414. }
  1415. };
  1416. /*************************************<->*************************************
  1417. *
  1418. * wmBackdropResources
  1419. *
  1420. *
  1421. * Description:
  1422. * -----------
  1423. * This data structure is used in the processing of workspace specific
  1424. * resources that apply to the backdrop.
  1425. *
  1426. * These resources are specified with the following syntax:
  1427. *
  1428. * "Mwm*[screen*][workspace*]backdrop*<resource_id>:"
  1429. *
  1430. * NOTE: The order of these resources is important for correct
  1431. * dynamic processing!!!!
  1432. *
  1433. *************************************<->***********************************/
  1434. XtResource wmBackdropResources[] =
  1435. {
  1436. {
  1437. WmNcolorSetId,
  1438. WmCColorSetId,
  1439. XtRInt,
  1440. sizeof (int),
  1441. XtOffsetOf (BackdropData, colorSet),
  1442. XtRCallProc,
  1443. (XtPointer) _WmBackdropColorSetDefault
  1444. },
  1445. {
  1446. WmNimageBackground,
  1447. WmCImageBackground,
  1448. XtRPixel,
  1449. sizeof (Pixel),
  1450. XtOffsetOf (BackdropData, background),
  1451. XtRCallProc,
  1452. (XtPointer) _WmBackdropBgDefault
  1453. },
  1454. {
  1455. WmNimageForeground,
  1456. WmCImageForeground,
  1457. XtRPixel,
  1458. sizeof (Pixel),
  1459. XtOffsetOf (BackdropData, foreground),
  1460. XtRCallProc,
  1461. (XtPointer) _WmBackdropFgDefault
  1462. },
  1463. {
  1464. WmNimage,
  1465. WmCImage,
  1466. XtRString,
  1467. sizeof (String),
  1468. XtOffsetOf (BackdropData, image),
  1469. XtRString,
  1470. (XtPointer)NULL
  1471. },
  1472. };
  1473. /*************************************<->*************************************
  1474. *
  1475. * wmWsPresenceResources
  1476. *
  1477. *
  1478. * Description:
  1479. * -----------
  1480. * This data structure is used in the processing of specific
  1481. * resources that apply to the WorkspacePresence dialog.
  1482. *
  1483. * These resources are specified with the following syntax:
  1484. *
  1485. * "Mwm*[screen*][workspace*]workspacePresence*<resource_id>:"
  1486. *
  1487. *************************************<->***********************************/
  1488. XtResource wmWsPresenceResources[] =
  1489. {
  1490. {
  1491. WmNtitle,
  1492. WmCTitle,
  1493. XmRXmString,
  1494. sizeof (XmString),
  1495. XtOffsetOf (WsPresenceData, title),
  1496. XmRXmString,
  1497. (XtPointer)NULL
  1498. }
  1499. };
  1500. /*************************************<->*************************************
  1501. *
  1502. * wmClientResources
  1503. *
  1504. *
  1505. * Description:
  1506. * -----------
  1507. * This data structure is used in the processing of client specific
  1508. * window manager resources. These resources are specified with the
  1509. * following syntax:
  1510. *
  1511. * "Mwm*<client_name_or_class>*<resource_identifier>"
  1512. *
  1513. *************************************<->***********************************/
  1514. XtResource wmClientResources[] =
  1515. {
  1516. {
  1517. WmNabsentMapBehavior,
  1518. WmCAbsentMapBehavior,
  1519. WmRAbsentMapBehavior,
  1520. sizeof (int),
  1521. XtOffsetOf (ClientData, absentMapBehavior),
  1522. XtRImmediate,
  1523. (XtPointer)(AMAP_BEHAVIOR_ADD)
  1524. },
  1525. {
  1526. WmNclientDecoration,
  1527. WmCClientDecoration,
  1528. WmRClientDecor,
  1529. sizeof (int),
  1530. XtOffsetOf (ClientData, clientDecoration),
  1531. XtRImmediate,
  1532. (XtPointer)(WM_DECOR_DEFAULT)
  1533. },
  1534. {
  1535. WmNclientFunctions,
  1536. WmCClientFunctions,
  1537. WmRClientFunction,
  1538. sizeof (int),
  1539. XtOffsetOf (ClientData, clientFunctions),
  1540. XtRImmediate,
  1541. (XtPointer)(WM_FUNC_DEFAULT)
  1542. },
  1543. {
  1544. WmNfocusAutoRaise,
  1545. WmCFocusAutoRaise,
  1546. XtRBoolean,
  1547. sizeof (Boolean),
  1548. XtOffsetOf (ClientData, focusAutoRaise),
  1549. XtRCallProc,
  1550. (XtPointer)_WmFocusAutoRaiseDefault
  1551. },
  1552. {
  1553. WmNiconImage,
  1554. WmCIconImage,
  1555. XtRString,
  1556. sizeof (String),
  1557. XtOffsetOf (ClientData, iconImage),
  1558. XtRString,
  1559. (XtPointer)NULL
  1560. },
  1561. {
  1562. WmNiconImageBackground,
  1563. WmCIconImageBackground,
  1564. XtRPixel,
  1565. sizeof (Pixel),
  1566. XtOffsetOf (ClientData, iconImageBackground),
  1567. XtRCallProc,
  1568. (XtPointer)_WmIconImageBDefault
  1569. },
  1570. {
  1571. WmNiconImageForeground,
  1572. WmCIconImageForeground,
  1573. XtRPixel,
  1574. sizeof (Pixel),
  1575. XtOffsetOf (ClientData, iconImageForeground),
  1576. XtRCallProc,
  1577. (XtPointer)_WmIconImageFDefault
  1578. },
  1579. {
  1580. WmNiconImageBottomShadowColor,
  1581. WmCIconImageBottomShadowColor,
  1582. XtRPixel,
  1583. sizeof (Pixel),
  1584. XtOffsetOf (ClientData, iconImageBottomShadowColor),
  1585. XtRCallProc,
  1586. (XtPointer)_WmIconImageBSCDefault
  1587. },
  1588. {
  1589. WmNiconImageBottomShadowPixmap,
  1590. WmCIconImageBottomShadowPixmap,
  1591. XtRString,
  1592. sizeof (String),
  1593. XtOffsetOf (ClientData, iconImageBottomShadowPStr),
  1594. XtRCallProc,
  1595. (XtPointer)_WmIconImageBSPDefault
  1596. },
  1597. {
  1598. WmNiconImageTopShadowColor,
  1599. WmCIconImageTopShadowColor,
  1600. XtRPixel,
  1601. sizeof (Pixel),
  1602. XtOffsetOf (ClientData, iconImageTopShadowColor),
  1603. XtRCallProc,
  1604. (XtPointer)_WmIconImageTSCDefault
  1605. },
  1606. {
  1607. WmNiconImageTopShadowPixmap,
  1608. WmCIconImageTopShadowPixmap,
  1609. XtRString,
  1610. sizeof (String),
  1611. XtOffsetOf (ClientData, iconImageTopShadowPStr),
  1612. XtRCallProc,
  1613. (XtPointer)_WmIconImageTSPDefault
  1614. },
  1615. {
  1616. WmNignoreWMSaveHints,
  1617. WmCIgnoreWMSaveHints,
  1618. XtRBoolean,
  1619. sizeof (Boolean),
  1620. XtOffsetOf (ClientData, ignoreWMSaveHints),
  1621. XtRImmediate,
  1622. (XtPointer)True
  1623. },
  1624. {
  1625. WmNmatteWidth,
  1626. WmCMatteWidth,
  1627. XtRInt,
  1628. sizeof (int),
  1629. XtOffsetOf (ClientData, matteWidth),
  1630. XtRImmediate,
  1631. (XtPointer)0
  1632. },
  1633. {
  1634. WmNmaximumClientSize,
  1635. WmCMaximumClientSize,
  1636. WmRSize,
  1637. sizeof (WHSize),
  1638. XtOffsetOf (ClientData, maximumClientSize),
  1639. XtRString,
  1640. "0x0"
  1641. },
  1642. {
  1643. WmNsecondariesOnTop,
  1644. WmCSecondariesOnTop,
  1645. XtRBoolean,
  1646. sizeof (Boolean),
  1647. XtOffsetOf (ClientData, secondariesOnTop),
  1648. XtRCallProc,
  1649. (XtPointer)_WmSecondariesOnTopDefault
  1650. },
  1651. {
  1652. WmNsystemMenu,
  1653. WmCSystemMenu,
  1654. XtRString,
  1655. sizeof (String),
  1656. XtOffsetOf (ClientData, systemMenu),
  1657. XtRString,
  1658. (XtPointer)defaultSystemMenuName
  1659. },
  1660. {
  1661. WmNuseClientIcon,
  1662. WmCUseClientIcon,
  1663. XtRBoolean,
  1664. sizeof (Boolean),
  1665. XtOffsetOf (ClientData, useClientIcon),
  1666. XtRImmediate,
  1667. (XtPointer)True
  1668. },
  1669. {
  1670. WmNusePPosition,
  1671. WmCUsePPosition,
  1672. WmRUsePPosition,
  1673. sizeof (int),
  1674. XtOffsetOf (ClientData, usePPosition),
  1675. XtRImmediate,
  1676. (XtPointer)(USE_PPOSITION_NONZERO)
  1677. }
  1678. }; /* END OF STRUCTURE wmClientResources */
  1679. /*************************************<->*************************************
  1680. *
  1681. * wmStdClientResources
  1682. *
  1683. *
  1684. * Description:
  1685. * -----------
  1686. * This data structure is used in the processing of client specific
  1687. * window manager resources that are not automatically set for the standard
  1688. * (default) behavior. These resources are specified with the
  1689. * following syntax:
  1690. *
  1691. * "Mwm*<client_name_or_class>*<resource_identifier>"
  1692. *
  1693. *************************************<->***********************************/
  1694. XtResource wmStdClientResources[] =
  1695. {
  1696. {
  1697. WmNiconImage,
  1698. WmCIconImage,
  1699. XtRString,
  1700. sizeof (String),
  1701. XtOffsetOf (ClientData, iconImage),
  1702. XtRString,
  1703. (XtPointer)NULL
  1704. },
  1705. {
  1706. WmNiconImageBackground,
  1707. WmCIconImageBackground,
  1708. XtRPixel,
  1709. sizeof (Pixel),
  1710. XtOffsetOf (ClientData, iconImageBackground),
  1711. XtRCallProc,
  1712. (XtPointer)_WmIconImageBDefault
  1713. },
  1714. {
  1715. WmNiconImageForeground,
  1716. WmCIconImageForeground,
  1717. XtRPixel,
  1718. sizeof (Pixel),
  1719. XtOffsetOf (ClientData, iconImageForeground),
  1720. XtRCallProc,
  1721. (XtPointer)_WmIconImageFDefault
  1722. },
  1723. {
  1724. WmNiconImageBottomShadowColor,
  1725. WmCIconImageBottomShadowColor,
  1726. XtRPixel,
  1727. sizeof (Pixel),
  1728. XtOffsetOf (ClientData, iconImageBottomShadowColor),
  1729. XtRCallProc,
  1730. (XtPointer)_WmIconImageBSCDefault
  1731. },
  1732. {
  1733. WmNiconImageBottomShadowPixmap,
  1734. WmCIconImageBottomShadowPixmap,
  1735. XtRString,
  1736. sizeof (String),
  1737. XtOffsetOf (ClientData, iconImageBottomShadowPStr),
  1738. XtRCallProc,
  1739. (XtPointer)_WmIconImageBSPDefault
  1740. },
  1741. {
  1742. WmNiconImageTopShadowColor,
  1743. WmCIconImageTopShadowColor,
  1744. XtRPixel,
  1745. sizeof (Pixel),
  1746. XtOffsetOf (ClientData, iconImageTopShadowColor),
  1747. XtRCallProc,
  1748. (XtPointer)_WmIconImageTSCDefault
  1749. },
  1750. {
  1751. WmNiconImageTopShadowPixmap,
  1752. WmCIconImageTopShadowPixmap,
  1753. XtRString,
  1754. sizeof (String),
  1755. XtOffsetOf (ClientData, iconImageTopShadowPStr),
  1756. XtRCallProc,
  1757. (XtPointer)_WmIconImageTSPDefault
  1758. },
  1759. {
  1760. WmNmatteWidth,
  1761. WmCMatteWidth,
  1762. XtRInt,
  1763. sizeof (int),
  1764. XtOffsetOf (ClientData, matteWidth),
  1765. XtRImmediate,
  1766. (XtPointer)0
  1767. },
  1768. {
  1769. WmNmaximumClientSize,
  1770. WmCMaximumClientSize,
  1771. WmRSize,
  1772. sizeof (WHSize),
  1773. XtOffsetOf (ClientData, maximumClientSize),
  1774. XtRString,
  1775. "0x0"
  1776. },
  1777. {
  1778. WmNsecondariesOnTop,
  1779. WmCSecondariesOnTop,
  1780. XtRBoolean,
  1781. sizeof (Boolean),
  1782. XtOffsetOf (ClientData, secondariesOnTop),
  1783. XtRCallProc,
  1784. (XtPointer)_WmSecondariesOnTopDefault
  1785. },
  1786. {
  1787. WmNuseClientIcon,
  1788. WmCUseClientIcon,
  1789. XtRBoolean,
  1790. sizeof (Boolean),
  1791. XtOffsetOf (ClientData, useClientIcon),
  1792. XtRImmediate,
  1793. (XtPointer)False
  1794. }
  1795. };
  1796. /*************************************<->*************************************
  1797. *
  1798. * wmClientResourcesM
  1799. *
  1800. *
  1801. * Description:
  1802. * -----------
  1803. * This data structure is used in the processing of client specific
  1804. * window manager resources that affect the appearance of the client
  1805. * matte. These resources are specified with the following syntax:
  1806. *
  1807. * "Mwm*<client_name_or_class>*<resource_identifier>"
  1808. *
  1809. *************************************<->***********************************/
  1810. XtResource wmClientResourcesM[] =
  1811. {
  1812. {
  1813. WmNmatteBackground,
  1814. WmCMatteBackground,
  1815. XtRPixel,
  1816. sizeof (Pixel),
  1817. XtOffsetOf (ClientData, matteBackground),
  1818. XtRCallProc,
  1819. (XtPointer)_WmMatteBDefault
  1820. },
  1821. {
  1822. WmNmatteForeground,
  1823. WmCMatteForeground,
  1824. XtRPixel,
  1825. sizeof (Pixel),
  1826. XtOffsetOf (ClientData, matteForeground),
  1827. XtRCallProc,
  1828. (XtPointer)_WmMatteFDefault
  1829. },
  1830. {
  1831. WmNmatteBottomShadowColor,
  1832. WmCMatteBottomShadowColor,
  1833. XtRPixel,
  1834. sizeof (Pixel),
  1835. XtOffsetOf (ClientData, matteBottomShadowColor),
  1836. XtRCallProc,
  1837. (XtPointer)_WmMatteBSCDefault
  1838. },
  1839. {
  1840. WmNmatteBottomShadowPixmap,
  1841. WmCMatteBottomShadowPixmap,
  1842. XtRString,
  1843. sizeof (String),
  1844. XtOffsetOf (ClientData, matteBottomShadowPStr),
  1845. XtRCallProc,
  1846. (XtPointer)_WmMatteBSPDefault
  1847. },
  1848. {
  1849. WmNmatteTopShadowColor,
  1850. WmCMatteTopShadowColor,
  1851. XtRPixel,
  1852. sizeof (Pixel),
  1853. XtOffsetOf (ClientData, matteTopShadowColor),
  1854. XtRCallProc,
  1855. (XtPointer)_WmMatteTSCDefault
  1856. },
  1857. {
  1858. WmNmatteTopShadowPixmap,
  1859. WmCMatteTopShadowPixmap,
  1860. XtRString,
  1861. sizeof (String),
  1862. XtOffsetOf (ClientData, matteTopShadowPStr),
  1863. XtRCallProc,
  1864. (XtPointer)_WmMatteTSPDefault
  1865. }
  1866. };
  1867. /*************************************<->*************************************
  1868. *
  1869. * wmAppearanceResources
  1870. *
  1871. *
  1872. * Description:
  1873. * -----------
  1874. * This data structure is used in the processing of component appearance
  1875. * resources. These resources are specified with the following syntax:
  1876. *
  1877. * "Mwm*<resource_identifier>"
  1878. * "Mwm*client*<resource_identifier>"
  1879. * "Mwm*icon*<resource_identifier>"
  1880. * "Mwm*feedback*<resource_identifier>"
  1881. *
  1882. *************************************<->***********************************/
  1883. XtResource wmAppearanceResources[] =
  1884. {
  1885. {
  1886. XmNfontList,
  1887. XmCFontList,
  1888. XmRFontList,
  1889. sizeof (XmFontList),
  1890. XtOffsetOf (AppearanceData, fontList),
  1891. XtRString,
  1892. "fixed"
  1893. },
  1894. {
  1895. WmNsaveUnder,
  1896. WmCSaveUnder,
  1897. XtRBoolean,
  1898. sizeof (Boolean),
  1899. XtOffsetOf (AppearanceData, saveUnder),
  1900. XtRImmediate,
  1901. (XtPointer)False
  1902. },
  1903. {
  1904. XtNbackground,
  1905. XtCBackground,
  1906. XtRPixel,
  1907. sizeof (Pixel),
  1908. XtOffsetOf (AppearanceData, background),
  1909. XtRCallProc,
  1910. (XtPointer)_WmBackgroundDefault
  1911. },
  1912. {
  1913. XtNforeground,
  1914. XtCForeground,
  1915. XtRPixel,
  1916. sizeof (Pixel),
  1917. XtOffsetOf (AppearanceData, foreground),
  1918. XtRCallProc,
  1919. (XtPointer)_WmForegroundDefault
  1920. },
  1921. {
  1922. XmNbottomShadowColor,
  1923. XtCForeground,
  1924. XtRPixel,
  1925. sizeof (Pixel),
  1926. XtOffsetOf (AppearanceData, bottomShadowColor),
  1927. XtRCallProc,
  1928. (XtPointer)_WmBottomShadowColorDefault
  1929. },
  1930. {
  1931. XmNbottomShadowPixmap,
  1932. XmCBottomShadowPixmap,
  1933. XtRString,
  1934. sizeof (String),
  1935. XtOffsetOf (AppearanceData, bottomShadowPStr),
  1936. XtRString,
  1937. (XtPointer)NULL
  1938. },
  1939. {
  1940. XmNtopShadowColor,
  1941. XtCForeground,
  1942. XtRPixel,
  1943. sizeof (Pixel),
  1944. XtOffsetOf (AppearanceData, topShadowColor),
  1945. XtRCallProc,
  1946. (XtPointer)_WmTopShadowColorDefault
  1947. },
  1948. {
  1949. XmNbackgroundPixmap,
  1950. XmCBackgroundPixmap,
  1951. XtRString,
  1952. sizeof (String),
  1953. XtOffsetOf (AppearanceData, backgroundPStr),
  1954. XtRCallProc,
  1955. (XtPointer)_WmBackgroundPixmapDefault
  1956. },
  1957. {
  1958. XmNtopShadowPixmap,
  1959. XmCTopShadowPixmap,
  1960. XtRString,
  1961. sizeof (String),
  1962. XtOffsetOf (AppearanceData, topShadowPStr),
  1963. XtRCallProc,
  1964. (XtPointer)_WmTopShadowPixmapDefault
  1965. },
  1966. {
  1967. WmNactiveBackground,
  1968. XtCBackground,
  1969. XtRPixel,
  1970. sizeof (Pixel),
  1971. XtOffsetOf (AppearanceData, activeBackground),
  1972. XtRCallProc,
  1973. (XtPointer)_WmABackgroundDefault
  1974. },
  1975. {
  1976. WmNactiveForeground,
  1977. XtCForeground,
  1978. XtRPixel,
  1979. sizeof (Pixel),
  1980. XtOffsetOf (AppearanceData, activeForeground),
  1981. XtRCallProc,
  1982. (XtPointer)_WmAForegroundDefault
  1983. },
  1984. {
  1985. WmNactiveBottomShadowColor,
  1986. XtCForeground,
  1987. XtRPixel,
  1988. sizeof (Pixel),
  1989. XtOffsetOf (AppearanceData, activeBottomShadowColor),
  1990. XtRCallProc,
  1991. (XtPointer)_WmABottomShadowColorDefault
  1992. },
  1993. {
  1994. WmNactiveBottomShadowPixmap,
  1995. XmCBottomShadowPixmap,
  1996. XtRString,
  1997. sizeof (String),
  1998. XtOffsetOf (AppearanceData, activeBottomShadowPStr),
  1999. XtRString,
  2000. (XtPointer)NULL
  2001. },
  2002. {
  2003. WmNactiveTopShadowColor,
  2004. XtCForeground,
  2005. XtRPixel,
  2006. sizeof (Pixel),
  2007. XtOffsetOf (AppearanceData, activeTopShadowColor),
  2008. XtRCallProc,
  2009. (XtPointer)_WmATopShadowColorDefault
  2010. },
  2011. {
  2012. WmNactiveBackgroundPixmap,
  2013. XmCBackgroundPixmap,
  2014. XtRString,
  2015. sizeof (String),
  2016. XtOffsetOf (AppearanceData, activeBackgroundPStr),
  2017. XtRCallProc,
  2018. (XtPointer)_WmABackgroundPixmapDefault
  2019. },
  2020. {
  2021. WmNactiveTopShadowPixmap,
  2022. XmCTopShadowPixmap,
  2023. XtRString,
  2024. sizeof (String),
  2025. XtOffsetOf (AppearanceData, activeTopShadowPStr),
  2026. XtRCallProc,
  2027. (XtPointer)_WmATopShadowPixmapDefault
  2028. }
  2029. };
  2030. /*************************************<->*************************************
  2031. *
  2032. * _WmIconImageFDefault (widget, offset, value)
  2033. * _WmIconImageBDefault (widget, offset, value)
  2034. * _WmIconImageBSCDefault (widget, offset, value)
  2035. * _WmIconImageBSPDefault (widget, offset, value)
  2036. * _WmIconImageTSCDefault (widget, offset, value)
  2037. * _WmIconImageTSPDefault (widget, offset, value)
  2038. * _WmMatteFDefault (widget, offset, value)
  2039. * _WmMatteBDefault (widget, offset, value)
  2040. * _WmMatteBSCDefault (widget, offset, value)
  2041. * _WmMatteBSPDefault (widget, offset, value)
  2042. * _WmMatteTSCDefault (widget, offset, value)
  2043. * _WmMatteTSPDefault (widget, offset, value)
  2044. *
  2045. *
  2046. * Description:
  2047. * -----------
  2048. * These functions are used to generate dynamic defaults for various
  2049. * client-specific appearance related resources.
  2050. *
  2051. *
  2052. * Inputs:
  2053. * ------
  2054. * widget = this is the parent widget for the wm subpart
  2055. *
  2056. * offset = this is the resource offset
  2057. *
  2058. * value = this is a pointer to a XrmValue in which to store the result
  2059. *
  2060. * _pCD = (static global) pointer to client data associated with resources
  2061. *
  2062. *
  2063. * Outputs:
  2064. * -------
  2065. * value = default resource value and size
  2066. *
  2067. *************************************<->***********************************/
  2068. void
  2069. _WmIconImageFDefault (Widget widget, int offset, XrmValue *value)
  2070. {
  2071. _WmGetDynamicDefault (widget, WmFGC, 0,
  2072. _pCD->iconImageBackground, value);
  2073. } /* END OF FUNCTION _WmIconImageFDefault */
  2074. void
  2075. _WmIconImageBDefault (Widget widget, int offset, XrmValue *value)
  2076. {
  2077. value->addr = (char *)&(_pCD->pSD->iconAppearance.background);
  2078. value->size = sizeof (Pixel);
  2079. } /* END OF FUNCTION _WmIconImageBDefault */
  2080. void
  2081. _WmIconImageBSCDefault (Widget widget, int offset, XrmValue *value)
  2082. {
  2083. _WmGetDynamicDefault (widget, WmBSC, 0,
  2084. _pCD->iconImageBackground, value);
  2085. } /* END OF FUNCTION _WmIconImageBSCDefault */
  2086. void
  2087. _WmIconImageBSPDefault (Widget widget, int offset, XrmValue *value)
  2088. {
  2089. value->addr = (char *)_pCD->pSD->iconAppearance.bottomShadowPStr;
  2090. value->size = sizeof (String);
  2091. } /* END OF FUNCTION _WmIconImageBSCDefault */
  2092. void
  2093. _WmIconImageTSCDefault (Widget widget, int offset, XrmValue *value)
  2094. {
  2095. _WmGetDynamicDefault (widget, WmTSC, 0,
  2096. _pCD->iconImageBackground, value);
  2097. } /* END OF FUNCTION _WmIconImageTSCDefault */
  2098. void
  2099. _WmIconImageTSPDefault (Widget widget, int offset, XrmValue *value)
  2100. {
  2101. value->addr = (char *)_pCD->pSD->iconAppearance.topShadowPStr;
  2102. value->size = sizeof (String);
  2103. } /* END OF FUNCTION _WmIconImageTSPDefault */
  2104. void
  2105. _WmMatteFDefault (Widget widget, int offset, XrmValue *value)
  2106. {
  2107. _WmGetDynamicDefault (widget, WmFGC, 0,
  2108. _pCD->matteBackground, value);
  2109. } /* END OF FUNCTION _WmMatteFDefault */
  2110. void
  2111. _WmMatteBDefault (Widget widget, int offset, XrmValue *value)
  2112. {
  2113. value->addr = (char *)&(_pCD->pSD->clientAppearance.background);
  2114. value->size = sizeof (Pixel);
  2115. } /* END OF FUNCTION _WmMatteBDefault */
  2116. void
  2117. _WmMatteBSCDefault (Widget widget, int offset, XrmValue *value)
  2118. {
  2119. _WmGetDynamicDefault (widget, WmBSC, 0,
  2120. _pCD->matteBackground, value);
  2121. } /* END OF FUNCTION _WmMatteBSCDefault */
  2122. void
  2123. _WmMatteBSPDefault (Widget widget, int offset, XrmValue *value)
  2124. {
  2125. value->addr = (char *)_pCD->pSD->clientAppearance.bottomShadowPStr;
  2126. value->size = sizeof (String);
  2127. } /* END OF FUNCTION _WmMatteBSCDefault */
  2128. void
  2129. _WmMatteTSCDefault (Widget widget, int offset, XrmValue *value)
  2130. {
  2131. _WmGetDynamicDefault (widget, WmTSC, 0,
  2132. _pCD->matteBackground, value);
  2133. } /* END OF FUNCTION _WmMatteTSCDefault */
  2134. void
  2135. _WmMatteTSPDefault (Widget widget, int offset, XrmValue *value)
  2136. {
  2137. value->addr = (char *)_pCD->pSD->clientAppearance.topShadowPStr;
  2138. value->size = sizeof (String);
  2139. } /* END OF FUNCTION _WmMatteTSCDefault */
  2140. /*************************************<->*************************************
  2141. *
  2142. * _WmBackgroundDefault (widget, offset, value)
  2143. * _WmForegroundDefault (widget, offset, value)
  2144. * _WmBackgroundPixmapDefault (widget, offset, value)
  2145. * _WmBottomShadowColorDefault (widget, offset, value)
  2146. * _WmTopShadowColorDefault (widget, offset, value)
  2147. * _WmTopShadowPixmapDefault (widget, offset, value)
  2148. * _WmABackgroundDefault (widget, offset, value)
  2149. * _WmAForegroundDefault (widget, offset, value)
  2150. * _WmABackgroundPixmapDefault (widget, offset, value)
  2151. * _WmABottomShadowColorDefault (widget, offset, value)
  2152. * _WmRFBackgroundDefault (widget, offset, value)
  2153. * _WmRFForegroundDefault (widget, offset, value)
  2154. * _WmATopShadowColorDefault (widget, offset, value)
  2155. * _WmATopShadowPixmapDefault (widget, offset, value)
  2156. *
  2157. *
  2158. * Description:
  2159. * -----------
  2160. * These functions are used to generate dynamic defaults for various
  2161. * component appearance related resources (not client-specific).
  2162. *
  2163. *
  2164. * Inputs:
  2165. * ------
  2166. * widget = this is the parent widget for the wm subpart
  2167. *
  2168. * offset = this is the resource offset
  2169. *
  2170. * value = this is a pointer to a XrmValue in which to store the result
  2171. *
  2172. * _defaultBackground = (static global) default background color (inactive)
  2173. *
  2174. * _defaultActiveBackground = (static global) default bg color (active)
  2175. *
  2176. * _pAppearanceData = (static global) pointer to resouce set structure
  2177. *
  2178. *
  2179. * Outputs:
  2180. * -------
  2181. * value = default resource value and size
  2182. *
  2183. *************************************<->***********************************/
  2184. void
  2185. _WmBackgroundDefault (Widget widget, int offset, XrmValue *value)
  2186. {
  2187. _WmGetDynamicDefault (widget, WmBGC, _defaultBackground, 0, value);
  2188. } /* END OF FUNCTION _WmBackgroundDefault */
  2189. void
  2190. _WmForegroundDefault (Widget widget, int offset, XrmValue *value)
  2191. {
  2192. _WmGetDynamicDefault (widget, WmFGC, 0, _pAppearanceData->background,
  2193. value);
  2194. } /* END OF FUNCTION _WmForegroundDefault */
  2195. void
  2196. _WmBackgroundPixmapDefault (Widget widget, int offset, XrmValue *value)
  2197. {
  2198. static String string;
  2199. if ((Monochrome (XtScreen (widget))) ||
  2200. (_pAppearanceData->topShadowColor == _pAppearanceData->background))
  2201. {
  2202. string = (String) _25_foreground;
  2203. }
  2204. else
  2205. {
  2206. string = NULL;
  2207. }
  2208. value->addr = (char *)string;
  2209. value->size = sizeof (String);
  2210. } /* END OF FUNCTION _WmBackgroundPixmapDefault */
  2211. void
  2212. _WmBottomShadowColorDefault (Widget widget, int offset, XrmValue *value)
  2213. {
  2214. _WmGetDynamicDefault (widget, WmBSC, 0, _pAppearanceData->background,
  2215. value);
  2216. } /* END OF FUNCTION _WmBottomShadowColorDefault */
  2217. void
  2218. _WmTopShadowColorDefault (Widget widget, int offset, XrmValue *value)
  2219. {
  2220. _WmGetDynamicDefault (widget, WmTSC, 0, _pAppearanceData->background,
  2221. value);
  2222. } /* END OF FUNCTION _WmTopShadowColorDefault */
  2223. void
  2224. _WmTopShadowPixmapDefault (Widget widget, int offset, XrmValue *value)
  2225. {
  2226. static String string;
  2227. if ((Monochrome (XtScreen (widget))) ||
  2228. (_pAppearanceData->topShadowColor == _pAppearanceData->background))
  2229. {
  2230. /* Fix monochrome 3D appearance */
  2231. string = (String) _50_foreground;
  2232. if (_pAppearanceData->backgroundPStr != NULL)
  2233. if (!strcmp(_pAppearanceData->backgroundPStr, _25_foreground) ||
  2234. !strcmp(_pAppearanceData->backgroundPStr, _50_foreground))
  2235. {
  2236. string = (String) _foreground;
  2237. }
  2238. }
  2239. else
  2240. {
  2241. string = NULL;
  2242. }
  2243. value->addr = (char *)string;
  2244. value->size = sizeof (String);
  2245. } /* END OF FUNCTION _WmTopShadowPixmapDefault */
  2246. void
  2247. _WmABackgroundDefault (Widget widget, int offset, XrmValue *value)
  2248. {
  2249. _WmGetDynamicDefault (widget, WmBGC, _defaultActiveBackground, 0, value);
  2250. } /* END OF FUNCTION _WmABackgroundDefault */
  2251. void
  2252. _WmAForegroundDefault (Widget widget, int offset, XrmValue *value)
  2253. {
  2254. _WmGetDynamicDefault (widget, WmFGC, 0, _pAppearanceData->activeBackground,
  2255. value);
  2256. } /* END OF FUNCTION _WmAForegroundDefault */
  2257. void
  2258. _WmABackgroundPixmapDefault (Widget widget, int offset, XrmValue *value)
  2259. {
  2260. static String string;
  2261. if ((Monochrome (XtScreen (widget))) ||
  2262. (_pAppearanceData->activeTopShadowColor ==
  2263. _pAppearanceData->activeBackground))
  2264. {
  2265. string = (String) _50_foreground;
  2266. }
  2267. else
  2268. {
  2269. string = NULL;
  2270. }
  2271. value->addr = (char *)string;
  2272. value->size = sizeof (String);
  2273. } /* END OF FUNCTION _WmABackgroundPixmapDefault */
  2274. void
  2275. _WmABottomShadowColorDefault (Widget widget, int offset, XrmValue *value)
  2276. {
  2277. _WmGetDynamicDefault (widget, WmBSC, 0, _pAppearanceData->activeBackground,
  2278. value);
  2279. } /* END OF FUNCTION _WmABottomShadowColorDefault */
  2280. void
  2281. _WmATopShadowColorDefault (Widget widget, int offset, XrmValue *value)
  2282. {
  2283. _WmGetDynamicDefault (widget, WmTSC, 0, _pAppearanceData->activeBackground,
  2284. value);
  2285. } /* END OF FUNCTION _WmATopShadowColorDefault */
  2286. void
  2287. _WmATopShadowPixmapDefault (Widget widget, int offset, XrmValue *value)
  2288. {
  2289. static String string;
  2290. if ((Monochrome (XtScreen (widget))) ||
  2291. (_pAppearanceData->activeTopShadowColor ==
  2292. _pAppearanceData->activeBackground))
  2293. {
  2294. /* Fix monochrome 3D appearance */
  2295. string = (String) _50_foreground;
  2296. if (_pAppearanceData->activeBackgroundPStr != NULL)
  2297. if (!strcmp
  2298. (_pAppearanceData->activeBackgroundPStr, _25_foreground) ||
  2299. !strcmp
  2300. (_pAppearanceData->activeBackgroundPStr, _50_foreground))
  2301. {
  2302. string = (String) _foreground;
  2303. }
  2304. }
  2305. else
  2306. {
  2307. string = NULL;
  2308. }
  2309. value->addr = (char *)string;
  2310. value->size = sizeof (String);
  2311. } /* END OF FUNCTION _WmATopShadowPixmapDefault */
  2312. void
  2313. _WmBackdropBgDefault (Widget widget, int offset, XrmValue *value)
  2314. {
  2315. static Pixel pixValue;
  2316. unsigned int colorSetId = (unsigned int) pResWS->backdrop.colorSet;
  2317. if (wmGD.statusColorServer == CSERVE_NORMAL)
  2318. {
  2319. if ((colorSetId == 0) || (colorSetId > XmCO_MAX_NUM_COLORS))
  2320. {
  2321. colorSetId = (unsigned int) DefaultWsColorSetId (pResWS);
  2322. }
  2323. switch (pResWS->pSD->colorUse)
  2324. {
  2325. case XmCO_BLACK_WHITE:
  2326. pixValue = pResWS->pSD->pPixelData[colorSetId-1].bg;
  2327. break;
  2328. default:
  2329. case XmCO_LOW_COLOR:
  2330. case XmCO_MEDIUM_COLOR:
  2331. case XmCO_HIGH_COLOR:
  2332. pixValue = pResWS->pSD->pPixelData[colorSetId-1].bs;
  2333. break;
  2334. }
  2335. }
  2336. else
  2337. {
  2338. /*
  2339. * Color server is unavailable. Has user specified a colorset?
  2340. *
  2341. * If not, go monochrome.
  2342. *
  2343. */
  2344. pixValue = WhitePixel (DISPLAY, pResWS->pSD->screen);
  2345. }
  2346. /* return the dynamic default */
  2347. value->addr = (char *) &pixValue;
  2348. value->size = sizeof (Pixel);
  2349. } /* END OF FUNCTION _WmBackdropBgDefault */
  2350. void
  2351. _WmBackdropFgDefault (Widget widget, int offset, XrmValue *value)
  2352. {
  2353. static Pixel pixValue;
  2354. unsigned int colorSetId = (unsigned int) pResWS->backdrop.colorSet;
  2355. if (wmGD.statusColorServer == CSERVE_NORMAL)
  2356. {
  2357. if ((colorSetId == 0) || (colorSetId > XmCO_MAX_NUM_COLORS))
  2358. {
  2359. colorSetId = (unsigned int) DefaultWsColorSetId (pResWS);
  2360. }
  2361. switch (pResWS->pSD->colorUse)
  2362. {
  2363. case XmCO_BLACK_WHITE:
  2364. pixValue = pResWS->pSD->pPixelData[colorSetId-1].fg;
  2365. break;
  2366. default:
  2367. case XmCO_LOW_COLOR:
  2368. case XmCO_MEDIUM_COLOR:
  2369. case XmCO_HIGH_COLOR:
  2370. pixValue = pResWS->pSD->pPixelData[colorSetId-1].bg;
  2371. break;
  2372. }
  2373. }
  2374. else
  2375. {
  2376. /*
  2377. * Color server is unavailable. Has user specified a colorset?
  2378. *
  2379. * If not, go monochrome.
  2380. *
  2381. */
  2382. pixValue = BlackPixel (DISPLAY, pResWS->pSD->screen);
  2383. }
  2384. value->addr = (char *) &pixValue;
  2385. value->size = sizeof (Pixel);
  2386. } /* END OF FUNCTION _WmBackdropFgDefault */
  2387. void
  2388. _WmBackdropColorSetDefault (Widget widget, int offset, XrmValue *value)
  2389. {
  2390. static unsigned int colorSetId;
  2391. if (wmGD.statusColorServer == CSERVE_NORMAL)
  2392. {
  2393. colorSetId = (unsigned int) DefaultWsColorSetId (pResWS);
  2394. }
  2395. else
  2396. {
  2397. colorSetId = 0; /* invalid color set */
  2398. }
  2399. value->addr = (char *) &colorSetId;
  2400. value->size = sizeof (Pixel);
  2401. } /* END OF FUNCTION _WmBackdropColorSetIdDefault */
  2402. void
  2403. _WmIconImageMaximumDefault (Widget widget, int offset, XrmValue *value)
  2404. {
  2405. static WHSize cval;
  2406. if ((pResSD->displayResolutionType == LOW_RES_DISPLAY) ||
  2407. (pResSD->displayResolutionType == VGA_RES_DISPLAY))
  2408. {
  2409. cval.width = 32;
  2410. cval.height = 32;
  2411. }
  2412. else
  2413. {
  2414. cval.width = 48;
  2415. cval.height = 48;
  2416. }
  2417. value->addr = (char *) &cval;
  2418. value->size = sizeof (WHSize);
  2419. } /* END OF FUNCTION _WmIconImageMaximumDefault */
  2420. /*************************************<->*************************************
  2421. *
  2422. * DefaultWsColorSetId (pWS)
  2423. *
  2424. *
  2425. * Description:
  2426. * -----------
  2427. * This function returns the default colorSetId for a given workspace
  2428. *
  2429. *
  2430. * Inputs:
  2431. * ------
  2432. * pWS = ptr to workspace data
  2433. *
  2434. * Outputs:
  2435. * -------
  2436. * return = default color set ID.
  2437. *
  2438. * "active" and "inactive" color sets are not used.
  2439. *
  2440. *************************************<->***********************************/
  2441. int
  2442. DefaultWsColorSetId (WmWorkspaceData *pWS)
  2443. {
  2444. static int _ws_high_color_map[] = { 3, 5, 6, 7 };
  2445. #define _WS_HIGH_COLOR_COUNT 4
  2446. int i;
  2447. WmScreenData *pSD;
  2448. int iIndex;
  2449. int rval = 8;
  2450. if (pWS)
  2451. {
  2452. pSD = pWS->pSD;
  2453. iIndex = (int) ((unsigned long)(pWS) -
  2454. (unsigned long)(pSD->pWS))/sizeof(WmWorkspaceData);
  2455. if (iIndex < 0)
  2456. iIndex = 0; /* bad pWS or pSD, shouldn't get here */
  2457. switch (pSD->colorUse)
  2458. {
  2459. case XmCO_BLACK_WHITE:
  2460. case XmCO_LOW_COLOR:
  2461. rval = 1 +
  2462. (pSD->pInactivePixelSet-pSD->pPixelData)/sizeof(XmPixelSet);
  2463. break;
  2464. case XmCO_MEDIUM_COLOR:
  2465. rval = HARD_CODED_PRIMARY;
  2466. break;
  2467. case XmCO_HIGH_COLOR:
  2468. i = iIndex % _WS_HIGH_COLOR_COUNT;
  2469. rval = _ws_high_color_map[i];
  2470. break;
  2471. }
  2472. }
  2473. return (rval);
  2474. } /* END OF FUNCTION DefaultWsColorSetId */
  2475. /*************************************<->*************************************
  2476. *
  2477. * _WmFocusAutoRaiseDefault (widget, offset, value)
  2478. *
  2479. *
  2480. * Description:
  2481. * -----------
  2482. * This function generates a default value for the focusAutoRaise resource.
  2483. *
  2484. *
  2485. * Inputs:
  2486. * ------
  2487. * widget = this is the parent widget for the wm subpart
  2488. *
  2489. * offset = this is the resource offset
  2490. *
  2491. * value = this is a pointer to a XrmValue in which to store the result
  2492. *
  2493. *
  2494. * Outputs:
  2495. * -------
  2496. * value = default resource value and size
  2497. *
  2498. *************************************<->***********************************/
  2499. void
  2500. _WmFocusAutoRaiseDefault (Widget widget, int offset, XrmValue *value)
  2501. {
  2502. static Boolean focusAutoRaise;
  2503. if (wmGD.keyboardFocusPolicy == KEYBOARD_FOCUS_EXPLICIT)
  2504. {
  2505. focusAutoRaise = True;
  2506. }
  2507. else
  2508. {
  2509. focusAutoRaise = False;
  2510. }
  2511. value->addr = (char *)&focusAutoRaise;
  2512. value->size = sizeof (Boolean);
  2513. } /* END OF FUNCTION _WmFocusAutoRaiseDefault */
  2514. /*************************************<->*************************************
  2515. *
  2516. * _WmMultiClickTimeDefault (widget, offset, value)
  2517. *
  2518. *
  2519. * Description:
  2520. * -----------
  2521. * This function generates a default value for the doubleClickTime resource.
  2522. * We dynamically default to the XtR4 multiClickTime value.
  2523. *
  2524. * Inputs:
  2525. * ------
  2526. * widget = this is the parent widget for the wm subpart
  2527. *
  2528. * offset = this is the resource offset
  2529. *
  2530. * value = this is a pointer to a XrmValue in which to store the result
  2531. *
  2532. * Outputs:
  2533. * -------
  2534. * value = default resource value and size
  2535. *
  2536. *************************************<->***********************************/
  2537. void
  2538. _WmMultiClickTimeDefault (Widget widget, int offset, XrmValue *value)
  2539. {
  2540. static int multiClickTime;
  2541. multiClickTime = XtGetMultiClickTime(XtDisplay(widget));
  2542. value->addr = (char *)&multiClickTime;
  2543. value->size = sizeof (int);
  2544. } /* END OF FUNCTION _WmMultiClickTimeDefault */
  2545. /*************************************<->*************************************
  2546. *
  2547. * _WmSecondariesOnTopDefault (widget, offset, value)
  2548. *
  2549. *
  2550. * Description:
  2551. * -----------
  2552. * This function generates a default value for the secondariesOnTop
  2553. * resource.
  2554. *
  2555. * Inputs:
  2556. * ------
  2557. * widget = this is the parent widget for the wm subpart
  2558. *
  2559. * offset = this is the resource offset
  2560. *
  2561. * value = this is a pointer to a XrmValue in which to store the result
  2562. *
  2563. * Outputs:
  2564. * -------
  2565. * value = default resource value and size
  2566. *
  2567. *************************************<->***********************************/
  2568. void
  2569. _WmSecondariesOnTopDefault (Widget widget, int offset, XrmValue *value)
  2570. {
  2571. static Boolean secondariesOnTop;
  2572. /*
  2573. * Inherit setting from primary window if this window is
  2574. * secondary.
  2575. */
  2576. if (_pCD->transientLeader != NULL)
  2577. secondariesOnTop = _pCD->transientLeader->secondariesOnTop;
  2578. else
  2579. secondariesOnTop = True;
  2580. value->addr = (char *)&secondariesOnTop;
  2581. value->size = sizeof (Boolean);
  2582. } /* END OF FUNCTION _WmSecondariesOnTopDefault */
  2583. /******************************<->*************************************
  2584. *
  2585. * ProcessWmResources ()
  2586. *
  2587. *
  2588. * Description:
  2589. * -----------
  2590. * This function is used to retrieve and process window manager resources
  2591. * that are not client-specific.
  2592. *
  2593. *
  2594. * Inputs:
  2595. * ------
  2596. * wmGlobalResources = pointer to wm resource list
  2597. *
  2598. *
  2599. * Outputs:
  2600. * -------
  2601. * wmGD = (global data filled out with resource values)
  2602. *
  2603. *************************************<->***********************************/
  2604. void
  2605. ProcessWmResources (void)
  2606. {
  2607. /*
  2608. * Process the mwm general appearance and behavior resources. Retrieve
  2609. * a limited set of resource values if the window manager is starting
  2610. * up with the standard behavior.
  2611. */
  2612. if (wmGD.useStandardBehavior)
  2613. {
  2614. XtGetApplicationResources (wmGD.topLevelW, (XtPointer) &wmGD,
  2615. wmStdGlobalResources, XtNumber (wmStdGlobalResources), NULL, 0);
  2616. /*
  2617. * Fill in the standard resource values.
  2618. */
  2619. SetStdGlobalResourceValues ();
  2620. }
  2621. else
  2622. {
  2623. XtGetApplicationResources (wmGD.topLevelW, (XtPointer) &wmGD,
  2624. wmGlobalResources, XtNumber (wmGlobalResources), NULL, 0);
  2625. }
  2626. if (wmGD.autoRaiseDelay < 0)
  2627. {
  2628. wmGD.autoRaiseDelay = 500;
  2629. Warning (((char *)GETMESSAGE(62, 66, "Out of range autoRaiseDelay resource value. Must be non-negative")));
  2630. }
  2631. } /* END OF FUNCTION ProcessWmResources */
  2632. /******************************<->*************************************
  2633. *
  2634. * ProcessGlobalScreenResources ()
  2635. *
  2636. *
  2637. * Description:
  2638. * -----------
  2639. * This function is used to retrieve window manager resources to
  2640. * determine the screens to manage.
  2641. *
  2642. *
  2643. * Inputs:
  2644. * ------
  2645. * wmGlobalScreenResources = pointer to wm resource list
  2646. *
  2647. *
  2648. * Outputs:
  2649. * -------
  2650. * wmGD = (global data filled out with resource values)
  2651. *
  2652. *************************************<->***********************************/
  2653. void
  2654. ProcessGlobalScreenResources (void)
  2655. {
  2656. XtGetApplicationResources (wmGD.topLevelW, &wmGD,
  2657. wmGlobalScreenResources,
  2658. XtNumber (wmGlobalScreenResources), NULL, 0);
  2659. if (wmGD.multiScreen)
  2660. {
  2661. wmGD.numScreens = ScreenCount(DISPLAY);
  2662. }
  2663. else
  2664. {
  2665. wmGD.numScreens = 1;
  2666. }
  2667. if (wmGD.screenList != NULL)
  2668. {
  2669. ProcessScreenListResource();
  2670. }
  2671. }
  2672. /*************************************<->*************************************
  2673. *
  2674. * SetStdGlobalResourceValues ()
  2675. *
  2676. *
  2677. * Description:
  2678. * -----------
  2679. * This function sets resource data to standard values. This setting
  2680. * is done in place of getting the values from the user settings in
  2681. * the resource database.
  2682. *
  2683. *
  2684. * Outputs:
  2685. * -------
  2686. * wmGD = (global data filled out with resource values)
  2687. *
  2688. *************************************<->***********************************/
  2689. void
  2690. SetStdGlobalResourceValues (void)
  2691. {
  2692. wmGD.autoKeyFocus = True;
  2693. wmGD.clientAutoPlace = True;
  2694. wmGD.colormapFocusPolicy = CMAP_FOCUS_KEYBOARD;
  2695. wmGD.deiconifyKeyFocus = True;
  2696. wmGD.doubleClickTime = 500;
  2697. wmGD.freezeOnConfig = True;
  2698. wmGD.iconAutoPlace = True;
  2699. wmGD.iconClick = True;
  2700. wmGD.interactivePlacement = False;
  2701. wmGD.keyboardFocusPolicy = KEYBOARD_FOCUS_EXPLICIT;
  2702. wmGD.lowerOnIconify = True;
  2703. wmGD.passSelectButton = True;
  2704. wmGD.startupKeyFocus = True;
  2705. wmGD.systemButtonClick = True;
  2706. wmGD.systemButtonClick2 = True;
  2707. wmGD.useFrontPanel=False;
  2708. } /* END OF FUNCTION SetStdGlobalResourceValues */
  2709. /*************************************<->*************************************
  2710. *
  2711. * ProcessScreenListResource ()
  2712. *
  2713. *
  2714. * Description:
  2715. * -----------
  2716. * This processes the names in the screenList resource.
  2717. *
  2718. *
  2719. * Inputs:
  2720. * ------
  2721. * wmGlobalResources = pointer to wmGD.screenList
  2722. *
  2723. *
  2724. * Outputs:
  2725. * -------
  2726. * wmGD.screenNames
  2727. *
  2728. *************************************<->***********************************/
  2729. void
  2730. ProcessScreenListResource (void)
  2731. {
  2732. unsigned char *lineP;
  2733. unsigned char *string;
  2734. int sNum = 0;
  2735. int nameCount = 0;
  2736. lineP = (unsigned char *)wmGD.screenList;
  2737. /*
  2738. * Parse screenList.
  2739. */
  2740. while (((string = GetString(&lineP)) != NULL) &&
  2741. (sNum < ScreenCount(DISPLAY)))
  2742. {
  2743. if (!(wmGD.screenNames[sNum] = (unsigned char *)
  2744. WmRealloc ((char*)wmGD.screenNames[sNum], strlen((char*)string)+1)))
  2745. {
  2746. ExitWM(WM_ERROR_EXIT_VALUE);
  2747. }
  2748. else
  2749. {
  2750. strcpy((char *)wmGD.screenNames[sNum], (char *)string);
  2751. nameCount++;
  2752. sNum++;
  2753. }
  2754. }
  2755. /*
  2756. * If the number of listed screens (sNum) is < screen count, fill in the
  2757. * remaining screen names with the name of the first screen specified,
  2758. * if such exists.
  2759. */
  2760. if (nameCount > 0)
  2761. {
  2762. string = wmGD.screenNames[0]; /* name of the first screen */
  2763. while (sNum < ScreenCount(DISPLAY))
  2764. {
  2765. if (!(wmGD.screenNames[sNum] = (unsigned char *)
  2766. WmRealloc ((char*)wmGD.screenNames[sNum],
  2767. strlen((char *)string)+1)))
  2768. {
  2769. ExitWM(WM_ERROR_EXIT_VALUE);
  2770. }
  2771. else
  2772. {
  2773. strcpy((char *)wmGD.screenNames[sNum], (char *)string);
  2774. sNum++;
  2775. }
  2776. }
  2777. }
  2778. } /* END OF FUNCTION ProcessScreenListResource */
  2779. /******************************<->*************************************
  2780. *
  2781. * ProcessWmColors ()
  2782. *
  2783. *
  2784. * Description:
  2785. * -----------
  2786. * Retrieve the color sets from the colorserver.
  2787. *
  2788. * Inputs:
  2789. * ------
  2790. * none
  2791. *
  2792. * Outputs:
  2793. * -------
  2794. * modifies parts of global pixel sets
  2795. *
  2796. * Comments:
  2797. * --------
  2798. *
  2799. ******************************<->***********************************/
  2800. void
  2801. ProcessWmColors (WmScreenData *pSD)
  2802. {
  2803. short active, inactive, primary, secondary;
  2804. if ((pSD->pPixelData = (XmPixelSet *)
  2805. XtMalloc (XmCO_NUM_COLORS * sizeof(XmPixelSet))))
  2806. {
  2807. /*
  2808. *
  2809. *
  2810. * ASSUMPTION: If XmeGetPixelData() returns true,
  2811. * we have a good color server at our disposal.
  2812. *
  2813. *
  2814. */
  2815. if (XmeGetPixelData (pSD->screen, &pSD->colorUse,
  2816. pSD->pPixelData, &active, &inactive,
  2817. &primary, &secondary))
  2818. {
  2819. pSD->pActivePixelSet = &(pSD->pPixelData[active]);
  2820. pSD->pInactivePixelSet = &(pSD->pPixelData[inactive]);
  2821. pSD->pPrimaryPixelSet = &(pSD->pPixelData[primary]);
  2822. pSD->pSecondaryPixelSet = &(pSD->pPixelData[secondary]);
  2823. /* Hack here. The index "4" is the proper array reference. */
  2824. /* This is used because XmGetPixelData has not been properly */
  2825. /* updated. */
  2826. pSD->pTextPixelSet = &(pSD->pPixelData[3]);
  2827. wmGD.statusColorServer = CSERVE_NORMAL;
  2828. }
  2829. else
  2830. {
  2831. XtFree((char *)pSD->pPixelData);
  2832. pSD->pPixelData = NULL;
  2833. pSD->pActivePixelSet = NULL;
  2834. pSD->pInactivePixelSet = NULL;
  2835. pSD->pPrimaryPixelSet = NULL;
  2836. pSD->pSecondaryPixelSet = NULL;
  2837. pSD->pTextPixelSet = NULL;
  2838. }
  2839. }
  2840. else
  2841. {
  2842. Warning (((char *)GETMESSAGE(62, 22, "Insufficient memory for color data")));
  2843. ExitWM (WM_ERROR_EXIT_VALUE);
  2844. }
  2845. } /* END OF FUNCTION ProcessWmColors */
  2846. /******************************<->*************************************
  2847. *
  2848. * WriteOutXrmColors ()
  2849. *
  2850. *
  2851. * Description:
  2852. * -----------
  2853. * Update the XRM database with pixel values from the color server.
  2854. *
  2855. * Inputs:
  2856. * ------
  2857. * pSD = contains pixel sets
  2858. *
  2859. * Outputs:
  2860. * -------
  2861. * updated resource database
  2862. *
  2863. * Comments:
  2864. * --------
  2865. * N.B. Must change to write out data on a PER-SCREEN basis.
  2866. * e.g., "Dtwm*0*background"
  2867. ******************************<->***********************************/
  2868. static void
  2869. WriteOutXrmColors (WmScreenData *pSD)
  2870. {
  2871. XrmDatabase db;
  2872. XrmValue value;
  2873. int thisScreen = pSD->screen;
  2874. XmPixelSet *tpixset;
  2875. XmPixelSet *spixset;
  2876. char *res_class;
  2877. String screen_name;
  2878. if (MwmBehavior)
  2879. {
  2880. res_class = WM_RESOURCE_CLASS;
  2881. }
  2882. else
  2883. {
  2884. res_class = DT_WM_RESOURCE_CLASS;
  2885. }
  2886. screen_name = (String) wmGD.screenNames[pSD->screen];
  2887. db = XtScreenDatabase(XScreenOfDisplay(DISPLAY, thisScreen));
  2888. /** update the clients database with new colors **/
  2889. value.size = sizeof(Pixel);
  2890. /*
  2891. *
  2892. * WM ACTIVE RESOURCES--e.g., for the active frame
  2893. *
  2894. */
  2895. if (pSD->pActivePixelSet)
  2896. {
  2897. tpixset = pSD->pActivePixelSet;
  2898. spixset = pSD->pSecondaryPixelSet;
  2899. if (pSD->colorUse == XmCO_BLACK_WHITE)
  2900. {
  2901. /*
  2902. *
  2903. * Limit ourselves here to the client (frame)
  2904. * visuals
  2905. *
  2906. */
  2907. /* activeForeground */
  2908. value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
  2909. XrmPutResource (&db,
  2910. ResCat (res_class, screen_name, WmNactiveForeground,
  2911. NULL), XtRPixel, &value);
  2912. /* activeBackground */
  2913. value.addr = (XtPointer) &(WhitePixel(DISPLAY, pSD->screen));
  2914. XrmPutResource (&db,
  2915. ResCat (res_class, screen_name, WmNactiveBackground,
  2916. NULL), XtRPixel, &value);
  2917. XrmPutStringResource (&db, ResCat (res_class, screen_name,
  2918. WmNactiveBackgroundPixmap, NULL),
  2919. _foreground);
  2920. /* activeTopShadow */
  2921. XrmPutStringResource (&db, ResCat (res_class, screen_name,
  2922. WmNactiveTopShadowPixmap, NULL),
  2923. _Dither);
  2924. value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
  2925. XrmPutResource (&db,
  2926. ResCat (res_class, screen_name, WmNactiveTopShadowColor,
  2927. NULL), XtRPixel, &value);
  2928. /* activeBottomShadow */
  2929. value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
  2930. XrmPutResource (&db,
  2931. ResCat (res_class, screen_name,
  2932. WmNactiveBottomShadowColor, NULL), XtRPixel, &value);
  2933. XrmPutStringResource (&db, ResCat (res_class, screen_name,
  2934. WmNactiveBottomShadowPixmap, NULL),
  2935. _foreground);
  2936. }
  2937. else /* active colors for non-BW systems */
  2938. {
  2939. value.addr = (XtPointer) &(tpixset->bg);
  2940. XrmPutResource (&db,
  2941. ResCat (res_class, screen_name, WmNactiveBackground, NULL),
  2942. XtRPixel, &value);
  2943. value.addr = (XtPointer) &(tpixset->fg);
  2944. XrmPutResource (&db,
  2945. ResCat (res_class, screen_name, WmNactiveForeground, NULL),
  2946. XtRPixel, &value);
  2947. value.addr = (XtPointer) &(tpixset->ts);
  2948. XrmPutResource (&db,
  2949. ResCat (res_class, screen_name, WmNactiveTopShadowColor, NULL),
  2950. XtRPixel, &value);
  2951. value.addr = (XtPointer) &(tpixset->bs);
  2952. XrmPutResource (&db,
  2953. ResCat (res_class, screen_name, WmNactiveBottomShadowColor, NULL),
  2954. XtRPixel, &value);
  2955. if (XmCO_DitherTopShadow(DISPLAY, thisScreen, tpixset))
  2956. {
  2957. XrmPutStringResource (&db,
  2958. ResCat (res_class, screen_name, WmNactiveTopShadowPixmap, NULL),
  2959. _Dither);
  2960. }
  2961. if (XmCO_DitherBottomShadow(DISPLAY, thisScreen, tpixset))
  2962. {
  2963. XrmPutStringResource (&db,
  2964. ResCat (res_class, screen_name, WmNactiveBottomShadowPixmap,
  2965. NULL),
  2966. _Dither);
  2967. }
  2968. }
  2969. }
  2970. /*
  2971. *
  2972. * WM INACTIVE colors--e.g., for dialogues
  2973. *
  2974. */
  2975. if (pSD->pInactivePixelSet)
  2976. {
  2977. tpixset = pSD->pInactivePixelSet;
  2978. spixset = pSD->pSecondaryPixelSet;
  2979. if (pSD->colorUse == XmCO_BLACK_WHITE)
  2980. {
  2981. /*
  2982. *
  2983. * Set colors/pixmaps for the frames--leave the
  2984. * menus out of it so that their text won't look
  2985. * unsatisfactory against a dithered background.
  2986. *
  2987. */
  2988. /* foreground */
  2989. value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
  2990. XrmPutResource (&db,
  2991. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  2992. WmNforeground), XtRPixel, &value);
  2993. XrmPutResource (&db,
  2994. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  2995. WmNforeground), XtRPixel, &value);
  2996. /* background */
  2997. XrmPutStringResource (&db,
  2998. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  2999. WmNbackgroundPixmap), _Dither);
  3000. XrmPutStringResource (&db,
  3001. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  3002. WmNbackgroundPixmap), _Dither);
  3003. value.addr = (XtPointer) &(WhitePixel(DISPLAY, pSD->screen));
  3004. XrmPutResource (&db,
  3005. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3006. WmNbackground), XtRPixel, &value);
  3007. XrmPutResource (&db,
  3008. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  3009. WmNbackground), XtRPixel, &value);
  3010. /* topshadow */
  3011. XrmPutStringResource (&db,
  3012. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3013. WmNtopShadowPixmap), _foreground);
  3014. XrmPutStringResource (&db,
  3015. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  3016. WmNtopShadowPixmap), _foreground);
  3017. value.addr = (XtPointer) &(WhitePixel(DISPLAY, pSD->screen));
  3018. XrmPutResource (&db,
  3019. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3020. WmNtopShadowColor), XtRPixel, &value);
  3021. XrmPutResource (&db,
  3022. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  3023. WmNtopShadowColor), XtRPixel, &value);
  3024. /* bottomshadow */
  3025. XrmPutStringResource (&db,
  3026. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3027. WmNbottomShadowPixmap), _foreground);
  3028. XrmPutStringResource (&db,
  3029. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  3030. WmNbottomShadowPixmap), _foreground);
  3031. value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
  3032. XrmPutResource (&db,
  3033. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3034. WmNbottomShadowColor), XtRPixel, &value);
  3035. XrmPutResource (&db,
  3036. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  3037. WmNbottomShadowColor), XtRPixel, &value);
  3038. /*
  3039. *
  3040. * Ensure that the icon images have a black foreground and
  3041. * a white background.
  3042. *
  3043. */
  3044. value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
  3045. XrmPutResource (&db,
  3046. ResCat (res_class, screen_name, WmNiconImageForeground,
  3047. NULL), XtRPixel, &value);
  3048. value.addr = (XtPointer) &(WhitePixel(DISPLAY, pSD->screen));
  3049. XrmPutResource (&db,
  3050. ResCat (res_class, screen_name, WmNiconImageBackground,
  3051. NULL), XtRPixel, &value);
  3052. /* Now deal with XmCO_BLACK_WHITE Menus */
  3053. /* XmCO_BLACK_WHITE menu foreground */
  3054. value.addr = (XtPointer) &(tpixset->fg);
  3055. XrmPutResource (&db,
  3056. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3057. WmNforeground), XtRPixel, &value);
  3058. /* XmCO_BLACK_WHITE menu background */
  3059. value.addr = (XtPointer) &(tpixset->bg);
  3060. XrmPutResource (&db,
  3061. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3062. WmNbackground), XtRPixel, &value);
  3063. /* XmCO_BLACK_WHITE menu top shadow */
  3064. XrmPutStringResource (&db,
  3065. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3066. WmNtopShadowPixmap), _50_foreground);
  3067. /* use foreground color for this pixmap */
  3068. value.addr = (XtPointer) &(tpixset->fg);
  3069. XrmPutResource (&db,
  3070. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3071. WmNtopShadowColor), XtRPixel, &value);
  3072. /* XmCO_BLACK_WHITE menu bottom shadow */
  3073. XrmPutStringResource (&db,
  3074. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3075. WmNbottomShadowPixmap), _75_foreground);
  3076. /* use foreground color for this pixmap */
  3077. value.addr = (XtPointer) &(tpixset->fg);
  3078. XrmPutResource (&db,
  3079. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3080. WmNbottomShadowColor), XtRPixel, &value);
  3081. /* Finally, deal with XmCO_BLACK_WHITE Confirm Boxes */
  3082. /* XmCO_BLACK_WHITE confirm box foreground */
  3083. value.addr = (XtPointer) &(spixset->fg);
  3084. XrmPutResource (&db,
  3085. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3086. WmNforeground), XtRPixel, &value);
  3087. /* XmCO_BLACK_WHITE confirm box background */
  3088. value.addr = (XtPointer) &(spixset->bg);
  3089. XrmPutResource (&db,
  3090. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3091. WmNbackground), XtRPixel, &value);
  3092. /* XmCO_BLACK_WHITE confirm box top shadow */
  3093. XrmPutStringResource (&db,
  3094. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3095. WmNtopShadowPixmap), _50_foreground);
  3096. /* use foreground color */
  3097. value.addr = (XtPointer) &(spixset->fg);
  3098. XrmPutResource (&db,
  3099. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3100. WmNtopShadowColor), XtRPixel, &value);
  3101. /* XmCO_BLACK_WHITE confirm box bottom shadow */
  3102. XrmPutStringResource (&db,
  3103. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3104. WmNbottomShadowPixmap), _75_foreground);
  3105. /* use foreground color */
  3106. value.addr = (XtPointer) &(spixset->fg);
  3107. XrmPutResource (&db,
  3108. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3109. WmNbottomShadowColor), XtRPixel, &value);
  3110. /* use select color for icon box trough color */
  3111. value.addr = (XtPointer) &(tpixset->sc);
  3112. XrmPutResource (&db,
  3113. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3114. XmNtroughColor), XtRPixel, &value);
  3115. /* use select color for arm and select colors in dialogs */
  3116. value.addr = (XtPointer) &(spixset->sc);
  3117. XrmPutResource (&db,
  3118. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3119. XmNarmColor), XtRPixel, &value);
  3120. XrmPutResource (&db,
  3121. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3122. XmNselectColor), XtRPixel, &value);
  3123. XrmPutResource (&db,
  3124. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3125. XmNtroughColor), XtRPixel, &value);
  3126. }
  3127. else /* inactive colors for non-BW systems */
  3128. {
  3129. XmPixelSet *fpixset;
  3130. /*
  3131. * Set mwm component colors
  3132. */
  3133. value.addr = (XtPointer) &(tpixset->bg);
  3134. XrmPutResource (&db,
  3135. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3136. WmNbackground), XtRPixel, &value);
  3137. XrmPutResource (&db,
  3138. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  3139. WmNbackground), XtRPixel, &value);
  3140. XrmPutResource (&db,
  3141. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3142. WmNbackground), XtRPixel, &value);
  3143. value.addr = (XtPointer) &(spixset->bg);
  3144. XrmPutResource (&db,
  3145. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3146. WmNbackground), XtRPixel, &value);
  3147. value.addr = (XtPointer) &(tpixset->ts);
  3148. XrmPutResource (&db,
  3149. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3150. WmNtopShadowColor), XtRPixel, &value);
  3151. XrmPutResource (&db,
  3152. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  3153. WmNtopShadowColor), XtRPixel, &value);
  3154. XrmPutResource (&db,
  3155. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3156. WmNtopShadowColor), XtRPixel, &value);
  3157. value.addr = (XtPointer) &(spixset->ts);
  3158. XrmPutResource (&db,
  3159. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3160. WmNtopShadowColor), XtRPixel, &value);
  3161. value.addr = (XtPointer) &(tpixset->bs);
  3162. XrmPutResource (&db,
  3163. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3164. WmNbottomShadowColor), XtRPixel, &value);
  3165. XrmPutResource (&db,
  3166. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  3167. WmNbottomShadowColor), XtRPixel, &value);
  3168. XrmPutResource (&db,
  3169. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3170. WmNbottomShadowColor), XtRPixel, &value);
  3171. value.addr = (XtPointer) &(spixset->bs);
  3172. XrmPutResource (&db,
  3173. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3174. WmNbottomShadowColor), XtRPixel, &value);
  3175. value.addr = (XtPointer) &(tpixset->fg);
  3176. XrmPutResource (&db,
  3177. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3178. WmNforeground), XtRPixel, &value);
  3179. XrmPutResource (&db,
  3180. ResCat (res_class, screen_name, (char *)ICON_FRAME_PART,
  3181. WmNforeground), XtRPixel, &value);
  3182. XrmPutResource (&db,
  3183. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3184. WmNforeground), XtRPixel, &value);
  3185. value.addr = (XtPointer) &(spixset->fg);
  3186. XrmPutResource (&db,
  3187. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3188. WmNforeground), XtRPixel, &value);
  3189. /*
  3190. * Set select color only for menus and feedback mwm
  3191. * parts. Client and Icon parts aren't real widgets.
  3192. * Set client trough color for icon box.
  3193. */
  3194. value.addr = (XtPointer) &(tpixset->sc);
  3195. XrmPutResource (&db,
  3196. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3197. XmNselectColor), XtRPixel, &value);
  3198. XrmPutResource (&db,
  3199. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3200. XmNarmColor), XtRPixel, &value);
  3201. XrmPutResource (&db,
  3202. ResCat (res_class, screen_name, (char *)MENU_ITEM_PART,
  3203. XmNtroughColor), XtRPixel, &value);
  3204. XrmPutResource (&db,
  3205. ResCat (res_class, screen_name, (char *)CLIENT_FRAME_PART,
  3206. XmNtroughColor), XtRPixel, &value);
  3207. XrmPutResource (&db,
  3208. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3209. XmNselectColor), XtRPixel, &value);
  3210. value.addr = (XtPointer) &(spixset->sc);
  3211. XrmPutResource (&db,
  3212. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3213. XmNarmColor), XtRPixel, &value);
  3214. XrmPutResource (&db,
  3215. ResCat (res_class, screen_name, (char *)FEEDBACK_FRAME_PART,
  3216. XmNtroughColor), XtRPixel, &value);
  3217. /*
  3218. * Set Dtwm dialog colors
  3219. */
  3220. fpixset = pSD->pSecondaryPixelSet;
  3221. value.addr = (XtPointer) &(fpixset->bg);
  3222. XrmPutResource (&db,
  3223. ResCat (res_class, screen_name, XmNbackground, NULL),
  3224. XtRPixel, &value);
  3225. value.addr = (XtPointer) &(fpixset->fg);
  3226. XrmPutResource (&db,
  3227. ResCat (res_class, screen_name, XmNforeground, NULL),
  3228. XtRPixel, &value);
  3229. value.addr = (XtPointer) &(fpixset->ts);
  3230. XrmPutResource (&db,
  3231. ResCat (res_class, screen_name, XmNtopShadowColor, NULL),
  3232. XtRPixel, &value);
  3233. value.addr = (XtPointer) &(fpixset->bs);
  3234. XrmPutResource (&db,
  3235. ResCat (res_class, screen_name, XmNbottomShadowColor, NULL),
  3236. XtRPixel, &value);
  3237. /*
  3238. *
  3239. * Set up the select color, as for buttons in the dialogue
  3240. * boxes.
  3241. *
  3242. */
  3243. value.addr = (XtPointer) &(fpixset->sc);
  3244. XrmPutResource (&db,
  3245. ResCat (res_class, screen_name, XmNselectColor, NULL),
  3246. XtRPixel, &value);
  3247. /* value.addr = (XtPointer) &(fpixset->sc); */
  3248. XrmPutResource (&db,
  3249. ResCat (res_class, screen_name, XmNarmColor, NULL),
  3250. XtRPixel, &value);
  3251. /* value.addr = (XtPointer) &(fpixset->sc); */
  3252. XrmPutResource (&db,
  3253. ResCat (res_class, screen_name, XmNtroughColor, NULL),
  3254. XtRPixel, &value);
  3255. if (XmCO_DitherTopShadow(DISPLAY, thisScreen, fpixset))
  3256. {
  3257. XrmPutStringResource (&db,
  3258. ResCat (res_class, screen_name, WmNtopShadowPixmap, NULL),
  3259. _Dither);
  3260. if (pSD->colorUse == XmCO_BLACK_WHITE)
  3261. {
  3262. XrmPutStringResource (&db,
  3263. ResCat (res_class, screen_name,
  3264. WmNbottomShadowPixmap, NULL),
  3265. _NoDither);
  3266. }
  3267. }
  3268. if (XmCO_DitherBottomShadow(DISPLAY, thisScreen, fpixset))
  3269. {
  3270. XrmPutStringResource (&db,
  3271. ResCat (res_class, screen_name, WmNbottomShadowPixmap, NULL),
  3272. _Dither);
  3273. if (pSD->colorUse == XmCO_BLACK_WHITE)
  3274. {
  3275. XrmPutStringResource (&db,
  3276. ResCat (res_class, screen_name,
  3277. WmNtopShadowPixmap, NULL),
  3278. _NoDither);
  3279. }
  3280. }
  3281. if (tpixset->bs != tpixset->ts)
  3282. /*
  3283. *
  3284. * If the inactive bottomshadow and topshadow are
  3285. * different (i.e., valid), then make the icon image
  3286. * use those colors.
  3287. */
  3288. {
  3289. value.addr = (XtPointer) &(tpixset->bs);
  3290. XrmPutResource (&db,
  3291. ResCat (res_class, screen_name, WmNiconImageForeground,
  3292. NULL), XtRPixel, &value);
  3293. value.addr = (XtPointer) &(tpixset->ts);
  3294. XrmPutResource (&db,
  3295. ResCat (res_class, screen_name, WmNiconImageBackground,
  3296. NULL), XtRPixel, &value);
  3297. value.addr = (XtPointer) &(tpixset->bs);
  3298. XrmPutResource (&db,
  3299. ResCat (res_class, screen_name,
  3300. WmNiconImageBottomShadowColor,
  3301. NULL), XtRPixel, &value);
  3302. value.addr = (XtPointer) &(tpixset->ts);
  3303. XrmPutResource (&db,
  3304. ResCat (res_class, screen_name,
  3305. WmNiconImageTopShadowColor,
  3306. NULL), XtRPixel, &value);
  3307. }
  3308. else
  3309. /*
  3310. *
  3311. * Ensure that the icon images have a black foreground and
  3312. * a white background.
  3313. *
  3314. */
  3315. {
  3316. value.addr = (XtPointer) &(BlackPixel(DISPLAY, pSD->screen));
  3317. XrmPutResource (&db,
  3318. ResCat (res_class, screen_name, WmNiconImageForeground,
  3319. NULL), XtRPixel, &value);
  3320. value.addr = (XtPointer) &(WhitePixel(DISPLAY, pSD->screen));
  3321. XrmPutResource (&db,
  3322. ResCat (res_class, screen_name, WmNiconImageBackground,
  3323. NULL), XtRPixel, &value);
  3324. }
  3325. }
  3326. }
  3327. if (pSD->pTextPixelSet)
  3328. {
  3329. value.addr = (XtPointer) &(pSD->pTextPixelSet->bg);
  3330. XrmPutResource (&db,
  3331. ResCat (res_class, screen_name, "XmTextField",
  3332. WmNbackground), XtRPixel, &value);
  3333. XrmPutResource (&db,
  3334. ResCat (res_class, screen_name, "XmText",
  3335. WmNbackground), XtRPixel, &value);
  3336. }
  3337. }
  3338. /******************************<->*************************************
  3339. *
  3340. * ResCat (s1,s2,s3,s4)
  3341. *
  3342. *
  3343. * Description:
  3344. * -----------
  3345. * Cats up to four strings together with '*' in between.
  3346. *
  3347. *
  3348. * Inputs:
  3349. * ------
  3350. * s1...s4 = pointers to Strings or NULL pointers (no string)
  3351. *
  3352. * Outputs:
  3353. * -------
  3354. * Return = pointer to statically allocated string that has
  3355. * the passed in string cat'ed together with '*'s
  3356. * in between.
  3357. *
  3358. * Comments:
  3359. * --------
  3360. * Does no limit checking on the static buffer
  3361. *
  3362. *************************************<->***********************************/
  3363. String
  3364. ResCat (String s1, String s2, String s3, String s4)
  3365. {
  3366. int count;
  3367. Boolean useResourceClass = True;
  3368. wmGD.tmpBuffer[0] = '\0';
  3369. count = MAXBUF - 1;
  3370. if (s1)
  3371. {
  3372. if ((MwmBehavior) &&
  3373. !strcmp (s1, WM_RESOURCE_CLASS))
  3374. /*
  3375. *
  3376. * if this routine is called with a class name
  3377. * ("Mwm" or "Dtwm"), then DON'T use it.
  3378. * We want our resources to be written out
  3379. * as: *iconImageForeground: <pixel_val>
  3380. *
  3381. * as opposed to: Dtwm*iconImageForeground: <pixel_val>
  3382. *
  3383. */
  3384. {
  3385. useResourceClass = False;
  3386. }
  3387. else if (!strcmp (s1, DT_WM_RESOURCE_CLASS))
  3388. {
  3389. useResourceClass = False;
  3390. }
  3391. else
  3392. {
  3393. strncat((char *)wmGD.tmpBuffer, s1, count);
  3394. count -= strlen(s1);
  3395. }
  3396. if (s2 && (count > 0))
  3397. {
  3398. strncat ((char *)wmGD.tmpBuffer, "*", count);
  3399. count -= 1;
  3400. strncat ((char *)wmGD.tmpBuffer, s2, count);
  3401. count -= strlen (s2);
  3402. if (s3 && (count > 0))
  3403. {
  3404. strncat ((char *)wmGD.tmpBuffer, "*", count);
  3405. count -= 1;
  3406. strncat ((char *)wmGD.tmpBuffer, s3, count);
  3407. count -= strlen (s3);
  3408. if (s4)
  3409. {
  3410. strncat ((char *)wmGD.tmpBuffer, "*", count);
  3411. count -= 1;
  3412. strncat ((char *)wmGD.tmpBuffer, s4, count);
  3413. }
  3414. }
  3415. }
  3416. }
  3417. return ((String) wmGD.tmpBuffer);
  3418. } /* END OF FUNCTION ResCat */
  3419. /******************************<->*************************************
  3420. *
  3421. * CheckForNoDither (pAD)
  3422. *
  3423. *
  3424. * Description:
  3425. * -----------
  3426. * Checks for reserved string as pixmap name of dither that indicates
  3427. * no dithering and replaces the string with a NULL.
  3428. *
  3429. *
  3430. * Inputs:
  3431. * ------
  3432. * pAD = pointer to appearance data
  3433. *
  3434. * Outputs:
  3435. * -------
  3436. * pAD = pointer to appearance data (may be modified)
  3437. *
  3438. * Comments:
  3439. * ---------
  3440. * This check is done to avoid repeated calls to XmGetPixmap when
  3441. * managing windows. XmGetPixmap doesn't cache failures, and the
  3442. * NoDither string should fail every time. We want to prevent
  3443. * XmGetPixmap from call XtResolvePathName to rummage through
  3444. * the file system.
  3445. *
  3446. *************************************<->***********************************/
  3447. void
  3448. CheckForNoDither (AppearanceData *pAD)
  3449. {
  3450. if (pAD->backgroundPStr &&
  3451. !strcmp(pAD->backgroundPStr, _NoDither))
  3452. {
  3453. pAD->backgroundPStr = NULL;
  3454. }
  3455. if (pAD->bottomShadowPStr &&
  3456. !strcmp(pAD->bottomShadowPStr, _NoDither))
  3457. {
  3458. pAD->bottomShadowPStr = NULL;
  3459. }
  3460. if (pAD->topShadowPStr &&
  3461. !strcmp(pAD->topShadowPStr, _NoDither))
  3462. {
  3463. pAD->topShadowPStr = NULL;
  3464. }
  3465. if (pAD->activeBackgroundPStr &&
  3466. !strcmp(pAD->activeBackgroundPStr, _NoDither))
  3467. {
  3468. pAD->activeBackgroundPStr = NULL;
  3469. }
  3470. if (pAD->activeBottomShadowPStr &&
  3471. !strcmp(pAD->activeBottomShadowPStr, _NoDither))
  3472. {
  3473. pAD->activeBottomShadowPStr = NULL;
  3474. }
  3475. if (pAD->activeTopShadowPStr &&
  3476. !strcmp(pAD->activeTopShadowPStr, _NoDither))
  3477. {
  3478. pAD->activeTopShadowPStr = NULL;
  3479. }
  3480. } /* END OF FUNCTION CheckForNoDither */
  3481. /******************************<->*************************************
  3482. *
  3483. * ProcessAppearanceResources (pSD)
  3484. *
  3485. *
  3486. * Description:
  3487. * -----------
  3488. * Retrieve and process the general appearance resources for the mwm
  3489. * subparts: "client", "icon", and "feedback"
  3490. *
  3491. *
  3492. * Inputs:
  3493. * ------
  3494. * pSD = pointer to screen data
  3495. *
  3496. * Outputs:
  3497. * -------
  3498. * modifies parts of global data wmGD.
  3499. *
  3500. * Comments:
  3501. * --------
  3502. * o Changeable GCs are created with XCreateGC. The base GCs used for
  3503. * text output will have clip_masks defined for them later.
  3504. *
  3505. *
  3506. *************************************<->***********************************/
  3507. void
  3508. ProcessAppearanceResources (WmScreenData *pSD)
  3509. {
  3510. Widget clientW; /* dummy widget for resource fetching */
  3511. int i;
  3512. Arg args[10];
  3513. /*
  3514. * Get the client subpart resources:
  3515. */
  3516. /* save info in static globals for dynamic default processing */
  3517. _defaultBackground = _defaultColor1;
  3518. _defaultActiveBackground = _defaultColor2;
  3519. _pAppearanceData = &(pSD->clientAppearance);
  3520. (void)XtGetSubresources (pSD->screenTopLevelW,
  3521. (XtPointer) &(pSD->clientAppearance),
  3522. WmNclient, WmCClient, wmAppearanceResources,
  3523. XtNumber (wmAppearanceResources), NULL, 0);
  3524. CheckForNoDither (&(pSD->clientAppearance));
  3525. /*
  3526. * Process the client resource values:
  3527. */
  3528. /* make background, top and bottom shadow pixmaps */
  3529. MakeAppearanceResources (pSD, &(pSD->clientAppearance), True);
  3530. /*
  3531. * Get the client.title subpart resources:
  3532. */
  3533. /* insert "client" widget in hierarchy */
  3534. i = 0;
  3535. clientW = XtCreateWidget (WmNclient, xmRowColumnWidgetClass,
  3536. pSD->screenTopLevelW, (ArgList) args, i);
  3537. /* fetch "client.title" subpart appearance resources */
  3538. _pAppearanceData = &(pSD->clientTitleAppearance);
  3539. (void)XtGetSubresources (clientW, (XtPointer) &(pSD->clientTitleAppearance),
  3540. WmNtitle, WmCTitle, wmAppearanceResources,
  3541. XtNumber (wmAppearanceResources), NULL, 0);
  3542. CheckForNoDither (&(pSD->clientTitleAppearance));
  3543. /*
  3544. * Process the client.title resource values:
  3545. */
  3546. /*
  3547. * check if client title appearance is different from the rest of frame.
  3548. */
  3549. if (SimilarAppearanceData (&(pSD->clientAppearance),
  3550. &(pSD->clientTitleAppearance)))
  3551. {
  3552. /* title bar doesn't need special graphic processing */
  3553. pSD->decoupleTitleAppearance = False;
  3554. }
  3555. else
  3556. {
  3557. /* make background, top and bottom shadow pixmaps */
  3558. MakeAppearanceResources (pSD, &(pSD->clientTitleAppearance), True);
  3559. pSD->decoupleTitleAppearance = True;
  3560. }
  3561. XtDestroyWidget (clientW); /* all done with dummy widget */
  3562. /*
  3563. * Get the icon subpart resources:
  3564. */
  3565. _pAppearanceData = &(pSD->iconAppearance);
  3566. (void)XtGetSubresources (pSD->screenTopLevelW,
  3567. (XtPointer) &(pSD->iconAppearance),
  3568. WmNicon, WmCIcon, wmAppearanceResources,
  3569. XtNumber (wmAppearanceResources), NULL, 0);
  3570. CheckForNoDither (&(pSD->iconAppearance));
  3571. /*
  3572. * Process the icon resource values:
  3573. */
  3574. /* make background, top and bottom shadow pixmaps */
  3575. MakeAppearanceResources (pSD, &(pSD->iconAppearance), True);
  3576. /*
  3577. * Get the feedback subpart resources:
  3578. * !!! only get "inactive" resources !!!
  3579. */
  3580. _defaultBackground = _defaultColor2;
  3581. _defaultActiveBackground = _defaultColor2;
  3582. _pAppearanceData = &(pSD->feedbackAppearance);
  3583. (void)XtGetSubresources (pSD->screenTopLevelW,
  3584. (XtPointer) &(pSD->feedbackAppearance),
  3585. WmNfeedback, WmCFeedback, wmAppearanceResources,
  3586. XtNumber (wmAppearanceResources), NULL, 0);
  3587. CheckForNoDither (&(pSD->feedbackAppearance));
  3588. /*
  3589. * Process the feedback resource values:
  3590. */
  3591. /* make background, top and bottom shadow pixmaps */
  3592. MakeAppearanceResources (pSD, &(pSD->feedbackAppearance), False);
  3593. } /* END OF FUNCTION ProcessAppearanceResources */
  3594. /*************************************<->*************************************
  3595. *
  3596. * FallbackMakeTitleHeight (pAData)
  3597. *
  3598. *
  3599. * Description:
  3600. * -----------
  3601. * This function makes title hight for AppearanceData
  3602. * (using XExtentsOfFontSet on pAData->fontList)
  3603. *
  3604. * Inputs:
  3605. * ------
  3606. *
  3607. * pAData = pointer to appearance data structure containing resource info
  3608. *
  3609. *
  3610. * Outputs:
  3611. * -------
  3612. * *pAData - pAData->titleHeight is updated
  3613. * return = 1 on success, 0 on failure (pAData->titleHeight is intact)
  3614. *
  3615. *************************************<->***********************************/
  3616. int
  3617. FallbackMakeTitleHeight (AppearanceData *pAData) {
  3618. XmFontContext fc;
  3619. XmFontType type;
  3620. XmFontListEntry entry;
  3621. XtPointer pFont;
  3622. XFontSetExtents *pExtents;
  3623. int result = 0;
  3624. XmFontListInitFontContext ( &fc, pAData->fontList);
  3625. pAData->titleHeight = 0;
  3626. entry = XmFontListNextEntry (fc);
  3627. while (entry)
  3628. {
  3629. pFont = XmFontListEntryGetFont (entry, &type);
  3630. switch (type)
  3631. {
  3632. case XmFONT_IS_FONT:
  3633. /* does not really happen since XmeRenderTableGetDefaultFont
  3634. seems to fail only on fontsets */
  3635. break;
  3636. case XmFONT_IS_FONTSET:
  3637. if (!(pExtents = XExtentsOfFontSet ((XFontSet) pFont))) {
  3638. break;
  3639. }
  3640. if (WM_TITLE_BAR_PADDING + pExtents->max_logical_extent.height > pAData->titleHeight) {
  3641. pAData->titleHeight = WM_TITLE_BAR_PADDING + pExtents->max_logical_extent.height;
  3642. result = 1;
  3643. }
  3644. break;
  3645. default:
  3646. break;
  3647. }
  3648. entry = XmFontListNextEntry (fc);
  3649. }
  3650. XmFontListFreeFontContext (fc);
  3651. return result;
  3652. }
  3653. /*************************************<->*************************************
  3654. *
  3655. * MakeAppearanceResources (pSD, pAData, makeActiveResources)
  3656. *
  3657. *
  3658. * Description:
  3659. * -----------
  3660. * This function makes top, bottom and background pixmaps for a window
  3661. * manager component. Inactive and active (if specified) GC's are
  3662. * also made.
  3663. *
  3664. *
  3665. * Inputs:
  3666. * ------
  3667. * pSD = pointer to screen data
  3668. *
  3669. * pAData = pointer to appearance data structure containing resource info
  3670. *
  3671. * makeActiveResources = if True then make active resources
  3672. *
  3673. * Outputs:
  3674. * -------
  3675. * *pAData = pixmap and GC fields filled out
  3676. *
  3677. *************************************<->***********************************/
  3678. void
  3679. MakeAppearanceResources (WmScreenData *pSD, AppearanceData *pAData, Boolean makeActiveResources)
  3680. {
  3681. Pixel foreground;
  3682. /*
  3683. * Extract a font from the font list.
  3684. */
  3685. if (! XmeRenderTableGetDefaultFont(pAData->fontList, &(pAData->font)))
  3686. {
  3687. #if 0
  3688. /* This always prints garbage on failure, which seems to
  3689. * always happen at least 1-3 times on startup.
  3690. */
  3691. sprintf((char *)wmGD.tmpBuffer,
  3692. ((char *)GETMESSAGE(62, 23, "failed to load font: %.100s\0")), (char*) pAData->fontList);
  3693. #endif
  3694. Warning("XmeRenderTableGetDefaultFont() failed, trying a fixed font");
  3695. #if defined(CSRG_BASED) || defined(__linux__)
  3696. /* HACK to try get _some_ font anyway (fontList seems to end
  3697. * up as an empty list on some modern systems; investigate) */
  3698. pAData->font = XLoadQueryFont(wmGD.display, "fixed");
  3699. if (pAData->font == NULL)
  3700. {
  3701. ExitWM(WM_ERROR_EXIT_VALUE);
  3702. }
  3703. /* try to get right title hight using XExtentsOfFontSet: on UTF-8
  3704. * locales XmeRenderTableGetDefaultFont does not return anything
  3705. * when font is a compound fontset*/
  3706. if (!FallbackMakeTitleHeight(pAData))
  3707. {
  3708. /* failed to get height from fontList - falling back to fixed */
  3709. pAData->titleHeight = (pAData->font)->ascent + (pAData->font)->descent
  3710. + WM_TITLE_BAR_PADDING;
  3711. }
  3712. #else
  3713. ExitWM(WM_ERROR_EXIT_VALUE);
  3714. #endif
  3715. } else {
  3716. /* got default font successfully, hack was not needed */
  3717. /*
  3718. * Calculate title bar's height (using selected font) and store it in pAData.
  3719. */
  3720. pAData->titleHeight = (pAData->font)->ascent + (pAData->font)->descent
  3721. + WM_TITLE_BAR_PADDING;
  3722. }
  3723. /*
  3724. * Make standard (inactive) appearance resources.
  3725. */
  3726. /* background pixmap */
  3727. if (pAData->backgroundPStr)
  3728. {
  3729. pAData->backgroundPixmap = XmGetPixmap (
  3730. ScreenOfDisplay (DISPLAY,
  3731. pSD->screen),
  3732. pAData->backgroundPStr,
  3733. pAData->foreground,
  3734. pAData->background);
  3735. if (pAData->backgroundPixmap == XmUNSPECIFIED_PIXMAP)
  3736. {
  3737. pAData->backgroundPixmap = (Pixmap)NULL;
  3738. }
  3739. }
  3740. else
  3741. {
  3742. pAData->backgroundPixmap = (Pixmap)NULL;
  3743. }
  3744. /* top shadow pixmap */
  3745. if (pAData->topShadowPStr)
  3746. {
  3747. /*
  3748. * Make sure top shadow color is not the same as background
  3749. * otherwise the wrong pixmap will be generated.
  3750. */
  3751. if (pAData->topShadowColor != pAData->background)
  3752. foreground = pAData->topShadowColor;
  3753. else
  3754. foreground = pAData->foreground;
  3755. pAData->topShadowPixmap = XmGetPixmap (
  3756. ScreenOfDisplay (DISPLAY,
  3757. pSD->screen),
  3758. pAData->topShadowPStr,
  3759. foreground,
  3760. pAData->background);
  3761. if (pAData->topShadowPixmap == XmUNSPECIFIED_PIXMAP)
  3762. {
  3763. pAData->topShadowPixmap = (Pixmap)NULL;
  3764. }
  3765. }
  3766. else
  3767. {
  3768. pAData->topShadowPixmap = (Pixmap)NULL;
  3769. }
  3770. /* bottom shadow pixmap */
  3771. if (pAData->bottomShadowPStr)
  3772. {
  3773. /*
  3774. * Make sure bottom shadow color is not the same as background
  3775. * otherwise the wrong pixmap will be generated.
  3776. */
  3777. if (pAData->bottomShadowColor != pAData->background)
  3778. foreground = pAData->bottomShadowColor;
  3779. else
  3780. foreground = pAData->foreground;
  3781. pAData->bottomShadowPixmap = XmGetPixmap (
  3782. ScreenOfDisplay (DISPLAY,
  3783. pSD->screen),
  3784. pAData->bottomShadowPStr,
  3785. foreground,
  3786. pAData->background);
  3787. if (pAData->bottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
  3788. {
  3789. pAData->bottomShadowPixmap = (Pixmap)NULL;
  3790. }
  3791. }
  3792. else
  3793. {
  3794. pAData->bottomShadowPixmap = (Pixmap)NULL;
  3795. }
  3796. /* inactive appearance GC */
  3797. GetAppearanceGCs (pSD,
  3798. pAData->foreground,
  3799. pAData->background,
  3800. pAData->font,
  3801. pAData->backgroundPixmap,
  3802. pAData->topShadowColor,
  3803. pAData->topShadowPixmap,
  3804. pAData->bottomShadowColor,
  3805. pAData->bottomShadowPixmap,
  3806. &(pAData->inactiveGC),
  3807. &(pAData->inactiveTopShadowGC),
  3808. &(pAData->inactiveBottomShadowGC));
  3809. /*
  3810. * Make active apppearance resources if specified.
  3811. */
  3812. if (!makeActiveResources)
  3813. {
  3814. return;
  3815. }
  3816. /* active background pixmap */
  3817. if (pAData->activeBackgroundPStr)
  3818. {
  3819. pAData->activeBackgroundPixmap = XmGetPixmap (
  3820. ScreenOfDisplay (DISPLAY,
  3821. pSD->screen),
  3822. pAData->activeBackgroundPStr,
  3823. pAData->activeForeground,
  3824. pAData->activeBackground);
  3825. if (pAData->activeBackgroundPixmap == XmUNSPECIFIED_PIXMAP)
  3826. {
  3827. pAData->activeBackgroundPixmap = (Pixmap)NULL;
  3828. }
  3829. }
  3830. else
  3831. {
  3832. pAData->activeBackgroundPixmap = (Pixmap)NULL;
  3833. }
  3834. /* active top shadow pixmap */
  3835. if (pAData->activeTopShadowPStr)
  3836. {
  3837. pAData->activeTopShadowPixmap = XmGetPixmap (
  3838. ScreenOfDisplay (DISPLAY,
  3839. pSD->screen),
  3840. pAData->activeTopShadowPStr,
  3841. pAData->activeTopShadowColor,
  3842. pAData->activeBackground);
  3843. if (pAData->activeTopShadowPixmap == XmUNSPECIFIED_PIXMAP)
  3844. {
  3845. pAData->activeTopShadowPixmap = (Pixmap)NULL;
  3846. }
  3847. }
  3848. else
  3849. {
  3850. pAData->activeTopShadowPixmap = (Pixmap)NULL;
  3851. }
  3852. /* active bottom shadow pixmap */
  3853. if (pAData->activeBottomShadowPStr)
  3854. {
  3855. pAData->activeBottomShadowPixmap = XmGetPixmap (
  3856. ScreenOfDisplay (DISPLAY,
  3857. pSD->screen),
  3858. pAData->activeBottomShadowPStr,
  3859. pAData->activeBottomShadowColor,
  3860. pAData->activeBackground);
  3861. if (pAData->activeBottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
  3862. {
  3863. pAData->activeBottomShadowPixmap = (Pixmap)NULL;
  3864. }
  3865. }
  3866. else
  3867. {
  3868. pAData->activeBottomShadowPixmap = (Pixmap)NULL;
  3869. }
  3870. /* inactive appearance GC */
  3871. GetAppearanceGCs (pSD,
  3872. pAData->activeForeground,
  3873. pAData->activeBackground,
  3874. pAData->font,
  3875. pAData->activeBackgroundPixmap,
  3876. pAData->activeTopShadowColor,
  3877. pAData->activeTopShadowPixmap,
  3878. pAData->activeBottomShadowColor,
  3879. pAData->activeBottomShadowPixmap,
  3880. &(pAData->activeGC),
  3881. &(pAData->activeTopShadowGC),
  3882. &(pAData->activeBottomShadowGC));
  3883. } /* END OF FUNCTION MakeAppearanceResources */
  3884. /*************************************<->*************************************
  3885. *
  3886. * GetAppearanceGCs (pSD, fg, bg, font, bg_pixmap, ts_color,
  3887. * ts_pixmap, bs_color, bs_pixmap, pGC, ptsGC, pbsGC)
  3888. *
  3889. *
  3890. * Description:
  3891. * -----------
  3892. * Creates the appearance GCs for any of the icon, client, or feedback
  3893. * resources.
  3894. *
  3895. *
  3896. * Inputs:
  3897. * ------
  3898. * pSD - pointer to screen data
  3899. * fg - base foreground color
  3900. * bg - base background color
  3901. * font - font
  3902. * bg_pixmap - background pixmap
  3903. * ts_color - top shadow color
  3904. * ts_pixmap - top shadow pixmap
  3905. * bs_color - bottom shadow color
  3906. * bs_pixmap - bottom shadow pixmap
  3907. * pGC - pointer to location to receive base GC
  3908. * ptsGC - pointer to location to receive top shadow GC
  3909. * pbsGC - pointer to location to receive bottom shadow GC
  3910. *
  3911. * Outputs:
  3912. * -------
  3913. * *pGC - base GC
  3914. * *ptsGC - top shadow GC
  3915. * *pbsGC - bottom shadow GC
  3916. *
  3917. *
  3918. * Comments:
  3919. * --------
  3920. *
  3921. *
  3922. *************************************<->***********************************/
  3923. void
  3924. GetAppearanceGCs (WmScreenData *pSD, Pixel fg, Pixel bg, XFontStruct *font, Pixmap bg_pixmap, Pixel ts_color, Pixmap ts_pixmap, Pixel bs_color, Pixmap bs_pixmap, GC *pGC, GC *ptsGC, GC *pbsGC)
  3925. {
  3926. XGCValues gcv;
  3927. XtGCMask mask;
  3928. /*
  3929. * Get base GC
  3930. */
  3931. mask = GCForeground | GCBackground | GCFont;
  3932. gcv.foreground = fg;
  3933. gcv.background = bg;
  3934. gcv.font = font->fid;
  3935. if (bg_pixmap)
  3936. {
  3937. mask |= GCTile;
  3938. gcv.tile = bg_pixmap;
  3939. }
  3940. *pGC = XCreateGC (DISPLAY, pSD->rootWindow, mask, &gcv);
  3941. /*
  3942. * !!! Need GC error detection !!!
  3943. */
  3944. *ptsGC = GetHighlightGC (pSD, ts_color, bg, ts_pixmap);
  3945. *pbsGC = GetHighlightGC (pSD, bs_color, bg, bs_pixmap);
  3946. } /* END OF FUNCTION GetAppearanceGCs */
  3947. /*************************************<->*************************************
  3948. *
  3949. * ProcessScreenResources (pSD, screenName)
  3950. *
  3951. *
  3952. * Description:
  3953. * -----------
  3954. * This function retrieves resources that are screen specific. If the
  3955. * window manager is providing standard behavior then retrieve the limited
  3956. * set of resources that don't affect standard behavior and set the
  3957. * values of the other resources to the standard values.
  3958. *
  3959. *
  3960. * Inputs:
  3961. * ------
  3962. * pSD = pointer to screen data
  3963. * screenName = name of screen
  3964. *
  3965. *
  3966. * Outputs:
  3967. * -------
  3968. * pSD = resource data for screen is set
  3969. *
  3970. *
  3971. * Comments:
  3972. * --------
  3973. * o Gets subresources based on workspace name
  3974. *
  3975. *************************************<->***********************************/
  3976. void
  3977. ProcessScreenResources (WmScreenData *pSD, unsigned char *screenName)
  3978. {
  3979. pResSD = pSD; /* save current screen data for default processing */
  3980. /*
  3981. * Use the screen name (e.g., "0") as the default resource name.
  3982. */
  3983. if (wmGD.useStandardBehavior)
  3984. {
  3985. XtGetSubresources (wmGD.topLevelW, (XtPointer) pSD,
  3986. (String) screenName,
  3987. (String) screenName,
  3988. wmStdScreenResources,
  3989. XtNumber (wmStdScreenResources), NULL, 0);
  3990. /*
  3991. * Fill in the standard resource values.
  3992. */
  3993. SetStdScreenResourceValues (pSD);
  3994. }
  3995. else
  3996. {
  3997. XtGetSubresources (wmGD.topLevelW, (XtPointer) pSD,
  3998. (String)screenName, (String) screenName,
  3999. wmScreenResources,
  4000. XtNumber (wmScreenResources), NULL, 0);
  4001. pSD->moveOpaque = (((XmScreen) XmGetXmScreen(XtScreen(pSD->screenTopLevelW)))
  4002. -> screen.moveOpaque);
  4003. }
  4004. /*
  4005. * Do some additional processing on the window manager resource values.
  4006. */
  4007. if (pSD->iconImageMinimum.width < ICON_IMAGE_MIN_WIDTH)
  4008. {
  4009. pSD->iconImageMinimum.width = ICON_IMAGE_MIN_WIDTH;
  4010. }
  4011. else if (pSD->iconImageMinimum.width > ICON_IMAGE_MAX_WIDTH)
  4012. {
  4013. pSD->iconImageMinimum.width = ICON_IMAGE_MAX_WIDTH;
  4014. }
  4015. if (pSD->iconImageMinimum.height < ICON_IMAGE_MIN_HEIGHT)
  4016. {
  4017. pSD->iconImageMinimum.height = ICON_IMAGE_MIN_HEIGHT;
  4018. }
  4019. else if (pSD->iconImageMinimum.height > ICON_IMAGE_MAX_HEIGHT)
  4020. {
  4021. pSD->iconImageMinimum.height = ICON_IMAGE_MAX_HEIGHT;
  4022. }
  4023. if (pSD->iconImageMaximum.width < pSD->iconImageMinimum.width)
  4024. {
  4025. pSD->iconImageMaximum.width = pSD->iconImageMinimum.width;
  4026. }
  4027. else if (pSD->iconImageMaximum.width > ICON_IMAGE_MAX_WIDTH)
  4028. {
  4029. pSD->iconImageMaximum.width = ICON_IMAGE_MAX_WIDTH;
  4030. }
  4031. if (pSD->iconImageMaximum.height < pSD->iconImageMinimum.height)
  4032. {
  4033. pSD->iconImageMaximum.height = pSD->iconImageMinimum.height;
  4034. }
  4035. else if (pSD->iconImageMaximum.height > ICON_IMAGE_MAX_HEIGHT)
  4036. {
  4037. pSD->iconImageMaximum.height = ICON_IMAGE_MAX_HEIGHT;
  4038. }
  4039. if (pSD->iconPlacementMargin > MAXIMUM_ICON_MARGIN)
  4040. {
  4041. pSD->iconPlacementMargin = MAXIMUM_ICON_MARGIN;
  4042. }
  4043. if (pSD->maximumMaximumSize.width <= 0)
  4044. {
  4045. pSD->maximumMaximumSize.width =
  4046. 2 * DisplayWidth (DISPLAY, pSD->screen);
  4047. }
  4048. if (pSD->maximumMaximumSize.height <= 0)
  4049. {
  4050. pSD->maximumMaximumSize.height =
  4051. 2 * DisplayHeight (DISPLAY, pSD->screen);
  4052. }
  4053. /*
  4054. * Set the icon appearance default based on whether or not the icon box
  4055. * is being used.
  4056. */
  4057. if (pSD->iconDecoration & USE_ICON_DEFAULT_APPEARANCE)
  4058. {
  4059. if (pSD->useIconBox)
  4060. {
  4061. pSD->iconDecoration = ICON_APPEARANCE_ICONBOX;
  4062. }
  4063. else
  4064. {
  4065. pSD->iconDecoration = ICON_APPEARANCE_STANDALONE;
  4066. }
  4067. }
  4068. /*
  4069. * If resizeBorderWidth or frameBorderWidth is unset then initialize
  4070. * to dynamic defaults.
  4071. */
  4072. if ((pSD->resizeBorderWidth == (Dimension)BIGSIZE) ||
  4073. (pSD->frameBorderWidth == (Dimension)BIGSIZE))
  4074. {
  4075. double xres, yres, avg_res;
  4076. xres = (((double) DisplayWidth(DISPLAY, pSD->screen)) /
  4077. ((double) DisplayWidthMM(DISPLAY, pSD->screen)));
  4078. yres = (((double) DisplayHeight(DISPLAY, pSD->screen)) /
  4079. ((double) DisplayHeightMM(DISPLAY, pSD->screen)));
  4080. avg_res = (xres + yres) / 2.0;
  4081. /* Multiply times width in mm (avg. 7-8 pixels) */
  4082. if (pSD->resizeBorderWidth == (Dimension)BIGSIZE)
  4083. {
  4084. pSD->resizeBorderWidth = (int) (avg_res * 2.2);
  4085. /* limit size because big borders look ugly */
  4086. if (pSD->resizeBorderWidth > 6) pSD->resizeBorderWidth = 6;
  4087. }
  4088. /* Multiply times width in mm (avg. 5-6 pixels) */
  4089. if (pSD->frameBorderWidth == (Dimension)BIGSIZE)
  4090. {
  4091. pSD->frameBorderWidth = (int) (avg_res * 1.7);
  4092. /* limit size because big borders look ugly */
  4093. if (wmGD.frameStyle == WmSLAB)
  4094. {
  4095. if (pSD->frameBorderWidth > 4) pSD->frameBorderWidth = 4;
  4096. }
  4097. else
  4098. {
  4099. if (pSD->frameBorderWidth > 5) pSD->frameBorderWidth = 5;
  4100. }
  4101. }
  4102. }
  4103. pSD->externalBevel = FRAME_EXTERNAL_SHADOW_WIDTH;
  4104. pSD->joinBevel = FRAME_INTERNAL_SHADOW_WIDTH;
  4105. if (pSD->frameBorderWidth <
  4106. (pSD->externalBevel + MIN_INTERNAL_BEVEL))
  4107. {
  4108. pSD->frameBorderWidth =
  4109. pSD->externalBevel + MIN_INTERNAL_BEVEL;
  4110. }
  4111. else if (pSD->frameBorderWidth > MAXIMUM_FRAME_BORDER_WIDTH)
  4112. {
  4113. pSD->frameBorderWidth = MAXIMUM_FRAME_BORDER_WIDTH;
  4114. }
  4115. if (pSD->resizeBorderWidth <
  4116. (pSD->externalBevel + MIN_INTERNAL_BEVEL))
  4117. {
  4118. pSD->resizeBorderWidth =
  4119. (pSD->externalBevel + MIN_INTERNAL_BEVEL);
  4120. }
  4121. else if (pSD->resizeBorderWidth > MAXIMUM_FRAME_BORDER_WIDTH)
  4122. {
  4123. pSD->resizeBorderWidth = MAXIMUM_FRAME_BORDER_WIDTH;
  4124. }
  4125. /*
  4126. * Update the resource database.
  4127. */
  4128. WriteOutXrmColors (pSD);
  4129. /*
  4130. * Process the component appearance resources for client,
  4131. * icon and feedback parts of mwm.
  4132. */
  4133. ProcessAppearanceResources (pSD);
  4134. /*
  4135. * Process the workspace list and name the initial
  4136. * workspaces
  4137. */
  4138. ProcessWorkspaceList (pSD);
  4139. /*
  4140. * Process default backdrop images to be used in low-color
  4141. * situations
  4142. */
  4143. ProcessDefaultBackdropImages (pSD);
  4144. /*
  4145. * Save the default icon pixmap in global data. We'll use it only
  4146. * as a last resort.
  4147. */
  4148. pSD->builtinIconPixmap =
  4149. XCreateBitmapFromData (DISPLAY, pSD->rootWindow, (char *)iImage_bits,
  4150. iImage_width, iImage_height);
  4151. } /* END OF FUNCTION ProcessScreenResources */
  4152. /*************************************<->*************************************
  4153. *
  4154. * ProcessDefaultBackdropImages (pSD)
  4155. *
  4156. *
  4157. * Description:
  4158. * -----------
  4159. * This function processes the default backdrop images to be used
  4160. * in low color or black and white workspaces.
  4161. *
  4162. *
  4163. * Inputs:
  4164. * ------
  4165. * pSD = pointer to screen data
  4166. *
  4167. *
  4168. * Outputs:
  4169. * -------
  4170. * pSD = resource data for screen is set
  4171. *
  4172. *
  4173. * Comments:
  4174. * --------
  4175. *
  4176. *************************************<->***********************************/
  4177. void
  4178. ProcessDefaultBackdropImages (WmScreenData *pSD)
  4179. {
  4180. } /* END OF FUNCTION ProcessDefaultBackdropImages */
  4181. /*************************************<->*************************************
  4182. *
  4183. * ProcessWorkspaceList (pSD)
  4184. *
  4185. *
  4186. * Description:
  4187. * -----------
  4188. * This function processes the workspaceCount and workspaceList
  4189. * resources for a particular screen. It creates space for the initial
  4190. * workspace data structures and adds in names for workspaces.
  4191. *
  4192. *
  4193. * Inputs:
  4194. * ------
  4195. * pSD = pointer to screen data
  4196. *
  4197. *
  4198. * Outputs:
  4199. * -------
  4200. * pSD = resource data for screen is set
  4201. *
  4202. *
  4203. * Comments:
  4204. * --------
  4205. * NOTE: The workspaceCount resource has precedence over the
  4206. * workspaceList resource. workspaceCount determines the number of
  4207. * workspaces to create for the screen. Once the number is determined,
  4208. * workspaceList is used to fill in the "names." If workspaceList is
  4209. * not present or doesn't have enough names, then missing names are
  4210. * generated automatically. If workspaceList is present and
  4211. * workspaceCount is not present, then the workspaceCount is determined
  4212. * by the number of names in workspaceList.
  4213. *
  4214. *************************************<->***********************************/
  4215. void
  4216. ProcessWorkspaceList (WmScreenData *pSD)
  4217. {
  4218. int i, wsNameCount, wsNamesAlloced;
  4219. WmWorkspaceData *pwsI;
  4220. unsigned char *lineP = NULL;
  4221. unsigned char *string;
  4222. Boolean bHaveWorkspaceList;
  4223. Boolean bHaveWorkspaceCount;
  4224. char **ppchWsNames = NULL;
  4225. /*
  4226. * Validate initial resource settings
  4227. */
  4228. bHaveWorkspaceCount = (pSD->numWorkspaces >= 1);
  4229. bHaveWorkspaceList = (pSD->workspaceList != NULL);
  4230. if (bHaveWorkspaceList)
  4231. {
  4232. /*
  4233. * Parse out array of workspace names
  4234. */
  4235. wsNamesAlloced = WS_ALLOC_AMOUNT;
  4236. ppchWsNames = (char **) XtMalloc (wsNamesAlloced * sizeof (char *));
  4237. if (pSD->workspaceList)
  4238. {
  4239. lineP = (unsigned char *) pSD->workspaceList;
  4240. }
  4241. else
  4242. {
  4243. lineP = (unsigned char *)NULL;
  4244. }
  4245. wsNameCount = 0;
  4246. while (((string = GetString(&lineP)) != NULL))
  4247. {
  4248. ppchWsNames[wsNameCount] = (char *) string;
  4249. if (++wsNameCount >= wsNamesAlloced)
  4250. {
  4251. /*
  4252. * Need to add more workspaces
  4253. */
  4254. wsNamesAlloced += WS_ALLOC_AMOUNT;
  4255. if (!(ppchWsNames = (char **) XtRealloc
  4256. ((char *)ppchWsNames,
  4257. wsNamesAlloced * sizeof(char *))))
  4258. {
  4259. ExitWM (WM_ERROR_EXIT_VALUE);
  4260. }
  4261. }
  4262. }
  4263. if (!bHaveWorkspaceCount)
  4264. {
  4265. pSD->numWorkspaces = wsNameCount;
  4266. }
  4267. }
  4268. else if (!bHaveWorkspaceCount)
  4269. {
  4270. /*
  4271. * Neither workspaceCount nor workspaceList specified!!
  4272. * Assume one workspace.
  4273. */
  4274. pSD->numWorkspaces = 1;
  4275. }
  4276. if (pSD->numWorkspaces > MAX_WORKSPACE_COUNT)
  4277. pSD->numWorkspaces = MAX_WORKSPACE_COUNT;
  4278. /*
  4279. * Allocate the array of workspace data
  4280. */
  4281. pSD->numWsDataAllocated = (pSD->numWorkspaces + WS_ALLOC_AMOUNT);
  4282. pSD->numWsDataAllocated -= pSD->numWsDataAllocated % WS_ALLOC_AMOUNT;
  4283. if (!(pSD->pWS = (WmWorkspaceData *)
  4284. XtMalloc (pSD->numWsDataAllocated * sizeof(WmWorkspaceData))))
  4285. {
  4286. ExitWM (WM_ERROR_EXIT_VALUE);
  4287. }
  4288. pwsI = pSD->pWS;
  4289. for (i = 0; i < pSD->numWorkspaces; i++, pwsI++)
  4290. {
  4291. if (bHaveWorkspaceList && i < wsNameCount)
  4292. {
  4293. string = (unsigned char *) ppchWsNames[i];
  4294. }
  4295. else
  4296. {
  4297. string = GenerateWorkspaceName (pSD, i);
  4298. }
  4299. if (!(pwsI->name = (String) XtMalloc (1+strlen((char *)string))))
  4300. {
  4301. Warning (((char *)GETMESSAGE(62, 27, "Insufficient memory for workspace data")));
  4302. ExitWM(WM_ERROR_EXIT_VALUE);
  4303. }
  4304. else
  4305. {
  4306. strcpy(pwsI->name, (char *)string);
  4307. }
  4308. }
  4309. if (ppchWsNames) XtFree ((char *) ppchWsNames);
  4310. } /* END OF FUNCTION ProcessWorkspaceList */
  4311. /******************************<->*************************************
  4312. *
  4313. * ProcessWorkspaceResources (pWS)
  4314. *
  4315. *
  4316. * Description:
  4317. * -----------
  4318. * This function retrieves resources that are workspace specific. If the
  4319. * window manager is providing standard behavior then retrieve the limited
  4320. * set of resources that don't affect standard behavior and set the
  4321. * values of the other resources to the standard values.
  4322. *
  4323. *
  4324. * Inputs:
  4325. * ------
  4326. * pWS = pointer to workspace data
  4327. *
  4328. *
  4329. * Outputs:
  4330. * -------
  4331. * pWS = resource data for workspace is set
  4332. *
  4333. *
  4334. * Comments:
  4335. * --------
  4336. * o Gets subresources based on workspace name
  4337. *
  4338. ******************************<->***********************************/
  4339. void
  4340. ProcessWorkspaceResources (WmWorkspaceData *pWS)
  4341. {
  4342. /*
  4343. * Retrieve workspace specific resources.
  4344. */
  4345. pResWS = pWS; /* save current ws for default processing */
  4346. if (wmGD.useStandardBehavior)
  4347. {
  4348. XtGetSubresources (pWS->pSD->screenTopLevelW, (XtPointer) pWS,
  4349. pWS->name, pWS->name, wmStdWorkspaceResources,
  4350. XtNumber (wmStdWorkspaceResources), NULL, 0);
  4351. /*
  4352. * Fill in the standard resource values.
  4353. *
  4354. * (no code for this right now)
  4355. */
  4356. pWS->iconBoxGeometry = NULL;
  4357. }
  4358. else
  4359. {
  4360. XtGetSubresources (pWS->pSD->screenTopLevelW, (XtPointer) pWS,
  4361. pWS->name, pWS->name, wmWorkspaceResources,
  4362. XtNumber (wmWorkspaceResources), NULL, 0);
  4363. /* Dup iconbox geometry, it may be free'd later on. */
  4364. if (pWS->iconBoxGeometry)
  4365. {
  4366. pWS->iconBoxGeometry = XtNewString (pWS->iconBoxGeometry);
  4367. }
  4368. }
  4369. if (pWS->title == NULL)
  4370. {
  4371. /*
  4372. * Setup default workspace title
  4373. */
  4374. pWS->title = XmStringCreateLocalized(pWS->name);
  4375. }
  4376. else
  4377. {
  4378. /*
  4379. * Copy resource just in case there's a duplicate
  4380. * Duplicates point to the same data, freeing on
  4381. * rename can cause a crash.
  4382. */
  4383. pWS->title = XmStringCopy(pWS->title);
  4384. }
  4385. /*
  4386. * Dup iconbox geometry, it may be free'd later on.
  4387. */
  4388. if (pWS->iconBoxGeometry)
  4389. {
  4390. pWS->iconBoxGeometry = XtNewString (pWS->iconBoxGeometry);
  4391. }
  4392. /*
  4393. * Get backdrop resources
  4394. */
  4395. XtGetSubresources (pWS->workspaceTopLevelW,
  4396. (XtPointer) &(pWS->backdrop),
  4397. WmNbackdrop, WmCBackdrop, wmBackdropResources,
  4398. XtNumber (wmBackdropResources), NULL, 0);
  4399. ProcessBackdropResources (pWS, 0);
  4400. } /* END OF FUNCTION ProcessWorkspaceResources */
  4401. /******************************<->*************************************
  4402. *
  4403. * ProcessPresenceResources (pSD)
  4404. *
  4405. *
  4406. * Description:
  4407. * -----------
  4408. * This function retrieves resources for the workspace presence
  4409. * dialog.
  4410. *
  4411. * Inputs:
  4412. * ------
  4413. * pSD = pointer to screen data
  4414. *
  4415. *
  4416. * Outputs:
  4417. * -------
  4418. * pSD = resource data for workspace presence dialog are set
  4419. *
  4420. *
  4421. * Comments:
  4422. * --------
  4423. * o Gets subresources
  4424. *
  4425. ******************************<->***********************************/
  4426. void
  4427. ProcessPresenceResources (WmScreenData *pSD)
  4428. {
  4429. #ifndef NO_MESSAGE_CATALOG
  4430. static char *default_ws_pres_title = NULL;
  4431. #else
  4432. static char *default_ws_pres_title = "Workspace Presence";
  4433. #endif
  4434. Arg args[5];
  4435. int n;
  4436. unsigned char *pch1, *pch2;
  4437. #ifndef NO_MESSAGE_CATALOG
  4438. /*
  4439. * Set up localized default title string on initial time through
  4440. */
  4441. if (default_ws_pres_title == NULL)
  4442. {
  4443. char * tmpString;
  4444. /*
  4445. * catgets returns a pointer to an area that is over written
  4446. * on each call to catgets.
  4447. */
  4448. tmpString = ((char *)GETMESSAGE(62, 59, "Occupy Workspace"));
  4449. if ((default_ws_pres_title =
  4450. (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
  4451. {
  4452. Warning (((char *)GETMESSAGE(62, 31, "Insufficient memory for local message string")));
  4453. default_ws_pres_title = "Occupy Workspace";
  4454. }
  4455. else
  4456. {
  4457. strcpy(default_ws_pres_title, tmpString);
  4458. }
  4459. }
  4460. #endif
  4461. if (pSD->presence.shellW)
  4462. {
  4463. XtGetSubresources (pSD->presence.shellW, (XtPointer) &pSD->presence,
  4464. WmNworkspacePresence, WmCWorkspacePresence,
  4465. wmWsPresenceResources,
  4466. XtNumber (wmWsPresenceResources), NULL, 0);
  4467. pch2 = NULL;
  4468. if (pSD->presence.title)
  4469. {
  4470. pch1 = (unsigned char *)
  4471. WmXmStringToString (pSD->presence.title);
  4472. if (pch1 && (pch2 = (unsigned char *)
  4473. XtMalloc (1+strlen((char *)pch1))))
  4474. {
  4475. strcpy ((char *)pch2, (char *)pch1);
  4476. }
  4477. }
  4478. if (!pch2)
  4479. {
  4480. pch2 = (unsigned char *) default_ws_pres_title;
  4481. }
  4482. n = 0;
  4483. XtSetArg (args[n], XmNtitle, pch2); n++;
  4484. XtSetValues (pSD->presence.shellW, args, n);
  4485. }
  4486. } /* END OF FUNCTION ProcessPresenceResources */
  4487. /*************************************<->*************************************
  4488. *
  4489. * ProcessClientResources (pCD)
  4490. *
  4491. *
  4492. * Description:
  4493. * -----------
  4494. * This function retrieves resources that are client specific. If the
  4495. * window manager is providing standard behavior then retrieve the limited
  4496. * set of resources that don't affect standard behavior and set the
  4497. * values of the other resources to the standard values.
  4498. *
  4499. *
  4500. * Inputs:
  4501. * ------
  4502. * pCD = pointer to client data
  4503. *
  4504. *
  4505. * Outputs:
  4506. * -------
  4507. * pCD = resource data for client is set
  4508. *
  4509. *
  4510. * Comments:
  4511. * --------
  4512. * o Gets subresources based on client name and class.
  4513. * o Creates GC for the client Matte, if there is one.
  4514. *
  4515. *************************************<->***********************************/
  4516. void
  4517. ProcessClientResources (ClientData *pCD)
  4518. {
  4519. String clientName;
  4520. String clientClass;
  4521. WmScreenData *pSD = pCD->pSD;
  4522. /*
  4523. * Retrieve basic client specific resources.
  4524. */
  4525. _pCD = pCD; /* save in static global for dynamic default processing */
  4526. clientName = (pCD->clientName) ? pCD->clientName : WmNdefaults;
  4527. clientClass = (pCD->clientClass) ? pCD->clientClass : WmNdefaults;
  4528. if (wmGD.useStandardBehavior)
  4529. {
  4530. XtGetSubresources (pSD->screenTopLevelW, (XtPointer) pCD, clientName,
  4531. clientClass, wmStdClientResources, XtNumber (wmStdClientResources),
  4532. NULL, 0);
  4533. /*
  4534. * Fill in the standard resource values.
  4535. */
  4536. SetStdClientResourceValues (pCD);
  4537. }
  4538. else
  4539. {
  4540. XtGetSubresources (pSD->screenTopLevelW, (XtPointer) pCD, clientName,
  4541. clientClass, wmClientResources, XtNumber (wmClientResources), NULL,
  4542. 0);
  4543. }
  4544. #ifdef NO_MESSAGE_CATALOG
  4545. /*
  4546. * If (window menu spec is not found) then use the builtin
  4547. * system menu.
  4548. */
  4549. if ((pCD->systemMenu == defaultSystemMenuName) &&
  4550. (pSD->defaultSystemMenuUseBuiltin == TRUE))
  4551. {
  4552. pCD->systemMenu = builtinSystemMenuName;
  4553. }
  4554. #endif
  4555. /*
  4556. * If the client decorations or client functions have been defaulted
  4557. * fix up the fields in the ProcessMwmHints function.
  4558. */
  4559. /* make top and bottom shadow pixmaps */
  4560. if (pCD->iconImageBottomShadowPStr)
  4561. {
  4562. if ((pCD->iconImageBottomShadowPStr ==
  4563. pSD->iconAppearance.bottomShadowPStr) &&
  4564. (pCD->iconImageBottomShadowColor ==
  4565. pSD->iconAppearance.bottomShadowColor) &&
  4566. (pCD->iconImageBackground ==
  4567. pSD->iconAppearance.background))
  4568. {
  4569. pCD->iconImageBottomShadowPixmap =
  4570. pSD->iconAppearance.bottomShadowPixmap;
  4571. }
  4572. else
  4573. {
  4574. pCD->iconImageBottomShadowPixmap =
  4575. XmGetPixmap ( ScreenOfDisplay (DISPLAY,
  4576. pSD->screen),
  4577. pCD->iconImageBottomShadowPStr,
  4578. pCD->iconImageBottomShadowColor,
  4579. pCD->iconImageBackground);
  4580. if (pCD->iconImageBottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
  4581. {
  4582. pCD->iconImageBottomShadowPixmap = (Pixmap)NULL;
  4583. }
  4584. }
  4585. }
  4586. else
  4587. {
  4588. pCD->iconImageBottomShadowPixmap = (Pixmap)NULL;
  4589. }
  4590. if (pCD->iconImageTopShadowPStr)
  4591. {
  4592. if ((pCD->iconImageTopShadowPStr ==
  4593. pSD->iconAppearance.topShadowPStr) &&
  4594. (pCD->iconImageTopShadowColor ==
  4595. pSD->iconAppearance.topShadowColor) &&
  4596. (pCD->iconImageBackground == pSD->iconAppearance.background))
  4597. {
  4598. pCD->iconImageTopShadowPixmap =
  4599. pSD->iconAppearance.topShadowPixmap;
  4600. }
  4601. else
  4602. {
  4603. pCD->iconImageTopShadowPixmap =
  4604. XmGetPixmap ( ScreenOfDisplay (DISPLAY,
  4605. pSD->screen),
  4606. pCD->iconImageTopShadowPStr,
  4607. pCD->iconImageTopShadowColor,
  4608. pCD->iconImageBackground);
  4609. if (pCD->iconImageTopShadowPixmap == XmUNSPECIFIED_PIXMAP)
  4610. {
  4611. pCD->iconImageTopShadowPixmap = (Pixmap)NULL;
  4612. }
  4613. }
  4614. }
  4615. else
  4616. {
  4617. pCD->iconImageTopShadowPixmap = (Pixmap)NULL;
  4618. }
  4619. if ((pCD->internalBevel < MIN_INTERNAL_BEVEL) ||
  4620. (pCD->internalBevel > MAX_INTERNAL_BEVEL))
  4621. {
  4622. pCD->internalBevel = MAX_INTERNAL_BEVEL;
  4623. }
  4624. /*
  4625. * Retrieve matte resources and make internal matte resources.
  4626. */
  4627. if (pCD->matteWidth > 0)
  4628. {
  4629. XtGetSubresources (pSD->screenTopLevelW, (XtPointer) pCD, clientName,
  4630. clientClass, wmClientResourcesM, XtNumber (wmClientResourcesM),
  4631. NULL, 0);
  4632. /* make top and bottom shadow pixmaps */
  4633. if (pCD->matteBottomShadowPStr &&
  4634. (!strcmp(pCD->matteBottomShadowPStr, _NoDither)))
  4635. {
  4636. pCD->matteBottomShadowPStr = NULL;
  4637. }
  4638. if (pCD->matteBottomShadowPStr)
  4639. {
  4640. if ((pCD->matteBottomShadowPStr ==
  4641. pSD->clientAppearance.bottomShadowPStr) &&
  4642. (pCD->matteBottomShadowColor ==
  4643. pSD->clientAppearance.bottomShadowColor) &&
  4644. (pCD->matteBackground == pSD->clientAppearance.background))
  4645. {
  4646. pCD->matteBottomShadowPixmap =
  4647. pSD->clientAppearance.bottomShadowPixmap;
  4648. }
  4649. else
  4650. {
  4651. pCD->matteBottomShadowPixmap =
  4652. XmGetPixmap (ScreenOfDisplay (DISPLAY,
  4653. pSD->screen),
  4654. pCD->matteBottomShadowPStr,
  4655. pCD->matteBottomShadowColor,
  4656. pCD->matteBackground);
  4657. if (pCD->matteBottomShadowPixmap == XmUNSPECIFIED_PIXMAP)
  4658. {
  4659. pCD->matteBottomShadowPixmap = (Pixmap)NULL;
  4660. }
  4661. }
  4662. }
  4663. else
  4664. {
  4665. pCD->matteBottomShadowPixmap = (Pixmap)NULL;
  4666. }
  4667. if (pCD->matteTopShadowPStr &&
  4668. (!strcmp(pCD->matteTopShadowPStr, _NoDither)))
  4669. {
  4670. pCD->matteTopShadowPStr = NULL;
  4671. }
  4672. if (pCD->matteTopShadowPStr)
  4673. {
  4674. if ((pCD->matteTopShadowPStr ==
  4675. pSD->clientAppearance.topShadowPStr) &&
  4676. (pCD->matteTopShadowColor ==
  4677. pSD->clientAppearance.topShadowColor) &&
  4678. (pCD->matteBackground == pSD->clientAppearance.background))
  4679. {
  4680. pCD->matteTopShadowPixmap =
  4681. pSD->clientAppearance.topShadowPixmap;
  4682. }
  4683. else
  4684. {
  4685. pCD->matteTopShadowPixmap =
  4686. XmGetPixmap (ScreenOfDisplay (DISPLAY,
  4687. pSD->screen),
  4688. pCD->matteTopShadowPStr,
  4689. pCD->matteTopShadowColor,
  4690. pCD->matteBackground);
  4691. if (pCD->matteTopShadowPixmap == XmUNSPECIFIED_PIXMAP)
  4692. {
  4693. pCD->matteTopShadowPixmap = (Pixmap)NULL;
  4694. }
  4695. }
  4696. }
  4697. else
  4698. {
  4699. pCD->matteTopShadowPixmap = (Pixmap)NULL;
  4700. }
  4701. /* make top and bottom shadow GC's */
  4702. pCD->clientMatteTopShadowGC = GetHighlightGC (pCD->pSD,
  4703. pCD->matteTopShadowColor,
  4704. pCD->matteBackground,
  4705. pCD->matteTopShadowPixmap);
  4706. pCD->clientMatteBottomShadowGC = GetHighlightGC (pCD->pSD,
  4707. pCD->matteBottomShadowColor,
  4708. pCD->matteBackground,
  4709. pCD->matteBottomShadowPixmap);
  4710. }
  4711. } /* END OF FUNCTION ProcessClientResources */
  4712. /*************************************<->*************************************
  4713. *
  4714. * SetStdClientResourceValues (pCD)
  4715. *
  4716. *
  4717. * Description:
  4718. * -----------
  4719. * This function sets client resource data to standard values. This setting
  4720. * is done in place of getting the values from the user settings in
  4721. * the resource database.
  4722. *
  4723. * Input:
  4724. * -----
  4725. * pCD = pointer to the client data
  4726. *
  4727. *
  4728. * Output:
  4729. * ------
  4730. * pCD = (client data filled out with resource values)
  4731. *
  4732. *************************************<->***********************************/
  4733. void
  4734. SetStdClientResourceValues (ClientData *pCD)
  4735. {
  4736. pCD->clientDecoration = WM_DECOR_DEFAULT;
  4737. pCD->clientFunctions = WM_FUNC_DEFAULT;
  4738. pCD->focusAutoRaise = True;
  4739. pCD->systemMenu = builtinSystemMenuName;
  4740. pCD->usePPosition = USE_PPOSITION_NONZERO;
  4741. pCD->ignoreWMSaveHints = True;
  4742. } /* END OF FUNCTION SetStdClientResourceValues */
  4743. /******************************<->*************************************
  4744. *
  4745. * SetStdScreenResourceValues (pSD)
  4746. *
  4747. *
  4748. * Description:
  4749. * -----------
  4750. * This function sets screen resource data to standard values. This setting
  4751. * is done in place of getting the values from the user settings in
  4752. * the resource database.
  4753. *
  4754. * Input:
  4755. * -----
  4756. * pSD = pointer to the screen data
  4757. *
  4758. *
  4759. * Output:
  4760. * ------
  4761. * pSD = (screen data filled out with resource values)
  4762. *
  4763. ******************************<->***********************************/
  4764. void
  4765. SetStdScreenResourceValues (WmScreenData *pSD)
  4766. {
  4767. pSD->buttonBindings = builtinButtonBindingsName;
  4768. pSD->cleanText = True;
  4769. pSD->iconDecoration =
  4770. (ICON_LABEL_PART | ICON_IMAGE_PART | ICON_ACTIVE_LABEL_PART);
  4771. pSD->iconPlacement =
  4772. (ICON_PLACE_LEFT_PRIMARY | ICON_PLACE_BOTTOM_SECONDARY);
  4773. pSD->keyBindings = builtinKeyBindingsName;
  4774. pSD->limitResize = True;
  4775. pSD->resizeCursors = True;
  4776. pSD->transientDecoration = (WM_DECOR_SYSTEM | WM_DECOR_RESIZEH);
  4777. pSD->transientFunctions =
  4778. (WM_FUNC_ALL & ~(MWM_FUNC_MAXIMIZE | MWM_FUNC_MINIMIZE |
  4779. MWM_FUNC_RESIZE));
  4780. pSD->useIconBox = False;
  4781. pSD->feedbackGeometry = NULL;
  4782. pSD->moveOpaque = False;
  4783. } /* END OF FUNCTION SetStdScreenResourceValues */
  4784. /*************************************<->*************************************
  4785. *
  4786. * GetHighlightGC (pSD, fg, bg, pixmap)
  4787. *
  4788. *
  4789. * Description:
  4790. * -----------
  4791. * Get a graphic context for either drawing top- or bottom-shadow
  4792. * highlights.
  4793. *
  4794. *
  4795. * Inputs:
  4796. * ------
  4797. * pSD = pointer to screen data
  4798. * fg = foreground color
  4799. * bg = background color
  4800. * pixmap = pixmap for highlight
  4801. *
  4802. * Outputs:
  4803. * -------
  4804. * RETRUN = GC with the input parameters incorporated.
  4805. *
  4806. *************************************<->***********************************/
  4807. GC GetHighlightGC (WmScreenData *pSD, Pixel fg, Pixel bg, Pixmap pixmap)
  4808. {
  4809. XGCValues gcv;
  4810. XtGCMask mask;
  4811. mask = GCForeground | GCBackground | GCLineWidth | GCFillStyle;
  4812. gcv.background = bg;
  4813. gcv.foreground = fg;
  4814. gcv.line_width = 1;
  4815. if (pixmap)
  4816. {
  4817. mask |= GCFillStyle | GCTile;
  4818. gcv.fill_style = FillTiled;
  4819. gcv.tile = pixmap;
  4820. }
  4821. else
  4822. {
  4823. gcv.fill_style = FillSolid;
  4824. }
  4825. #ifdef OLD_CODE
  4826. /*
  4827. * NOTE: If additional mask bits are added, modify WmGetGC()
  4828. * in WmGraphics.c to check those values for matches.
  4829. */
  4830. return (WmGetGC (pSD, mask, &gcv));
  4831. #endif /* OLD_CODE */
  4832. return (XtGetGC (pSD->screenTopLevelW, mask, &gcv));
  4833. } /* END OF FUNCTION GetHighlightGC */
  4834. /*************************************<->*************************************
  4835. *
  4836. * _WmGetDynamicDefault (widget, type, defaultColor, newBackground, value)
  4837. *
  4838. *
  4839. * Description:
  4840. * -----------
  4841. * This function is used to generate a default color of the requested
  4842. * type. Default colors are generated for a 3-D appearance.
  4843. *
  4844. *
  4845. * Inputs:
  4846. * ------
  4847. * widget = this is the widget that is associated with the resource or
  4848. * that is the reference widget for the wm subpart.
  4849. *
  4850. * type = this is the type of color resource (e.g., top shadow color).
  4851. *
  4852. * defaultColor = pointer to default color name/specification.
  4853. *
  4854. * newBackground = background pixel for generating 3-D colors.
  4855. *
  4856. *
  4857. * Outputs:
  4858. * -------
  4859. * value = pointer to the XrmValue in which to store the color
  4860. *
  4861. *************************************<->***********************************/
  4862. void
  4863. _WmGetDynamicDefault (Widget widget, unsigned char type, String defaultColor, Pixel newBackground, XrmValue *value)
  4864. {
  4865. static Screen *oldScreen = NULL;
  4866. static Screen *newScreen;
  4867. static Colormap oldColormap;
  4868. static Colormap newColormap;
  4869. static Pixel newValue;
  4870. static Pixel background;
  4871. static String oldDefaultColor = DEFAULT_COLOR_NONE;
  4872. static XmColorData colorData;
  4873. /* initialize the return value */
  4874. value->size = sizeof (newValue);
  4875. value->addr = (char *)&newValue;
  4876. /*
  4877. * Process monochrome defaults first.
  4878. */
  4879. newScreen = XtScreen (widget);
  4880. if (Monochrome (newScreen))
  4881. {
  4882. Boolean ok = False;
  4883. /*
  4884. * Check color server sets for this screen.
  4885. */
  4886. if (wmGD.statusColorServer == CSERVE_NORMAL)
  4887. {
  4888. WmScreenData *pSD;
  4889. int i;
  4890. for (i = 0; i < wmGD.numScreens; i++)
  4891. {
  4892. if (XScreenNumberOfScreen(newScreen) == wmGD.Screens[i].screen)
  4893. {
  4894. pSD = &wmGD.Screens[i];
  4895. ok = True;
  4896. break;
  4897. }
  4898. }
  4899. if (ok)
  4900. {
  4901. ok = False;
  4902. for (i = 0; i < XmCO_MAX_NUM_COLORS; i++)
  4903. {
  4904. if (pSD->pPixelData[i].bg == newBackground)
  4905. {
  4906. switch (type)
  4907. {
  4908. case WmFGC: newValue = pSD->pPixelData[i].fg; break;
  4909. case WmBGC: newValue = pSD->pPixelData[i].bg; break;
  4910. case WmTSC: newValue = pSD->pPixelData[i].ts; break;
  4911. case WmBSC: newValue = pSD->pPixelData[i].bs; break;
  4912. }
  4913. ok = True;
  4914. }
  4915. }
  4916. }
  4917. }
  4918. if (!ok)
  4919. {
  4920. switch (type)
  4921. {
  4922. case WmFGC: newValue = BlackPixelOfScreen (newScreen); break;
  4923. case WmBGC: newValue = WhitePixelOfScreen (newScreen); break;
  4924. case WmTSC: newValue = WhitePixelOfScreen (newScreen); break;
  4925. case WmBSC: newValue = BlackPixelOfScreen (newScreen); break;
  4926. }
  4927. }
  4928. return;
  4929. }
  4930. /*
  4931. * Check to see if appropriate colors are available from the
  4932. * previous request; if the color is a background color then get
  4933. * default colors. Generate 3-D colors if necessary. Maintain
  4934. * new colors in static variables for later reuse.
  4935. */
  4936. newColormap = widget->core.colormap;
  4937. if ((oldScreen != NULL) && (oldScreen == newScreen) &&
  4938. (oldColormap == newColormap) && (type != WmBGC) &&
  4939. (background == newBackground))
  4940. {
  4941. }
  4942. else if ((oldScreen == newScreen) && (oldColormap == newColormap) &&
  4943. (type == WmBGC) && (oldDefaultColor == defaultColor))
  4944. {
  4945. }
  4946. else if (type == WmBGC)
  4947. {
  4948. /*
  4949. * Find or generate a background color and associated 3-D colors.
  4950. */
  4951. oldDefaultColor = defaultColor;
  4952. /*
  4953. * Fix for CR 5152 - Due to the use of Realloc in the color caches,
  4954. * a static pointer is not acceptable. Change it
  4955. * to a static structure to maintain the data
  4956. */
  4957. colorData = *_WmGetDefaultColors (newScreen, newColormap, defaultColor);
  4958. }
  4959. else
  4960. {
  4961. /*
  4962. * Find or generate a color based on the associated background color.
  4963. */
  4964. oldDefaultColor = DEFAULT_COLOR_NONE;
  4965. background = newBackground;
  4966. XmGetColors(newScreen, newColormap, background,
  4967. &colorData.foreground.pixel,
  4968. &colorData.top_shadow.pixel,
  4969. &colorData.bottom_shadow.pixel,
  4970. &colorData.select.pixel);
  4971. }
  4972. oldScreen = newScreen;
  4973. oldColormap = newColormap;
  4974. /*
  4975. * Set up the return value.
  4976. */
  4977. colorData.allocated |= type;
  4978. switch (type)
  4979. {
  4980. case XmBACKGROUND: newValue = colorData.background.pixel; break;
  4981. case XmFOREGROUND: newValue = colorData.foreground.pixel; break;
  4982. case XmTOP_SHADOW: newValue = colorData.top_shadow.pixel; break;
  4983. case XmBOTTOM_SHADOW: newValue = colorData.bottom_shadow.pixel; break;
  4984. case XmSELECT: newValue = colorData.select.pixel; break;
  4985. default: newValue = colorData.background.pixel; break;
  4986. }
  4987. } /* END OF FUNCTION _WmGetDynamicDefault */
  4988. /*************************************<->*************************************
  4989. *
  4990. * _WmGetDefaultColors (screen, colormap, defaultColor)
  4991. *
  4992. *
  4993. * Description:
  4994. * -----------
  4995. * This function is used to find or generate default 3-D colors based on a
  4996. * default background color.
  4997. *
  4998. *
  4999. * Inputs:
  5000. * ------
  5001. * screen = screen for which colors are to be generated.
  5002. *
  5003. * colormap = colormap that is to be used to make colors.
  5004. *
  5005. * defaultColor = pointer to a default color name/specification.
  5006. *
  5007. *
  5008. * Outputs:
  5009. * -------
  5010. * RETURN = pointer to WmColorData structure containing 3-D colors.
  5011. *
  5012. *************************************<->***********************************/
  5013. XmColorData * _WmGetDefaultColors (Screen *screen, Colormap colormap,
  5014. String defaultColor)
  5015. {
  5016. static XmColorData *defaultSet[2] = {NULL, NULL};
  5017. static int defaultCount[2] = {0, 0};
  5018. static int defaultSize[2] = {0, 0};
  5019. int setId;
  5020. XmColorData *set;
  5021. int count;
  5022. int size;
  5023. int i;
  5024. Display *display = DisplayOfScreen (screen);
  5025. XColor colorDef;
  5026. /*
  5027. * Fix for CR 5152 - Due to the use of Realloc with _XmGetColors, it is
  5028. * necessary to maintain a separate cache of color
  5029. * data. The Realloc may cause the data to be moved,
  5030. * and the cache would contain pointers into the heap.
  5031. */
  5032. /*
  5033. * Look through the cache to see if the defaults are already in the
  5034. * cache. There is a list of cached defaults for each default color.
  5035. */
  5036. if (defaultColor == _defaultColor2)
  5037. {
  5038. setId = 1;
  5039. }
  5040. else
  5041. {
  5042. setId = 0;
  5043. }
  5044. set = defaultSet[setId];
  5045. count = defaultCount[setId];
  5046. size = defaultSize[setId];
  5047. for (i = 0; i < count; i++)
  5048. {
  5049. if (((set + i)->screen == screen) && ((set + i)->color_map == colormap))
  5050. {
  5051. return (set + i);
  5052. }
  5053. }
  5054. /*
  5055. * No match in the cache, make a new entry and generate the colors.
  5056. */
  5057. if (count == size)
  5058. {
  5059. size = (defaultSize[setId] += 10);
  5060. set = defaultSet[setId] =
  5061. (XmColorData *)WmRealloc ((char *) defaultSet[setId],
  5062. sizeof (XmColorData) * size);
  5063. }
  5064. /*
  5065. * Make the default background color for the resource set.
  5066. */
  5067. if(!XParseColor (display, colormap, defaultColor, &colorDef))
  5068. {
  5069. if(!(strcmp(defaultColor, _defaultColor1)))
  5070. {
  5071. XParseColor (display, colormap, _defaultColor1HEX, &colorDef);
  5072. }
  5073. else
  5074. {
  5075. XParseColor (display, colormap, _defaultColor2HEX, &colorDef);
  5076. }
  5077. }
  5078. XAllocColor (display, colormap, &colorDef);
  5079. /*
  5080. * Generate the 3-D colors and save them in the defaults cache.
  5081. */
  5082. XmGetColors(screen, colormap, colorDef.pixel,
  5083. &set[count].foreground.pixel,
  5084. &set[count].top_shadow.pixel,
  5085. &set[count].bottom_shadow.pixel,
  5086. &set[count].select.pixel);
  5087. set[count].background.pixel = colorDef.pixel;
  5088. set[count].screen = screen;
  5089. set[count].color_map = colormap;
  5090. set[count].allocated = True;
  5091. XQueryColor(DISPLAY, colormap, &(set[count].background));
  5092. XQueryColor(DISPLAY, colormap, &(set[count].foreground));
  5093. XQueryColor(DISPLAY, colormap, &(set[count].top_shadow));
  5094. XQueryColor(DISPLAY, colormap, &(set[count].bottom_shadow));
  5095. XQueryColor(DISPLAY, colormap, &(set[count].select));
  5096. (defaultCount[setId])++;
  5097. return (set + count);
  5098. } /* END OF FUNCTION _WmGetDefaultColors */
  5099. /*************************************<->*************************************
  5100. *
  5101. * WmRealloc (ptr, size)
  5102. *
  5103. *
  5104. * Description:
  5105. * -----------
  5106. * This function is used reallocate a block of storage that has been
  5107. * malloc'ed.
  5108. *
  5109. *
  5110. * Inputs:
  5111. * ------
  5112. * ptr = pointer to storage that is to be realloc'ed; if NULL malloc an
  5113. * initial block of storage.
  5114. *
  5115. * size = size of new storage
  5116. *
  5117. * Outputs:
  5118. * -------
  5119. * RETURN = pointer to realloc'ed block of storage
  5120. *
  5121. *************************************<->***********************************/
  5122. char * WmRealloc (char *ptr, unsigned size)
  5123. {
  5124. if (ptr)
  5125. {
  5126. ptr = (char *)XtRealloc (ptr, size);
  5127. }
  5128. else
  5129. {
  5130. ptr = (char *)XtMalloc (size);
  5131. }
  5132. if (ptr == NULL)
  5133. {
  5134. Warning (((char *)GETMESSAGE(62, 37, "Insufficient memory for window manager data")));
  5135. }
  5136. return (ptr);
  5137. } /* END OF FUNCTION WmRealloc */
  5138. /*************************************<->*************************************
  5139. *
  5140. * WmMalloc (ptr, size)
  5141. *
  5142. *
  5143. * Description:
  5144. * -----------
  5145. * This function is used malloc a block of storage. If a previous block
  5146. * of storage is being replace the old block is free'd.
  5147. *
  5148. *
  5149. * Inputs:
  5150. * ------
  5151. * ptr = pointer to storage that is to be replaced (free'd).
  5152. *
  5153. * size = size of new storage
  5154. *
  5155. * Outputs:
  5156. * -------
  5157. * RETURN = pointer to malloc'ed block of storage
  5158. *
  5159. *************************************<->***********************************/
  5160. char * WmMalloc (char *ptr, unsigned size)
  5161. {
  5162. if (ptr)
  5163. {
  5164. XtFree (ptr);
  5165. }
  5166. ptr = (char *)XtMalloc (size);
  5167. if (ptr == NULL)
  5168. {
  5169. Warning (((char *)GETMESSAGE(62, 38, "Insufficient memory for window manager data")));
  5170. }
  5171. return (ptr);
  5172. } /* END OF FUNCTION WmMalloc */
  5173. /*************************************<->*************************************
  5174. *
  5175. * SetupDefaultResources (pSD)
  5176. *
  5177. *
  5178. * Description:
  5179. * -----------
  5180. * This function is used to setup default (builtin) resources for the
  5181. * key bindings.
  5182. *
  5183. *
  5184. * Inputs:
  5185. * ------
  5186. * pSD = pointer to screen data
  5187. * wmGD = (defaultKeyBindingsString, ...)
  5188. *
  5189. * builtinKeyBindingsName = name of default key bindings set
  5190. *
  5191. *
  5192. * Outputs:
  5193. * -------
  5194. * None
  5195. *
  5196. *************************************<->***********************************/
  5197. void
  5198. SetupDefaultResources (WmScreenData *pSD)
  5199. {
  5200. KeySpec *nextKeySpec;
  5201. String keyBindings;
  5202. MenuSpec *menuSpec;
  5203. /*
  5204. * If (using DefaultBindings mechanism and bindings are not found in .mwmrc)
  5205. * then use the builtin bindings.
  5206. */
  5207. if (!pSD->keySpecs && !wmGD.useStandardBehavior)
  5208. {
  5209. /*
  5210. * Print warning if user is NOT using "DefaultKeyBindings".
  5211. */
  5212. if (strcmp (pSD->keyBindings, defaultKeyBindingsName))
  5213. {
  5214. MWarning (((char *)GETMESSAGE(62, 67, "Key bindings %s not found, using builtin key bindings\n")),
  5215. pSD->keyBindings);
  5216. }
  5217. pSD->keyBindings = builtinKeyBindingsName;
  5218. }
  5219. if (!pSD->buttonSpecs && !wmGD.useStandardBehavior)
  5220. {
  5221. /*
  5222. * Print warning if user is NOT using "DefaultButtonBindings".
  5223. */
  5224. if (strcmp (pSD->buttonBindings, defaultButtonBindingsName))
  5225. {
  5226. MWarning (((char *)GETMESSAGE(62, 68, "Button bindings %s not found, using builtin button bindings\n")),
  5227. pSD->buttonBindings);
  5228. }
  5229. pSD->buttonBindings = builtinButtonBindingsName;
  5230. }
  5231. if (pSD->keyBindings == builtinKeyBindingsName)
  5232. {
  5233. /*
  5234. * Default key specifications are to be used and no default
  5235. * set has been provided by the user. Make the built-in default
  5236. * set.
  5237. */
  5238. ParseKeyStr (pSD, (unsigned char *)builtinKeyBindings);
  5239. }
  5240. else
  5241. {
  5242. /*
  5243. * Add the switch behavior key binding to the front of the list
  5244. * of user specified key bindings that have been parsed.
  5245. */
  5246. nextKeySpec = pSD->keySpecs;
  5247. keyBindings = pSD->keyBindings;
  5248. pSD->keyBindings = behaviorKeyBindingName;
  5249. pSD->keySpecs = NULL;
  5250. ParseKeyStr (pSD, (unsigned char *)behaviorKeyBindings);
  5251. if (pSD->keySpecs)
  5252. {
  5253. /* Skip past the TWO key definitions (1.2 & 1.1.4) */
  5254. pSD->keySpecs->nextKeySpec->nextKeySpec = nextKeySpec;
  5255. }
  5256. else
  5257. {
  5258. pSD->keySpecs = nextKeySpec;
  5259. }
  5260. pSD->keyBindings = keyBindings;
  5261. }
  5262. if (pSD->buttonBindings == builtinButtonBindingsName)
  5263. {
  5264. /*
  5265. * Default button specifications are to be used and no default
  5266. * set has been provided by the user. Make the built-in default
  5267. * set.
  5268. */
  5269. ParseButtonStr (pSD, (unsigned char *)builtinButtonBindings);
  5270. }
  5271. #ifdef NO_MESSAGE_CATALOG
  5272. /*
  5273. * Set defaultSystemMenuUseBuiltin to FALSE if DefaultWindowMenu spec
  5274. * is found.
  5275. */
  5276. menuSpec = pSD->menuSpecs;
  5277. while ( menuSpec )
  5278. {
  5279. if (!strcmp(menuSpec->name, defaultSystemMenuName))
  5280. {
  5281. pSD->defaultSystemMenuUseBuiltin = FALSE;
  5282. break;
  5283. }
  5284. menuSpec = menuSpec->nextMenuSpec;
  5285. }
  5286. #endif
  5287. } /* END OF FUNCTION SetupDefaultResources */
  5288. /*************************************<->*************************************
  5289. *
  5290. * SimilarAppearanceData (pAD1, pAD2)
  5291. *
  5292. *
  5293. * Description:
  5294. * -----------
  5295. * This function returns True if the two passed sets of AppearanceData
  5296. * are similar. This is designed to compare appearance data before
  5297. * creation of the GCs.
  5298. *
  5299. *
  5300. * Inputs:
  5301. * ------
  5302. * pAD1 pointer to AppearanceData 1
  5303. * pAD2 pointer to AppearanceData 2
  5304. *
  5305. *
  5306. * Outputs:
  5307. * -------
  5308. * Function returns True if similar, False otherwise.
  5309. *
  5310. * Comments:
  5311. * ---------
  5312. * This function is only used to compare the client
  5313. * and client*title appearance data.
  5314. *************************************<->***********************************/
  5315. Boolean SimilarAppearanceData (AppearanceData *pAD1, AppearanceData *pAD2)
  5316. {
  5317. Boolean rval;
  5318. /*
  5319. * !!! Should find out why all the Pixmap resources are unset !!!
  5320. */
  5321. if ((pAD1->fontList == pAD2->fontList) &&
  5322. (pAD1->background == pAD2->background) &&
  5323. (pAD1->foreground == pAD2->foreground) &&
  5324. (pAD1->backgroundPStr == pAD2->backgroundPStr) &&
  5325. (pAD1->bottomShadowColor == pAD2->bottomShadowColor) &&
  5326. (pAD1->bottomShadowPStr == pAD2->bottomShadowPStr) &&
  5327. (pAD1->topShadowColor == pAD2->topShadowColor) &&
  5328. (pAD1->topShadowPStr == pAD2->topShadowPStr) &&
  5329. (pAD1->activeBackground == pAD2->activeBackground) &&
  5330. (pAD1->activeForeground == pAD2->activeForeground) &&
  5331. (pAD1->activeBackgroundPStr == pAD2->activeBackgroundPStr) &&
  5332. (pAD1->activeBottomShadowColor == pAD2->activeBottomShadowColor) &&
  5333. (pAD1->activeBottomShadowPStr == pAD2->activeBottomShadowPStr) &&
  5334. (pAD1->activeTopShadowColor == pAD2->activeTopShadowColor) &&
  5335. (pAD1->activeTopShadowPStr == pAD2->activeTopShadowPStr) )
  5336. {
  5337. rval = True;
  5338. }
  5339. else
  5340. {
  5341. rval = False;
  5342. }
  5343. return (rval);
  5344. } /* END OF FUNCTION SimilarAppearanceData */
  5345. /*************************************<->*************************************
  5346. *
  5347. * Monochrome (screen)
  5348. *
  5349. *
  5350. * Description:
  5351. * -----------
  5352. * This function returns True if the screen passed it to be treated
  5353. * as monochrome for the purpose of assigning default resources.
  5354. *
  5355. *
  5356. * Inputs:
  5357. * ------
  5358. * screen pointer to Screen
  5359. *
  5360. *
  5361. * Outputs:
  5362. * -------
  5363. * Function returns True if monochrome (or Static Gray), False otherwise.
  5364. *
  5365. *************************************<->***********************************/
  5366. Boolean
  5367. Monochrome (Screen *screen)
  5368. {
  5369. WmScreenData *pSD;
  5370. int scr;
  5371. if (wmGD.statusColorServer == CSERVE_NORMAL)
  5372. {
  5373. for (scr = 0; scr < wmGD.numScreens; scr++)
  5374. {
  5375. pSD = &(wmGD.Screens[scr]);
  5376. if (pSD->managed)
  5377. {
  5378. if (XScreenOfDisplay (DISPLAY, pSD->screen) == screen)
  5379. {
  5380. if (pSD->colorUse == XmCO_BLACK_WHITE)
  5381. {
  5382. return(True);
  5383. }
  5384. else
  5385. {
  5386. return(False);
  5387. }
  5388. }
  5389. }
  5390. }
  5391. }
  5392. /*
  5393. * If we don't know the answer to our question by now,
  5394. * fall back to the old mwm way of determining monochromicity.
  5395. *
  5396. */
  5397. return ((DefaultDepthOfScreen(screen) == 1));
  5398. } /* END OF FUNCTION Monochrome */
  5399. /**************************** eof ***************************/