123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174 |
- /*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them under the terms of the GNU
- * Lesser General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * These libraries and programs are distributed in the hope that
- * they will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
- /************************************<+>*************************************/
- /****************************************************************************/
- /** **/
- /** File: Screen.c **/
- /** **/
- /** Project: DT 1.0 **/
- /** **/
- /** Description: Controls the Dtstyle Screen dialog **/
- /** **/
- /** **/
- /** **/
- /** **/
- /****************************************************************************/
- /************************************<+>*************************************/
- /*$TOG: Screen.c /main/9 1997/07/14 17:44:42 samborn $*/
- #include <X11/Xlib.h>
- #include <Xm/MwmUtil.h>
- #include <Xm/Xm.h>
- #include <Xm/XmP.h>
- #include <Xm/DrawingA.h>
- #include <Xm/Form.h>
- #include <Xm/List.h>
- #include <Xm/Frame.h>
- #include <Xm/LabelG.h>
- #include <Xm/PushBG.h>
- #include <Xm/PushB.h>
- #include <Xm/RowColumn.h>
- #include <Xm/Scale.h>
- #include <Xm/ToggleBG.h>
- #include <Xm/VendorSEP.h>
- #include <Xm/Protocols.h>
- #include <stdio.h>
- #include <signal.h>
- #include <errno.h>
- #include <X11/Intrinsic.h>
- #include <X11/Xutil.h>
- #include <X11/Xatom.h>
- #include <Dt/Action.h>
- #include <Dt/UserMsg.h>
- #include <Dt/SaverP.h>
- #include <Dt/DialogBox.h>
- #include <Dt/Icon.h>
- #include <Dt/TitleBox.h>
- #include <Dt/Message.h>
- #include <Dt/HourGlass.h>
- #include "Help.h"
- #include "Main.h"
- #include "SaveRestore.h"
- #include "Protocol.h"
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* include extern functions */
- /*+++++++++++++++++++++++++++++++++++++++*/
- #include "Screen.h"
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* Local #defines */
- /*+++++++++++++++++++++++++++++++++++++++*/
- #ifndef MIN
- #define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
- #endif
- #define TIMEOUT_MIN 1
- #define TIMEOUT_MAX 120
- #define CYCLETIME_MIN 0
- #define CYCLE_DEFAULT 3 /* 1-120 */
- #define LOCK_DEFAULT 30 /* 1-120 */
- #define SAVER_DEFAULT 10 /* 0-120 */
- #define SAVER_HEIGHT 238
- #define SAVER_WIDTH 298
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* Internal Functions */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static Widget build_screenDialog( Widget shell) ;
- static void formLayoutCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void no_svr_ext_formLayoutCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void _DtmapCB_screenDialog(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void no_svr_ext_DtmapCB_screenDialog(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void timeOutvalueChangedCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void no_svr_ext_timeOutvalueChangedCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void saverToggleCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void no_svr_ext_saverToggleCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void saversToggleCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void lockToggleCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void systemDefaultCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void no_svr_ext_systemDefaultCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void ButtonCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void no_svr_ext_ButtonCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static XmString * MakeListStrings(char **list ) ;
- static void FreeListStrings(XmString *xmlist,
- int count) ;
- static void ListCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- static void IconHandler(Widget shell,
- XtPointer client_data,
- XEvent *event,
- Boolean *dispatch) ;
- static void UnmapCB(Widget w,
- XtPointer client_data,
- XtPointer call_data) ;
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* Internal Variables */
- /*+++++++++++++++++++++++++++++++++++++++*/
- typedef struct {
- Widget pictLabel;
- Widget systemDefault;
- Widget saverFrame;
- Widget saverForm;
- Widget saverArea;
- Widget saverAreaFrame;
- Widget saverLabel;
- Widget prevLabel;
- Widget saverOn;
- Widget saverOff;
- Widget saverRadioBox;
- Widget saverList;
- Widget timeOutLabel;
- Widget timeOutScale;
- Widget saverMinutesLabel;
- Widget cycleTimeLabel;
- Widget cycleTimeScale;
- Widget cycleMinutesLabel;
- Widget lockFrame;
- Widget lockForm;
- Widget lockLabel;
- Widget lockOn;
- Widget lockOff;
- Widget lockRadioBox;
- Widget lockingRadioBox;
- Widget lockOutLabel;
- Widget lockOutScale;
- Widget lockMinutesLabel;
- Widget useSaversOn; /* used for graying saverList and saverArea in no saver extn mode */
- Widget useSaversOff; /* used for graying saverList and saverArea in no saver extn mode */
- int interval;
- int blanking;
- int exposures;
- int newTimeout; /* the min value of savertimeout and locktimeout */
- int origTimeout; /* the original value of the min of savertimeout and locktimeout */
- int xTimeout; /* the value of the timeout extracted from the X server */
- Boolean timeMismatch; /* use to keep track of mismatch between xTimeout and newTimeout */
- int saverTimeout; /* the value of savertimeout */
- int lockTimeout; /* the value of locktimeout */
- int cycleTimeout; /* the value of cycletimeout */
- int saverTimeout_xrdb; /* the value of savertimeout from xrdb, in case saver is off */
- int lockTimeout_xrdb; /* the value of locktimeout from xrdb, in case lock is off */
- int new_blanking;
- Boolean systemDefaultFlag;
-
- } ScreenData; /* using the savers toggle when the saver extn is not present */
- static ScreenData screen;
- static saveRestore save = {FALSE, 0,};
- typedef struct {
- char *saversList; /* list of available savers */
- char *selsaversList; /* list of selected savers */
- char **saverActionNames; /* array of saver names */
- char **saverActionDesc; /* array of saver action descriptions */
- char **selsaverActionNames; /* array of originally selected saver names */
- int *selPositions; /* array of currently selected saver positions */
- int *origSelPositions; /* array of originally selected saver positions */
- int saverCount; /* number of available savers */
- int selsaverCount; /* number of currently selected screen savers */
- int orig_selsaverCount; /* number of originally selected screen savers */
- int previous_selsaverCount; /* number of previously selected screen savers */
- char *current_saver; /* name of current screen saver actions */
- char *current_saverDesc; /* description of current screen saver actions */
- int current_position; /* the clicked on position in the scrolled list */
- int shadow; /* shadow width of saver area */
- Pixel bg; /* bg color of the style manager dialogs */
- Pixel black; /* value of the black pixel */
- void *saverstate; /* current running screen saver state */
- } Savers, *SaversPtr;
- static Savers savers;
- /*++++++++++++++++++++++++++++++++++++++++*/
- /* build_saverList */
- /* parses a space separated list of */
- /* savers to build a an array of saver */
- /* names. Returns the array and the saver */
- /* count. */
- /*++++++++++++++++++++++++++++++++++++++++*/
- char **
- build_saverList(char * str,
- int * count)
- {
- char tokenSep[] = " ";
- char * token;
- char ** saverList = NULL;
- int i = 0;
- char * tmpStr, *tmpStr2;
- int len = strlen(str);
-
- *count = 0;
- tmpStr = (char *)XtCalloc(1, len + 1);
- tmpStr2 = tmpStr;
- strcpy(tmpStr, str);
- token = strtok(tmpStr, tokenSep);
- while(token != NULL)
- {
- ++(i);
- token = strtok(NULL, tokenSep);
- }
- if (i == 0)
- return (NULL);
- saverList = (char **) XtCalloc(1, i * sizeof(char *));
- if( saverList )
- {
- strcpy(tmpStr, str);
- while (isspace(*tmpStr))
- tmpStr++;
- token = strtok(tmpStr, tokenSep);
- *count=0;
- while(token != NULL)
- {
- if (DtActionExists(token))
- {
- saverList[*count] = (char *) XtCalloc(1, strlen( token ) + 1);
- strcpy(saverList[*count], token);
- ++(*count);
- }
- tmpStr += strlen(token);
- if (tmpStr >= tmpStr2 + len )
- token = NULL;
- else
- {
- do tmpStr++;
- while (isspace(*tmpStr));
- token = strtok(tmpStr, tokenSep);
- }
- }
- }
- if (tmpStr2)
- XtFree ((char *) tmpStr2);
- return(saverList);
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* build_selsaverList */
- /*+++++++++++++++++++++++++++++++++++++++*/
- char **
- build_selsaverList(char * envStr,
- int * count)
- {
- char tokenSep[] = " ";
- char * token;
- char ** saverList = NULL;
- int i = 0;
- char * tmpStr;
- int len = strlen(envStr);
- *count = 0;
- tmpStr = (char *)XtCalloc(1, len + 1);
- strcpy(tmpStr, envStr);
- token = strtok(tmpStr, tokenSep);
- while(token != NULL)
- {
- ++(i);
- token = strtok(NULL, tokenSep);
- }
- if (i == 0)
- return (NULL);
- saverList = (char **) XtCalloc(1, i * sizeof(char *));
- if( saverList )
- {
- strcpy(tmpStr, envStr);
- token = strtok(tmpStr, tokenSep);
- *count=0;
- while(token != NULL)
- {
- saverList[*count] = (char *) XtCalloc(1, strlen( token ) + 1);
- strcpy(saverList[*count], token);
- token = strtok(NULL, tokenSep);
- ++(*count);
- }
- }
- XtFree ((char *) tmpStr);
- return(saverList);
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* build_saverDesc */
- /*+++++++++++++++++++++++++++++++++++++++*/
- char **
- build_saverDesc(char ** names,
- int count)
- {
- char **saverDesc = NULL;
- char *tmpstr;
- int i;
- saverDesc = (char **) XtCalloc(1, count * sizeof(char *));
- for (i=0; i<count; i++)
- {
- tmpstr = DtActionDescription(savers.saverActionNames[i]);
- if (tmpstr == NULL)
- {
- saverDesc[i] = (char *) XtMalloc(strlen(savers.saverActionNames[i]) + 1);
- strcpy(saverDesc[i], savers.saverActionNames[i]);
- }
- else
- {
- saverDesc[i] = (char *) XtMalloc(strlen(tmpstr) + 1);
- strcpy(saverDesc[i], tmpstr);
- }
- XtFree((char *) tmpstr);
- }
- return(saverDesc);
- }
-
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* build_selectedList */
- /* takes an array of names and a count */
- /* and returns a space separated list */
- /*+++++++++++++++++++++++++++++++++++++++*/
- char *
- build_selectedList(char ** saverList,
- int count)
- {
- char * selectedList = NULL;
- int i = 0;
- char * tmpStr;
- int len = 0;
- int tmplen = 0;
-
- if (saverList == NULL)
- return(NULL);
-
- for (i=0; i<count; i++)
- {
- len += strlen(saverList[i]) + 1;
- }
-
- selectedList = (char *)XtMalloc(len + 1);
- selectedList[0] = '\0';
- for (i=0; i<count; i++)
- {
- strcat(selectedList, saverList[i]);
- strcat(selectedList, " ");
- }
-
- return(selectedList);
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* free_saverList */
- /*+++++++++++++++++++++++++++++++++++++++*/
- void
- free_saverList(char ** saverList,
- int count)
- {
- int i;
- if (saverList == NULL)
- return;
- for (i=0; i<count; i++)
- XtFree((char *) saverList[i]);
-
- XtFree ((char *) saverList);
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* popup_screenBB */
- /*+++++++++++++++++++++++++++++++++++++++*/
- void
- popup_screenBB(
- Widget shell )
- {
- if (style.screenDialog == NULL) {
- _DtTurnOnHourGlass(shell);
- build_screenDialog(shell);
- XtManageChild(style.screenDialog);
- _DtTurnOffHourGlass(shell);
- }
- else
- {
- XtManageChild(style.screenDialog);
- raiseWindow(XtWindow(XtParent(style.screenDialog)));
- }
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* build_screenDialog */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static Widget
- build_screenDialog(
- Widget shell )
- {
- int i, m, n;
- Arg args[MAX_ARGS];
- Widget form;
- Boolean sel_matched = False;
- int sel_found = 1;
- int old_selsaverCount = 0;
- Widget widget_list1[12];
- Widget widget_list2[12];
- int list1_count = 0;
- int list2_count = 0;
- XmString button_string[NUM_LABELS];
- XmString string;
- XmString *listStrings;
- XColor color;
- Colormap cmap;
- Dimension MaxLabelWidth = 0;
- Dimension LabelWidth = 0;
- Atom delete_window_atom;
- Boolean low_res = False;
- XtArgVal scratch;
- /* initialize saver data */
- savers.shadow = 2;
- savers.saverstate = NULL;
- savers.saverCount = 0;
- savers.selsaverCount = 0;
- savers.previous_selsaverCount = 0;
- savers.saversList = NULL;
- savers.selsaverActionNames = NULL;
- savers.selPositions = NULL;
- savers.selsaversList = NULL;
- savers.saverActionNames = NULL;
- savers.saverActionDesc = NULL;
- savers.current_saver = NULL;
- savers.current_saverDesc = NULL;
- savers.current_position = 0;
- savers.black = BlackPixel(style.display, DefaultScreen(XtDisplay(shell)));
-
- /* load the actions data base */
- DtDbLoad();
- if (_DtGetDisplayResolution(style.display, style.screenNum) == 1)
- low_res = True;
-
- /* Set up DialogBoxDialog button labels */
- button_string[0] = CMPSTR((String) _DtOkString);
- button_string[1] = CMPSTR((String) _DtCancelString);
- button_string[2] = CMPSTR((String) _DtHelpString);
- /* Create toplevel DialogBox */
- /* saveRestore - Note that save.poscnt has been initialized elsewhere. */
- /* save.posArgs may contain information from restoreScreen().*/
- XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS);
- save.poscnt++;
- XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string);
- save.poscnt++;
- XtSetArg (save.posArgs[save.poscnt], XmNdefaultPosition, False);
- save.poscnt++;
- style.screenDialog =
- __DtCreateDialogBoxDialog(shell, "ScreenDialog", save.posArgs, save.poscnt);
- XmStringFree(button_string[0]);
- XmStringFree(button_string[1]);
- XmStringFree(button_string[2]);
- widget_list1[0] = _DtDialogBoxGetButton(style.screenDialog,2);
- n=0;
- XtSetArg(args[n], XmNautoUnmanage, False); n++;
- XtSetArg(args[n], XmNcancelButton, widget_list1[0]); n++;
- XtSetValues (style.screenDialog, args, n);
- /* Set the title */
- n=0;
- XtSetArg(args[n], XmNtitle, ((char *)GETMESSAGE(12, 1, "Style Manager - Screen"))); n++;
- XtSetArg(args[n], XmNuseAsyncGeometry, True); n++;
- XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
- XtSetValues (XtParent(style.screenDialog), args, n);
- /* Create the main form */
- n = 0;
- XtSetArg(args[n], XmNallowOverlap, False); n++;
- XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
- form=XmCreateForm(style.screenDialog, "Form", args, n);
-
- /* Create the visual */
- n = 0;
- XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
- XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
- XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
- XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
- XtSetArg(args[n], XmNstring, NULL); n++;
- XtSetArg(args[n], XmNshadowThickness, 0); n++;
- XtSetArg(args[n], XmNimageName, SCREEN_ICON); n++;
- XtSetArg(args[n], XmNtraversalOn, False); n++;
- widget_list1[list1_count++] =
- screen.pictLabel= _DtCreateIcon(form, "screenLabelPixmap", args, n);
- /* Create the default button */
- n = 0;
- XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT); n++;
- XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++;
- string = CMPSTR(((char *)GETMESSAGE(12, 3, "Default")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;
- widget_list1[list1_count++] =
- screen.systemDefault= XmCreatePushButtonGadget(form, "systemDefault", args, n);
- XmStringFree(string);
- /* Create the screen lock title box */
- n = 0;
- if (style.smState.smLockOnTimeoutStatus)
- string = CMPSTR(((char *)GETMESSAGE(12, 8, "Screen Lock")));
- else
- string = CMPSTR(((char *)GETMESSAGE(12, 18, "Front Panel Lock")));
- XtSetArg(args[n], XmNtitleString, string); n++;
- widget_list1[list1_count++] =
- screen.lockFrame= _DtCreateTitleBox(form, "lockFrame", args, n);
- XmStringFree(string);
-
- /* Create a form for the screen lock widgets */
- n = 0;
- XtSetArg(args[n], XmNallowOverlap, False); n++;
- XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
- screen.lockForm= XmCreateForm(screen.lockFrame, "lockForm", args, n);
-
- /* Create the screen saver title box */
- n = 0;
- if (style.smState.smLockOnTimeoutStatus)
- string = CMPSTR(((char *)GETMESSAGE(12, 4, "Screen Saver")));
- else
- string = CMPSTR(((char *)GETMESSAGE(12, 15, "Auto Screen Blanking")));
- XtSetArg(args[n], XmNtitleString, string); n++;
- widget_list1[list1_count++] =
- screen.saverFrame= _DtCreateTitleBox(form, "saverFrame", args, n);
- XmStringFree(string);
-
- /* Create a form for the screen saver widgets */
- n = 0;
- XtSetArg(args[n], XmNallowOverlap, False); n++;
- XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
- screen.saverForm= XmCreateForm(screen.saverFrame, "saverForm", args, n);
- /* Create the cycle time labels and slider */
- n = 0;
- if (style.smState.smLockOnTimeoutStatus)
- string = CMPSTR(((char *)GETMESSAGE(12, 6, "Time Per Saver")));
- else
- string = CMPSTR(((char *)GETMESSAGE(12, 20, "Time Per Background")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- /* only if saver extensions are present */
- if (style.smState.smLockOnTimeoutStatus)
- screen.cycleTimeLabel = XmCreateLabelGadget(screen.saverForm,"cycleTimeLabel", args, n);
- else
- screen.cycleTimeLabel = XmCreateLabelGadget(screen.lockForm,"cycleTimeLabel", args, n);
- XmStringFree(string);
- n = 0;
- XtSetArg(args[n], XmNminimum, CYCLETIME_MIN); n++;
- XtSetArg(args[n], XmNmaximum, TIMEOUT_MAX); n++;
- XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
- XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
- XtSetArg(args[n], XmNshowValue, True); n++;
- XtSetArg(args[n], XmNhighlightThickness, SCALE_HIGHLIGHT_THICKNESS); n++;
- if (style.smState.smLockOnTimeoutStatus)
- screen.cycleTimeScale= XmCreateScale(screen.saverForm,"cycleTimeScale", args, n);
- else
- screen.cycleTimeScale= XmCreateScale(screen.lockForm,"cycleTimeScale", args, n);
-
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 7, "minutes")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- if (style.smState.smLockOnTimeoutStatus)
- screen.cycleMinutesLabel= XmCreateLabelGadget(screen.saverForm,"cycleMinutes", args, n);
- else
- screen.cycleMinutesLabel= XmCreateLabelGadget(screen.lockForm,"cycleMinutes", args, n);
- XmStringFree(string);
- /* Create the screen saver on/off radio buttons and label */
- n = 0;
- if (style.smState.smLockOnTimeoutStatus)
- string = CMPSTR(((char *)GETMESSAGE(12, 12, "Screen Saver:")));
- else
- string = CMPSTR(((char *)GETMESSAGE(12, 16, "Screen Blanker:")));
- XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
- XtSetArg(args[n], XmNlabelString, string); n++;
- screen.saverLabel= XmCreateLabelGadget(screen.saverForm, "saverLabel", args, n);
- XmStringFree(string);
- n = 0;
- XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
- screen.saverRadioBox= XmCreateRadioBox(screen.saverForm, "saverRadioBox", args, n);
-
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 10, "On")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- screen.saverOn= XmCreateToggleButtonGadget(screen.saverRadioBox, "saverOn", args, n);
- XmStringFree(string);
-
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 11, "Off")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- screen.saverOff= XmCreateToggleButtonGadget(screen.saverRadioBox, "saverOff", args, n);
- XmStringFree(string);
-
- /* Create the screen saver list */
- n = 0;
- XtSetArg (args[n], XmNautomaticSelection, True); n++;
- XtSetArg (args[n], XmNselectionPolicy, XmMULTIPLE_SELECT); n++;
- XtSetArg (args[n], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); n++;
- if (low_res) {
- XtSetArg (args[n], XmNheight, 100); n++; }
- else {
- XtSetArg (args[n], XmNheight, SAVER_HEIGHT); n++; }
- XtSetArg (args[n], XmNhighlightColor, 0); n++;
- /* choose the parent of saverList depending on the presence of saver extensions */
- if (style.smState.smLockOnTimeoutStatus)
- screen.saverList = XmCreateScrolledList (screen.saverForm, "saversList", args, n);
- else
- screen.saverList = XmCreateScrolledList (screen.lockForm, "saversList", args, n);
- /* use the environment variable DTSCREENSAVERLIST to get the list of */
- /* available screen saver actions, load them into the scrolled list*/
- savers.saversList = getenv ("DTSCREENSAVERLIST");
- /* if DTSCREENSAVER is not set, set saver count to zero */
- if (savers.saversList == NULL) {
- savers.saverCount = 0;
- savers.selsaverCount=0;
- } else {
- savers.saverActionNames = build_saverList(savers.saversList, &savers.saverCount);
- savers.saverActionDesc = build_saverDesc(savers.saverActionNames, savers.saverCount);
- /* convert to XmString */
- listStrings = MakeListStrings(savers.saverActionDesc);
- XmListAddItems (screen.saverList, listStrings, savers.saverCount, 0);
- XtAddCallback (screen.saverList, XmNmultipleSelectionCallback,
- ListCB, (XtPointer)NULL);
- FreeListStrings (listStrings, savers.saverCount);
-
- /* check the state to see which item(s) should be selected, if none are */
- /* selected or if none in the selected list match the available list then */
- /* set the selection to the last position by default. This should be blank */
- /* if the DTSCREENSAVERLIST environment variable is set to default */
- savers.selsaverActionNames =
- build_selsaverList(style.smSaver.saverList, &savers.selsaverCount);
- /* since savers.selsaverCount may be changed below, we save */
- /* number of originally selected savers in order to accurately free the */
- /* savers.selsaverActionNames array below. */
- old_selsaverCount = savers.selsaverCount;
- if (savers.selsaverCount) {
- savers.selPositions = (int *) XtMalloc(sizeof(int) * savers.selsaverCount);
- for (n=0; n<savers.selsaverCount; n++) {
- /* determine if this selected saver matches one in valid saver list */
- for (m=0; (m < savers.saverCount) &&
- ((sel_found = strcmp(savers.selsaverActionNames[n],
- savers.saverActionNames[m])) != 0); m++) {}
- if (sel_found == 0) {
- XmListSelectPos (screen.saverList, m+1, False);
- savers.selPositions[n]=m+1;
- sel_matched = True;
- } else {
- /* This selected saver isn't valid, need to get rid of it.
- Do this by shifting each selected saver in the array
- back one position, i.e. n = n+1, n+1 = n+2, ....
- This overwrites the nth element and leaves the empty
- space at the end of the array. */
- for (i=n; i < (savers.selsaverCount - 1); i++)
- savers.selsaverActionNames[i] = savers.selsaverActionNames[i+1];
- /* reduce # of selected savers */
- savers.selsaverCount--;
- /* reset selected saver array position counter back one position for
- next loop test */
- n--;
- } /* if (sel_found == 0) */
- } /* for n<savers.selsaverCount */
- } /* if (savers.selsaverCount) */
- /* if there are still savers selected that match valid saver names */
- if (savers.selsaverCount) {
- /* set current saver to first selection */
- savers.current_saver = savers.saverActionNames[savers.selPositions[0] - 1];
- savers.current_saverDesc = savers.saverActionDesc[savers.selPositions[0] - 1];
- savers.current_position = savers.selPositions[0];
- } else {
- /* highlight last saver */
- XmListSelectPos (screen.saverList, savers.saverCount, False);
- /* set current saver to last one */
- savers.current_saver = savers.saverActionNames[savers.saverCount - 1];
- savers.current_saverDesc = savers.saverActionDesc[savers.saverCount - 1];
- savers.selPositions = (int *) XtMalloc(sizeof(int));
- savers.selPositions[0] = savers.saverCount;
- savers.selsaverCount = 1;
- savers.current_position = 1;
- }
- /* save the selected positions for later use */
- savers.origSelPositions = (int *) XtMalloc(sizeof(int) * savers.selsaverCount);
- for (i=0; i<savers.selsaverCount; i++)
- savers.origSelPositions[i] = savers.selPositions[i];
- savers.orig_selsaverCount = savers.selsaverCount;
- savers.previous_selsaverCount = savers.selsaverCount;
- free_saverList(savers.selsaverActionNames, old_selsaverCount);
- }
-
- /* Create frame for the saver area */
- n = 0;
- XtSetArg (args[n], XmNshadowType, XmSHADOW_IN); n++;
- XtSetArg (args[n], XmNshadowThickness, savers.shadow); n++;
- XtSetArg (args[n], XmNhighlightThickness, 0); n++;
- XtSetArg (args[n], XmNtraversalOn, False); n++;
- /* depending on the presence of saver extensions choose the parent of saverAreaFrame */
- if (style.smState.smLockOnTimeoutStatus)
- screen.saverAreaFrame = XmCreateFrame(screen.saverForm, "saverAreaFrame", args, n);
- else
- screen.saverAreaFrame = XmCreateFrame(screen.lockForm, "saverAreaFrame", args, n);
-
- /* Create saver area for the screen savers */
- n = 0;
- XtSetArg (args[n], XmNtraversalOn, False); n++;
- if (low_res) {
- XtSetArg (args[n], XmNwidth, 180); n++; }
- else {
- XtSetArg (args[n], XmNwidth, SAVER_WIDTH); n++; }
- screen.saverArea = XmCreateDrawingArea (screen.saverAreaFrame, "saverArea", args, n);
- /* get the initial secondary color pixel value for dtstyle for later use */
- XtVaGetValues(screen.saverArea, XmNbackground, &scratch, NULL);
- savers.bg = (Pixel)scratch;
- /* label for the previewed saver */
- n = 0;
- if (savers.saverCount)
- string = XmStringCreateLocalized (savers.current_saverDesc);
- else
- string = XmStringCreateLocalized (" ");
- XtSetArg(args[n], XmNlabelString, string); n++;
- if (style.smState.smLockOnTimeoutStatus)
- screen.prevLabel = XmCreateLabelGadget(screen.saverForm,"prevLabel", args, n);
- else
- screen.prevLabel = XmCreateLabelGadget(screen.lockForm,"prevLabel", args, n);
- XmStringFree(string);
- /* Create the screen saver labels and slider */
- n = 0;
- if (style.smState.smLockOnTimeoutStatus)
- string = CMPSTR(((char *)GETMESSAGE(12, 5, "Start Saver")));
- else
- string = CMPSTR(((char *)GETMESSAGE(12, 17, "Start Blanker")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
- screen.timeOutLabel= XmCreateLabelGadget(screen.saverForm,"timeOutLabel", args, n);
- XmStringFree(string);
- n = 0;
- XtSetArg(args[n], XmNminimum, TIMEOUT_MIN); n++;
- XtSetArg(args[n], XmNmaximum, TIMEOUT_MAX); n++;
- XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
- XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
- XtSetArg(args[n], XmNshowValue, True); n++;
- XtSetArg(args[n], XmNhighlightThickness, SCALE_HIGHLIGHT_THICKNESS); n++;
- screen.timeOutScale= XmCreateScale(screen.saverForm,"timeOutScale", args, n);
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 7, "minutes")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- screen.saverMinutesLabel= XmCreateLabelGadget(screen.saverForm,"saverMinutes", args, n);
- XmStringFree(string);
- /* Create the screen lock on/off radio buttons and label */
- /* mapped only when saver extensions are present */
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 13, "Screen Lock:")));
- XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
- XtSetArg(args[n], XmNlabelString, string); n++;
- screen.lockLabel= XmCreateLabelGadget(screen.lockForm, "lockLabel", args, n);
- XmStringFree(string);
-
- n = 0;
- XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
- screen.lockRadioBox= XmCreateRadioBox(screen.lockForm, "lockRadioBox", args, n);
-
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 10, "On")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- XtSetArg(args[n], XmNset, style.smState.smCoverScreen ? True : False); n++;
- screen.lockOn= XmCreateToggleButtonGadget(screen.lockRadioBox, "lockOn", args, n);
- XmStringFree(string);
-
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 11, "Off")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- XtSetArg(args[n], XmNset, style.smState.smCoverScreen ? False : True); n++;
- screen.lockOff= XmCreateToggleButtonGadget(screen.lockRadioBox, "lockOff", args, n);
- XmStringFree(string);
-
-
- /* Create the screen lock labels and slider */
- /* mapped only when saver extensions are present */
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 14, "Start Lock")));
- XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
- XtSetArg(args[n], XmNlabelString, string); n++;
- screen.lockOutLabel= XmCreateLabelGadget(screen.lockForm,"lockOutLabel", args, n);
- XmStringFree(string);
-
- n = 0;
- XtSetArg(args[n], XmNminimum, TIMEOUT_MIN); n++;
- XtSetArg(args[n], XmNmaximum, TIMEOUT_MAX); n++;
- XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
- XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
- XtSetArg(args[n], XmNshowValue, True); n++;
- XtSetArg(args[n], XmNhighlightThickness, SCALE_HIGHLIGHT_THICKNESS); n++;
- screen.lockOutScale= XmCreateScale(screen.lockForm,"lockOutScale", args, n);
-
-
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 7, "minutes")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- screen.lockMinutesLabel= XmCreateLabelGadget(screen.lockForm,"lockMinutes", args, n);
- XmStringFree(string);
- /* Create the radio buttons for lock savers */
- /* mapped only when saver extensions are not present */
- n = 0;
- XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
- XtSetArg(args[n], XmNspacing, 25); n++;
- screen.lockingRadioBox= XmCreateRadioBox(screen.lockForm, "lockingRadioBox", args, n);
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 21, "Use Backgrounds For Lock")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- screen.useSaversOn= XmCreateToggleButtonGadget(screen.lockingRadioBox, "useSaversOn", args, n);
- XmStringFree(string);
-
- n = 0;
- string = CMPSTR(((char *)GETMESSAGE(12, 22, "Transparent Lock")));
- XtSetArg(args[n], XmNlabelString, string); n++;
- screen.useSaversOff= XmCreateToggleButtonGadget(screen.lockingRadioBox, "useSaversOff", args, n);
- XmStringFree(string);
-
- /* add callbacks */
- /* Configure dialog based on the presence of screen saver extensions */
- if (!style.smState.smLockOnTimeoutStatus)
- {
- XtAddCallback(style.screenDialog, XmNmapCallback, no_svr_ext_formLayoutCB, NULL);
- XtAddCallback(style.screenDialog, XmNmapCallback, no_svr_ext_DtmapCB_screenDialog, shell);
- XtAddCallback(screen.systemDefault, XmNactivateCallback, no_svr_ext_systemDefaultCB, NULL);
- XtAddCallback(screen.timeOutScale, XmNvalueChangedCallback,
- no_svr_ext_timeOutvalueChangedCB, NULL);
- XtAddCallback(screen.saverOn, XmNvalueChangedCallback,
- no_svr_ext_saverToggleCB, NULL);
- XtAddCallback(screen.saverOff, XmNvalueChangedCallback,
- no_svr_ext_saverToggleCB, NULL);
- XtAddCallback(screen.useSaversOn, XmNvalueChangedCallback,
- saversToggleCB, NULL);
- XtAddCallback(screen.useSaversOff, XmNvalueChangedCallback,
- saversToggleCB, NULL);
- XtAddCallback(style.screenDialog, XmNcallback, no_svr_ext_ButtonCB, NULL);
- }
- else
- {
- XtAddCallback(style.screenDialog, XmNmapCallback, formLayoutCB, NULL);
- XtAddCallback(style.screenDialog, XmNmapCallback, _DtmapCB_screenDialog, shell);
- XtAddCallback(screen.systemDefault, XmNactivateCallback, systemDefaultCB, NULL);
- XtAddCallback(screen.timeOutScale, XmNvalueChangedCallback,
- timeOutvalueChangedCB, NULL);
- XtAddCallback(screen.lockOutScale, XmNvalueChangedCallback,
- timeOutvalueChangedCB, NULL);
- XtAddCallback(screen.saverOn, XmNvalueChangedCallback,
- saverToggleCB, NULL);
- XtAddCallback(screen.saverOff, XmNvalueChangedCallback,
- saverToggleCB, NULL);
- XtAddCallback(screen.lockOn, XmNvalueChangedCallback,
- lockToggleCB, NULL);
- XtAddCallback(screen.lockOff, XmNvalueChangedCallback,
- lockToggleCB, NULL);
- XtAddCallback(style.screenDialog, XmNcallback, ButtonCB, NULL);
- }
- XtAddCallback(style.screenDialog, XmNunmapCallback, UnmapCB, shell);
- XtAddCallback(style.screenDialog, XmNhelpCallback,
- (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_SCREEN_DIALOG);
-
- /* calculate the max label width for labels */
- if ((LabelWidth = XtWidth(screen.saverLabel)) > MaxLabelWidth)
- MaxLabelWidth = LabelWidth;
- if ((LabelWidth = XtWidth(screen.timeOutLabel)) > MaxLabelWidth)
- MaxLabelWidth = LabelWidth;
- if ((LabelWidth = XtWidth(screen.cycleTimeLabel)) > MaxLabelWidth)
- MaxLabelWidth = LabelWidth;
- if (style.smState.smLockOnTimeoutStatus)
- {
- if ((LabelWidth = XtWidth(screen.lockLabel)) > MaxLabelWidth)
- MaxLabelWidth = LabelWidth;
- if ((LabelWidth = XtWidth(screen.lockOutLabel)) > MaxLabelWidth)
- MaxLabelWidth = LabelWidth;
- }
-
- XtVaSetValues(screen.saverLabel, XmNwidth, MaxLabelWidth, NULL);
- XtVaSetValues(screen.timeOutLabel, XmNwidth, MaxLabelWidth, NULL);
- XtVaSetValues(screen.cycleTimeLabel, XmNwidth, MaxLabelWidth, NULL);
- if (style.smState.smLockOnTimeoutStatus)
- {
- XtVaSetValues(screen.lockLabel, XmNwidth, MaxLabelWidth, NULL);
- XtVaSetValues(screen.lockOutLabel, XmNwidth, MaxLabelWidth, NULL);
- }
-
- /* manage widgets */
- XtManageChildren(widget_list1,list1_count);
- XtManageChild(form);
- XtManageChild(screen.saverForm);
- XtManageChild(screen.cycleTimeLabel);
- XtManageChild(screen.cycleTimeScale);
- XtManageChild(screen.saverLabel);
- XtManageChild(screen.prevLabel);
- XtManageChild(screen.saverRadioBox);
- XtManageChild(screen.saverOn);
- XtManageChild(screen.saverOff);
- XtManageChild(screen.timeOutLabel);
- XtManageChild(screen.timeOutScale);
- XtManageChild(screen.saverMinutesLabel);
- XtManageChild(screen.saverList);
- XtManageChild(screen.saverAreaFrame);
- XtManageChild(screen.saverArea);
- XtManageChild(screen.cycleMinutesLabel);
- XtManageChild(screen.saverList);
- XtManageChild(screen.lockForm);
- /* manage the lock label, scale and minutes label only if */
- /* saver extensions are present */
- if (style.smState.smLockOnTimeoutStatus)
- {
- XtManageChild(screen.lockLabel);
- XtManageChild(screen.lockRadioBox);
- XtManageChild(screen.lockOn);
- XtManageChild(screen.lockOff);
- XtManageChild(screen.lockOutLabel);
- XtManageChild(screen.lockOutScale);
- XtManageChild(screen.lockMinutesLabel);
- }
- else
- {
- XtManageChild(screen.lockingRadioBox);
- XtManageChild(screen.useSaversOn);
- XtManageChild(screen.useSaversOff);
- }
- XtAddEventHandler(style.shell, StructureNotifyMask, False, IconHandler, NULL);
- return(style.screenDialog);
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* formLayoutCB */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- formLayoutCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int n;
- Arg args[MAX_ARGS];
- Dimension ScaleHeight;
- Dimension LabelHeight;
- Dimension RadioHeight;
- Dimension RadioOffset, ScaleOffset;
- /* calculate width and height information */
- ScaleHeight = XtHeight(screen.timeOutScale);
- LabelHeight = XtHeight(screen.timeOutLabel);
- RadioHeight = XtHeight(screen.saverRadioBox);
- RadioOffset = ((Dimension) (RadioHeight - LabelHeight) / 2) - 2;
- ScaleOffset = 0;
- /* do form attachments */
- /* Picture Label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.pictLabel, args, n);
- /* system Default */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.systemDefault, args, n);
- /* lock titlebox */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.lockFrame, args, n);
- /* lock label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.lockLabel, args, n);
- /* lock Radiobox */
- n=0;
-
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, screen.lockLabel); n++;
- XtSetArg(args[n], XmNtopOffset, -RadioOffset); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNleftWidget, screen.lockLabel); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.lockRadioBox, args, n);
- /* lockOut Label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, screen.lockLabel); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing + ScaleHeight - LabelHeight); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.lockOutLabel, args, n);
- /* lockOut Scale */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.lockOutLabel);n++;
- XtSetArg(args[n], XmNbottomOffset, ScaleOffset); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNleftWidget, screen.lockOutLabel);n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNrightWidget, screen.lockMinutesLabel);n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.lockOutScale, args, n);
- /* Minutes label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.lockOutLabel);n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.lockMinutesLabel, args, n);
- /* saver titlebox */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, screen.pictLabel); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.lockFrame); n++;
- XtSetArg(args[n], XmNbottomOffset, 2*style.verticalSpacing); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.saverFrame, args, n);
- /* cycleTime Label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.cycleTimeLabel, args, n);
- /* cycleTime Scale */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel);n++;
- XtSetArg(args[n], XmNbottomOffset, ScaleOffset);n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNleftWidget, screen.cycleTimeLabel);n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNrightWidget, screen.cycleMinutesLabel);n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.cycleTimeScale, args, n);
- /* Minutes label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel);n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.cycleMinutesLabel, args, n);
-
- /* TimeOut Label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel);n++;
- XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing + ScaleHeight - LabelHeight); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.timeOutLabel, args, n);
- /* Minutes label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.timeOutLabel);n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.saverMinutesLabel, args, n);
- /* TimeOut Scale */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.timeOutLabel);n++;
- XtSetArg(args[n], XmNbottomOffset, ScaleOffset); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNleftWidget, screen.timeOutLabel);n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNrightWidget, screen.saverMinutesLabel);n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.timeOutScale, args, n);
- /* saver label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.saverLabel, args, n);
- /* saver Radiobox */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, screen.saverLabel); n++;
- XtSetArg(args[n], XmNtopOffset, -RadioOffset); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNleftWidget, screen.saverLabel); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.saverRadioBox, args, n);
- /* preview label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, screen.saverLabel); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.prevLabel, args, n);
- /* scrolled list */
- n = 0;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg (args[n], XmNtopWidget, screen.prevLabel); n++;
- XtSetArg (args[n], XmNtopOffset, style.verticalSpacing/2); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.timeOutLabel); n++;
- XtSetArg(args[n], XmNbottomOffset, 5*style.verticalSpacing); n++;
- XtSetValues (XtParent(screen.saverList), args, n);
- /* saverArea */
- n=0;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, XtParent(screen.saverList)); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNleftWidget, XtParent(screen.saverList)); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, XtParent(screen.saverList)); n++;
- XtSetValues (screen.saverAreaFrame, args, n);
-
- XtRemoveCallback(style.screenDialog, XmNmapCallback, formLayoutCB, NULL);
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* no_svr_ext_formLayoutCB */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- no_svr_ext_formLayoutCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int n;
- Arg args[MAX_ARGS];
- Dimension ScaleHeight;
- Dimension LabelHeight;
- Dimension RadioHeight;
- Dimension RadioOffset, ScaleOffset;
-
- /* calculate width and height information */
- ScaleHeight = XtHeight(XtParent(screen.timeOutScale));
- LabelHeight = XtHeight(screen.timeOutLabel);
- RadioHeight = XtHeight(screen.saverRadioBox);
-
- RadioOffset = ((Dimension) (RadioHeight - LabelHeight) / 2) - 2;
- ScaleOffset = 0;
- /* do form attachments */
-
- /* Picture Label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.pictLabel, args, n);
-
- /* system Default */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.systemDefault, args, n);
-
-
- /* saver titlebox */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, screen.pictLabel); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.saverFrame, args, n);
- /* saver label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.saverLabel, args, n);
-
- /* saver Radiobox */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, screen.saverLabel); n++;
- XtSetArg(args[n], XmNtopOffset, -RadioOffset); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNleftWidget, screen.saverLabel); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.saverRadioBox, args, n);
-
- /* TimeOut Label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, screen.saverLabel); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing + ScaleHeight - LabelHeight); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.timeOutLabel, args, n);
-
- /* TimeOut Scale */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.timeOutLabel);n++;
- XtSetArg(args[n], XmNbottomOffset, ScaleOffset); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNleftWidget, screen.timeOutLabel);n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNrightWidget, screen.saverMinutesLabel);n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.timeOutScale, args, n);
- /* Minutes label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.timeOutLabel);n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.saverMinutesLabel, args, n);
-
- /* lock titlebox */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, screen.saverFrame); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.lockFrame, args, n);
- /* locking radiobox */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.lockingRadioBox, args, n);
- /* preview label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, screen.lockingRadioBox); n++;
- XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.prevLabel, args, n);
-
- /* cycleTime Label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetValues (screen.cycleTimeLabel, args, n);
-
- /* cycleTime Scale */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel);n++;
- XtSetArg(args[n], XmNbottomOffset, ScaleOffset); n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNleftWidget, screen.cycleTimeLabel);n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNrightWidget, screen.cycleMinutesLabel);n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.cycleTimeScale, args, n);
-
- /* Minutes label */
- n=0;
- XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel);n++;
- XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
- XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetValues (screen.cycleMinutesLabel, args, n);
-
- /* scrolled list */
- n = 0;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg (args[n], XmNtopWidget, screen.prevLabel); n++;
- XtSetArg (args[n], XmNtopOffset, style.verticalSpacing); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_NONE); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel); n++;
- XtSetArg(args[n], XmNbottomOffset, 5*style.verticalSpacing); n++;
- XtSetValues (XtParent(screen.saverList), args, n);
-
-
- /* saverArea */
- n=0;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNtopWidget, XtParent(screen.saverList)); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(args[n], XmNleftWidget, XtParent(screen.saverList)); n++;
- XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
- XtSetArg(args[n], XmNbottomWidget, XtParent(screen.saverList)); n++;
- XtSetValues (screen.saverAreaFrame, args, n);
-
-
- XtRemoveCallback(style.screenDialog, XmNmapCallback, no_svr_ext_formLayoutCB, NULL);
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* _DtmapCB_screenDialog */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- _DtmapCB_screenDialog(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- static int first_time = 1;
- int n;
- Arg args[MAX_ARGS];
- XmString string;
- Boolean lock_on, saver_on;
- if (first_time)
- {
- DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));
-
- if (!save.restoreFlag)
- putDialog ((Widget)client_data, w);
-
- /* Retrieve the value for the saver slider from xrdb */
- screen.saverTimeout_xrdb = atoi((char *)style.xrdb.timeoutScale);
- if (screen.saverTimeout_xrdb < 1)
- screen.saverTimeout_xrdb = 10;
- /* Retrieve the value for the lock slider from xrdb */
- screen.lockTimeout_xrdb = atoi((char *)style.xrdb.lockoutScale);
- if (screen.lockTimeout_xrdb < 1)
- screen.lockTimeout_xrdb = 30;
-
- /* initialize the value of savertimeout and locktimeout and cycle time to the */
- /* initial state or to the values retrieved from xrdb if the corresponding*/
- /* initial state is zero */
- if (style.smState.smSaverTimeout)
- screen.saverTimeout = style.smState.smSaverTimeout / 60;
- else
- screen.saverTimeout = screen.saverTimeout_xrdb;
-
- if (style.smState.smLockTimeout)
- screen.lockTimeout = style.smState.smLockTimeout / 60;
- else
- screen.lockTimeout = screen.lockTimeout_xrdb;
-
- if (style.smState.smCycleTimeout)
- screen.cycleTimeout = style.smState.smCycleTimeout / 60;
- else
- screen.cycleTimeout = 0;
-
- /* set the value of the scales */
- XtVaSetValues(screen.timeOutScale, XmNvalue, screen.saverTimeout, NULL);
- XtVaSetValues(screen.lockOutScale, XmNvalue, screen.lockTimeout, NULL);
- XtVaSetValues(screen.cycleTimeScale, XmNvalue, screen.cycleTimeout , NULL);
- /* set the value of the saver toggles */
- XmToggleButtonGadgetSetState(screen.saverOn,
- style.smState.smSaverTimeout ? True : False, False);
- XmToggleButtonGadgetSetState(screen.saverOff,
- !style.smState.smSaverTimeout ? True : False, False );
- XmToggleButtonGadgetSetState(screen.lockOn,
- style.smState.smLockTimeout ? True : False, False);
- XmToggleButtonGadgetSetState(screen.lockOff,
- !style.smState.smLockTimeout ? True : False, False);
- /* make saver widgets insensitive if screen saver is off */
- /* also blank out the preview label widget */
- if (XmToggleButtonGadgetGetState(screen.saverOff))
- {
- XtSetSensitive(screen.saverList, False);
- XtSetSensitive(screen.saverArea, False);
- XtSetSensitive(screen.timeOutLabel, False);
- XtSetSensitive(screen.timeOutScale, False);
- XtSetSensitive(screen.saverMinutesLabel, False);
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- XtUnmanageChild(screen.prevLabel);
- }
- /* make saver widgets sensitive if screen saver is on */
- /* also manage the preview label widget */
- if (XmToggleButtonGadgetGetState(screen.saverOn))
- {
- XtSetSensitive(screen.saverList, True);
- XtSetSensitive(screen.saverArea, True);
- XtSetSensitive(screen.timeOutLabel, True);
- XtSetSensitive(screen.timeOutScale, True);
- XtSetSensitive(screen.saverMinutesLabel, True);
- XtManageChild(screen.prevLabel);
- /* make cycletime scale sensitive if selected savers are more than 1 */
- if (savers.selsaverCount > 1)
- {
- XtSetSensitive(screen.cycleTimeLabel, True);
- XtSetSensitive(screen.cycleTimeScale, True);
- XtSetSensitive(screen.cycleMinutesLabel, True);
- }
- else
- {
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- }
- }
- /* make lock widgets insensitive if lock screen is off */
- if (XmToggleButtonGadgetGetState(screen.lockOff))
- {
- XtSetSensitive(screen.lockOutLabel, False);
- XtSetSensitive(screen.lockOutScale, False);
- XtSetSensitive(screen.lockMinutesLabel, False);
- }
- /* make lock widgets sensitive if lock screen is on */
- if (XmToggleButtonGadgetGetState(screen.lockOn))
- {
- XtSetSensitive(screen.lockOutLabel, True);
- XtSetSensitive(screen.lockOutScale, True);
- XtSetSensitive(screen.lockMinutesLabel, True);
- }
-
- if (!style.smState.smSaverTimeout)
- screen.origTimeout = screen.newTimeout = style.smState.smLockTimeout;
- else
- if (!style.smState.smLockTimeout)
- screen.origTimeout = screen.newTimeout = style.smState.smSaverTimeout;
- else
- screen.origTimeout =
- screen.newTimeout =
- MIN(style.smState.smSaverTimeout, style.smState.smLockTimeout);
-
- first_time = 0;
- }
- /* check the saver values from X - need to do this everytime dialog is mapped because */
- /* the user may have changed settings thru X while style manager has been running */
- /* if the value of the timeout retrieved from X is not equal to the new timeout set in the */
- /* style manager interface, then set both lock time and saver time scales to value retrieved from */
- /* X, otherwise leave them alone */
-
- XGetScreenSaver(style.display, &screen.xTimeout, &screen.interval,
- &screen.blanking, &screen.exposures);
-
- screen.new_blanking = DontPreferBlanking;
- if (screen.xTimeout < 0)
- screen.xTimeout = 0;
- else
- if ((screen.xTimeout < 60) && (screen.xTimeout > 1))
- screen.xTimeout = 60;
- else
- if (screen.xTimeout > TIMEOUT_MAX * 60)
- screen.xTimeout = TIMEOUT_MAX * 60;
-
- if (screen.xTimeout < 0)
- screen.xTimeout = 0;
- else
- if ((screen.xTimeout < 60) && (screen.xTimeout > 1))
- screen.xTimeout = 60;
- else
- if (screen.xTimeout > TIMEOUT_MAX * 60)
- screen.xTimeout = TIMEOUT_MAX * 60;
-
- screen.timeMismatch = False;
- if (screen.xTimeout != screen.newTimeout)
- {
- screen.timeMismatch = True;
- screen.newTimeout = screen.xTimeout;
- if (screen.xTimeout)
- {
- screen.saverTimeout = screen.xTimeout / 60;
- screen.lockTimeout = screen.xTimeout / 60;
- }
- else
- {
- screen.saverTimeout = screen.saverTimeout_xrdb;
- screen.lockTimeout = screen.lockTimeout_xrdb;
- }
- /* set the value of the saver widgets */
- XmToggleButtonGadgetSetState(screen.saverOn, screen.xTimeout ? True : False, False);
- XmToggleButtonGadgetSetState(screen.saverOff, !screen.xTimeout ? True : False, False);
- XmToggleButtonGadgetSetState(screen.lockOn, screen.xTimeout ? True : False, False);
- XmToggleButtonGadgetSetState(screen.lockOff, !screen.xTimeout ? True : False, False);
-
- /* set the value of the scales */
- XtVaSetValues(screen.timeOutScale, XmNvalue, screen.saverTimeout, NULL);
- XtVaSetValues(screen.lockOutScale, XmNvalue, screen.lockTimeout_xrdb, NULL);
-
- /* make saver widgets insensitive if screen saver is off */
- /* also blankout the preview label widget */
- if (XmToggleButtonGadgetGetState(screen.saverOff))
- {
- XtSetSensitive(screen.saverList, False);
- XtSetSensitive(screen.saverArea, False);
- XtSetSensitive(screen.timeOutLabel, False);
- XtSetSensitive(screen.timeOutScale, False);
- XtSetSensitive(screen.saverMinutesLabel, False);
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- XtUnmanageChild(screen.prevLabel);
- }
- /* make saver widgets sensitive if screen saver is on */
- /* also manage the preview label widget */
- if (XmToggleButtonGadgetGetState(screen.saverOn))
- {
- XtSetSensitive(screen.saverList, True);
- XtSetSensitive(screen.saverArea, True);
- XtSetSensitive(screen.timeOutLabel, True);
- XtSetSensitive(screen.timeOutScale, True);
- XtSetSensitive(screen.saverMinutesLabel, True);
- XtManageChild(screen.prevLabel);
- /* make cycletime scale sensitive if selected savers are more than 1 */
- if (savers.selsaverCount > 1)
- {
- XtSetSensitive(screen.cycleTimeLabel, True);
- XtSetSensitive(screen.cycleTimeScale, True);
- XtSetSensitive(screen.cycleMinutesLabel, True);
- }
- else
- {
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- }
- }
-
- /* make lock widgets insensitive if lock screen is off */
- if (XmToggleButtonGadgetGetState(screen.lockOff))
- {
- XtSetSensitive(screen.lockOutLabel, False);
- XtSetSensitive(screen.lockOutScale, False);
- XtSetSensitive(screen.lockMinutesLabel, False);
- }
- /* make lock widgets sensitive if lock screen is on */
- if (XmToggleButtonGadgetGetState(screen.lockOn))
- {
- XtSetSensitive(screen.lockOutLabel, True);
- XtSetSensitive(screen.lockOutScale, True);
- XtSetSensitive(screen.lockMinutesLabel, True);
- }
- }
-
- /* run the current screen saver only if screen saver is turned on and a valid saver exists*/
- if (XmToggleButtonGadgetGetState(screen.saverOn) && savers.saverCount && !savers.saverstate)
- {
- XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
-
- savers.saverstate = _DtSaverStart(style.display, &screen.saverArea, 1,
- savers.current_saver, style.screenDialog);
- string = XmStringCreateLocalized (savers.current_saverDesc);
- XtVaSetValues(screen.prevLabel, XmNlabelString, string, NULL);
- XmStringFree(string);
- }
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* no_svr_ext_DtmapCB_screenDialog */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- no_svr_ext_DtmapCB_screenDialog(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- static int first_time = 1;
- int n;
- Arg args[MAX_ARGS];
- XmString string;
- int mintime;
-
- if (first_time)
- {
- DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));
-
- if (!save.restoreFlag)
- putDialog ((Widget)client_data, w);
-
- /* Retrieve the value for the saver slider from xrdb */
- screen.saverTimeout_xrdb = atoi((char *)style.xrdb.timeoutScale);
- if (screen.saverTimeout_xrdb < 1)
- screen.saverTimeout_xrdb = 10;
- if (style.smState.smCycleTimeout)
- screen.cycleTimeout = style.smState.smCycleTimeout / 60;
- else
- screen.cycleTimeout = 0;
-
- /* set the value of the cycle time scale */
- XtVaSetValues(screen.cycleTimeScale, XmNvalue, screen.cycleTimeout , NULL);
-
- /* set the initial condition for the locking RadioBoxes */
-
- XmToggleButtonGadgetSetState(screen.useSaversOn,
- style.smState.smSaverTimeout ? True : False, False);
- XmToggleButtonGadgetSetState(screen.useSaversOff,
- style.smState.smSaverTimeout ? False : True, False);
- if (style.smState.smSaverTimeout)
- {
- XtSetSensitive(screen.saverList, True);
- XtSetSensitive(screen.saverArea, True);
- if (savers.selsaverCount > 1)
- {
- XtSetSensitive(screen.cycleTimeLabel, True);
- XtSetSensitive(screen.cycleTimeScale, True);
- XtSetSensitive(screen.cycleMinutesLabel, True);
- }
- else
- {
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- }
- XtManageChild(screen.prevLabel);
- SmNewSaverTime(60);
- }
- else
- {
- XtSetSensitive(screen.saverList, False);
- XtSetSensitive(screen.saverArea, False);
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- XtUnmanageChild(screen.prevLabel);
- SmNewSaverTime(0);
- }
- screen.newTimeout = screen.origTimeout = 0;
- first_time = 0;
- }
-
- /* check the saver values from X - need to do this everytime dialog is mapped because */
- /* the user may have changed settings thru X while style manager has been running */
- /* if the value of the timeout retrieved from X is not equal to the new timeout set in the */
- /* style manager interface, then set both lock time and saver time scales to value retrieved from */
- /* X, otherwise leave them alone */
-
- XGetScreenSaver(style.display, &screen.xTimeout, &screen.interval,
- &screen.blanking, &screen.exposures);
-
- screen.new_blanking = PreferBlanking;
- if (screen.xTimeout < 0)
- screen.xTimeout = 0;
- else
- if ((screen.xTimeout < 60) && (screen.xTimeout > 1))
- screen.xTimeout = 60;
- else
- if (screen.xTimeout > TIMEOUT_MAX * 60)
- screen.xTimeout = TIMEOUT_MAX * 60;
-
- if (screen.xTimeout != screen.newTimeout)
- {
- screen.origTimeout = screen.newTimeout = screen.xTimeout;
- screen.saverTimeout = screen.xTimeout / 60;
- }
-
- /* set the value of the saver widgets */
- XmToggleButtonGadgetSetState(screen.saverOn, screen.newTimeout ? True : False, False);
- XmToggleButtonGadgetSetState(screen.saverOff, !screen.newTimeout ? True : False, False);
-
- if (!screen.saverTimeout)
- screen.saverTimeout = screen.saverTimeout_xrdb;
-
- XtVaSetValues(screen.timeOutScale, XmNvalue, screen.saverTimeout, NULL);
-
- /* make saver widgets insensitive if screen saver is off */
- if (XmToggleButtonGadgetGetState(screen.saverOff))
- {
- XtSetSensitive(screen.timeOutLabel, False);
- XtSetSensitive(screen.timeOutScale, False);
- XtSetSensitive(screen.saverMinutesLabel, False);
- }
- /* make saver widgets sensitive if screen saver is on */
- if (XmToggleButtonGadgetGetState(screen.saverOn))
- {
- XtSetSensitive(screen.timeOutLabel, True);
- XtSetSensitive(screen.timeOutScale, True);
- XtSetSensitive(screen.saverMinutesLabel, True);
- }
-
-
- /* run the current screen saver only if the useSaversOn toggle is enabled and valid saver exist*/
- if (XmToggleButtonGadgetGetState(screen.useSaversOn) && savers.saverCount && !savers.saverstate)
- {
- XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
- savers.saverstate = _DtSaverStart(style.display, &screen.saverArea, 1,
- savers.current_saver, style.screenDialog);
- string = XmStringCreateLocalized (savers.current_saverDesc);
- XtVaSetValues(screen.prevLabel, XmNlabelString, string, NULL);
- XmStringFree(string);
- }
-
- }
- /*****************************************/
- /* timeOutvalueChangedCB */
- /* set the timeout to be the minimum of */
- /* the lock scale and timeout scale */
- /*****************************************/
- static void
- timeOutvalueChangedCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int n;
- Arg args[MAX_ARGS];
- n=0;
- XtSetArg(args[n], XmNvalue, &screen.saverTimeout); n++;
- XtGetValues(screen.timeOutScale, args, n);
- n=0;
- XtSetArg(args[n], XmNvalue, &screen.lockTimeout); n++;
- XtGetValues(screen.lockOutScale, args, n);
- /* set newTimeout to the min value of lock scale and saver scale */
- /* unless either screen saver or lock is off */
- if (!XmToggleButtonGadgetGetState(screen.lockOn))
- screen.newTimeout = screen.saverTimeout * 60;
- else
- if (!XmToggleButtonGadgetGetState(screen.saverOn))
- screen.newTimeout = screen.lockTimeout * 60;
- else
- screen.newTimeout = MIN(screen.saverTimeout, screen.lockTimeout) * 60;
-
- /* register new timeout with X */
- XSetScreenSaver(style.display, screen.newTimeout,
- screen.interval, screen.new_blanking, screen.exposures);
- screen.systemDefaultFlag = False;
- }
- /*****************************************/
- /* no_svr_ext_timeOutvalueChangedCB */
- /* set the timeout to be the minimum of */
- /* the lock scale and timeout scale */
- /*****************************************/
- static void
- no_svr_ext_timeOutvalueChangedCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int n;
- Arg args[MAX_ARGS];
- n=0;
- XtSetArg(args[n], XmNvalue, &screen.saverTimeout); n++;
- XtGetValues(screen.timeOutScale, args, n);
- /* set newTimeout to the value of saver scale */
- screen.newTimeout = screen.saverTimeout * 60;
-
- /* register new timeout with X */
- XSetScreenSaver(style.display, screen.newTimeout,
- screen.interval, screen.new_blanking, screen.exposures);
- screen.systemDefaultFlag = False;
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* saverToggleCB */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- saverToggleCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int n;
- Arg args[MAX_ARGS];
- Boolean set;
- XmString string;
- XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)call_data;
-
- set = (Boolean) cb->set;
-
-
- if (w == screen.saverOff && !set )
- {
- return;
- }
-
- if (w == screen.saverOff && set)
- {
- /* Terminate the screen saver that is currently running */
- if (savers.saverstate)
- {
- _DtSaverStop(style.display, savers.saverstate);
- savers.saverstate = NULL;
- XSync(style.display, False);
- XClearWindow(style.display, XtWindow(screen.saverArea));
- }
- XtSetSensitive(screen.saverList, False);
- XtSetSensitive(screen.saverArea, False);
- XtSetSensitive(screen.timeOutLabel, False);
- XtSetSensitive(screen.timeOutScale, False);
- XtSetSensitive(screen.saverMinutesLabel, False);
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- /* do not display preview string */
- XtUnmanageChild(screen.prevLabel);
- /* set the background color of the saver window to the */
- /* secondary color ID */
- XSync(style.display, False);
- XtVaSetValues(screen.saverArea, XmNbackground, savers.bg, NULL);
- XClearWindow(style.display, XtWindow(screen.saverArea));
- /* set the new timeout for the X server - note that since */
- /* screen saver is disabled, the new timeout is now the value of the */
- /* lock slider or zero if lock is disabled */
- if (XmToggleButtonGadgetGetState(screen.lockOn))
- screen.newTimeout = screen.lockTimeout * 60;
- else
- screen.newTimeout = 0;
- /* let the session manger know not to run any savers */
- SmNewSaverTime(0);
- }
-
-
- if (w == screen.saverOn && !set)
- {
- return;
- }
-
- if (w == screen.saverOn && set)
- {
- XtSetSensitive(screen.saverList, True);
- XtSetSensitive(screen.saverArea, True);
- XtSetSensitive(screen.timeOutLabel, True);
- XtSetSensitive(screen.timeOutScale, True);
- XtSetSensitive(screen.saverMinutesLabel , True);
- if (savers.selsaverCount > 1)
- {
- XtSetSensitive(screen.cycleTimeLabel, True);
- XtSetSensitive(screen.cycleTimeScale, True);
- XtSetSensitive(screen.cycleMinutesLabel, True );
- }
- else
- {
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- }
-
- if (savers.saverCount)
- {
- /* display the preview label */
- XtManageChild(screen.prevLabel);
- /* Restart the screen saver that is is currently selected */
- if (!savers.saverstate)
- {
- XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
- savers.saverstate = _DtSaverStart(style.display,
- &screen.saverArea, 1, savers.current_saver,
- style.screenDialog);
- }
- /* set the new timeout for the X server - note that since */
- /* screen saver is enabled, the new timeout is now the value of the */
- /* saver slider or the minimum of the timeout sliders */
- }
- if (!XmToggleButtonGadgetGetState(screen.lockOn))
- screen.newTimeout = screen.saverTimeout * 60;
- else
- screen.newTimeout = MIN(screen.saverTimeout, screen.lockTimeout) * 60;
- /* let the session manger know to run savers */
- SmNewSaverTime(screen.newTimeout);
- }
-
- XSetScreenSaver(style.display, screen.newTimeout,
- screen.interval, screen.new_blanking, screen.exposures);
-
- screen.systemDefaultFlag = False;
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* no_svr_ext_saverToggleCB */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- no_svr_ext_saverToggleCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int n;
- Arg args[MAX_ARGS];
- Boolean set;
- XmString string;
- XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)call_data;
- set = (Boolean) cb->set;
-
- if (w == screen.saverOff && !set )
- {
- return;
- }
- if (w == screen.saverOff && set)
- {
- XtSetSensitive(screen.timeOutLabel, False);
- XtSetSensitive(screen.timeOutScale, False);
- XtSetSensitive(screen.saverMinutesLabel, False);
- /* set the new timeout for the X server - note that since */
- /* screen saver is disabled, the new timeout is now zero */
- screen.newTimeout = 0;
- }
-
- if (w == screen.saverOn && !set)
- {
- return;
- }
-
- if (w == screen.saverOn && set)
- {
- XtSetSensitive(screen.timeOutLabel, True);
- XtSetSensitive(screen.timeOutScale, True);
- XtSetSensitive(screen.saverMinutesLabel , True);
- /* register the new timeout with the X server - note that since */
- /* screen saver is enabled, the new timeout is now the value of the */
- /* saver slider */
- screen.newTimeout = screen.saverTimeout * 60;
- }
-
- XSetScreenSaver(style.display, screen.newTimeout,
- screen.interval, screen.new_blanking, screen.exposures);
- screen.systemDefaultFlag = False;
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* lock ToggleCB */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- lockToggleCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int n;
- Arg args[MAX_ARGS];
- Boolean set;
- XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)call_data;
-
- set = (Boolean) cb->set;
-
- if (w == screen.lockOff && !set )
- {
- return;
- }
- if (w == screen.lockOff && set)
- {
- XtSetSensitive(screen.lockOutLabel, False);
- XtSetSensitive(screen.lockOutScale, False);
- XtSetSensitive(screen.lockMinutesLabel, False);
- /* register the new timeout with the X server - note that since */
- /* lock is disabled, the new timeout is now the value of the */
- /* saver slider or zero if saver is disabled */
- if (XmToggleButtonGadgetGetState(screen.saverOn))
- screen.newTimeout = screen.saverTimeout * 60;
- else
- screen.newTimeout = 0;
- XSetScreenSaver(style.display, screen.newTimeout,
- screen.interval, screen.new_blanking, screen.exposures);
- }
- if (w == screen.lockOn && !set)
- {
- return;
- }
- if (w == screen.lockOn && set)
- {
- XtSetSensitive(screen.lockOutLabel, True);
- XtSetSensitive(screen.lockOutScale, True);
- XtSetSensitive(screen.lockMinutesLabel, True);
- /* register the new timeout with the X server - note that since */
- /* lock is disabled, the new timeout is now the value of the */
- /* lock slider or the minimum of the two timeout sliders */
- if (!XmToggleButtonGadgetGetState(screen.saverOn))
- screen.newTimeout = screen.lockTimeout * 60;
- else
- screen.newTimeout = MIN(screen.saverTimeout, screen.lockTimeout) * 60;
- XSetScreenSaver(style.display, screen.newTimeout,
- screen.interval, screen.new_blanking, screen.exposures);
- }
- screen.systemDefaultFlag = False;
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* saversToggleCB */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- saversToggleCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int n;
- Arg args[MAX_ARGS];
- Boolean set;
- XmString string;
- XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)call_data;
-
- set = (Boolean) cb->set;
- if (w == screen.useSaversOff && !set )
- {
- return;
- }
- if (w == screen.useSaversOff && set)
- {
- /* Terminate the screen saver that is currently running */
- if (savers.saverstate)
- {
- _DtSaverStop(style.display, savers.saverstate);
- savers.saverstate = NULL;
- XSync(style.display, False);
- XClearWindow(style.display, XtWindow(screen.saverArea));
- }
-
- XtSetSensitive(screen.saverList, False);
- XtSetSensitive(screen.saverArea, False);
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- /* do not display preview string */
- XtUnmanageChild(screen.prevLabel);
- /* set the background color of the saver window to the */
- /* secondary color ID */
- XSync(style.display, False);
- XtVaSetValues(screen.saverArea, XmNbackground, savers.bg, NULL);
- XClearWindow(style.display, XtWindow(screen.saverArea));
- /* let the session manger know not to run any savers */
- SmNewSaverTime(0);
- }
- if (w == screen.useSaversOn && !set)
- {
- return;
- }
- if (w == screen.useSaversOn && set)
- {
- XtSetSensitive(screen.saverList, True);
- XtSetSensitive(screen.saverArea, True);
- if (savers.selsaverCount > 1)
- {
- XtSetSensitive(screen.cycleTimeLabel, True);
- XtSetSensitive(screen.cycleTimeScale, True);
- XtSetSensitive(screen.cycleMinutesLabel, True);
- }
- if (savers.saverCount)
- {
- /* display the preview label */
- XtManageChild(screen.prevLabel);
- /* Restart the screen saver that is is currently selected */
- if (!savers.saverstate)
- {
- XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
- savers.saverstate = _DtSaverStart(style.display,
- &screen.saverArea, 1, savers.current_saver, style.screenDialog);
- }
- }
- /* let the session manger know to run the savers */
- SmNewSaverTime(screen.saverTimeout*60);
-
- }
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* systemDefaultCB */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- systemDefaultCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int n;
- Arg args[MAX_ARGS];
-
- screen.saverTimeout = SAVER_DEFAULT;
- n=0;
- XtSetArg(args[n], XmNvalue, screen.saverTimeout); n++;
- XtSetValues(screen.timeOutScale, args, n);
-
- screen.lockTimeout = LOCK_DEFAULT;
- n=0;
- XtSetArg(args[n], XmNvalue, screen.lockTimeout); n++;
- XtSetValues(screen.lockOutScale, args, n);
- XmToggleButtonGadgetSetState(screen.lockOff, True, True);
-
- screen.cycleTimeout = CYCLE_DEFAULT;
- n=0;
- XtSetArg(args[n], XmNvalue, screen.cycleTimeout); n++;
- XtSetValues(screen.cycleTimeScale, args, n);
- XmToggleButtonGadgetSetState(screen.saverOn, True, True);
-
- screen.newTimeout = MIN(SAVER_DEFAULT, LOCK_DEFAULT) * 60;
- /* register new timeout with X */
- XSetScreenSaver(style.display, screen.newTimeout,
- screen.interval, screen.new_blanking, screen.exposures);
- screen.systemDefaultFlag = True;
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* no_svr_ext_systemDefaultCB */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- no_svr_ext_systemDefaultCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int n;
- Arg args[MAX_ARGS];
- screen.saverTimeout = SAVER_DEFAULT;
- n=0;
- XtSetArg(args[n], XmNvalue, screen.saverTimeout); n++;
- XtSetValues(screen.timeOutScale, args, n);
-
- screen.cycleTimeout = CYCLE_DEFAULT;
- n=0;
- XtSetArg(args[n], XmNvalue, screen.cycleTimeout); n++;
- XtSetValues(screen.cycleTimeScale, args, n);
- XmToggleButtonGadgetSetState(screen.saverOn, True, True);
- XmToggleButtonGadgetSetState(screen.useSaversOn, True, True);
- screen.newTimeout = SAVER_DEFAULT * 60;
- /* register new timeout with X */
- XSetScreenSaver(style.display, screen.newTimeout,
- screen.interval, screen.new_blanking, screen.exposures);
-
- screen.systemDefaultFlag = True;
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* ButtonCB */
- /* callback for PushButtons in DialogBox */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- ButtonCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int i, n, m;
- Arg args[MAX_ARGS];
- Boolean sel_matched = False;
- Boolean lockset;
- Boolean saverset;
- Boolean flag;
- static char screenres[48];
- int mintime;
- XtArgVal scratch;
-
- DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data;
-
- switch (cb->button_position)
- {
- case OK_BUTTON:
-
- XtUnmanageChild (w);
- /* terminate the saver that is currently running */
- if (savers.saverstate)
- {
- _DtSaverStop(style.display, savers.saverstate);
- savers.saverstate = NULL;
- }
-
- /* write saver timeout resource to xrdb to save scale value */
- /* when screen saver is turned off */
- saverset = XmToggleButtonGadgetGetState(screen.saverOn);
- if (!saverset)
- {
- sprintf (screenres, "Dtstyle*timeoutScale: %d\n", screen.saverTimeout);
- _DtAddToResource (style.display, screenres);
- }
-
- /* write lock timeout resource to xrdb to save scale value */
- /* when lock is turned off */
- lockset = XmToggleButtonGadgetGetState(screen.lockOn);
- if (!lockset)
- {
- sprintf (screenres, "Dtstyle*lockoutScale: %d\n", screen.lockTimeout);
- _DtAddToResource (style.display, screenres);
- }
- /* if sendSettings is true send message to Session Manager */
- if(style.smState.smSendSettings)
- {
- if(screen.systemDefaultFlag)
- {
- SmDefaultScreenSettings();
- }
- else
- {
-
- SmNewScreenSettings(saverset||lockset ? screen.newTimeout : 0,
- screen.new_blanking,
- screen.interval,
- screen.exposures);
- }
- }
-
-
- if (savers.saverCount)
- {
- savers.selsaverActionNames = (char **) XtMalloc(sizeof(char *) *
- savers.selsaverCount);
-
- for (i=0; i<savers.selsaverCount; i++)
- {
- char *tmp = savers.saverActionNames[savers.selPositions[i] - 1];
- savers.selsaverActionNames[i] = (char *) XtMalloc(strlen(tmp) + 1);
- strcpy(savers.selsaverActionNames[i], tmp);
- }
-
- if (savers.selsaversList != NULL)
- XtFree((char*) savers.selsaversList);
-
- savers.selsaversList = build_selectedList(savers.selsaverActionNames,
- savers.selsaverCount);
- }
-
- else
- savers.selsaversList = NULL;
- /* save the selected positions for later use */
- savers.orig_selsaverCount = savers.selsaverCount;
- if (savers.origSelPositions != NULL)
- XtFree((char *) savers.origSelPositions);
- savers.origSelPositions = (int *) XtMalloc(sizeof(int) * savers.orig_selsaverCount);
- for (i=0; i<savers.orig_selsaverCount; i++)
- savers.origSelPositions[i] = savers.selPositions[i];
- /* free the allocated selected savers */
- free_saverList(savers.selsaverActionNames, savers.selsaverCount);
- savers.selsaverActionNames = NULL;
- XtVaGetValues(screen.cycleTimeScale, XmNvalue, &scratch, NULL);
- screen.cycleTimeout = scratch;
-
- /* send new saver time, lock time and time per saver to SM if they have changed, */
- /* flag value indicates which value has changed */
-
- SmNewSaverSettings(saverset ? screen.saverTimeout*60 : 0,
- lockset ? screen.lockTimeout*60 : 0,
- screen.cycleTimeout*60,
- savers.selsaversList);
-
- style.smState.smSaverTimeout = saverset ? screen.saverTimeout*60 : 0;
- style.smState.smLockTimeout = lockset ? screen.lockTimeout*60 : 0;
- style.smState.smCycleTimeout = screen.cycleTimeout*60;
- style.smSaver.saverList = savers.selsaversList;
-
- screen.origTimeout = screen.newTimeout;
- XSetScreenSaver(style.display, style.smState.smSaverTimeout,
- style.smState.smCycleTimeout,
- screen.new_blanking,
- screen.exposures);
-
- break;
-
- case CANCEL_BUTTON:
- XtUnmanageChild(w);
-
- /* initialize the value of savertimeout and locktimeout and cycle time to the */
- /* current state or to the values retrieved from xrdb if the corresponding */
- /* initial state is zero */
- if (style.smState.smSaverTimeout)
- screen.saverTimeout = style.smState.smSaverTimeout / 60;
- else
- screen.saverTimeout = screen.saverTimeout_xrdb;
-
- if (style.smState.smLockTimeout)
- screen.lockTimeout = style.smState.smLockTimeout / 60;
- else
- screen.lockTimeout = screen.lockTimeout_xrdb;
-
- if (style.smState.smCycleTimeout)
- screen.cycleTimeout = style.smState.smCycleTimeout / 60;
- else
- screen.cycleTimeout = 0;
-
-
- /* reset the value of the scales */
- XtVaSetValues(screen.timeOutScale, XmNvalue, screen.saverTimeout, NULL);
- XtVaSetValues(screen.lockOutScale, XmNvalue, screen.lockTimeout, NULL);
- XtVaSetValues(screen.cycleTimeScale, XmNvalue, screen.cycleTimeout , NULL);
-
- /* reset the value of the saver toggles */
- XmToggleButtonGadgetSetState(screen.saverOn, style.smState.smSaverTimeout ? True : False, True);
- XmToggleButtonGadgetSetState(screen.saverOff, !style.smState.smSaverTimeout ? True : False, True);
- XmToggleButtonGadgetSetState(screen.lockOn, style.smState.smLockTimeout ? True : False, True);
- XmToggleButtonGadgetSetState(screen.lockOff, !style.smState.smLockTimeout ? True : False, True);
-
- /* reset the X timeout */
- screen.newTimeout = screen.origTimeout;
- XSetScreenSaver(style.display, screen.origTimeout, screen.interval,
- screen.blanking, screen.exposures);
-
- /* if timeMismatch is true, set the timeout to xTimeout so that the next time */
- /* the interface is mapped the correct timeouts show up */
- if (screen.timeMismatch)
- XSetScreenSaver(style.display, screen.xTimeout, screen.interval,
- screen.blanking,screen.exposures);
-
-
- if (savers.saverCount)
- {
- /* reset the list selection back to the current state */
- /* first deselect all items */
- XmListDeselectAllItems(screen.saverList);
- for (i=0; i<savers.orig_selsaverCount; i++)
- XmListSelectPos(screen.saverList, savers.origSelPositions[i], False);
- /* set the current saver to be the first saver in the selected list */
- savers.current_saver = savers.saverActionNames[savers.origSelPositions[0] - 1];
- savers.current_saverDesc = savers.saverActionDesc[savers.origSelPositions[0] - 1];
- savers.current_position = savers.origSelPositions[0];
- }
- /* Need to make sure the savers.selPositions array reflects the accurate
- current selections. If the user invokes the Screen dialog, then cancels,
- then reinvokes and OKs without making any changes to the selections, the
- savers.selPositions array is assumed to contain the accurate selections.
- Unless we reset it here to the origSelPositions, it may be inaccurate.
- */
- XtFree((char *) savers.selPositions);
- savers.selPositions = (int *) XtMalloc(sizeof(int) * savers.orig_selsaverCount);
- for (i=0; i<savers.orig_selsaverCount; i++)
- savers.selPositions[i] = savers.origSelPositions[i];
- savers.selsaverCount = savers.orig_selsaverCount;
- break;
- break;
-
-
- case HELP_BUTTON:
- XtCallCallbacks(style.screenDialog, XmNhelpCallback, (XtPointer)NULL);
- break;
-
- default:
- break;
- }
- }
- /*+++++++++++++++++++++++++++++++++++++++*/
- /* no_svr_ext_ButtonCB */
- /* callback for PushButtons in DialogBox */
- /*+++++++++++++++++++++++++++++++++++++++*/
- static void
- no_svr_ext_ButtonCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- int i, n, m;
- Arg args[MAX_ARGS];
- Boolean sel_matched = False;
- Boolean saverset;
- Boolean flag;
- static char screenres[48];
- int mintime;
- XtArgVal scratch;
-
- DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data;
-
- switch (cb->button_position)
- {
- case OK_BUTTON:
-
- XtUnmanageChild (w);
- /* terminate the saver that is currently running */
- if (savers.saverstate)
- {
- _DtSaverStop(style.display, savers.saverstate);
- savers.saverstate = NULL;
- }
-
- /* write saver timeout resource to xrdb to save scale value */
- /* when screen saver is turned off */
- saverset = XmToggleButtonGadgetGetState(screen.saverOn);
- if (!saverset)
- {
- sprintf (screenres, "Dtstyle*timeoutScale: %d\n", screen.saverTimeout);
- _DtAddToResource (style.display, screenres);
- }
-
- /* if sendSettings is true send message to Session Manager */
- if(style.smState.smSendSettings)
- {
- if(screen.systemDefaultFlag)
- {
- SmDefaultScreenSettings();
- }
- else
- {
- SmNewScreenSettings(saverset ? screen.newTimeout : 0,
- screen.new_blanking,
- screen.interval,
- screen.exposures);
- }
- }
-
- if (savers.saverCount)
- {
- savers.selsaverActionNames = (char **) XtMalloc(sizeof(char *) *
- savers.selsaverCount);
-
- for (i=0; i<savers.selsaverCount; i++)
- {
- char *tmp = savers.saverActionNames[savers.selPositions[i] - 1];
- savers.selsaverActionNames[i] = (char *) XtMalloc(strlen(tmp) + 1);
- strcpy(savers.selsaverActionNames[i], tmp);
- }
-
- if (savers.selsaversList != NULL)
- XtFree((char*) savers.selsaversList);
-
- savers.selsaversList = build_selectedList(savers.selsaverActionNames,
- savers.selsaverCount);
- }
-
- else
- savers.selsaversList = NULL;
- /* save the selected positions for later use */
- savers.orig_selsaverCount = savers.selsaverCount;
- if (savers.origSelPositions != NULL)
- XtFree((char *) savers.origSelPositions);
- savers.origSelPositions = (int *) XtMalloc(sizeof(int) * savers.orig_selsaverCount);
- for (i=0; i<savers.orig_selsaverCount; i++)
- savers.origSelPositions[i] = savers.selPositions[i];
- /* free the allocated selected savers */
- free_saverList(savers.selsaverActionNames, savers.selsaverCount);
- savers.selsaverActionNames = NULL;
- XtVaGetValues(screen.cycleTimeScale, XmNvalue, &scratch, NULL);
- screen.cycleTimeout = scratch;
-
- /* send new saver time, lock time and time per saver to SM if they have changed, */
- /* flag value indicates which value has changed */
- /* send zero to the session manger if no savers selected */
-
- if(!XmToggleButtonGadgetGetState(screen.useSaversOn))
- saverset = False;
- else
- saverset = True;
- SmNewSaverSettings(saverset ? screen.saverTimeout*60 : 0,
- style.smState.smLockTimeout,
- screen.cycleTimeout*60,
- savers.selsaversList);
-
- style.smState.smSaverTimeout = saverset ? screen.saverTimeout*60 : 0;
- style.smState.smCycleTimeout = screen.cycleTimeout*60;
- style.smSaver.saverList = savers.selsaversList;
-
- screen.origTimeout = screen.newTimeout;
- XSetScreenSaver(style.display, style.smState.smSaverTimeout,
- style.smState.smCycleTimeout,
- screen.new_blanking,
- screen.exposures);
-
- break;
-
- case CANCEL_BUTTON:
- XtUnmanageChild(w);
-
- /* initialize the value of savertimeout and cycle time to the */
- /* original value */
-
- if (screen.origTimeout)
- screen.saverTimeout = screen.origTimeout / 60;
- else
- screen.saverTimeout = screen.saverTimeout_xrdb;
-
-
- if (style.smState.smCycleTimeout)
- screen.cycleTimeout = style.smState.smCycleTimeout / 60;
- else
- screen.cycleTimeout = 0;
-
- /* reset the value of the scales */
- XtVaSetValues(screen.timeOutScale, XmNvalue, screen.saverTimeout, NULL);
- XtVaSetValues(screen.cycleTimeScale, XmNvalue, screen.cycleTimeout , NULL);
-
- /* reset the value of the saver toggles */
- XmToggleButtonGadgetSetState(screen.saverOn, screen.origTimeout ? True : False, True);
- XmToggleButtonGadgetSetState(screen.saverOff, !screen.origTimeout ? True : False, True);
- /* reset the value of the locking radio box toggles */
- if (style.smState.smSaverTimeout)
- {
- XmToggleButtonGadgetSetState(screen.useSaversOn, True, False);
- XmToggleButtonGadgetSetState(screen.useSaversOff, False, False);
- XtSetSensitive(screen.saverList, True);
- XtSetSensitive(screen.saverArea, True);
- if (savers.selsaverCount > 1)
- {
- XtSetSensitive(screen.cycleTimeLabel, True);
- XtSetSensitive(screen.cycleTimeScale, True);
- XtSetSensitive(screen.cycleMinutesLabel, True);
- }
- if (savers.saverCount)
- /* display the preview label */
- XtManageChild(screen.prevLabel);
- /* let the session manger know to run the savers */
- SmNewSaverTime(screen.saverTimeout*60);
- }
- else
- {
- XmToggleButtonGadgetSetState(screen.useSaversOff, True, False);
- XmToggleButtonGadgetSetState(screen.useSaversOn, False, False);
- XtSetSensitive(screen.saverList, False);
- XtSetSensitive(screen.saverArea, False);
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- /* do not display preview string */
- XtUnmanageChild(screen.prevLabel);
- /* set the background color of the saver window to the */
- /* secondary color ID */
- XSync(style.display, False);
- XtVaSetValues(screen.saverArea, XmNbackground, savers.bg, NULL);
- XClearWindow(style.display, XtWindow(screen.saverArea));
- /* let the session manger know not to run any savers */
- SmNewSaverTime(0);
- }
-
- /* reset the X timeout */
- screen.newTimeout = screen.origTimeout;
- XSetScreenSaver(style.display, screen.origTimeout, screen.interval,
- screen.blanking,screen.exposures);
-
- if (savers.saverCount)
- {
- /* reset the list selection back to the current state */
- /* first deselect all items */
- XmListDeselectAllItems(screen.saverList);
- for (i=0; i<savers.orig_selsaverCount; i++)
- XmListSelectPos(screen.saverList, savers.origSelPositions[i], False);
- /* set the current saver to be the first saver in the selected list */
- savers.current_saver = savers.saverActionNames[savers.origSelPositions[0] - 1];
- savers.current_saverDesc = savers.saverActionDesc[savers.origSelPositions[0] - 1];
- savers.current_position = savers.origSelPositions[0];
- }
- /* Need to make sure the savers.selPositions array reflects the accurate
- current selections. If the user invokes the Screen dialog, then cancels,
- then reinvokes and OKs without making any changes to the selections, the
- savers.selPositions array is assumed to contain the accurate selections.
- Unless we reset it here to the origSelPositions, it may be inaccurate.
- */
- XtFree((char *) savers.selPositions);
- if (savers.orig_selsaverCount > 0) {
- savers.selPositions =
- (int *) XtMalloc(sizeof(int) * savers.orig_selsaverCount);
- for (i=0; i<savers.orig_selsaverCount; i++)
- savers.selPositions[i] = savers.origSelPositions[i];
- }
-
- savers.selsaverCount = savers.orig_selsaverCount;
- break;
-
-
- case HELP_BUTTON:
- XtCallCallbacks(style.screenDialog, XmNhelpCallback, (XtPointer)NULL);
- break;
-
- default:
- break;
- }
- }
- /************************************************************************/
- /* restoreScreen() */
- /* restore any state information saved with saveScreen. */
- /* This is called from restoreSession with the application */
- /* shell and the special xrm database retrieved for restore. */
- /************************************************************************/
- void
- restoreScreen(
- Widget shell,
- XrmDatabase db )
- {
- XrmName xrm_name[5];
- XrmRepresentation rep_type;
- XrmValue value;
- xrm_name [0] = XrmStringToQuark ("Screen");
- xrm_name [2] = 0;
- /* get x position */
- xrm_name [1] = XrmStringToQuark ("x");
- if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
- XtSetArg (save.posArgs[save.poscnt], XmNx, atoi((char *)value.addr)); save.poscnt++;
- save.restoreFlag = True;
- }
- /* get y position */
- xrm_name [1] = XrmStringToQuark ("y");
- if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
- XtSetArg (save.posArgs[save.poscnt], XmNy, atoi((char *)value.addr)); save.poscnt++;
- }
- xrm_name [1] = XrmStringToQuark ("ismapped");
- XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value);
- /* Are we supposed to be mapped? */
- if (strcmp(value.addr, "True") == 0)
- popup_screenBB(shell);
- }
- /*******************************************************************************/
- /* saveScreen() */
- /* This routine will write out to the passed file descriptor any state */
- /* information this dialog needs. It is called from saveSessionCB with the */
- /* file already opened. */
- /* All information is saved in xrm format. There is no restriction */
- /* on what can be saved. It doesn't have to be defined or be part of any */
- /* widget or Xt definition. Just name and save it here and recover it in */
- /* restoreBackdrop. The suggested minimum is whether you are mapped, and your */
- /* location. */
- /*******************************************************************************/
- void
- saveScreen(
- int fd )
- {
- Position x,y;
- char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */
- XmVendorShellExtObject vendorExt;
- XmWidgetExtData extData;
- if (style.screenDialog != NULL)
- {
- if (XtIsManaged(style.screenDialog))
- sprintf(bufr, "*Screen.ismapped: True\n");
- else
- sprintf(bufr, "*Screen.ismapped: False\n");
- /* Get and write out the geometry info for our Window */
- x = XtX(XtParent(style.screenDialog));
- y = XtY(XtParent(style.screenDialog));
- /* Modify x & y to take into account window mgr frames */
- /* This is pretty bogus, but I don't know a better way to do it. */
- extData = _XmGetWidgetExtData(style.shell, XmSHELL_EXTENSION);
- vendorExt = (XmVendorShellExtObject)extData->widget;
- x -= vendorExt->vendor.xOffset;
- y -= vendorExt->vendor.yOffset;
- sprintf(bufr, "%s*Screen.x: %d\n", bufr, x);
- sprintf(bufr, "%s*Screen.y: %d\n", bufr, y);
-
- if(-1 == write (fd, bufr, strlen(bufr))) {
- perror(strerror(errno));
- }
- }
- }
- /************************************************************************/
- /* MakeListStrings() */
- /* Make XmStrings from the saver names, to pass into list. */
- /************************************************************************/
- static XmString *
- MakeListStrings( char ** list )
- {
- int i;
- XmString *xmList;
-
- xmList = (XmString *) XtMalloc(savers.saverCount * sizeof(XmString));
- for (i = 0; i < savers.saverCount; i++)
- {
- xmList[i] = XmStringCreateLocalized (list[i]);
- }
- return (xmList);
- }
- /************************************************************************/
- /* FreeListStrings() */
- /************************************************************************/
- static void
- FreeListStrings(XmString *xmlist,
- int count)
- {
- int i;
-
- for (i = 0; i < count; i++)
- {
- if (xmlist[i])
- XmStringFree(xmlist[i]);
- }
- XtFree ((char *)xmlist);
- }
- /************************************************************************/
- /* ListCB() */
- /* Get the lastly selected Screen saver client running in the preview */
- /* area. For a multiple selection by dragging, the last item in the */
- /* selection is the client that is previewed. */
- /************************************************************************/
- static void
- ListCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- XmListCallbackStruct *cb = (XmListCallbackStruct *)call_data;
- int i;
- Boolean runsaver = False;
- XmString string;
- /* If no items are left in the selection (i.e. the last selected item */
- /* was deselected) then force the previously selected item to remain */
- /* selected */
-
- if (cb->selected_item_count == 0)
- {
- XmListSelectPos(screen.saverList, cb->item_position, False);
- savers.selsaverCount = 1;
- if (savers.selPositions != NULL)
- XtFree ((char *) savers.selPositions);
- savers.selPositions = (int *) XtMalloc(sizeof(int));
- savers.selPositions[0] = cb->item_position;
- savers.current_saver = savers.saverActionNames[savers.selPositions[0] - 1];
- savers.current_saverDesc = savers.saverActionDesc[savers.selPositions[0] - 1];
- return;
- }
-
- /* make a copy of the selected item positions for later use */
-
- if (savers.selPositions != NULL)
- XtFree ((char *) savers.selPositions);
-
- savers.selPositions = (int *) XtMalloc(sizeof(int) * cb->selected_item_count);
- for (i=0; i< cb->selected_item_count; i++)
- {
- savers.selPositions[i] = cb->selected_item_positions[i];
- }
-
- savers.selsaverCount = cb->selected_item_count;
- if (savers.selsaverCount < 2)
- {
- XtSetSensitive(screen.cycleTimeScale, False);
- XtSetSensitive(screen.cycleTimeLabel, False);
- XtSetSensitive(screen.cycleMinutesLabel, False);
- }
- else
- if (savers.previous_selsaverCount < 2)
- {
- XtSetSensitive(screen.cycleTimeScale, True);
- XtSetSensitive(screen.cycleTimeLabel, True);
- XtSetSensitive(screen.cycleMinutesLabel, True);
- }
- savers.previous_selsaverCount = savers.selsaverCount;
-
- /* Find out if the item is selected or deselected. When an item */
- /* is deselected item_position is set to the deselected item which has */
- /* the keyboard focus. However, the deselected screen saver must not be */
- /* previewed. Therfore before a screen saver is started, its position must */
- /* exist in the selected_item_positions array. If not then just return without */
- /* altering the current (previewed) saver unless the deselected saver was the */
- /* current saver. In that case kill the current saver and preview the last */
- /* item from the selected list. */
- for (i=0; i<cb->selected_item_count; i++)
- {
- if(cb->selected_item_positions[i] == cb->item_position)
- runsaver=True;
- }
-
- if (!runsaver)
- {
- i = cb->selected_item_positions[(cb->selected_item_count-1)];
- if (savers.current_position == cb->item_position)
- {
- if (savers.saverstate)
- {
- /* Terminate the screen saver that is currently running */
- _DtSaverStop(style.display, savers.saverstate);
- XSync(style.display, False);
- savers.saverstate = NULL;
- }
- savers.current_saver = savers.saverActionNames[i-1];
- savers.current_saverDesc = savers.saverActionDesc[i-1];
- savers.current_position = i;
- XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
- savers.saverstate = _DtSaverStart(style.display, &screen.saverArea,
- 1, savers.current_saver, style.screenDialog);
- string = XmStringCreateLocalized (savers.current_saverDesc);
- XtVaSetValues(screen.prevLabel, XmNlabelString, string, NULL);
- XmStringFree(string);
- }
- return;
- }
-
- /* The item position returned is the selcted item */
- /* Start screen saver. _DtSaverStop() must be called to terminate the */
- /* screen saver. */
- if (savers.saverstate)
- {
- /* Terminate the screen saver that is currently running */
- _DtSaverStop(style.display, savers.saverstate);
- XSync(style.display, False);
- savers.saverstate = NULL;
- }
-
- XSync(style.display, False);
- XClearWindow(style.display, XtWindow(screen.saverArea));
- XSync(style.display, False);
- XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
-
- savers.current_position = cb->item_position;
- savers.current_saver = savers.saverActionNames[savers.current_position - 1];
- savers.current_saverDesc = savers.saverActionDesc[savers.current_position - 1];
- savers.saverstate = _DtSaverStart(style.display, &screen.saverArea, 1,
- savers.current_saver, style.screenDialog);
- /* update the preview label with the current running saver */
- XtVaSetValues(screen.prevLabel, XmNlabelString, cb->item, NULL);
- }
- /************************************************************************/
- /* IconHandler() */
- /* Kills the currently previewed saver when the user iconifies the */
- /* style manager. An XtEventHandler. */
- /************************************************************************/
- static void
- IconHandler(
- Widget shell,
- XtPointer client_data,
- XEvent *event,
- Boolean *dispatch)
- {
-
- XmString string;
- if (event->type == UnmapNotify)
- {
- /* terminate the saver that is currently running */
- if (savers.saverstate)
- {
- _DtSaverStop(style.display, savers.saverstate);
- savers.saverstate = NULL;
- }
- }
- /* run the current screen saver only if the useSaversOn/saverOn toggle is enabled
- and valid saver exist and one is not already running*/
- else if (savers.saverCount && event->type == 19 && !savers.saverstate)
- if (style.smState.smLockOnTimeoutStatus)
- {
- if (XmToggleButtonGadgetGetState(screen.saverOn) && savers.saverCount)
- {
- XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
- savers.saverstate = _DtSaverStart(style.display, &screen.saverArea, 1,
- savers.current_saver, style.screenDialog);
- string = XmStringCreateLocalized (savers.current_saverDesc);
- XtVaSetValues(screen.prevLabel, XmNlabelString, string, NULL);
- XmStringFree(string);
- }
- }
- else
- {
- if (XmToggleButtonGadgetGetState(screen.useSaversOn) && savers.saverCount)
- {
- XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
- savers.saverstate = _DtSaverStart(style.display, &screen.saverArea, 1,
- savers.current_saver, style.screenDialog);
- string = XmStringCreateLocalized (savers.current_saverDesc);
- XtVaSetValues(screen.prevLabel, XmNlabelString, string, NULL);
- XmStringFree(string);
- }
- }
- }
- /************************************************************************/
- /* UnmapCB() */
- /* Kills the currently previewed saver when the user iconifies the */
- /* style manager or unmaps the screen dialog. */
- /************************************************************************/
- static void
- UnmapCB(
- Widget w,
- XtPointer client_data,
- XtPointer call_data )
- {
- /* terminate the saver that is currently running */
- if (savers.saverstate)
- {
- _DtSaverStop(style.display, savers.saverstate);
- savers.saverstate = NULL;
- }
-
- }
|