2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /************************************<+>*************************************/
24 /****************************************************************************/
26 /** File: Screen.c **/
28 /** Project: DT 1.0 **/
30 /** Description: Controls the Dtstyle Screen dialog **/
35 /****************************************************************************/
36 /************************************<+>*************************************/
38 /*$TOG: Screen.c /main/9 1997/07/14 17:44:42 samborn $*/
41 #include <Xm/MwmUtil.h>
45 #include <Xm/DrawingA.h>
49 #include <Xm/LabelG.h>
50 #include <Xm/PushBG.h>
52 #include <Xm/RowColumn.h>
54 #include <Xm/ToggleBG.h>
55 #include <Xm/VendorSEP.h>
56 #include <Xm/Protocols.h>
62 #include <X11/Intrinsic.h>
63 #include <X11/Xutil.h>
64 #include <X11/Xatom.h>
66 #include <Dt/Action.h>
67 #include <Dt/UserMsg.h>
68 #include <Dt/SaverP.h>
69 #include <Dt/DialogBox.h>
71 #include <Dt/TitleBox.h>
72 #include <Dt/Message.h>
73 #include <Dt/HourGlass.h>
77 #include "SaveRestore.h"
80 /*+++++++++++++++++++++++++++++++++++++++*/
81 /* include extern functions */
82 /*+++++++++++++++++++++++++++++++++++++++*/
85 /*+++++++++++++++++++++++++++++++++++++++*/
87 /*+++++++++++++++++++++++++++++++++++++++*/
89 #define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
92 #define TIMEOUT_MAX 120
93 #define CYCLETIME_MIN 0
94 #define CYCLE_DEFAULT 3 /* 1-120 */
95 #define LOCK_DEFAULT 30 /* 1-120 */
96 #define SAVER_DEFAULT 10 /* 0-120 */
97 #define SAVER_HEIGHT 238
98 #define SAVER_WIDTH 298
100 /*+++++++++++++++++++++++++++++++++++++++*/
101 /* Internal Functions */
102 /*+++++++++++++++++++++++++++++++++++++++*/
104 static Widget build_screenDialog( Widget shell) ;
106 static void formLayoutCB(Widget w,
107 XtPointer client_data,
108 XtPointer call_data) ;
110 static void no_svr_ext_formLayoutCB(Widget w,
111 XtPointer client_data,
112 XtPointer call_data) ;
114 static void _DtmapCB_screenDialog(Widget w,
115 XtPointer client_data,
116 XtPointer call_data) ;
118 static void no_svr_ext_DtmapCB_screenDialog(Widget w,
119 XtPointer client_data,
120 XtPointer call_data) ;
122 static void timeOutvalueChangedCB(Widget w,
123 XtPointer client_data,
124 XtPointer call_data) ;
126 static void no_svr_ext_timeOutvalueChangedCB(Widget w,
127 XtPointer client_data,
128 XtPointer call_data) ;
130 static void saverToggleCB(Widget w,
131 XtPointer client_data,
132 XtPointer call_data) ;
134 static void no_svr_ext_saverToggleCB(Widget w,
135 XtPointer client_data,
136 XtPointer call_data) ;
138 static void saversToggleCB(Widget w,
139 XtPointer client_data,
140 XtPointer call_data) ;
142 static void lockToggleCB(Widget w,
143 XtPointer client_data,
144 XtPointer call_data) ;
146 static void systemDefaultCB(Widget w,
147 XtPointer client_data,
148 XtPointer call_data) ;
150 static void no_svr_ext_systemDefaultCB(Widget w,
151 XtPointer client_data,
152 XtPointer call_data) ;
154 static void ButtonCB(Widget w,
155 XtPointer client_data,
156 XtPointer call_data) ;
158 static void no_svr_ext_ButtonCB(Widget w,
159 XtPointer client_data,
160 XtPointer call_data) ;
162 static XmString * MakeListStrings(char **list ) ;
164 static void FreeListStrings(XmString *xmlist,
167 static void ListCB(Widget w,
168 XtPointer client_data,
169 XtPointer call_data) ;
171 static void IconHandler(Widget shell,
172 XtPointer client_data,
176 static void UnmapCB(Widget w,
177 XtPointer client_data,
178 XtPointer call_data) ;
181 /*+++++++++++++++++++++++++++++++++++++++*/
182 /* Internal Variables */
183 /*+++++++++++++++++++++++++++++++++++++++*/
186 Widget systemDefault;
190 Widget saverAreaFrame;
195 Widget saverRadioBox;
199 Widget saverMinutesLabel;
200 Widget cycleTimeLabel;
201 Widget cycleTimeScale;
202 Widget cycleMinutesLabel;
209 Widget lockingRadioBox;
212 Widget lockMinutesLabel;
213 Widget useSaversOn; /* used for graying saverList and saverArea in no saver extn mode */
214 Widget useSaversOff; /* used for graying saverList and saverArea in no saver extn mode */
218 int newTimeout; /* the min value of savertimeout and locktimeout */
219 int origTimeout; /* the original value of the min of savertimeout and locktimeout */
220 int xTimeout; /* the value of the timeout extracted from the X server */
221 Boolean timeMismatch; /* use to keep track of mismatch between xTimeout and newTimeout */
222 int saverTimeout; /* the value of savertimeout */
223 int lockTimeout; /* the value of locktimeout */
224 int cycleTimeout; /* the value of cycletimeout */
225 int saverTimeout_xrdb; /* the value of savertimeout from xrdb, in case saver is off */
226 int lockTimeout_xrdb; /* the value of locktimeout from xrdb, in case lock is off */
228 Boolean systemDefaultFlag;
230 } ScreenData; /* using the savers toggle when the saver extn is not present */
232 static ScreenData screen;
233 static saveRestore save = {FALSE, 0,};
236 char *saversList; /* list of available savers */
237 char *selsaversList; /* list of selected savers */
238 char **saverActionNames; /* array of saver names */
239 char **saverActionDesc; /* array of saver action descriptions */
240 char **selsaverActionNames; /* array of originally selected saver names */
241 int *selPositions; /* array of currently selected saver positions */
242 int *origSelPositions; /* array of originally selected saver positions */
243 int saverCount; /* number of available savers */
244 int selsaverCount; /* number of currently selected screen savers */
245 int orig_selsaverCount; /* number of originally selected screen savers */
246 int previous_selsaverCount; /* number of previously selected screen savers */
247 char *current_saver; /* name of current screen saver actions */
248 char *current_saverDesc; /* description of current screen saver actions */
249 int current_position; /* the clicked on position in the scrolled list */
250 int shadow; /* shadow width of saver area */
251 Pixel bg; /* bg color of the style manager dialogs */
252 Pixel black; /* value of the black pixel */
253 void *saverstate; /* current running screen saver state */
254 } Savers, *SaversPtr;
255 static Savers savers;
260 /*++++++++++++++++++++++++++++++++++++++++*/
261 /* build_saverList */
262 /* parses a space separated list of */
263 /* savers to build a an array of saver */
264 /* names. Returns the array and the saver */
266 /*++++++++++++++++++++++++++++++++++++++++*/
269 build_saverList(char * str,
272 char tokenSep[] = " ";
274 char ** saverList = NULL;
276 char * tmpStr, *tmpStr2;
277 int len = strlen(str);
282 tmpStr = (char *)XtCalloc(1, len + 1);
285 token = strtok(tmpStr, tokenSep);
289 token = strtok(NULL, tokenSep);
295 saverList = (char **) XtCalloc(1, i * sizeof(char *));
299 while (isspace(*tmpStr))
301 token = strtok(tmpStr, tokenSep);
305 if (DtActionExists(token))
307 saverList[*count] = (char *) XtCalloc(1, strlen( token ) + 1);
308 strcpy(saverList[*count], token);
311 tmpStr += strlen(token);
312 if (tmpStr >= tmpStr2 + len )
317 while (isspace(*tmpStr));
318 token = strtok(tmpStr, tokenSep);
323 XtFree ((char *) tmpStr2);
327 /*+++++++++++++++++++++++++++++++++++++++*/
328 /* build_selsaverList */
329 /*+++++++++++++++++++++++++++++++++++++++*/
332 build_selsaverList(char * envStr,
335 char tokenSep[] = " ";
337 char ** saverList = NULL;
340 int len = strlen(envStr);
343 tmpStr = (char *)XtCalloc(1, len + 1);
344 strcpy(tmpStr, envStr);
345 token = strtok(tmpStr, tokenSep);
349 token = strtok(NULL, tokenSep);
355 saverList = (char **) XtCalloc(1, i * sizeof(char *));
358 strcpy(tmpStr, envStr);
359 token = strtok(tmpStr, tokenSep);
363 saverList[*count] = (char *) XtCalloc(1, strlen( token ) + 1);
364 strcpy(saverList[*count], token);
365 token = strtok(NULL, tokenSep);
370 XtFree ((char *) tmpStr);
374 /*+++++++++++++++++++++++++++++++++++++++*/
375 /* build_saverDesc */
376 /*+++++++++++++++++++++++++++++++++++++++*/
379 build_saverDesc(char ** names,
382 char **saverDesc = NULL;
386 saverDesc = (char **) XtCalloc(1, count * sizeof(char *));
388 for (i=0; i<count; i++)
390 tmpstr = DtActionDescription(savers.saverActionNames[i]);
393 saverDesc[i] = (char *) XtMalloc(strlen(savers.saverActionNames[i]) + 1);
394 strcpy(saverDesc[i], savers.saverActionNames[i]);
398 saverDesc[i] = (char *) XtMalloc(strlen(tmpstr) + 1);
399 strcpy(saverDesc[i], tmpstr);
401 XtFree((char *) tmpstr);
407 /*+++++++++++++++++++++++++++++++++++++++*/
408 /* build_selectedList */
409 /* takes an array of names and a count */
410 /* and returns a space separated list */
411 /*+++++++++++++++++++++++++++++++++++++++*/
414 build_selectedList(char ** saverList,
418 char * selectedList = NULL;
424 if (saverList == NULL)
427 for (i=0; i<count; i++)
429 len += strlen(saverList[i]) + 1;
432 selectedList = (char *)XtMalloc(len + 1);
433 selectedList[0] = '\0';
434 for (i=0; i<count; i++)
436 strcat(selectedList, saverList[i]);
437 strcat(selectedList, " ");
440 return(selectedList);
444 /*+++++++++++++++++++++++++++++++++++++++*/
446 /*+++++++++++++++++++++++++++++++++++++++*/
449 free_saverList(char ** saverList,
455 if (saverList == NULL)
457 for (i=0; i<count; i++)
458 XtFree((char *) saverList[i]);
460 XtFree ((char *) saverList);
464 /*+++++++++++++++++++++++++++++++++++++++*/
466 /*+++++++++++++++++++++++++++++++++++++++*/
472 if (style.screenDialog == NULL) {
473 _DtTurnOnHourGlass(shell);
474 build_screenDialog(shell);
475 XtManageChild(style.screenDialog);
476 _DtTurnOffHourGlass(shell);
480 XtManageChild(style.screenDialog);
481 raiseWindow(XtWindow(XtParent(style.screenDialog)));
485 /*+++++++++++++++++++++++++++++++++++++++*/
486 /* build_screenDialog */
487 /*+++++++++++++++++++++++++++++++++++++++*/
492 register int i, m, n;
495 Boolean sel_matched = False;
497 int old_selsaverCount = 0;
498 Widget widget_list1[12];
499 Widget widget_list2[12];
502 XmString button_string[NUM_LABELS];
504 XmString *listStrings;
507 Dimension MaxLabelWidth = 0;
508 Dimension LabelWidth = 0;
509 Atom delete_window_atom;
510 Boolean low_res = False;
513 /* initialize saver data */
515 savers.saverstate = NULL;
516 savers.saverCount = 0;
517 savers.selsaverCount = 0;
518 savers.previous_selsaverCount = 0;
519 savers.saversList = NULL;
520 savers.selsaverActionNames = NULL;
521 savers.selPositions = NULL;
522 savers.selsaversList = NULL;
523 savers.saverActionNames = NULL;
524 savers.saverActionDesc = NULL;
525 savers.current_saver = NULL;
526 savers.current_saverDesc = NULL;
527 savers.current_position = 0;
528 savers.black = BlackPixel(style.display, DefaultScreen(XtDisplay(shell)));
530 /* load the actions data base */
533 if (_DtGetDisplayResolution(style.display, style.screenNum) == 1)
536 /* Set up DialogBoxDialog button labels */
537 button_string[0] = CMPSTR((String) _DtOkString);
538 button_string[1] = CMPSTR((String) _DtCancelString);
539 button_string[2] = CMPSTR((String) _DtHelpString);
541 /* Create toplevel DialogBox */
542 /* saveRestore - Note that save.poscnt has been initialized elsewhere. */
543 /* save.posArgs may contain information from restoreScreen().*/
545 XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS);
547 XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string);
549 XtSetArg (save.posArgs[save.poscnt], XmNdefaultPosition, False);
552 __DtCreateDialogBoxDialog(shell, "ScreenDialog", save.posArgs, save.poscnt);
554 XmStringFree(button_string[0]);
555 XmStringFree(button_string[1]);
556 XmStringFree(button_string[2]);
558 widget_list1[0] = _DtDialogBoxGetButton(style.screenDialog,2);
560 XtSetArg(args[n], XmNautoUnmanage, False); n++;
561 XtSetArg(args[n], XmNcancelButton, widget_list1[0]); n++;
562 XtSetValues (style.screenDialog, args, n);
567 XtSetArg(args[n], XmNtitle, ((char *)GETMESSAGE(12, 1, "Style Manager - Screen"))); n++;
568 XtSetArg(args[n], XmNuseAsyncGeometry, True); n++;
569 XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
570 XtSetValues (XtParent(style.screenDialog), args, n);
572 /* Create the main form */
574 XtSetArg(args[n], XmNallowOverlap, False); n++;
575 XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
576 form=XmCreateForm(style.screenDialog, "Form", args, n);
578 /* Create the visual */
580 XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
581 XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
582 XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
583 XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
584 XtSetArg(args[n], XmNstring, NULL); n++;
585 XtSetArg(args[n], XmNshadowThickness, 0); n++;
586 XtSetArg(args[n], XmNimageName, SCREEN_ICON); n++;
587 XtSetArg(args[n], XmNtraversalOn, False); n++;
588 widget_list1[list1_count++] =
589 screen.pictLabel= _DtCreateIcon(form, "screenLabelPixmap", args, n);
591 /* Create the default button */
593 XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT); n++;
594 XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++;
595 string = CMPSTR(((char *)GETMESSAGE(12, 3, "Default")));
596 XtSetArg(args[n], XmNlabelString, string); n++;
597 XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;
598 widget_list1[list1_count++] =
599 screen.systemDefault= XmCreatePushButtonGadget(form, "systemDefault", args, n);
600 XmStringFree(string);
602 /* Create the screen lock title box */
604 if (style.smState.smLockOnTimeoutStatus)
605 string = CMPSTR(((char *)GETMESSAGE(12, 8, "Screen Lock")));
607 string = CMPSTR(((char *)GETMESSAGE(12, 18, "Front Panel Lock")));
608 XtSetArg(args[n], XmNtitleString, string); n++;
609 widget_list1[list1_count++] =
610 screen.lockFrame= _DtCreateTitleBox(form, "lockFrame", args, n);
611 XmStringFree(string);
614 /* Create a form for the screen lock widgets */
616 XtSetArg(args[n], XmNallowOverlap, False); n++;
617 XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
618 screen.lockForm= XmCreateForm(screen.lockFrame, "lockForm", args, n);
621 /* Create the screen saver title box */
623 if (style.smState.smLockOnTimeoutStatus)
624 string = CMPSTR(((char *)GETMESSAGE(12, 4, "Screen Saver")));
626 string = CMPSTR(((char *)GETMESSAGE(12, 15, "Auto Screen Blanking")));
627 XtSetArg(args[n], XmNtitleString, string); n++;
628 widget_list1[list1_count++] =
629 screen.saverFrame= _DtCreateTitleBox(form, "saverFrame", args, n);
630 XmStringFree(string);
632 /* Create a form for the screen saver widgets */
634 XtSetArg(args[n], XmNallowOverlap, False); n++;
635 XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
636 screen.saverForm= XmCreateForm(screen.saverFrame, "saverForm", args, n);
639 /* Create the cycle time labels and slider */
641 if (style.smState.smLockOnTimeoutStatus)
642 string = CMPSTR(((char *)GETMESSAGE(12, 6, "Time Per Saver")));
644 string = CMPSTR(((char *)GETMESSAGE(12, 20, "Time Per Background")));
645 XtSetArg(args[n], XmNlabelString, string); n++;
646 /* only if saver extensions are present */
647 if (style.smState.smLockOnTimeoutStatus)
648 screen.cycleTimeLabel = XmCreateLabelGadget(screen.saverForm,"cycleTimeLabel", args, n);
650 screen.cycleTimeLabel = XmCreateLabelGadget(screen.lockForm,"cycleTimeLabel", args, n);
651 XmStringFree(string);
654 XtSetArg(args[n], XmNminimum, CYCLETIME_MIN); n++;
655 XtSetArg(args[n], XmNmaximum, TIMEOUT_MAX); n++;
656 XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
657 XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
658 XtSetArg(args[n], XmNshowValue, True); n++;
659 XtSetArg(args[n], XmNhighlightThickness, SCALE_HIGHLIGHT_THICKNESS); n++;
660 if (style.smState.smLockOnTimeoutStatus)
661 screen.cycleTimeScale= XmCreateScale(screen.saverForm,"cycleTimeScale", args, n);
663 screen.cycleTimeScale= XmCreateScale(screen.lockForm,"cycleTimeScale", args, n);
666 string = CMPSTR(((char *)GETMESSAGE(12, 7, "minutes")));
667 XtSetArg(args[n], XmNlabelString, string); n++;
668 if (style.smState.smLockOnTimeoutStatus)
669 screen.cycleMinutesLabel= XmCreateLabelGadget(screen.saverForm,"cycleMinutes", args, n);
671 screen.cycleMinutesLabel= XmCreateLabelGadget(screen.lockForm,"cycleMinutes", args, n);
672 XmStringFree(string);
674 /* Create the screen saver on/off radio buttons and label */
676 if (style.smState.smLockOnTimeoutStatus)
677 string = CMPSTR(((char *)GETMESSAGE(12, 12, "Screen Saver:")));
679 string = CMPSTR(((char *)GETMESSAGE(12, 16, "Screen Blanker:")));
680 XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
681 XtSetArg(args[n], XmNlabelString, string); n++;
682 screen.saverLabel= XmCreateLabelGadget(screen.saverForm, "saverLabel", args, n);
683 XmStringFree(string);
686 XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
687 screen.saverRadioBox= XmCreateRadioBox(screen.saverForm, "saverRadioBox", args, n);
690 string = CMPSTR(((char *)GETMESSAGE(12, 10, "On")));
691 XtSetArg(args[n], XmNlabelString, string); n++;
692 screen.saverOn= XmCreateToggleButtonGadget(screen.saverRadioBox, "saverOn", args, n);
693 XmStringFree(string);
696 string = CMPSTR(((char *)GETMESSAGE(12, 11, "Off")));
697 XtSetArg(args[n], XmNlabelString, string); n++;
698 screen.saverOff= XmCreateToggleButtonGadget(screen.saverRadioBox, "saverOff", args, n);
699 XmStringFree(string);
701 /* Create the screen saver list */
703 XtSetArg (args[n], XmNautomaticSelection, True); n++;
704 XtSetArg (args[n], XmNselectionPolicy, XmMULTIPLE_SELECT); n++;
705 XtSetArg (args[n], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); n++;
707 XtSetArg (args[n], XmNheight, 100); n++; }
709 XtSetArg (args[n], XmNheight, SAVER_HEIGHT); n++; }
710 XtSetArg (args[n], XmNhighlightColor, 0); n++;
711 /* choose the parent of saverList depending on the presence of saver extensions */
712 if (style.smState.smLockOnTimeoutStatus)
713 screen.saverList = XmCreateScrolledList (screen.saverForm, "saversList", args, n);
715 screen.saverList = XmCreateScrolledList (screen.lockForm, "saversList", args, n);
716 /* use the environment variable DTSCREENSAVERLIST to get the list of */
717 /* available screen saver actions, load them into the scrolled list*/
718 savers.saversList = getenv ("DTSCREENSAVERLIST");
719 /* if DTSCREENSAVER is not set, set saver count to zero */
720 if (savers.saversList == NULL) {
721 savers.saverCount = 0;
722 savers.selsaverCount=0;
724 savers.saverActionNames = build_saverList(savers.saversList, &savers.saverCount);
725 savers.saverActionDesc = build_saverDesc(savers.saverActionNames, savers.saverCount);
726 /* convert to XmString */
727 listStrings = MakeListStrings(savers.saverActionDesc);
728 XmListAddItems (screen.saverList, listStrings, savers.saverCount, 0);
729 XtAddCallback (screen.saverList, XmNmultipleSelectionCallback,
730 ListCB, (XtPointer)NULL);
731 FreeListStrings (listStrings, savers.saverCount);
733 /* check the state to see which item(s) should be selected, if none are */
734 /* selected or if none in the selected list match the available list then */
735 /* set the selection to the last position by default. This should be blank */
736 /* if the DTSCREENSAVERLIST environment variable is set to default */
737 savers.selsaverActionNames =
738 build_selsaverList(style.smSaver.saverList, &savers.selsaverCount);
740 /* since savers.selsaverCount may be changed below, we save */
741 /* number of originally selected savers in order to accurately free the */
742 /* savers.selsaverActionNames array below. */
743 old_selsaverCount = savers.selsaverCount;
745 if (savers.selsaverCount) {
746 savers.selPositions = (int *) XtMalloc(sizeof(int) * savers.selsaverCount);
747 for (n=0; n<savers.selsaverCount; n++) {
748 /* determine if this selected saver matches one in valid saver list */
749 for (m=0; (m < savers.saverCount) &&
750 ((sel_found = strcmp(savers.selsaverActionNames[n],
751 savers.saverActionNames[m])) != 0); m++) {}
752 if (sel_found == 0) {
753 XmListSelectPos (screen.saverList, m+1, False);
754 savers.selPositions[n]=m+1;
757 /* This selected saver isn't valid, need to get rid of it.
758 Do this by shifting each selected saver in the array
759 back one position, i.e. n = n+1, n+1 = n+2, ....
760 This overwrites the nth element and leaves the empty
761 space at the end of the array. */
762 for (i=n; i < (savers.selsaverCount - 1); i++)
763 savers.selsaverActionNames[i] = savers.selsaverActionNames[i+1];
765 /* reduce # of selected savers */
766 savers.selsaverCount--;
768 /* reset selected saver array position counter back one position for
771 } /* if (sel_found == 0) */
772 } /* for n<savers.selsaverCount */
773 } /* if (savers.selsaverCount) */
775 /* if there are still savers selected that match valid saver names */
776 if (savers.selsaverCount) {
777 /* set current saver to first selection */
778 savers.current_saver = savers.saverActionNames[savers.selPositions[0] - 1];
779 savers.current_saverDesc = savers.saverActionDesc[savers.selPositions[0] - 1];
780 savers.current_position = savers.selPositions[0];
782 /* highlight last saver */
783 XmListSelectPos (screen.saverList, savers.saverCount, False);
785 /* set current saver to last one */
786 savers.current_saver = savers.saverActionNames[savers.saverCount - 1];
787 savers.current_saverDesc = savers.saverActionDesc[savers.saverCount - 1];
789 savers.selPositions = (int *) XtMalloc(sizeof(int));
790 savers.selPositions[0] = savers.saverCount;
791 savers.selsaverCount = 1;
792 savers.current_position = 1;
794 /* save the selected positions for later use */
795 savers.origSelPositions = (int *) XtMalloc(sizeof(int) * savers.selsaverCount);
796 for (i=0; i<savers.selsaverCount; i++)
797 savers.origSelPositions[i] = savers.selPositions[i];
798 savers.orig_selsaverCount = savers.selsaverCount;
800 savers.previous_selsaverCount = savers.selsaverCount;
801 free_saverList(savers.selsaverActionNames, old_selsaverCount);
804 /* Create frame for the saver area */
806 XtSetArg (args[n], XmNshadowType, XmSHADOW_IN); n++;
807 XtSetArg (args[n], XmNshadowThickness, savers.shadow); n++;
808 XtSetArg (args[n], XmNhighlightThickness, 0); n++;
809 XtSetArg (args[n], XmNtraversalOn, False); n++;
810 /* depending on the presence of saver extensions choose the parent of saverAreaFrame */
811 if (style.smState.smLockOnTimeoutStatus)
812 screen.saverAreaFrame = XmCreateFrame(screen.saverForm, "saverAreaFrame", args, n);
814 screen.saverAreaFrame = XmCreateFrame(screen.lockForm, "saverAreaFrame", args, n);
816 /* Create saver area for the screen savers */
818 XtSetArg (args[n], XmNtraversalOn, False); n++;
820 XtSetArg (args[n], XmNwidth, 180); n++; }
822 XtSetArg (args[n], XmNwidth, SAVER_WIDTH); n++; }
823 screen.saverArea = XmCreateDrawingArea (screen.saverAreaFrame, "saverArea", args, n);
824 /* get the initial secondary color pixel value for dtstyle for later use */
825 XtVaGetValues(screen.saverArea, XmNbackground, &scratch, NULL);
826 savers.bg = (Pixel)scratch;
828 /* label for the previewed saver */
830 if (savers.saverCount)
831 string = XmStringCreateLocalized (savers.current_saverDesc);
833 string = XmStringCreateLocalized (" ");
834 XtSetArg(args[n], XmNlabelString, string); n++;
835 if (style.smState.smLockOnTimeoutStatus)
836 screen.prevLabel = XmCreateLabelGadget(screen.saverForm,"prevLabel", args, n);
838 screen.prevLabel = XmCreateLabelGadget(screen.lockForm,"prevLabel", args, n);
839 XmStringFree(string);
841 /* Create the screen saver labels and slider */
843 if (style.smState.smLockOnTimeoutStatus)
844 string = CMPSTR(((char *)GETMESSAGE(12, 5, "Start Saver")));
846 string = CMPSTR(((char *)GETMESSAGE(12, 17, "Start Blanker")));
847 XtSetArg(args[n], XmNlabelString, string); n++;
848 XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
849 screen.timeOutLabel= XmCreateLabelGadget(screen.saverForm,"timeOutLabel", args, n);
850 XmStringFree(string);
853 XtSetArg(args[n], XmNminimum, TIMEOUT_MIN); n++;
854 XtSetArg(args[n], XmNmaximum, TIMEOUT_MAX); n++;
855 XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
856 XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
857 XtSetArg(args[n], XmNshowValue, True); n++;
858 XtSetArg(args[n], XmNhighlightThickness, SCALE_HIGHLIGHT_THICKNESS); n++;
859 screen.timeOutScale= XmCreateScale(screen.saverForm,"timeOutScale", args, n);
862 string = CMPSTR(((char *)GETMESSAGE(12, 7, "minutes")));
863 XtSetArg(args[n], XmNlabelString, string); n++;
864 screen.saverMinutesLabel= XmCreateLabelGadget(screen.saverForm,"saverMinutes", args, n);
865 XmStringFree(string);
867 /* Create the screen lock on/off radio buttons and label */
868 /* mapped only when saver extensions are present */
870 string = CMPSTR(((char *)GETMESSAGE(12, 13, "Screen Lock:")));
871 XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
872 XtSetArg(args[n], XmNlabelString, string); n++;
873 screen.lockLabel= XmCreateLabelGadget(screen.lockForm, "lockLabel", args, n);
874 XmStringFree(string);
877 XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
878 screen.lockRadioBox= XmCreateRadioBox(screen.lockForm, "lockRadioBox", args, n);
881 string = CMPSTR(((char *)GETMESSAGE(12, 10, "On")));
882 XtSetArg(args[n], XmNlabelString, string); n++;
883 XtSetArg(args[n], XmNset, style.smState.smCoverScreen ? True : False); n++;
884 screen.lockOn= XmCreateToggleButtonGadget(screen.lockRadioBox, "lockOn", args, n);
885 XmStringFree(string);
888 string = CMPSTR(((char *)GETMESSAGE(12, 11, "Off")));
889 XtSetArg(args[n], XmNlabelString, string); n++;
890 XtSetArg(args[n], XmNset, style.smState.smCoverScreen ? False : True); n++;
891 screen.lockOff= XmCreateToggleButtonGadget(screen.lockRadioBox, "lockOff", args, n);
892 XmStringFree(string);
895 /* Create the screen lock labels and slider */
896 /* mapped only when saver extensions are present */
898 string = CMPSTR(((char *)GETMESSAGE(12, 14, "Start Lock")));
899 XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
900 XtSetArg(args[n], XmNlabelString, string); n++;
901 screen.lockOutLabel= XmCreateLabelGadget(screen.lockForm,"lockOutLabel", args, n);
902 XmStringFree(string);
905 XtSetArg(args[n], XmNminimum, TIMEOUT_MIN); n++;
906 XtSetArg(args[n], XmNmaximum, TIMEOUT_MAX); n++;
907 XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
908 XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
909 XtSetArg(args[n], XmNshowValue, True); n++;
910 XtSetArg(args[n], XmNhighlightThickness, SCALE_HIGHLIGHT_THICKNESS); n++;
911 screen.lockOutScale= XmCreateScale(screen.lockForm,"lockOutScale", args, n);
915 string = CMPSTR(((char *)GETMESSAGE(12, 7, "minutes")));
916 XtSetArg(args[n], XmNlabelString, string); n++;
917 screen.lockMinutesLabel= XmCreateLabelGadget(screen.lockForm,"lockMinutes", args, n);
918 XmStringFree(string);
920 /* Create the radio buttons for lock savers */
921 /* mapped only when saver extensions are not present */
923 XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
924 XtSetArg(args[n], XmNspacing, 25); n++;
925 screen.lockingRadioBox= XmCreateRadioBox(screen.lockForm, "lockingRadioBox", args, n);
928 string = CMPSTR(((char *)GETMESSAGE(12, 21, "Use Backgrounds For Lock")));
929 XtSetArg(args[n], XmNlabelString, string); n++;
930 screen.useSaversOn= XmCreateToggleButtonGadget(screen.lockingRadioBox, "useSaversOn", args, n);
931 XmStringFree(string);
936 string = CMPSTR(((char *)GETMESSAGE(12, 22, "Transparent Lock")));
937 XtSetArg(args[n], XmNlabelString, string); n++;
938 screen.useSaversOff= XmCreateToggleButtonGadget(screen.lockingRadioBox, "useSaversOff", args, n);
939 XmStringFree(string);
943 /* Configure dialog based on the presence of screen saver extensions */
944 if (!style.smState.smLockOnTimeoutStatus)
946 XtAddCallback(style.screenDialog, XmNmapCallback, no_svr_ext_formLayoutCB, NULL);
947 XtAddCallback(style.screenDialog, XmNmapCallback, no_svr_ext_DtmapCB_screenDialog, shell);
948 XtAddCallback(screen.systemDefault, XmNactivateCallback, no_svr_ext_systemDefaultCB, NULL);
949 XtAddCallback(screen.timeOutScale, XmNvalueChangedCallback,
950 no_svr_ext_timeOutvalueChangedCB, NULL);
951 XtAddCallback(screen.saverOn, XmNvalueChangedCallback,
952 no_svr_ext_saverToggleCB, NULL);
953 XtAddCallback(screen.saverOff, XmNvalueChangedCallback,
954 no_svr_ext_saverToggleCB, NULL);
955 XtAddCallback(screen.useSaversOn, XmNvalueChangedCallback,
956 saversToggleCB, NULL);
957 XtAddCallback(screen.useSaversOff, XmNvalueChangedCallback,
958 saversToggleCB, NULL);
960 XtAddCallback(style.screenDialog, XmNcallback, no_svr_ext_ButtonCB, NULL);
964 XtAddCallback(style.screenDialog, XmNmapCallback, formLayoutCB, NULL);
965 XtAddCallback(style.screenDialog, XmNmapCallback, _DtmapCB_screenDialog, shell);
966 XtAddCallback(screen.systemDefault, XmNactivateCallback, systemDefaultCB, NULL);
967 XtAddCallback(screen.timeOutScale, XmNvalueChangedCallback,
968 timeOutvalueChangedCB, NULL);
969 XtAddCallback(screen.lockOutScale, XmNvalueChangedCallback,
970 timeOutvalueChangedCB, NULL);
971 XtAddCallback(screen.saverOn, XmNvalueChangedCallback,
972 saverToggleCB, NULL);
973 XtAddCallback(screen.saverOff, XmNvalueChangedCallback,
974 saverToggleCB, NULL);
975 XtAddCallback(screen.lockOn, XmNvalueChangedCallback,
977 XtAddCallback(screen.lockOff, XmNvalueChangedCallback,
979 XtAddCallback(style.screenDialog, XmNcallback, ButtonCB, NULL);
981 XtAddCallback(style.screenDialog, XmNunmapCallback, UnmapCB, shell);
982 XtAddCallback(style.screenDialog, XmNhelpCallback,
983 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_SCREEN_DIALOG);
985 /* calculate the max label width for labels */
986 if ((LabelWidth = XtWidth(screen.saverLabel)) > MaxLabelWidth)
987 MaxLabelWidth = LabelWidth;
988 if ((LabelWidth = XtWidth(screen.timeOutLabel)) > MaxLabelWidth)
989 MaxLabelWidth = LabelWidth;
990 if ((LabelWidth = XtWidth(screen.cycleTimeLabel)) > MaxLabelWidth)
991 MaxLabelWidth = LabelWidth;
992 if (style.smState.smLockOnTimeoutStatus)
994 if ((LabelWidth = XtWidth(screen.lockLabel)) > MaxLabelWidth)
995 MaxLabelWidth = LabelWidth;
996 if ((LabelWidth = XtWidth(screen.lockOutLabel)) > MaxLabelWidth)
997 MaxLabelWidth = LabelWidth;
1000 XtVaSetValues(screen.saverLabel, XmNwidth, MaxLabelWidth, NULL);
1001 XtVaSetValues(screen.timeOutLabel, XmNwidth, MaxLabelWidth, NULL);
1002 XtVaSetValues(screen.cycleTimeLabel, XmNwidth, MaxLabelWidth, NULL);
1003 if (style.smState.smLockOnTimeoutStatus)
1005 XtVaSetValues(screen.lockLabel, XmNwidth, MaxLabelWidth, NULL);
1006 XtVaSetValues(screen.lockOutLabel, XmNwidth, MaxLabelWidth, NULL);
1009 /* manage widgets */
1010 XtManageChildren(widget_list1,list1_count);
1011 XtManageChild(form);
1012 XtManageChild(screen.saverForm);
1013 XtManageChild(screen.cycleTimeLabel);
1014 XtManageChild(screen.cycleTimeScale);
1015 XtManageChild(screen.saverLabel);
1016 XtManageChild(screen.prevLabel);
1017 XtManageChild(screen.saverRadioBox);
1018 XtManageChild(screen.saverOn);
1019 XtManageChild(screen.saverOff);
1020 XtManageChild(screen.timeOutLabel);
1021 XtManageChild(screen.timeOutScale);
1022 XtManageChild(screen.saverMinutesLabel);
1023 XtManageChild(screen.saverList);
1024 XtManageChild(screen.saverAreaFrame);
1025 XtManageChild(screen.saverArea);
1026 XtManageChild(screen.cycleMinutesLabel);
1027 XtManageChild(screen.saverList);
1028 XtManageChild(screen.lockForm);
1029 /* manage the lock label, scale and minutes label only if */
1030 /* saver extensions are present */
1031 if (style.smState.smLockOnTimeoutStatus)
1033 XtManageChild(screen.lockLabel);
1034 XtManageChild(screen.lockRadioBox);
1035 XtManageChild(screen.lockOn);
1036 XtManageChild(screen.lockOff);
1037 XtManageChild(screen.lockOutLabel);
1038 XtManageChild(screen.lockOutScale);
1039 XtManageChild(screen.lockMinutesLabel);
1043 XtManageChild(screen.lockingRadioBox);
1044 XtManageChild(screen.useSaversOn);
1045 XtManageChild(screen.useSaversOff);
1047 XtAddEventHandler(style.shell, StructureNotifyMask, False, IconHandler, NULL);
1049 return(style.screenDialog);
1053 /*+++++++++++++++++++++++++++++++++++++++*/
1055 /*+++++++++++++++++++++++++++++++++++++++*/
1059 XtPointer client_data,
1060 XtPointer call_data )
1064 Dimension ScaleHeight;
1065 Dimension LabelHeight;
1066 Dimension RadioHeight;
1067 Dimension RadioOffset, ScaleOffset;
1069 /* calculate width and height information */
1070 ScaleHeight = XtHeight(screen.timeOutScale);
1071 LabelHeight = XtHeight(screen.timeOutLabel);
1072 RadioHeight = XtHeight(screen.saverRadioBox);
1073 RadioOffset = ((Dimension) (RadioHeight - LabelHeight) / 2) - 2;
1076 /* do form attachments */
1080 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
1081 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1082 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1083 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1084 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1085 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1086 XtSetValues (screen.pictLabel, args, n);
1088 /* system Default */
1090 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
1091 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1092 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1093 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
1094 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1095 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1096 XtSetValues (screen.systemDefault, args, n);
1100 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1101 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
1102 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
1103 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1104 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1105 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1106 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1107 XtSetValues (screen.lockFrame, args, n);
1112 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
1113 XtSetArg (args[n], XmNtopOffset, style.verticalSpacing); n++;
1114 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1115 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1116 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1117 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1118 XtSetValues (screen.lockLabel, args, n);
1124 XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1125 XtSetArg(args[n], XmNtopWidget, screen.lockLabel); n++;
1126 XtSetArg(args[n], XmNtopOffset, -RadioOffset); n++;
1127 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1128 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1129 XtSetArg(args[n], XmNleftWidget, screen.lockLabel); n++;
1130 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1131 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1132 XtSetValues (screen.lockRadioBox, args, n);
1137 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1138 XtSetArg(args[n], XmNtopWidget, screen.lockLabel); n++;
1139 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing + ScaleHeight - LabelHeight); n++;
1140 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1141 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1142 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1143 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1144 XtSetValues (screen.lockOutLabel, args, n);
1149 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1150 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1151 XtSetArg(args[n], XmNbottomWidget, screen.lockOutLabel);n++;
1152 XtSetArg(args[n], XmNbottomOffset, ScaleOffset); n++;
1153 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1154 XtSetArg(args[n], XmNleftWidget, screen.lockOutLabel);n++;
1155 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1156 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
1157 XtSetArg(args[n], XmNrightWidget, screen.lockMinutesLabel);n++;
1158 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1159 XtSetValues (screen.lockOutScale, args, n);
1164 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1165 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1166 XtSetArg(args[n], XmNbottomWidget, screen.lockOutLabel);n++;
1167 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
1168 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1169 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1170 XtSetValues (screen.lockMinutesLabel, args, n);
1173 /* saver titlebox */
1175 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1176 XtSetArg(args[n], XmNtopWidget, screen.pictLabel); n++;
1177 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1178 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
1179 XtSetArg(args[n], XmNbottomWidget, screen.lockFrame); n++;
1180 XtSetArg(args[n], XmNbottomOffset, 2*style.verticalSpacing); n++;
1181 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1182 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1183 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1184 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1185 XtSetValues (screen.saverFrame, args, n);
1187 /* cycleTime Label */
1189 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1190 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
1191 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
1192 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1193 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1194 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1195 XtSetValues (screen.cycleTimeLabel, args, n);
1197 /* cycleTime Scale */
1199 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1200 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1201 XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel);n++;
1202 XtSetArg(args[n], XmNbottomOffset, ScaleOffset);n++;
1203 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1204 XtSetArg(args[n], XmNleftWidget, screen.cycleTimeLabel);n++;
1205 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1206 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
1207 XtSetArg(args[n], XmNrightWidget, screen.cycleMinutesLabel);n++;
1208 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1209 XtSetValues (screen.cycleTimeScale, args, n);
1213 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1214 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1215 XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel);n++;
1216 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
1217 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1218 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1219 XtSetValues (screen.cycleMinutesLabel, args, n);
1223 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1224 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
1225 XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel);n++;
1226 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing + ScaleHeight - LabelHeight); n++;
1227 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1228 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1229 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1230 XtSetValues (screen.timeOutLabel, args, n);
1234 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1235 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1236 XtSetArg(args[n], XmNbottomWidget, screen.timeOutLabel);n++;
1237 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
1238 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1239 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1240 XtSetValues (screen.saverMinutesLabel, args, n);
1244 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1245 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1246 XtSetArg(args[n], XmNbottomWidget, screen.timeOutLabel);n++;
1247 XtSetArg(args[n], XmNbottomOffset, ScaleOffset); n++;
1248 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1249 XtSetArg(args[n], XmNleftWidget, screen.timeOutLabel);n++;
1250 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1251 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
1252 XtSetArg(args[n], XmNrightWidget, screen.saverMinutesLabel);n++;
1253 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1254 XtSetValues (screen.timeOutScale, args, n);
1258 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
1259 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1260 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1261 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1262 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1263 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1264 XtSetValues (screen.saverLabel, args, n);
1267 /* saver Radiobox */
1269 XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1270 XtSetArg(args[n], XmNtopWidget, screen.saverLabel); n++;
1271 XtSetArg(args[n], XmNtopOffset, -RadioOffset); n++;
1272 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1273 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1274 XtSetArg(args[n], XmNleftWidget, screen.saverLabel); n++;
1275 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1276 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1277 XtSetValues (screen.saverRadioBox, args, n);
1282 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1283 XtSetArg(args[n], XmNtopWidget, screen.saverLabel); n++;
1284 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1285 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1286 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
1287 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1288 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1289 XtSetValues (screen.prevLabel, args, n);
1293 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1294 XtSetArg (args[n], XmNtopWidget, screen.prevLabel); n++;
1295 XtSetArg (args[n], XmNtopOffset, style.verticalSpacing/2); n++;
1296 XtSetArg (args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1297 XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1298 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1299 XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
1300 XtSetArg(args[n], XmNbottomWidget, screen.timeOutLabel); n++;
1301 XtSetArg(args[n], XmNbottomOffset, 5*style.verticalSpacing); n++;
1302 XtSetValues (XtParent(screen.saverList), args, n);
1307 XtSetArg (args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1308 XtSetArg(args[n], XmNtopWidget, XtParent(screen.saverList)); n++;
1309 XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1310 XtSetArg(args[n], XmNleftWidget, XtParent(screen.saverList)); n++;
1311 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1312 XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1313 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1314 XtSetArg (args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1315 XtSetArg(args[n], XmNbottomWidget, XtParent(screen.saverList)); n++;
1316 XtSetValues (screen.saverAreaFrame, args, n);
1319 XtRemoveCallback(style.screenDialog, XmNmapCallback, formLayoutCB, NULL);
1323 /*+++++++++++++++++++++++++++++++++++++++*/
1324 /* no_svr_ext_formLayoutCB */
1325 /*+++++++++++++++++++++++++++++++++++++++*/
1327 no_svr_ext_formLayoutCB(
1329 XtPointer client_data,
1330 XtPointer call_data )
1334 Dimension ScaleHeight;
1335 Dimension LabelHeight;
1336 Dimension RadioHeight;
1337 Dimension RadioOffset, ScaleOffset;
1339 /* calculate width and height information */
1340 ScaleHeight = XtHeight(XtParent(screen.timeOutScale));
1341 LabelHeight = XtHeight(screen.timeOutLabel);
1342 RadioHeight = XtHeight(screen.saverRadioBox);
1344 RadioOffset = ((Dimension) (RadioHeight - LabelHeight) / 2) - 2;
1346 /* do form attachments */
1350 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
1351 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1352 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1353 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1354 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1355 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1356 XtSetValues (screen.pictLabel, args, n);
1358 /* system Default */
1360 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
1361 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1362 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1363 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
1364 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1365 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1366 XtSetValues (screen.systemDefault, args, n);
1369 /* saver titlebox */
1371 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1372 XtSetArg(args[n], XmNtopWidget, screen.pictLabel); n++;
1373 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1374 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1375 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1376 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1377 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1378 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1379 XtSetValues (screen.saverFrame, args, n);
1383 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
1384 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1385 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1386 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1387 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1388 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1389 XtSetValues (screen.saverLabel, args, n);
1391 /* saver Radiobox */
1393 XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1394 XtSetArg(args[n], XmNtopWidget, screen.saverLabel); n++;
1395 XtSetArg(args[n], XmNtopOffset, -RadioOffset); n++;
1396 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1397 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1398 XtSetArg(args[n], XmNleftWidget, screen.saverLabel); n++;
1399 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1400 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1401 XtSetValues (screen.saverRadioBox, args, n);
1405 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1406 XtSetArg(args[n], XmNtopWidget, screen.saverLabel); n++;
1407 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing + ScaleHeight - LabelHeight); n++;
1408 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1409 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1410 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1411 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1412 XtSetValues (screen.timeOutLabel, args, n);
1416 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1417 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1418 XtSetArg(args[n], XmNbottomWidget, screen.timeOutLabel);n++;
1419 XtSetArg(args[n], XmNbottomOffset, ScaleOffset); n++;
1420 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1421 XtSetArg(args[n], XmNleftWidget, screen.timeOutLabel);n++;
1422 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1423 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
1424 XtSetArg(args[n], XmNrightWidget, screen.saverMinutesLabel);n++;
1425 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1426 XtSetValues (screen.timeOutScale, args, n);
1430 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1431 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1432 XtSetArg(args[n], XmNbottomWidget, screen.timeOutLabel);n++;
1433 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
1434 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1435 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1436 XtSetValues (screen.saverMinutesLabel, args, n);
1440 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1441 XtSetArg(args[n], XmNtopWidget, screen.saverFrame); n++;
1442 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1443 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
1444 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
1445 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1446 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1447 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1448 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1449 XtSetValues (screen.lockFrame, args, n);
1451 /* locking radiobox */
1453 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
1454 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1455 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
1456 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1457 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1458 XtSetValues (screen.lockingRadioBox, args, n);
1462 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1463 XtSetArg(args[n], XmNtopWidget, screen.lockingRadioBox); n++;
1464 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
1465 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
1466 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1467 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1468 XtSetValues (screen.prevLabel, args, n);
1470 /* cycleTime Label */
1472 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1473 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
1474 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
1475 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1476 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1477 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1478 XtSetValues (screen.cycleTimeLabel, args, n);
1480 /* cycleTime Scale */
1482 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1483 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1484 XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel);n++;
1485 XtSetArg(args[n], XmNbottomOffset, ScaleOffset); n++;
1486 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1487 XtSetArg(args[n], XmNleftWidget, screen.cycleTimeLabel);n++;
1488 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1489 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
1490 XtSetArg(args[n], XmNrightWidget, screen.cycleMinutesLabel);n++;
1491 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1492 XtSetValues (screen.cycleTimeScale, args, n);
1496 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
1497 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1498 XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel);n++;
1499 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
1500 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1501 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1502 XtSetValues (screen.cycleMinutesLabel, args, n);
1506 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
1507 XtSetArg (args[n], XmNtopWidget, screen.prevLabel); n++;
1508 XtSetArg (args[n], XmNtopOffset, style.verticalSpacing); n++;
1509 XtSetArg (args[n], XmNrightAttachment, XmATTACH_NONE); n++;
1510 XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
1511 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1512 XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
1513 XtSetArg(args[n], XmNbottomWidget, screen.cycleTimeLabel); n++;
1514 XtSetArg(args[n], XmNbottomOffset, 5*style.verticalSpacing); n++;
1515 XtSetValues (XtParent(screen.saverList), args, n);
1520 XtSetArg (args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1521 XtSetArg(args[n], XmNtopWidget, XtParent(screen.saverList)); n++;
1522 XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1523 XtSetArg(args[n], XmNleftWidget, XtParent(screen.saverList)); n++;
1524 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
1525 XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
1526 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
1527 XtSetArg (args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
1528 XtSetArg(args[n], XmNbottomWidget, XtParent(screen.saverList)); n++;
1529 XtSetValues (screen.saverAreaFrame, args, n);
1532 XtRemoveCallback(style.screenDialog, XmNmapCallback, no_svr_ext_formLayoutCB, NULL);
1535 /*+++++++++++++++++++++++++++++++++++++++*/
1536 /* _DtmapCB_screenDialog */
1537 /*+++++++++++++++++++++++++++++++++++++++*/
1540 _DtmapCB_screenDialog(
1542 XtPointer client_data,
1543 XtPointer call_data )
1545 static int first_time = 1;
1549 Boolean lock_on, saver_on;
1553 DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));
1555 if (!save.restoreFlag)
1556 putDialog ((Widget)client_data, w);
1558 /* Retrieve the value for the saver slider from xrdb */
1559 screen.saverTimeout_xrdb = atoi((char *)style.xrdb.timeoutScale);
1560 if (screen.saverTimeout_xrdb < 1)
1561 screen.saverTimeout_xrdb = 10;
1563 /* Retrieve the value for the lock slider from xrdb */
1564 screen.lockTimeout_xrdb = atoi((char *)style.xrdb.lockoutScale);
1565 if (screen.lockTimeout_xrdb < 1)
1566 screen.lockTimeout_xrdb = 30;
1568 /* initialize the value of savertimeout and locktimeout and cycle time to the */
1569 /* initial state or to the values retrieved from xrdb if the corresponding*/
1570 /* initial state is zero */
1571 if (style.smState.smSaverTimeout)
1572 screen.saverTimeout = style.smState.smSaverTimeout / 60;
1574 screen.saverTimeout = screen.saverTimeout_xrdb;
1576 if (style.smState.smLockTimeout)
1577 screen.lockTimeout = style.smState.smLockTimeout / 60;
1579 screen.lockTimeout = screen.lockTimeout_xrdb;
1581 if (style.smState.smCycleTimeout)
1582 screen.cycleTimeout = style.smState.smCycleTimeout / 60;
1584 screen.cycleTimeout = 0;
1587 /* set the value of the scales */
1588 XtVaSetValues(screen.timeOutScale, XmNvalue, screen.saverTimeout, NULL);
1589 XtVaSetValues(screen.lockOutScale, XmNvalue, screen.lockTimeout, NULL);
1590 XtVaSetValues(screen.cycleTimeScale, XmNvalue, screen.cycleTimeout , NULL);
1592 /* set the value of the saver toggles */
1593 XmToggleButtonGadgetSetState(screen.saverOn,
1594 style.smState.smSaverTimeout ? True : False, False);
1595 XmToggleButtonGadgetSetState(screen.saverOff,
1596 !style.smState.smSaverTimeout ? True : False, False );
1597 XmToggleButtonGadgetSetState(screen.lockOn,
1598 style.smState.smLockTimeout ? True : False, False);
1599 XmToggleButtonGadgetSetState(screen.lockOff,
1600 !style.smState.smLockTimeout ? True : False, False);
1602 /* make saver widgets insensitive if screen saver is off */
1603 /* also blank out the preview label widget */
1604 if (XmToggleButtonGadgetGetState(screen.saverOff))
1606 XtSetSensitive(screen.saverList, False);
1607 XtSetSensitive(screen.saverArea, False);
1608 XtSetSensitive(screen.timeOutLabel, False);
1609 XtSetSensitive(screen.timeOutScale, False);
1610 XtSetSensitive(screen.saverMinutesLabel, False);
1611 XtSetSensitive(screen.cycleTimeLabel, False);
1612 XtSetSensitive(screen.cycleTimeScale, False);
1613 XtSetSensitive(screen.cycleMinutesLabel, False);
1614 XtUnmanageChild(screen.prevLabel);
1616 /* make saver widgets sensitive if screen saver is on */
1617 /* also manage the preview label widget */
1618 if (XmToggleButtonGadgetGetState(screen.saverOn))
1620 XtSetSensitive(screen.saverList, True);
1621 XtSetSensitive(screen.saverArea, True);
1622 XtSetSensitive(screen.timeOutLabel, True);
1623 XtSetSensitive(screen.timeOutScale, True);
1624 XtSetSensitive(screen.saverMinutesLabel, True);
1625 XtManageChild(screen.prevLabel);
1626 /* make cycletime scale sensitive if selected savers are more than 1 */
1627 if (savers.selsaverCount > 1)
1629 XtSetSensitive(screen.cycleTimeLabel, True);
1630 XtSetSensitive(screen.cycleTimeScale, True);
1631 XtSetSensitive(screen.cycleMinutesLabel, True);
1635 XtSetSensitive(screen.cycleTimeLabel, False);
1636 XtSetSensitive(screen.cycleTimeScale, False);
1637 XtSetSensitive(screen.cycleMinutesLabel, False);
1640 /* make lock widgets insensitive if lock screen is off */
1641 if (XmToggleButtonGadgetGetState(screen.lockOff))
1643 XtSetSensitive(screen.lockOutLabel, False);
1644 XtSetSensitive(screen.lockOutScale, False);
1645 XtSetSensitive(screen.lockMinutesLabel, False);
1647 /* make lock widgets sensitive if lock screen is on */
1648 if (XmToggleButtonGadgetGetState(screen.lockOn))
1650 XtSetSensitive(screen.lockOutLabel, True);
1651 XtSetSensitive(screen.lockOutScale, True);
1652 XtSetSensitive(screen.lockMinutesLabel, True);
1656 if (!style.smState.smSaverTimeout)
1657 screen.origTimeout = screen.newTimeout = style.smState.smLockTimeout;
1659 if (!style.smState.smLockTimeout)
1660 screen.origTimeout = screen.newTimeout = style.smState.smSaverTimeout;
1662 screen.origTimeout =
1664 MIN(style.smState.smSaverTimeout, style.smState.smLockTimeout);
1668 /* check the saver values from X - need to do this everytime dialog is mapped because */
1669 /* the user may have changed settings thru X while style manager has been running */
1670 /* if the value of the timeout retrieved from X is not equal to the new timeout set in the */
1671 /* style manager interface, then set both lock time and saver time scales to value retrieved from */
1672 /* X, otherwise leave them alone */
1674 XGetScreenSaver(style.display, &screen.xTimeout, &screen.interval,
1675 &screen.blanking, &screen.exposures);
1677 screen.new_blanking = DontPreferBlanking;
1679 if (screen.xTimeout < 0)
1680 screen.xTimeout = 0;
1682 if ((screen.xTimeout < 60) && (screen.xTimeout > 1))
1683 screen.xTimeout = 60;
1685 if (screen.xTimeout > TIMEOUT_MAX * 60)
1686 screen.xTimeout = TIMEOUT_MAX * 60;
1688 if (screen.xTimeout < 0)
1689 screen.xTimeout = 0;
1691 if ((screen.xTimeout < 60) && (screen.xTimeout > 1))
1692 screen.xTimeout = 60;
1694 if (screen.xTimeout > TIMEOUT_MAX * 60)
1695 screen.xTimeout = TIMEOUT_MAX * 60;
1697 screen.timeMismatch = False;
1698 if (screen.xTimeout != screen.newTimeout)
1700 screen.timeMismatch = True;
1701 screen.newTimeout = screen.xTimeout;
1702 if (screen.xTimeout)
1704 screen.saverTimeout = screen.xTimeout / 60;
1705 screen.lockTimeout = screen.xTimeout / 60;
1709 screen.saverTimeout = screen.saverTimeout_xrdb;
1710 screen.lockTimeout = screen.lockTimeout_xrdb;
1712 /* set the value of the saver widgets */
1713 XmToggleButtonGadgetSetState(screen.saverOn, screen.xTimeout ? True : False, False);
1714 XmToggleButtonGadgetSetState(screen.saverOff, !screen.xTimeout ? True : False, False);
1715 XmToggleButtonGadgetSetState(screen.lockOn, screen.xTimeout ? True : False, False);
1716 XmToggleButtonGadgetSetState(screen.lockOff, !screen.xTimeout ? True : False, False);
1718 /* set the value of the scales */
1719 XtVaSetValues(screen.timeOutScale, XmNvalue, screen.saverTimeout, NULL);
1720 XtVaSetValues(screen.lockOutScale, XmNvalue, screen.lockTimeout_xrdb, NULL);
1722 /* make saver widgets insensitive if screen saver is off */
1723 /* also blankout the preview label widget */
1724 if (XmToggleButtonGadgetGetState(screen.saverOff))
1726 XtSetSensitive(screen.saverList, False);
1727 XtSetSensitive(screen.saverArea, False);
1728 XtSetSensitive(screen.timeOutLabel, False);
1729 XtSetSensitive(screen.timeOutScale, False);
1730 XtSetSensitive(screen.saverMinutesLabel, False);
1731 XtSetSensitive(screen.cycleTimeLabel, False);
1732 XtSetSensitive(screen.cycleTimeScale, False);
1733 XtSetSensitive(screen.cycleMinutesLabel, False);
1734 XtUnmanageChild(screen.prevLabel);
1736 /* make saver widgets sensitive if screen saver is on */
1737 /* also manage the preview label widget */
1738 if (XmToggleButtonGadgetGetState(screen.saverOn))
1740 XtSetSensitive(screen.saverList, True);
1741 XtSetSensitive(screen.saverArea, True);
1742 XtSetSensitive(screen.timeOutLabel, True);
1743 XtSetSensitive(screen.timeOutScale, True);
1744 XtSetSensitive(screen.saverMinutesLabel, True);
1745 XtManageChild(screen.prevLabel);
1746 /* make cycletime scale sensitive if selected savers are more than 1 */
1747 if (savers.selsaverCount > 1)
1749 XtSetSensitive(screen.cycleTimeLabel, True);
1750 XtSetSensitive(screen.cycleTimeScale, True);
1751 XtSetSensitive(screen.cycleMinutesLabel, True);
1755 XtSetSensitive(screen.cycleTimeLabel, False);
1756 XtSetSensitive(screen.cycleTimeScale, False);
1757 XtSetSensitive(screen.cycleMinutesLabel, False);
1761 /* make lock widgets insensitive if lock screen is off */
1762 if (XmToggleButtonGadgetGetState(screen.lockOff))
1764 XtSetSensitive(screen.lockOutLabel, False);
1765 XtSetSensitive(screen.lockOutScale, False);
1766 XtSetSensitive(screen.lockMinutesLabel, False);
1769 /* make lock widgets sensitive if lock screen is on */
1770 if (XmToggleButtonGadgetGetState(screen.lockOn))
1772 XtSetSensitive(screen.lockOutLabel, True);
1773 XtSetSensitive(screen.lockOutScale, True);
1774 XtSetSensitive(screen.lockMinutesLabel, True);
1779 /* run the current screen saver only if screen saver is turned on and a valid saver exists*/
1780 if (XmToggleButtonGadgetGetState(screen.saverOn) && savers.saverCount && !savers.saverstate)
1782 XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
1784 savers.saverstate = _DtSaverStart(style.display, &screen.saverArea, 1,
1785 savers.current_saver, style.screenDialog);
1786 string = XmStringCreateLocalized (savers.current_saverDesc);
1787 XtVaSetValues(screen.prevLabel, XmNlabelString, string, NULL);
1788 XmStringFree(string);
1792 /*+++++++++++++++++++++++++++++++++++++++*/
1793 /* no_svr_ext_DtmapCB_screenDialog */
1794 /*+++++++++++++++++++++++++++++++++++++++*/
1797 no_svr_ext_DtmapCB_screenDialog(
1799 XtPointer client_data,
1800 XtPointer call_data )
1802 static int first_time = 1;
1810 DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));
1812 if (!save.restoreFlag)
1813 putDialog ((Widget)client_data, w);
1815 /* Retrieve the value for the saver slider from xrdb */
1816 screen.saverTimeout_xrdb = atoi((char *)style.xrdb.timeoutScale);
1817 if (screen.saverTimeout_xrdb < 1)
1818 screen.saverTimeout_xrdb = 10;
1820 if (style.smState.smCycleTimeout)
1821 screen.cycleTimeout = style.smState.smCycleTimeout / 60;
1823 screen.cycleTimeout = 0;
1825 /* set the value of the cycle time scale */
1826 XtVaSetValues(screen.cycleTimeScale, XmNvalue, screen.cycleTimeout , NULL);
1828 /* set the initial condition for the locking RadioBoxes */
1830 XmToggleButtonGadgetSetState(screen.useSaversOn,
1831 style.smState.smSaverTimeout ? True : False, False);
1832 XmToggleButtonGadgetSetState(screen.useSaversOff,
1833 style.smState.smSaverTimeout ? False : True, False);
1835 if (style.smState.smSaverTimeout)
1837 XtSetSensitive(screen.saverList, True);
1838 XtSetSensitive(screen.saverArea, True);
1839 if (savers.selsaverCount > 1)
1841 XtSetSensitive(screen.cycleTimeLabel, True);
1842 XtSetSensitive(screen.cycleTimeScale, True);
1843 XtSetSensitive(screen.cycleMinutesLabel, True);
1847 XtSetSensitive(screen.cycleTimeLabel, False);
1848 XtSetSensitive(screen.cycleTimeScale, False);
1849 XtSetSensitive(screen.cycleMinutesLabel, False);
1851 XtManageChild(screen.prevLabel);
1856 XtSetSensitive(screen.saverList, False);
1857 XtSetSensitive(screen.saverArea, False);
1858 XtSetSensitive(screen.cycleTimeLabel, False);
1859 XtSetSensitive(screen.cycleTimeScale, False);
1860 XtSetSensitive(screen.cycleMinutesLabel, False);
1861 XtUnmanageChild(screen.prevLabel);
1864 screen.newTimeout = screen.origTimeout = 0;
1869 /* check the saver values from X - need to do this everytime dialog is mapped because */
1870 /* the user may have changed settings thru X while style manager has been running */
1871 /* if the value of the timeout retrieved from X is not equal to the new timeout set in the */
1872 /* style manager interface, then set both lock time and saver time scales to value retrieved from */
1873 /* X, otherwise leave them alone */
1875 XGetScreenSaver(style.display, &screen.xTimeout, &screen.interval,
1876 &screen.blanking, &screen.exposures);
1878 screen.new_blanking = PreferBlanking;
1880 if (screen.xTimeout < 0)
1881 screen.xTimeout = 0;
1883 if ((screen.xTimeout < 60) && (screen.xTimeout > 1))
1884 screen.xTimeout = 60;
1886 if (screen.xTimeout > TIMEOUT_MAX * 60)
1887 screen.xTimeout = TIMEOUT_MAX * 60;
1889 if (screen.xTimeout != screen.newTimeout)
1891 screen.origTimeout = screen.newTimeout = screen.xTimeout;
1892 screen.saverTimeout = screen.xTimeout / 60;
1895 /* set the value of the saver widgets */
1896 XmToggleButtonGadgetSetState(screen.saverOn, screen.newTimeout ? True : False, False);
1897 XmToggleButtonGadgetSetState(screen.saverOff, !screen.newTimeout ? True : False, False);
1899 if (!screen.saverTimeout)
1900 screen.saverTimeout = screen.saverTimeout_xrdb;
1902 XtVaSetValues(screen.timeOutScale, XmNvalue, screen.saverTimeout, NULL);
1904 /* make saver widgets insensitive if screen saver is off */
1905 if (XmToggleButtonGadgetGetState(screen.saverOff))
1907 XtSetSensitive(screen.timeOutLabel, False);
1908 XtSetSensitive(screen.timeOutScale, False);
1909 XtSetSensitive(screen.saverMinutesLabel, False);
1911 /* make saver widgets sensitive if screen saver is on */
1912 if (XmToggleButtonGadgetGetState(screen.saverOn))
1914 XtSetSensitive(screen.timeOutLabel, True);
1915 XtSetSensitive(screen.timeOutScale, True);
1916 XtSetSensitive(screen.saverMinutesLabel, True);
1920 /* run the current screen saver only if the useSaversOn toggle is enabled and valid saver exist*/
1921 if (XmToggleButtonGadgetGetState(screen.useSaversOn) && savers.saverCount && !savers.saverstate)
1923 XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
1924 savers.saverstate = _DtSaverStart(style.display, &screen.saverArea, 1,
1925 savers.current_saver, style.screenDialog);
1926 string = XmStringCreateLocalized (savers.current_saverDesc);
1927 XtVaSetValues(screen.prevLabel, XmNlabelString, string, NULL);
1928 XmStringFree(string);
1933 /*****************************************/
1934 /* timeOutvalueChangedCB */
1935 /* set the timeout to be the minimum of */
1936 /* the lock scale and timeout scale */
1937 /*****************************************/
1939 timeOutvalueChangedCB(
1941 XtPointer client_data,
1942 XtPointer call_data )
1948 XtSetArg(args[n], XmNvalue, &screen.saverTimeout); n++;
1949 XtGetValues(screen.timeOutScale, args, n);
1952 XtSetArg(args[n], XmNvalue, &screen.lockTimeout); n++;
1953 XtGetValues(screen.lockOutScale, args, n);
1955 /* set newTimeout to the min value of lock scale and saver scale */
1956 /* unless either screen saver or lock is off */
1957 if (!XmToggleButtonGadgetGetState(screen.lockOn))
1958 screen.newTimeout = screen.saverTimeout * 60;
1960 if (!XmToggleButtonGadgetGetState(screen.saverOn))
1961 screen.newTimeout = screen.lockTimeout * 60;
1963 screen.newTimeout = MIN(screen.saverTimeout, screen.lockTimeout) * 60;
1965 /* register new timeout with X */
1966 XSetScreenSaver(style.display, screen.newTimeout,
1967 screen.interval, screen.new_blanking, screen.exposures);
1969 screen.systemDefaultFlag = False;
1971 /*****************************************/
1972 /* no_svr_ext_timeOutvalueChangedCB */
1973 /* set the timeout to be the minimum of */
1974 /* the lock scale and timeout scale */
1975 /*****************************************/
1977 no_svr_ext_timeOutvalueChangedCB(
1979 XtPointer client_data,
1980 XtPointer call_data )
1986 XtSetArg(args[n], XmNvalue, &screen.saverTimeout); n++;
1987 XtGetValues(screen.timeOutScale, args, n);
1989 /* set newTimeout to the value of saver scale */
1990 screen.newTimeout = screen.saverTimeout * 60;
1992 /* register new timeout with X */
1993 XSetScreenSaver(style.display, screen.newTimeout,
1994 screen.interval, screen.new_blanking, screen.exposures);
1995 screen.systemDefaultFlag = False;
1998 /*+++++++++++++++++++++++++++++++++++++++*/
2000 /*+++++++++++++++++++++++++++++++++++++++*/
2004 XtPointer client_data,
2005 XtPointer call_data )
2011 XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)call_data;
2013 set = (Boolean) cb->set;
2016 if (w == screen.saverOff && !set )
2021 if (w == screen.saverOff && set)
2023 /* Terminate the screen saver that is currently running */
2024 if (savers.saverstate)
2026 _DtSaverStop(style.display, savers.saverstate);
2027 savers.saverstate = NULL;
2028 XSync(style.display, False);
2029 XClearWindow(style.display, XtWindow(screen.saverArea));
2031 XtSetSensitive(screen.saverList, False);
2032 XtSetSensitive(screen.saverArea, False);
2033 XtSetSensitive(screen.timeOutLabel, False);
2034 XtSetSensitive(screen.timeOutScale, False);
2035 XtSetSensitive(screen.saverMinutesLabel, False);
2036 XtSetSensitive(screen.cycleTimeLabel, False);
2037 XtSetSensitive(screen.cycleTimeScale, False);
2038 XtSetSensitive(screen.cycleMinutesLabel, False);
2039 /* do not display preview string */
2040 XtUnmanageChild(screen.prevLabel);
2041 /* set the background color of the saver window to the */
2042 /* secondary color ID */
2043 XSync(style.display, False);
2044 XtVaSetValues(screen.saverArea, XmNbackground, savers.bg, NULL);
2045 XClearWindow(style.display, XtWindow(screen.saverArea));
2046 /* set the new timeout for the X server - note that since */
2047 /* screen saver is disabled, the new timeout is now the value of the */
2048 /* lock slider or zero if lock is disabled */
2049 if (XmToggleButtonGadgetGetState(screen.lockOn))
2050 screen.newTimeout = screen.lockTimeout * 60;
2052 screen.newTimeout = 0;
2053 /* let the session manger know not to run any savers */
2058 if (w == screen.saverOn && !set)
2063 if (w == screen.saverOn && set)
2065 XtSetSensitive(screen.saverList, True);
2066 XtSetSensitive(screen.saverArea, True);
2067 XtSetSensitive(screen.timeOutLabel, True);
2068 XtSetSensitive(screen.timeOutScale, True);
2069 XtSetSensitive(screen.saverMinutesLabel , True);
2070 if (savers.selsaverCount > 1)
2072 XtSetSensitive(screen.cycleTimeLabel, True);
2073 XtSetSensitive(screen.cycleTimeScale, True);
2074 XtSetSensitive(screen.cycleMinutesLabel, True );
2078 XtSetSensitive(screen.cycleTimeLabel, False);
2079 XtSetSensitive(screen.cycleTimeScale, False);
2080 XtSetSensitive(screen.cycleMinutesLabel, False);
2083 if (savers.saverCount)
2085 /* display the preview label */
2086 XtManageChild(screen.prevLabel);
2087 /* Restart the screen saver that is is currently selected */
2088 if (!savers.saverstate)
2090 XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
2091 savers.saverstate = _DtSaverStart(style.display,
2092 &screen.saverArea, 1, savers.current_saver,
2093 style.screenDialog);
2095 /* set the new timeout for the X server - note that since */
2096 /* screen saver is enabled, the new timeout is now the value of the */
2097 /* saver slider or the minimum of the timeout sliders */
2099 if (!XmToggleButtonGadgetGetState(screen.lockOn))
2100 screen.newTimeout = screen.saverTimeout * 60;
2102 screen.newTimeout = MIN(screen.saverTimeout, screen.lockTimeout) * 60;
2103 /* let the session manger know to run savers */
2104 SmNewSaverTime(screen.newTimeout);
2107 XSetScreenSaver(style.display, screen.newTimeout,
2108 screen.interval, screen.new_blanking, screen.exposures);
2110 screen.systemDefaultFlag = False;
2112 /*+++++++++++++++++++++++++++++++++++++++*/
2113 /* no_svr_ext_saverToggleCB */
2114 /*+++++++++++++++++++++++++++++++++++++++*/
2116 no_svr_ext_saverToggleCB(
2118 XtPointer client_data,
2119 XtPointer call_data )
2125 XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)call_data;
2127 set = (Boolean) cb->set;
2130 if (w == screen.saverOff && !set )
2135 if (w == screen.saverOff && set)
2137 XtSetSensitive(screen.timeOutLabel, False);
2138 XtSetSensitive(screen.timeOutScale, False);
2139 XtSetSensitive(screen.saverMinutesLabel, False);
2140 /* set the new timeout for the X server - note that since */
2141 /* screen saver is disabled, the new timeout is now zero */
2142 screen.newTimeout = 0;
2145 if (w == screen.saverOn && !set)
2150 if (w == screen.saverOn && set)
2152 XtSetSensitive(screen.timeOutLabel, True);
2153 XtSetSensitive(screen.timeOutScale, True);
2154 XtSetSensitive(screen.saverMinutesLabel , True);
2155 /* register the new timeout with the X server - note that since */
2156 /* screen saver is enabled, the new timeout is now the value of the */
2158 screen.newTimeout = screen.saverTimeout * 60;
2161 XSetScreenSaver(style.display, screen.newTimeout,
2162 screen.interval, screen.new_blanking, screen.exposures);
2164 screen.systemDefaultFlag = False;
2167 /*+++++++++++++++++++++++++++++++++++++++*/
2169 /*+++++++++++++++++++++++++++++++++++++++*/
2173 XtPointer client_data,
2174 XtPointer call_data )
2179 XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)call_data;
2181 set = (Boolean) cb->set;
2184 if (w == screen.lockOff && !set )
2189 if (w == screen.lockOff && set)
2191 XtSetSensitive(screen.lockOutLabel, False);
2192 XtSetSensitive(screen.lockOutScale, False);
2193 XtSetSensitive(screen.lockMinutesLabel, False);
2195 /* register the new timeout with the X server - note that since */
2196 /* lock is disabled, the new timeout is now the value of the */
2197 /* saver slider or zero if saver is disabled */
2198 if (XmToggleButtonGadgetGetState(screen.saverOn))
2199 screen.newTimeout = screen.saverTimeout * 60;
2201 screen.newTimeout = 0;
2203 XSetScreenSaver(style.display, screen.newTimeout,
2204 screen.interval, screen.new_blanking, screen.exposures);
2207 if (w == screen.lockOn && !set)
2212 if (w == screen.lockOn && set)
2214 XtSetSensitive(screen.lockOutLabel, True);
2215 XtSetSensitive(screen.lockOutScale, True);
2216 XtSetSensitive(screen.lockMinutesLabel, True);
2218 /* register the new timeout with the X server - note that since */
2219 /* lock is disabled, the new timeout is now the value of the */
2220 /* lock slider or the minimum of the two timeout sliders */
2221 if (!XmToggleButtonGadgetGetState(screen.saverOn))
2222 screen.newTimeout = screen.lockTimeout * 60;
2224 screen.newTimeout = MIN(screen.saverTimeout, screen.lockTimeout) * 60;
2226 XSetScreenSaver(style.display, screen.newTimeout,
2227 screen.interval, screen.new_blanking, screen.exposures);
2229 screen.systemDefaultFlag = False;
2233 /*+++++++++++++++++++++++++++++++++++++++*/
2234 /* saversToggleCB */
2235 /*+++++++++++++++++++++++++++++++++++++++*/
2239 XtPointer client_data,
2240 XtPointer call_data )
2246 XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)call_data;
2248 set = (Boolean) cb->set;
2250 if (w == screen.useSaversOff && !set )
2255 if (w == screen.useSaversOff && set)
2257 /* Terminate the screen saver that is currently running */
2258 if (savers.saverstate)
2260 _DtSaverStop(style.display, savers.saverstate);
2261 savers.saverstate = NULL;
2262 XSync(style.display, False);
2263 XClearWindow(style.display, XtWindow(screen.saverArea));
2266 XtSetSensitive(screen.saverList, False);
2267 XtSetSensitive(screen.saverArea, False);
2268 XtSetSensitive(screen.cycleTimeLabel, False);
2269 XtSetSensitive(screen.cycleTimeScale, False);
2270 XtSetSensitive(screen.cycleMinutesLabel, False);
2271 /* do not display preview string */
2272 XtUnmanageChild(screen.prevLabel);
2273 /* set the background color of the saver window to the */
2274 /* secondary color ID */
2275 XSync(style.display, False);
2276 XtVaSetValues(screen.saverArea, XmNbackground, savers.bg, NULL);
2277 XClearWindow(style.display, XtWindow(screen.saverArea));
2278 /* let the session manger know not to run any savers */
2282 if (w == screen.useSaversOn && !set)
2287 if (w == screen.useSaversOn && set)
2289 XtSetSensitive(screen.saverList, True);
2290 XtSetSensitive(screen.saverArea, True);
2291 if (savers.selsaverCount > 1)
2293 XtSetSensitive(screen.cycleTimeLabel, True);
2294 XtSetSensitive(screen.cycleTimeScale, True);
2295 XtSetSensitive(screen.cycleMinutesLabel, True);
2297 if (savers.saverCount)
2299 /* display the preview label */
2300 XtManageChild(screen.prevLabel);
2301 /* Restart the screen saver that is is currently selected */
2302 if (!savers.saverstate)
2304 XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
2305 savers.saverstate = _DtSaverStart(style.display,
2306 &screen.saverArea, 1, savers.current_saver, style.screenDialog);
2309 /* let the session manger know to run the savers */
2310 SmNewSaverTime(screen.saverTimeout*60);
2315 /*+++++++++++++++++++++++++++++++++++++++*/
2316 /* systemDefaultCB */
2317 /*+++++++++++++++++++++++++++++++++++++++*/
2321 XtPointer client_data,
2322 XtPointer call_data )
2327 screen.saverTimeout = SAVER_DEFAULT;
2329 XtSetArg(args[n], XmNvalue, screen.saverTimeout); n++;
2330 XtSetValues(screen.timeOutScale, args, n);
2332 screen.lockTimeout = LOCK_DEFAULT;
2334 XtSetArg(args[n], XmNvalue, screen.lockTimeout); n++;
2335 XtSetValues(screen.lockOutScale, args, n);
2336 XmToggleButtonGadgetSetState(screen.lockOff, True, True);
2338 screen.cycleTimeout = CYCLE_DEFAULT;
2340 XtSetArg(args[n], XmNvalue, screen.cycleTimeout); n++;
2341 XtSetValues(screen.cycleTimeScale, args, n);
2342 XmToggleButtonGadgetSetState(screen.saverOn, True, True);
2344 screen.newTimeout = MIN(SAVER_DEFAULT, LOCK_DEFAULT) * 60;
2345 /* register new timeout with X */
2346 XSetScreenSaver(style.display, screen.newTimeout,
2347 screen.interval, screen.new_blanking, screen.exposures);
2348 screen.systemDefaultFlag = True;
2351 /*+++++++++++++++++++++++++++++++++++++++*/
2352 /* no_svr_ext_systemDefaultCB */
2353 /*+++++++++++++++++++++++++++++++++++++++*/
2355 no_svr_ext_systemDefaultCB(
2357 XtPointer client_data,
2358 XtPointer call_data )
2363 screen.saverTimeout = SAVER_DEFAULT;
2365 XtSetArg(args[n], XmNvalue, screen.saverTimeout); n++;
2366 XtSetValues(screen.timeOutScale, args, n);
2368 screen.cycleTimeout = CYCLE_DEFAULT;
2370 XtSetArg(args[n], XmNvalue, screen.cycleTimeout); n++;
2371 XtSetValues(screen.cycleTimeScale, args, n);
2373 XmToggleButtonGadgetSetState(screen.saverOn, True, True);
2374 XmToggleButtonGadgetSetState(screen.useSaversOn, True, True);
2376 screen.newTimeout = SAVER_DEFAULT * 60;
2377 /* register new timeout with X */
2378 XSetScreenSaver(style.display, screen.newTimeout,
2379 screen.interval, screen.new_blanking, screen.exposures);
2381 screen.systemDefaultFlag = True;
2384 /*+++++++++++++++++++++++++++++++++++++++*/
2386 /* callback for PushButtons in DialogBox */
2387 /*+++++++++++++++++++++++++++++++++++++++*/
2391 XtPointer client_data,
2392 XtPointer call_data )
2394 register int i, n, m;
2396 Boolean sel_matched = False;
2400 static char screenres[48];
2404 DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data;
2406 switch (cb->button_position)
2410 XtUnmanageChild (w);
2411 /* terminate the saver that is currently running */
2412 if (savers.saverstate)
2414 _DtSaverStop(style.display, savers.saverstate);
2415 savers.saverstate = NULL;
2418 /* write saver timeout resource to xrdb to save scale value */
2419 /* when screen saver is turned off */
2420 saverset = XmToggleButtonGadgetGetState(screen.saverOn);
2423 sprintf (screenres, "Dtstyle*timeoutScale: %d\n", screen.saverTimeout);
2424 _DtAddToResource (style.display, screenres);
2427 /* write lock timeout resource to xrdb to save scale value */
2428 /* when lock is turned off */
2429 lockset = XmToggleButtonGadgetGetState(screen.lockOn);
2432 sprintf (screenres, "Dtstyle*lockoutScale: %d\n", screen.lockTimeout);
2433 _DtAddToResource (style.display, screenres);
2436 /* if sendSettings is true send message to Session Manager */
2437 if(style.smState.smSendSettings)
2439 if(screen.systemDefaultFlag)
2441 SmDefaultScreenSettings();
2446 SmNewScreenSettings(saverset||lockset ? screen.newTimeout : 0,
2447 screen.new_blanking,
2455 if (savers.saverCount)
2457 savers.selsaverActionNames = (char **) XtMalloc(sizeof(char *) *
2458 savers.selsaverCount);
2460 for (i=0; i<savers.selsaverCount; i++)
2462 char *tmp = savers.saverActionNames[savers.selPositions[i] - 1];
2463 savers.selsaverActionNames[i] = (char *) XtMalloc(strlen(tmp) + 1);
2464 strcpy(savers.selsaverActionNames[i], tmp);
2467 if (savers.selsaversList != NULL)
2468 XtFree((char*) savers.selsaversList);
2470 savers.selsaversList = build_selectedList(savers.selsaverActionNames,
2471 savers.selsaverCount);
2475 savers.selsaversList = NULL;
2477 /* save the selected positions for later use */
2478 savers.orig_selsaverCount = savers.selsaverCount;
2479 if (savers.origSelPositions != NULL)
2480 XtFree((char *) savers.origSelPositions);
2481 savers.origSelPositions = (int *) XtMalloc(sizeof(int) * savers.orig_selsaverCount);
2482 for (i=0; i<savers.orig_selsaverCount; i++)
2483 savers.origSelPositions[i] = savers.selPositions[i];
2485 /* free the allocated selected savers */
2486 free_saverList(savers.selsaverActionNames, savers.selsaverCount);
2487 savers.selsaverActionNames = NULL;
2489 XtVaGetValues(screen.cycleTimeScale, XmNvalue, &scratch, NULL);
2490 screen.cycleTimeout = scratch;
2492 /* send new saver time, lock time and time per saver to SM if they have changed, */
2493 /* flag value indicates which value has changed */
2495 SmNewSaverSettings(saverset ? screen.saverTimeout*60 : 0,
2496 lockset ? screen.lockTimeout*60 : 0,
2497 screen.cycleTimeout*60,
2498 savers.selsaversList);
2500 style.smState.smSaverTimeout = saverset ? screen.saverTimeout*60 : 0;
2501 style.smState.smLockTimeout = lockset ? screen.lockTimeout*60 : 0;
2502 style.smState.smCycleTimeout = screen.cycleTimeout*60;
2503 style.smSaver.saverList = savers.selsaversList;
2505 screen.origTimeout = screen.newTimeout;
2506 XSetScreenSaver(style.display, style.smState.smSaverTimeout,
2507 style.smState.smCycleTimeout,
2508 screen.new_blanking,
2516 /* initialize the value of savertimeout and locktimeout and cycle time to the */
2517 /* current state or to the values retrieved from xrdb if the corresponding */
2518 /* initial state is zero */
2519 if (style.smState.smSaverTimeout)
2520 screen.saverTimeout = style.smState.smSaverTimeout / 60;
2522 screen.saverTimeout = screen.saverTimeout_xrdb;
2524 if (style.smState.smLockTimeout)
2525 screen.lockTimeout = style.smState.smLockTimeout / 60;
2527 screen.lockTimeout = screen.lockTimeout_xrdb;
2529 if (style.smState.smCycleTimeout)
2530 screen.cycleTimeout = style.smState.smCycleTimeout / 60;
2532 screen.cycleTimeout = 0;
2535 /* reset the value of the scales */
2536 XtVaSetValues(screen.timeOutScale, XmNvalue, screen.saverTimeout, NULL);
2537 XtVaSetValues(screen.lockOutScale, XmNvalue, screen.lockTimeout, NULL);
2538 XtVaSetValues(screen.cycleTimeScale, XmNvalue, screen.cycleTimeout , NULL);
2540 /* reset the value of the saver toggles */
2541 XmToggleButtonGadgetSetState(screen.saverOn, style.smState.smSaverTimeout ? True : False, True);
2542 XmToggleButtonGadgetSetState(screen.saverOff, !style.smState.smSaverTimeout ? True : False, True);
2543 XmToggleButtonGadgetSetState(screen.lockOn, style.smState.smLockTimeout ? True : False, True);
2544 XmToggleButtonGadgetSetState(screen.lockOff, !style.smState.smLockTimeout ? True : False, True);
2546 /* reset the X timeout */
2547 screen.newTimeout = screen.origTimeout;
2548 XSetScreenSaver(style.display, screen.origTimeout, screen.interval,
2549 screen.blanking, screen.exposures);
2551 /* if timeMismatch is true, set the timeout to xTimeout so that the next time */
2552 /* the interface is mapped the correct timeouts show up */
2553 if (screen.timeMismatch)
2554 XSetScreenSaver(style.display, screen.xTimeout, screen.interval,
2555 screen.blanking,screen.exposures);
2558 if (savers.saverCount)
2560 /* reset the list selection back to the current state */
2561 /* first deselect all items */
2562 XmListDeselectAllItems(screen.saverList);
2563 for (i=0; i<savers.orig_selsaverCount; i++)
2564 XmListSelectPos(screen.saverList, savers.origSelPositions[i], False);
2565 /* set the current saver to be the first saver in the selected list */
2566 savers.current_saver = savers.saverActionNames[savers.origSelPositions[0] - 1];
2567 savers.current_saverDesc = savers.saverActionDesc[savers.origSelPositions[0] - 1];
2568 savers.current_position = savers.origSelPositions[0];
2571 /* Need to make sure the savers.selPositions array reflects the accurate
2572 current selections. If the user invokes the Screen dialog, then cancels,
2573 then reinvokes and OKs without making any changes to the selections, the
2574 savers.selPositions array is assumed to contain the accurate selections.
2575 Unless we reset it here to the origSelPositions, it may be inaccurate.
2578 XtFree((char *) savers.selPositions);
2579 savers.selPositions = (int *) XtMalloc(sizeof(int) * savers.orig_selsaverCount);
2581 for (i=0; i<savers.orig_selsaverCount; i++)
2582 savers.selPositions[i] = savers.origSelPositions[i];
2584 savers.selsaverCount = savers.orig_selsaverCount;
2593 XtCallCallbacks(style.screenDialog, XmNhelpCallback, (XtPointer)NULL);
2601 /*+++++++++++++++++++++++++++++++++++++++*/
2602 /* no_svr_ext_ButtonCB */
2603 /* callback for PushButtons in DialogBox */
2604 /*+++++++++++++++++++++++++++++++++++++++*/
2606 no_svr_ext_ButtonCB(
2608 XtPointer client_data,
2609 XtPointer call_data )
2611 register int i, n, m;
2613 Boolean sel_matched = False;
2616 static char screenres[48];
2620 DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data;
2622 switch (cb->button_position)
2626 XtUnmanageChild (w);
2627 /* terminate the saver that is currently running */
2628 if (savers.saverstate)
2630 _DtSaverStop(style.display, savers.saverstate);
2631 savers.saverstate = NULL;
2634 /* write saver timeout resource to xrdb to save scale value */
2635 /* when screen saver is turned off */
2636 saverset = XmToggleButtonGadgetGetState(screen.saverOn);
2639 sprintf (screenres, "Dtstyle*timeoutScale: %d\n", screen.saverTimeout);
2640 _DtAddToResource (style.display, screenres);
2643 /* if sendSettings is true send message to Session Manager */
2644 if(style.smState.smSendSettings)
2646 if(screen.systemDefaultFlag)
2648 SmDefaultScreenSettings();
2652 SmNewScreenSettings(saverset ? screen.newTimeout : 0,
2653 screen.new_blanking,
2661 if (savers.saverCount)
2663 savers.selsaverActionNames = (char **) XtMalloc(sizeof(char *) *
2664 savers.selsaverCount);
2666 for (i=0; i<savers.selsaverCount; i++)
2668 char *tmp = savers.saverActionNames[savers.selPositions[i] - 1];
2669 savers.selsaverActionNames[i] = (char *) XtMalloc(strlen(tmp) + 1);
2670 strcpy(savers.selsaverActionNames[i], tmp);
2673 if (savers.selsaversList != NULL)
2674 XtFree((char*) savers.selsaversList);
2676 savers.selsaversList = build_selectedList(savers.selsaverActionNames,
2677 savers.selsaverCount);
2681 savers.selsaversList = NULL;
2683 /* save the selected positions for later use */
2684 savers.orig_selsaverCount = savers.selsaverCount;
2685 if (savers.origSelPositions != NULL)
2686 XtFree((char *) savers.origSelPositions);
2687 savers.origSelPositions = (int *) XtMalloc(sizeof(int) * savers.orig_selsaverCount);
2688 for (i=0; i<savers.orig_selsaverCount; i++)
2689 savers.origSelPositions[i] = savers.selPositions[i];
2691 /* free the allocated selected savers */
2692 free_saverList(savers.selsaverActionNames, savers.selsaverCount);
2693 savers.selsaverActionNames = NULL;
2695 XtVaGetValues(screen.cycleTimeScale, XmNvalue, &scratch, NULL);
2696 screen.cycleTimeout = scratch;
2698 /* send new saver time, lock time and time per saver to SM if they have changed, */
2699 /* flag value indicates which value has changed */
2700 /* send zero to the session manger if no savers selected */
2702 if(!XmToggleButtonGadgetGetState(screen.useSaversOn))
2706 SmNewSaverSettings(saverset ? screen.saverTimeout*60 : 0,
2707 style.smState.smLockTimeout,
2708 screen.cycleTimeout*60,
2709 savers.selsaversList);
2711 style.smState.smSaverTimeout = saverset ? screen.saverTimeout*60 : 0;
2712 style.smState.smCycleTimeout = screen.cycleTimeout*60;
2713 style.smSaver.saverList = savers.selsaversList;
2715 screen.origTimeout = screen.newTimeout;
2716 XSetScreenSaver(style.display, style.smState.smSaverTimeout,
2717 style.smState.smCycleTimeout,
2718 screen.new_blanking,
2726 /* initialize the value of savertimeout and cycle time to the */
2727 /* original value */
2729 if (screen.origTimeout)
2730 screen.saverTimeout = screen.origTimeout / 60;
2732 screen.saverTimeout = screen.saverTimeout_xrdb;
2735 if (style.smState.smCycleTimeout)
2736 screen.cycleTimeout = style.smState.smCycleTimeout / 60;
2738 screen.cycleTimeout = 0;
2740 /* reset the value of the scales */
2741 XtVaSetValues(screen.timeOutScale, XmNvalue, screen.saverTimeout, NULL);
2742 XtVaSetValues(screen.cycleTimeScale, XmNvalue, screen.cycleTimeout , NULL);
2744 /* reset the value of the saver toggles */
2745 XmToggleButtonGadgetSetState(screen.saverOn, screen.origTimeout ? True : False, True);
2746 XmToggleButtonGadgetSetState(screen.saverOff, !screen.origTimeout ? True : False, True);
2748 /* reset the value of the locking radio box toggles */
2749 if (style.smState.smSaverTimeout)
2751 XmToggleButtonGadgetSetState(screen.useSaversOn, True, False);
2752 XmToggleButtonGadgetSetState(screen.useSaversOff, False, False);
2753 XtSetSensitive(screen.saverList, True);
2754 XtSetSensitive(screen.saverArea, True);
2755 if (savers.selsaverCount > 1)
2757 XtSetSensitive(screen.cycleTimeLabel, True);
2758 XtSetSensitive(screen.cycleTimeScale, True);
2759 XtSetSensitive(screen.cycleMinutesLabel, True);
2761 if (savers.saverCount)
2762 /* display the preview label */
2763 XtManageChild(screen.prevLabel);
2765 /* let the session manger know to run the savers */
2766 SmNewSaverTime(screen.saverTimeout*60);
2770 XmToggleButtonGadgetSetState(screen.useSaversOff, True, False);
2771 XmToggleButtonGadgetSetState(screen.useSaversOn, False, False);
2772 XtSetSensitive(screen.saverList, False);
2773 XtSetSensitive(screen.saverArea, False);
2774 XtSetSensitive(screen.cycleTimeLabel, False);
2775 XtSetSensitive(screen.cycleTimeScale, False);
2776 XtSetSensitive(screen.cycleMinutesLabel, False);
2777 /* do not display preview string */
2778 XtUnmanageChild(screen.prevLabel);
2779 /* set the background color of the saver window to the */
2780 /* secondary color ID */
2781 XSync(style.display, False);
2782 XtVaSetValues(screen.saverArea, XmNbackground, savers.bg, NULL);
2783 XClearWindow(style.display, XtWindow(screen.saverArea));
2784 /* let the session manger know not to run any savers */
2788 /* reset the X timeout */
2789 screen.newTimeout = screen.origTimeout;
2790 XSetScreenSaver(style.display, screen.origTimeout, screen.interval,
2791 screen.blanking,screen.exposures);
2794 if (savers.saverCount)
2796 /* reset the list selection back to the current state */
2797 /* first deselect all items */
2798 XmListDeselectAllItems(screen.saverList);
2799 for (i=0; i<savers.orig_selsaverCount; i++)
2800 XmListSelectPos(screen.saverList, savers.origSelPositions[i], False);
2801 /* set the current saver to be the first saver in the selected list */
2802 savers.current_saver = savers.saverActionNames[savers.origSelPositions[0] - 1];
2803 savers.current_saverDesc = savers.saverActionDesc[savers.origSelPositions[0] - 1];
2804 savers.current_position = savers.origSelPositions[0];
2807 /* Need to make sure the savers.selPositions array reflects the accurate
2808 current selections. If the user invokes the Screen dialog, then cancels,
2809 then reinvokes and OKs without making any changes to the selections, the
2810 savers.selPositions array is assumed to contain the accurate selections.
2811 Unless we reset it here to the origSelPositions, it may be inaccurate.
2814 XtFree((char *) savers.selPositions);
2815 if (savers.orig_selsaverCount > 0) {
2816 savers.selPositions =
2817 (int *) XtMalloc(sizeof(int) * savers.orig_selsaverCount);
2819 for (i=0; i<savers.orig_selsaverCount; i++)
2820 savers.selPositions[i] = savers.origSelPositions[i];
2823 savers.selsaverCount = savers.orig_selsaverCount;
2829 XtCallCallbacks(style.screenDialog, XmNhelpCallback, (XtPointer)NULL);
2837 /************************************************************************/
2838 /* restoreScreen() */
2839 /* restore any state information saved with saveScreen. */
2840 /* This is called from restoreSession with the application */
2841 /* shell and the special xrm database retrieved for restore. */
2842 /************************************************************************/
2848 XrmName xrm_name[5];
2849 XrmRepresentation rep_type;
2852 xrm_name [0] = XrmStringToQuark ("Screen");
2855 /* get x position */
2856 xrm_name [1] = XrmStringToQuark ("x");
2857 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
2858 XtSetArg (save.posArgs[save.poscnt], XmNx, atoi((char *)value.addr)); save.poscnt++;
2859 save.restoreFlag = True;
2862 /* get y position */
2863 xrm_name [1] = XrmStringToQuark ("y");
2864 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
2865 XtSetArg (save.posArgs[save.poscnt], XmNy, atoi((char *)value.addr)); save.poscnt++;
2868 xrm_name [1] = XrmStringToQuark ("ismapped");
2869 XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value);
2870 /* Are we supposed to be mapped? */
2871 if (strcmp(value.addr, "True") == 0)
2872 popup_screenBB(shell);
2875 /*******************************************************************************/
2877 /* This routine will write out to the passed file descriptor any state */
2878 /* information this dialog needs. It is called from saveSessionCB with the */
2879 /* file already opened. */
2880 /* All information is saved in xrm format. There is no restriction */
2881 /* on what can be saved. It doesn't have to be defined or be part of any */
2882 /* widget or Xt definition. Just name and save it here and recover it in */
2883 /* restoreBackdrop. The suggested minimum is whether you are mapped, and your */
2885 /*******************************************************************************/
2891 char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */
2892 XmVendorShellExtObject vendorExt;
2893 XmWidgetExtData extData;
2895 if (style.screenDialog != NULL)
2897 if (XtIsManaged(style.screenDialog))
2898 sprintf(bufr, "*Screen.ismapped: True\n");
2900 sprintf(bufr, "*Screen.ismapped: False\n");
2902 /* Get and write out the geometry info for our Window */
2903 x = XtX(XtParent(style.screenDialog));
2904 y = XtY(XtParent(style.screenDialog));
2906 /* Modify x & y to take into account window mgr frames */
2907 /* This is pretty bogus, but I don't know a better way to do it. */
2908 extData = _XmGetWidgetExtData(style.shell, XmSHELL_EXTENSION);
2909 vendorExt = (XmVendorShellExtObject)extData->widget;
2910 x -= vendorExt->vendor.xOffset;
2911 y -= vendorExt->vendor.yOffset;
2913 sprintf(bufr, "%s*Screen.x: %d\n", bufr, x);
2914 sprintf(bufr, "%s*Screen.y: %d\n", bufr, y);
2916 if(-1 == write (fd, bufr, strlen(bufr))) {
2917 perror(strerror(errno));
2923 /************************************************************************/
2924 /* MakeListStrings() */
2925 /* Make XmStrings from the saver names, to pass into list. */
2926 /************************************************************************/
2928 MakeListStrings( char ** list )
2933 xmList = (XmString *) XtMalloc(savers.saverCount * sizeof(XmString));
2935 for (i = 0; i < savers.saverCount; i++)
2937 xmList[i] = XmStringCreateLocalized (list[i]);
2944 /************************************************************************/
2945 /* FreeListStrings() */
2946 /************************************************************************/
2949 FreeListStrings(XmString *xmlist,
2954 for (i = 0; i < count; i++)
2957 XmStringFree(xmlist[i]);
2959 XtFree ((char *)xmlist);
2963 /************************************************************************/
2965 /* Get the lastly selected Screen saver client running in the preview */
2966 /* area. For a multiple selection by dragging, the last item in the */
2967 /* selection is the client that is previewed. */
2968 /************************************************************************/
2972 XtPointer client_data,
2973 XtPointer call_data )
2975 XmListCallbackStruct *cb = (XmListCallbackStruct *)call_data;
2977 Boolean runsaver = False;
2981 /* If no items are left in the selection (i.e. the last selected item */
2982 /* was deselected) then force the previously selected item to remain */
2985 if (cb->selected_item_count == 0)
2987 XmListSelectPos(screen.saverList, cb->item_position, False);
2988 savers.selsaverCount = 1;
2989 if (savers.selPositions != NULL)
2990 XtFree ((char *) savers.selPositions);
2991 savers.selPositions = (int *) XtMalloc(sizeof(int));
2992 savers.selPositions[0] = cb->item_position;
2993 savers.current_saver = savers.saverActionNames[savers.selPositions[0] - 1];
2994 savers.current_saverDesc = savers.saverActionDesc[savers.selPositions[0] - 1];
2998 /* make a copy of the selected item positions for later use */
3000 if (savers.selPositions != NULL)
3001 XtFree ((char *) savers.selPositions);
3003 savers.selPositions = (int *) XtMalloc(sizeof(int) * cb->selected_item_count);
3004 for (i=0; i< cb->selected_item_count; i++)
3006 savers.selPositions[i] = cb->selected_item_positions[i];
3009 savers.selsaverCount = cb->selected_item_count;
3010 if (savers.selsaverCount < 2)
3012 XtSetSensitive(screen.cycleTimeScale, False);
3013 XtSetSensitive(screen.cycleTimeLabel, False);
3014 XtSetSensitive(screen.cycleMinutesLabel, False);
3017 if (savers.previous_selsaverCount < 2)
3019 XtSetSensitive(screen.cycleTimeScale, True);
3020 XtSetSensitive(screen.cycleTimeLabel, True);
3021 XtSetSensitive(screen.cycleMinutesLabel, True);
3024 savers.previous_selsaverCount = savers.selsaverCount;
3026 /* Find out if the item is selected or deselected. When an item */
3027 /* is deselected item_position is set to the deselected item which has */
3028 /* the keyboard focus. However, the deselected screen saver must not be */
3029 /* previewed. Therfore before a screen saver is started, its position must */
3030 /* exist in the selected_item_positions array. If not then just return without */
3031 /* altering the current (previewed) saver unless the deselected saver was the */
3032 /* current saver. In that case kill the current saver and preview the last */
3033 /* item from the selected list. */
3034 for (i=0; i<cb->selected_item_count; i++)
3036 if(cb->selected_item_positions[i] == cb->item_position)
3042 i = cb->selected_item_positions[(cb->selected_item_count-1)];
3043 if (savers.current_position == cb->item_position)
3045 if (savers.saverstate)
3047 /* Terminate the screen saver that is currently running */
3048 _DtSaverStop(style.display, savers.saverstate);
3049 XSync(style.display, False);
3050 savers.saverstate = NULL;
3052 savers.current_saver = savers.saverActionNames[i-1];
3053 savers.current_saverDesc = savers.saverActionDesc[i-1];
3054 savers.current_position = i;
3055 XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
3056 savers.saverstate = _DtSaverStart(style.display, &screen.saverArea,
3057 1, savers.current_saver, style.screenDialog);
3058 string = XmStringCreateLocalized (savers.current_saverDesc);
3059 XtVaSetValues(screen.prevLabel, XmNlabelString, string, NULL);
3060 XmStringFree(string);
3065 /* The item position returned is the selcted item */
3066 /* Start screen saver. _DtSaverStop() must be called to terminate the */
3068 if (savers.saverstate)
3070 /* Terminate the screen saver that is currently running */
3071 _DtSaverStop(style.display, savers.saverstate);
3072 XSync(style.display, False);
3073 savers.saverstate = NULL;
3076 XSync(style.display, False);
3077 XClearWindow(style.display, XtWindow(screen.saverArea));
3078 XSync(style.display, False);
3079 XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
3081 savers.current_position = cb->item_position;
3082 savers.current_saver = savers.saverActionNames[savers.current_position - 1];
3083 savers.current_saverDesc = savers.saverActionDesc[savers.current_position - 1];
3084 savers.saverstate = _DtSaverStart(style.display, &screen.saverArea, 1,
3085 savers.current_saver, style.screenDialog);
3086 /* update the preview label with the current running saver */
3087 XtVaSetValues(screen.prevLabel, XmNlabelString, cb->item, NULL);
3092 /************************************************************************/
3094 /* Kills the currently previewed saver when the user iconifies the */
3095 /* style manager. An XtEventHandler. */
3096 /************************************************************************/
3100 XtPointer client_data,
3107 if (event->type == UnmapNotify)
3109 /* terminate the saver that is currently running */
3110 if (savers.saverstate)
3112 _DtSaverStop(style.display, savers.saverstate);
3113 savers.saverstate = NULL;
3116 /* run the current screen saver only if the useSaversOn/saverOn toggle is enabled
3117 and valid saver exist and one is not already running*/
3118 else if (savers.saverCount && event->type == 19 && !savers.saverstate)
3119 if (style.smState.smLockOnTimeoutStatus)
3121 if (XmToggleButtonGadgetGetState(screen.saverOn) && savers.saverCount)
3123 XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
3124 savers.saverstate = _DtSaverStart(style.display, &screen.saverArea, 1,
3125 savers.current_saver, style.screenDialog);
3126 string = XmStringCreateLocalized (savers.current_saverDesc);
3127 XtVaSetValues(screen.prevLabel, XmNlabelString, string, NULL);
3128 XmStringFree(string);
3133 if (XmToggleButtonGadgetGetState(screen.useSaversOn) && savers.saverCount)
3135 XtVaSetValues(screen.saverArea, XmNbackground, savers.black, NULL);
3136 savers.saverstate = _DtSaverStart(style.display, &screen.saverArea, 1,
3137 savers.current_saver, style.screenDialog);
3138 string = XmStringCreateLocalized (savers.current_saverDesc);
3139 XtVaSetValues(screen.prevLabel, XmNlabelString, string, NULL);
3140 XmStringFree(string);
3146 /************************************************************************/
3148 /* Kills the currently previewed saver when the user iconifies the */
3149 /* style manager or unmaps the screen dialog. */
3150 /************************************************************************/
3155 XtPointer client_data,
3156 XtPointer call_data )
3158 /* terminate the saver that is currently running */
3159 if (savers.saverstate)
3161 _DtSaverStop(style.display, savers.saverstate);
3162 savers.saverstate = NULL;