WmResource.c 148 KB

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