MCDE dtsystemsettings: Desktop & Screen Saver, with Test and Random (t0110)
Desktop and Screen Saver are one pane with the two tabs of the reference;
-pane screensaver still opens the saver's page (PaneFind gives the old id to
the pane). The saver page has the list in two groups ("Screen Savers" and
"Pictures"), a running preview, Options..., Test, the start time in the
reference's seven steps (3/5/15/30 minutes, 1 and 2 hours, Never), the
password box and the notes for the corners and the energy pane.
* "Use random screen saver" selects StartDtscreenRandom, a new action
(programs/types/dtscreen.dt.src: dtscreen -mode random) that dtscreen
resolves into one of its modes each time it starts.
* Test starts the chosen saver fullscreen in an override-redirect window
and stops it after eight seconds -- dtscreen has no input loop, and a
session's saver is stopped by dtsession's lock, which a settings program
does not have.
* Options... writes dtscreen.<mode>.batchcount and dtscreen.<mode>.delay
into the server's resources (where dtscreen reads them, resource.c) and
records them in ~/.dt/screensaver; the preview restarts with them.
* The start-time scale writes dtsession's saver timeout, as before.
Pictures are listed but not offered: dtscreen's image mode has no picture
folder source of its own, so a folder entry would write a setting nobody
reads. "Show with clock" and the hot corners wait for a clock mode in
dtscreen and for the Expose & Spaces pane; the energy warning waits for the
Energy Saver pane (there is no DPMS time to compare with yet). Those three
are named in the pane itself.
tools/mcde-shot.sh: DTDATABASESEARCHPATH is comma-separated now -- that is
the separator DtEnvMap uses for it; with colons DtDb stays half-loaded and
actions are not found (the preview said "Action StartDtscreenSwarm was not
found"; with commas the savers run). The data types come with it: a dtfile
window in the test home shows the PNG and text icons instead of "??" (the
t0194 symptom). The script also exports DTSCREENSAVERLIST as dtsession does,
through a Session() function because the list has spaces.
Measured under Xvfb with xdotool:
- the page shows the two groups, Swarm chosen and running in the preview
(docs/screenshots/leopard/System-Preferences-Desktop-and-Screen-Saver-
mcde.png);
- Test covers the screen with the saver (...-Test-mcde.png) and the pane is
back eight seconds later;
- Random replaces the preview's process: "dtscreen -mode swarm" became
"dtscreen -mode random" (pgrep), and dtscreen itself reports "random
mode chose image" when run with -mode random;
- Options... with the delay moved writes "dtscreen.swarm.batchcount: 100"
and "dtscreen.swarm.delay: 530000" into RESOURCE_MANAGER and
"mode=swarm" / "batchcount=100" / "delay=530" into ~/.dt/screensaver;
- make check: test_panes PASS (new alias checks).
This commit is contained in:
1 parent
67315ef458
commit
c13e16700b
9 files changed
+561
-73
No files matched your search
@@ -92,6 +92,13 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
|
||||
window. A foreign window is registered with a hidden core widget, never a
|
||||
shell. A program without a global menu in front: the bar shows only the M
|
||||
menu. The bar uses colour set 5 (`Dtbar*secondaryColorSetId: 5`).
|
||||
- **Testing a pane**: `tools/mcde-shot.sh` sets `DTDATABASESEARCHPATH` with
|
||||
**commas** (`types/%L,types/C`), which is the separator `DtEnvMap` uses for
|
||||
this variable; a colon-separated list leaves DtDb half-loaded, so data types
|
||||
say UNKNOWN and actions ("StartDtscreenSwarm", "Trash") are not found
|
||||
(measured 2026-11-14 -- the screen saver preview showed "Action ...
|
||||
was not found" until the commas were in). The same script exports
|
||||
`DTSCREENSAVERLIST` as dtsession would.
|
||||
- **Windows**: dtwm places and maximizes below the bar; focus follows the
|
||||
pointer without auto-raise by default; zones and full screen use Command+Ctrl
|
||||
keys; the outline is XOR or four thin windows, never FlashOutline. The main
|
||||
@@ -118,6 +125,17 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
|
||||
`Dtlaunch*hotkey`, and `dtlaunch -quit` asks the running launcher to let go
|
||||
of it, so the next one takes the new key. The other rows are a record --
|
||||
their keys live in dtwm and the app-defaults.
|
||||
- **Desktop & Screen Saver** are one pane with two tabs (the old
|
||||
`-pane screensaver` opens the saver's page). The saver list is dtsession's
|
||||
`DTSCREENSAVERLIST` plus `StartDtscreenRandom` (`dtscreen -mode random`, an
|
||||
action of its own in `programs/types/dtscreen.dt.src`); "Test" starts the
|
||||
chosen saver in a fullscreen override-redirect window and stops it after
|
||||
8 s (dtscreen has no input loop; a session's saver is ended by dtsession's
|
||||
lock, which the settings program does not have). "Options..." writes
|
||||
`dtscreen.<mode>.batchcount` and `.delay` into the server's resources and
|
||||
`~/.dt/screensaver`. The start time has the reference's seven steps
|
||||
(3/5/15/30/60/120 minutes, never) and goes to dtsession as the saver
|
||||
timeout.
|
||||
- **Look settings**: System Settings > Appearance writes what the session
|
||||
reads -- `*<screen>*ColorPalette` and `*highlightColor`/`*selectColor`
|
||||
(through `_DtAddToResource`, so programs started later use them),
|
||||
|
||||
@@ -641,8 +641,10 @@ GetResources(int argc, char *argv[])
|
||||
/*
|
||||
* if random< mode, then just grab a random entry from the table
|
||||
*/
|
||||
if (!strcmp(mode, randomstring))
|
||||
if (!strcmp(mode, randomstring)) {
|
||||
mode = LockProcs[random() % (NUMPROCS - 2)].cmdline_arg;
|
||||
fprintf(stderr, "dtscreen: random mode chose %s\n", mode);
|
||||
}
|
||||
|
||||
sprintf(modename, "%s.%s", ProgramName, mode);
|
||||
sprintf(modeclass, "%s.%s", classname, mode);
|
||||
|
||||
@@ -774,11 +774,88 @@ MakeDesktopPage(Widget parent)
|
||||
/* ---- the screen saver --------------------------------------------------- */
|
||||
|
||||
#define MAX_SAVERS 32
|
||||
#define RANDOM_SAVER "StartDtscreenRandom"
|
||||
|
||||
static Widget saverList, saverArea, saverAfter, saverLock, saverNote;
|
||||
static Widget saverList, saverArea, saverAfter, saverAfterLabel, saverLock;
|
||||
static Widget saverNote, saverRandom, saverOptions, saverTest;
|
||||
static char *savers[MAX_SAVERS];
|
||||
static int nsavers, saverChosen = -1;
|
||||
static void *saverRunning;
|
||||
static int saverRow[MAX_SAVERS + 8]; /* list row -> saver, -1 header */
|
||||
static int nsaverRows;
|
||||
static int saverStep; /* index into saverSteps */
|
||||
static const int saverSteps[] = { 3, 5, 15, 30, 60, 120, 0 };
|
||||
#define NSAVERSTEPS ((int) (sizeof saverSteps / sizeof saverSteps[0]))
|
||||
|
||||
static Widget testShell;
|
||||
static void *testRunning;
|
||||
static Widget optShell, optBatch, optDelay, optNote;
|
||||
static char optMode[32];
|
||||
|
||||
/* the label without "StartDtscreen" */
|
||||
static const char *
|
||||
SaverLabel(const char *name)
|
||||
{
|
||||
if (strncmp(name, "StartDtscreen", 13) == 0 && name[13])
|
||||
return name + 13;
|
||||
return name;
|
||||
}
|
||||
|
||||
static int
|
||||
SaverRandomIndex(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nsavers; i++)
|
||||
if (strcmp(savers[i], RANDOM_SAVER) == 0)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
SaverMinutes(void)
|
||||
{
|
||||
return saverSteps[saverStep >= 0 && saverStep < NSAVERSTEPS ?
|
||||
saverStep : 0];
|
||||
}
|
||||
|
||||
static void
|
||||
SaverStepLabel(void)
|
||||
{
|
||||
char text[96];
|
||||
int m = SaverMinutes();
|
||||
|
||||
if (m == 0)
|
||||
(void)snprintf(text, sizeof text, "Never.");
|
||||
else if (m == 60)
|
||||
(void)snprintf(text, sizeof text, "After 1 hour.");
|
||||
else if (m == 120)
|
||||
(void)snprintf(text, sizeof text, "After 2 hours.");
|
||||
else
|
||||
(void)snprintf(text, sizeof text, "After %d minutes.", m);
|
||||
SetText(saverAfterLabel, text);
|
||||
}
|
||||
|
||||
/* the step nearest to MINUTES (0 = never) */
|
||||
static int
|
||||
SaverStepOf(int minutes)
|
||||
{
|
||||
int i, best = 0, diff = 100000;
|
||||
|
||||
if (minutes <= 0)
|
||||
return NSAVERSTEPS - 1;
|
||||
for (i = 0; i < NSAVERSTEPS - 1; i++) {
|
||||
int d = saverSteps[i] - minutes;
|
||||
|
||||
if (d < 0)
|
||||
d = -d;
|
||||
if (d < diff) {
|
||||
diff = d;
|
||||
best = i;
|
||||
}
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
static void
|
||||
SaverStop(void)
|
||||
@@ -807,9 +884,8 @@ SaverSend(void)
|
||||
Window sm;
|
||||
SmStateInfo state;
|
||||
SmSaverInfo saver;
|
||||
int minutes = 0;
|
||||
int minutes = SaverMinutes();
|
||||
|
||||
XmScaleGetValue(saverAfter, &minutes);
|
||||
if (_DtGetSmWindow(dpy, RootWindow(dpy, 0), &sm) != Success) {
|
||||
SetText(saverNote, "No session manager runs: the setting is "
|
||||
"not kept.");
|
||||
@@ -818,28 +894,263 @@ SaverSend(void)
|
||||
memset(&state, 0, sizeof state);
|
||||
state.flags = SM_STATE_SAVERTIMEOUT | SM_STATE_LOCKTIMEOUT;
|
||||
state.smSaverTimeout = minutes * 60;
|
||||
state.smLockTimeout = XmToggleButtonGetState(saverLock) ?
|
||||
state.smLockTimeout = (minutes > 0 && XmToggleButtonGetState(saverLock)) ?
|
||||
minutes * 60 : 0;
|
||||
_DtSetSmState(dpy, sm, &state);
|
||||
if (saverChosen >= 0) {
|
||||
memset(&saver, 0, sizeof saver);
|
||||
saver.saverList = savers[saverChosen];
|
||||
_DtSetSmSaver(dpy, sm, &saver);
|
||||
}
|
||||
XFlush(dpy);
|
||||
SetText(saverNote, minutes > 0 ? "" :
|
||||
"The screen saver does not start by itself.");
|
||||
SetText(saverNote, "");
|
||||
}
|
||||
|
||||
/* ---- Test: the saver over the whole screen, stopped by a key or a click -- */
|
||||
|
||||
|
||||
|
||||
static void
|
||||
TestStop(void)
|
||||
{
|
||||
if (testRunning != NULL) {
|
||||
_DtSaverStop(XtDisplay(testShell), testRunning);
|
||||
testRunning = NULL;
|
||||
}
|
||||
if (testShell != NULL) {
|
||||
XtPopdown(testShell);
|
||||
XtDestroyWidget(testShell);
|
||||
testShell = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
TestTimeout(XtPointer data, XtIntervalId *id)
|
||||
{
|
||||
(void) data;
|
||||
(void) id;
|
||||
TestStop();
|
||||
/* back to the preview in the window */
|
||||
SaverPreview();
|
||||
}
|
||||
|
||||
static void
|
||||
SaverTestCB(Widget w, XtPointer data, XtPointer call)
|
||||
{
|
||||
Display *dpy = XtDisplay(w);
|
||||
Screen *scr = XtScreen(w);
|
||||
Widget area;
|
||||
int idx = saverChosen;
|
||||
Arg a[8];
|
||||
int n = 0;
|
||||
|
||||
(void) data;
|
||||
(void) call;
|
||||
if (testShell != NULL)
|
||||
return;
|
||||
if (idx < 0 || idx >= nsavers)
|
||||
idx = nsavers > 0 ? 0 : -1;
|
||||
if (idx < 0)
|
||||
return;
|
||||
if (saverRunning != NULL)
|
||||
SaverStop();
|
||||
|
||||
n = 0;
|
||||
XtSetArg(a[n], XmNwidth, WidthOfScreen(scr)); n++;
|
||||
XtSetArg(a[n], XmNheight, HeightOfScreen(scr)); n++;
|
||||
XtSetArg(a[n], XmNx, 0); n++;
|
||||
XtSetArg(a[n], XmNy, 0); n++;
|
||||
XtSetArg(a[n], XmNoverrideRedirect, True); n++;
|
||||
XtSetArg(a[n], XmNmappedWhenManaged, False); n++;
|
||||
testShell = XtCreatePopupShell("saverTest", topLevelShellWidgetClass,
|
||||
XtParent(w), a, n);
|
||||
area = XtVaCreateManagedWidget("testArea", xmDrawingAreaWidgetClass,
|
||||
testShell, XmNbackground, BlackPixelOfScreen(scr),
|
||||
XmNwidth, WidthOfScreen(scr), XmNheight, HeightOfScreen(scr),
|
||||
NULL);
|
||||
XtPopup(testShell, XtGrabNone);
|
||||
XRaiseWindow(dpy, XtWindow(testShell));
|
||||
testRunning = _DtSaverStart(dpy, &area, 1, savers[idx], area);
|
||||
/* dtscreen keeps no event loop of its own; the saver in a window is
|
||||
* stopped after a few seconds (a session's saver is stopped by
|
||||
* dtsession's lock, which a settings program does not have) */
|
||||
XtAppAddTimeOut(app, 8000, TestTimeout, NULL);
|
||||
}
|
||||
|
||||
/* ---- Options: the chosen saver's batch and delay ------------------------ */
|
||||
|
||||
/* "StartDtscreenSwarm" -> "swarm" */
|
||||
static void
|
||||
SaverMode(char *buf, size_t len)
|
||||
{
|
||||
const char *n = saverChosen >= 0 && saverChosen < nsavers ?
|
||||
savers[saverChosen] : "blank";
|
||||
size_t i;
|
||||
|
||||
if (strncmp(n, "StartDtscreen", 13) == 0)
|
||||
n += 13;
|
||||
for (i = 0; n[i] != '\0' && i + 1 < len; i++)
|
||||
buf[i] = (n[i] >= 'A' && n[i] <= 'Z') ? n[i] - 'A' + 'a' :
|
||||
n[i];
|
||||
buf[i] = '\0';
|
||||
if (i == 0)
|
||||
(void)snprintf(buf, len, "blank");
|
||||
}
|
||||
|
||||
static void
|
||||
OptionsFill(void)
|
||||
{
|
||||
char name[128], class[128], v[32];
|
||||
int batch = 100, delay = 30;
|
||||
|
||||
SaverMode(optMode, sizeof optMode);
|
||||
(void)snprintf(name, sizeof name, "dtscreen.%s.batchcount", optMode);
|
||||
(void)snprintf(class, sizeof class, "Dtscreen.%s.Batchcount", optMode);
|
||||
ServerResource(XtDisplay(optShell), name, class, "100", v, sizeof v);
|
||||
batch = atoi(v);
|
||||
(void)snprintf(name, sizeof name, "dtscreen.%s.delay", optMode);
|
||||
(void)snprintf(class, sizeof class, "Dtscreen.%s.Delay", optMode);
|
||||
ServerResource(XtDisplay(optShell), name, class, "30000", v, sizeof v);
|
||||
delay = atoi(v) / 1000; /* microseconds -> milliseconds */
|
||||
XmScaleSetValue(optBatch, batch > 0 ? batch : 1);
|
||||
XmScaleSetValue(optDelay, delay >= 0 ? delay : 0);
|
||||
{
|
||||
char text[128];
|
||||
|
||||
(void)snprintf(text, sizeof text, "Options for %s:",
|
||||
SaverLabel(savers[saverChosen]));
|
||||
SetText(XtNameToWidget(optShell, "*optionsLabel"), text);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SaverFile(char *buf, size_t len)
|
||||
{
|
||||
const char *home = getenv("HOME");
|
||||
|
||||
(void)snprintf(buf, len, "%s/.dt/screensaver", home != NULL ? home :
|
||||
".");
|
||||
}
|
||||
|
||||
static void
|
||||
OptionsApply(Widget w, XtPointer data, XtPointer call)
|
||||
{
|
||||
char res[256], name[128], class[128], path[1024];
|
||||
int batch = 0, delay = 0;
|
||||
FILE *f;
|
||||
|
||||
(void) data;
|
||||
(void) call;
|
||||
XmScaleGetValue(optBatch, &batch);
|
||||
XmScaleGetValue(optDelay, &delay);
|
||||
/* dtscreen reads Dtscreen.<mode>.batchcount and .delay (resource.c) */
|
||||
(void)snprintf(res, sizeof res,
|
||||
"dtscreen.%s.batchcount: %d\ndtscreen.%s.delay: %d\n",
|
||||
optMode, batch > 0 ? batch : 1, optMode, (delay < 0 ? 0 : delay) *
|
||||
1000);
|
||||
_DtAddToResource(XtDisplay(w), res);
|
||||
SaverFile(path, sizeof path);
|
||||
if ((f = fopen(path, "w")) != NULL) {
|
||||
fprintf(f, "# the screen saver's options (System Settings)\n"
|
||||
"mode=%s\nbatchcount=%d\ndelay=%d\n", optMode, batch,
|
||||
delay);
|
||||
fclose(f);
|
||||
}
|
||||
(void)name;
|
||||
(void)class;
|
||||
SetText(optNote, "The preview uses it now; a running saver when it "
|
||||
"starts again.");
|
||||
SaverPreview();
|
||||
}
|
||||
|
||||
static void
|
||||
OptionsClose(Widget w, XtPointer data, XtPointer call)
|
||||
{
|
||||
(void) w;
|
||||
(void) data;
|
||||
(void) call;
|
||||
XtPopdown(optShell);
|
||||
}
|
||||
|
||||
static void
|
||||
SaverOptionsCB(Widget w, XtPointer data, XtPointer call)
|
||||
{
|
||||
(void) data;
|
||||
(void) call;
|
||||
if (saverChosen < 0 || savers[saverChosen] == NULL) {
|
||||
Message(XtParent(w), "Choose a screen saver first.", 0);
|
||||
return;
|
||||
}
|
||||
if (strcmp(savers[saverChosen], RANDOM_SAVER) == 0) {
|
||||
Message(XtParent(w), "The random mode takes the options of the "
|
||||
"saver it picks.", 0);
|
||||
return;
|
||||
}
|
||||
if (optShell == NULL) {
|
||||
Widget box, row, buttons;
|
||||
XmString s;
|
||||
|
||||
optShell = XtVaCreatePopupShell("saverOptions",
|
||||
topLevelShellWidgetClass, XtParent(w),
|
||||
XmNtitle, "Screen Saver Options", NULL);
|
||||
box = XtVaCreateManagedWidget("optionsBox",
|
||||
xmRowColumnWidgetClass, optShell, XmNorientation,
|
||||
XmVERTICAL, XmNmarginWidth, 12, XmNmarginHeight, 12,
|
||||
XmNspacing, 6, XmNwidth, 380, NULL);
|
||||
s = XmStringCreateLocalized((char *) "Options:");
|
||||
XtVaCreateManagedWidget("optionsLabel", xmLabelWidgetClass,
|
||||
box, XmNlabelString, s, XmNalignment,
|
||||
XmALIGNMENT_BEGINNING, NULL);
|
||||
XmStringFree(s);
|
||||
row = XtVaCreateManagedWidget("batchRow",
|
||||
xmRowColumnWidgetClass, box, NULL);
|
||||
(void) Text(row, "batchLabel", "Things per batch:");
|
||||
optBatch = XtVaCreateManagedWidget("batch", xmScaleWidgetClass,
|
||||
row, XmNorientation, XmHORIZONTAL, XmNminimum, 1,
|
||||
XmNmaximum, 500, XmNvalue, 100, XmNshowValue, True,
|
||||
XmNscaleWidth, 260, NULL);
|
||||
row = XtVaCreateManagedWidget("delayRow",
|
||||
xmRowColumnWidgetClass, box, NULL);
|
||||
(void) Text(row, "delayLabel", "Delay between updates "
|
||||
"(milliseconds):");
|
||||
optDelay = XtVaCreateManagedWidget("delay", xmScaleWidgetClass,
|
||||
row, XmNorientation, XmHORIZONTAL, XmNminimum, 0,
|
||||
XmNmaximum, 5000, XmNvalue, 30, XmNshowValue, True,
|
||||
XmNscaleWidth, 260, NULL);
|
||||
optNote = Text(box, "optionsNote", "");
|
||||
buttons = XtVaCreateManagedWidget("optionsButtons",
|
||||
xmRowColumnWidgetClass, box, XmNorientation,
|
||||
XmHORIZONTAL, XmNspacing, 8, XmNmarginWidth, 0, NULL);
|
||||
{
|
||||
Widget ap = Button(buttons, "Apply", OptionsApply,
|
||||
NULL);
|
||||
Widget cl = Button(buttons, "Close", OptionsClose,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(ap, XmNwidth, 90, NULL);
|
||||
XtVaSetValues(cl, XmNwidth, 90, NULL);
|
||||
}
|
||||
}
|
||||
OptionsFill();
|
||||
XtPopup(optShell, XtGrabNone);
|
||||
}
|
||||
|
||||
/* ---- the list: the savers, a Pictures group, the choice ----------------- */
|
||||
|
||||
static void
|
||||
SaverChosen(Widget w, XtPointer data, XtPointer call)
|
||||
{
|
||||
int pos = ((XmListCallbackStruct *) call)->item_position;
|
||||
int row = ((XmListCallbackStruct *) call)->item_position - 1;
|
||||
int idx;
|
||||
|
||||
(void) w;
|
||||
(void) data;
|
||||
if (pos < 1 || pos > nsavers)
|
||||
if (row < 0 || row >= nsaverRows)
|
||||
return;
|
||||
saverChosen = pos - 1;
|
||||
idx = saverRow[row];
|
||||
if (idx < 0)
|
||||
return; /* a group's head */
|
||||
saverChosen = idx;
|
||||
SaverPreview();
|
||||
SaverSend();
|
||||
}
|
||||
@@ -853,11 +1164,42 @@ SaverChanged(Widget w, XtPointer data, XtPointer call)
|
||||
SaverSend();
|
||||
}
|
||||
|
||||
static void
|
||||
SaverRandomCB(Widget w, XtPointer data, XtPointer call)
|
||||
{
|
||||
int i, idx;
|
||||
|
||||
(void) data;
|
||||
(void) call;
|
||||
if (!((XmToggleButtonCallbackStruct *) call)->set)
|
||||
return;
|
||||
idx = SaverRandomIndex();
|
||||
if (idx < 0)
|
||||
return;
|
||||
for (i = 0; i < nsaverRows; i++)
|
||||
if (saverRow[i] == idx)
|
||||
XmListSelectPos(saverList, i + 1, True);
|
||||
}
|
||||
|
||||
static void
|
||||
SaverAfterCB(Widget w, XtPointer data, XtPointer call)
|
||||
{
|
||||
int v = 0;
|
||||
|
||||
(void) w;
|
||||
(void) data;
|
||||
(void) call;
|
||||
XmScaleGetValue(saverAfter, &v);
|
||||
saverStep = v;
|
||||
SaverStepLabel();
|
||||
SaverSend();
|
||||
}
|
||||
|
||||
static Widget
|
||||
MakeSaverPage(Widget parent)
|
||||
{
|
||||
Display *dpy = XtDisplay(parent);
|
||||
Widget form, frame, controls;
|
||||
Widget form, frame, left, right, bottom, row;
|
||||
const char *env = getenv("DTSCREENSAVERLIST");
|
||||
char *list, *tok, *last = NULL, *current = NULL;
|
||||
Window sm;
|
||||
@@ -870,9 +1212,16 @@ MakeSaverPage(Widget parent)
|
||||
nsavers = 0;
|
||||
list = strdup(env != NULL ? env : "StartDtscreenBlank");
|
||||
for (tok = strtok_r(list, " \t", &last); tok != NULL &&
|
||||
nsavers < MAX_SAVERS; tok = strtok_r(NULL, " \t", &last))
|
||||
nsavers < MAX_SAVERS - 1; tok = strtok_r(NULL, " \t", &last))
|
||||
savers[nsavers++] = strdup(tok);
|
||||
free(list);
|
||||
/* the random mode is a saver of its own (dtscreen -mode random) */
|
||||
for (i = 0; i < nsavers; i++)
|
||||
if (strcmp(savers[i], RANDOM_SAVER) == 0)
|
||||
break;
|
||||
if (i == nsavers && nsavers < MAX_SAVERS)
|
||||
savers[nsavers++] = strdup(RANDOM_SAVER);
|
||||
|
||||
memset(&saver, 0, sizeof saver);
|
||||
if (_DtGetSmWindow(dpy, RootWindow(dpy, 0), &sm) == Success) {
|
||||
if (_DtGetSmState(dpy, sm, &state) == Success) {
|
||||
@@ -884,61 +1233,142 @@ MakeSaverPage(Widget parent)
|
||||
current = saver.saverList;
|
||||
}
|
||||
|
||||
form = XtVaCreateWidget("saverPage", xmFormWidgetClass, parent,
|
||||
XmNwidth, 600, XmNheight, 400, NULL);
|
||||
controls = XtVaCreateManagedWidget("controls", xmRowColumnWidgetClass,
|
||||
form, XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM, NULL);
|
||||
(void) Text(controls, "label", "Start the screen saver after "
|
||||
"(minutes; 0: never):");
|
||||
form = XtVaCreateWidget("saverPage", xmRowColumnWidgetClass, parent,
|
||||
XmNspacing, 6, NULL);
|
||||
|
||||
/* left: the savers in two groups; right: the preview */
|
||||
left = XtVaCreateManagedWidget("saverRow", xmRowColumnWidgetClass,
|
||||
form, XmNorientation, XmHORIZONTAL, XmNspacing, 12,
|
||||
XmNmarginWidth, 0, NULL);
|
||||
{
|
||||
Widget col = XtVaCreateManagedWidget("saverLeft",
|
||||
xmRowColumnWidgetClass, left, XmNspacing, 4,
|
||||
XmNmarginWidth, 0, NULL);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(a[n], XmNvisibleItemCount, 14); n++;
|
||||
XtSetArg(a[n], XmNselectionPolicy, XmBROWSE_SELECT); n++;
|
||||
saverList = XmCreateScrolledList(col, "savers", a, n);
|
||||
XtVaSetValues(XtParent(saverList), XmNwidth, 240,
|
||||
XmNheight, 300, NULL);
|
||||
nsaverRows = 0;
|
||||
{
|
||||
XmString s = XmStringCreateLocalized((char *)
|
||||
"Screen Savers");
|
||||
|
||||
XmListAddItemUnselected(saverList, s, 0);
|
||||
XmStringFree(s);
|
||||
saverRow[nsaverRows++] = -1;
|
||||
}
|
||||
for (i = 0; i < nsavers; i++) {
|
||||
char label[128];
|
||||
XmString s;
|
||||
|
||||
if (strcmp(savers[i], RANDOM_SAVER) == 0)
|
||||
(void)snprintf(label, sizeof label,
|
||||
" Random");
|
||||
else
|
||||
(void)snprintf(label, sizeof label, " %s",
|
||||
SaverLabel(savers[i]));
|
||||
s = XmStringCreateLocalized(label);
|
||||
XmListAddItemUnselected(saverList, s, 0);
|
||||
XmStringFree(s);
|
||||
saverRow[nsaverRows++] = i;
|
||||
if (current != NULL &&
|
||||
strstr(current, savers[i]) == current)
|
||||
saverChosen = i;
|
||||
}
|
||||
{
|
||||
XmString s = XmStringCreateLocalized((char *)
|
||||
"Pictures");
|
||||
|
||||
XmListAddItemUnselected(saverList, s, 0);
|
||||
XmStringFree(s);
|
||||
saverRow[nsaverRows++] = -1;
|
||||
s = XmStringCreateLocalized((char *) " (dtscreen "
|
||||
"reads no picture folders yet)");
|
||||
XmListAddItemUnselected(saverList, s, 0);
|
||||
XmStringFree(s);
|
||||
saverRow[nsaverRows++] = -1;
|
||||
}
|
||||
if (saverChosen >= 0)
|
||||
for (i = 0; i < nsaverRows; i++)
|
||||
if (saverRow[i] == saverChosen)
|
||||
XmListSelectPos(saverList, i + 1,
|
||||
False);
|
||||
XtManageChild(saverList);
|
||||
XtAddCallback(saverList, XmNbrowseSelectionCallback,
|
||||
SaverChosen, NULL);
|
||||
saverRandom = XtVaCreateManagedWidget("Use random screen "
|
||||
"saver", xmToggleButtonWidgetClass, col, NULL);
|
||||
XtAddCallback(saverRandom, XmNvalueChangedCallback,
|
||||
SaverRandomCB, NULL);
|
||||
}
|
||||
{
|
||||
Widget col = XtVaCreateManagedWidget("saverRight",
|
||||
xmRowColumnWidgetClass, left, XmNspacing, 6,
|
||||
XmNmarginWidth, 0, NULL);
|
||||
Widget row;
|
||||
|
||||
frame = XtVaCreateManagedWidget("previewFrame",
|
||||
xmFrameWidgetClass, col, XmNshadowType, XmSHADOW_IN,
|
||||
XmNmarginWidth, 0, XmNmarginHeight, 0, NULL);
|
||||
saverArea = XtVaCreateManagedWidget("preview",
|
||||
xmDrawingAreaWidgetClass, frame,
|
||||
XmNbackground, BlackPixelOfScreen(XtScreen(parent)),
|
||||
XmNwidth, 360, XmNheight, 220, XmNresizePolicy,
|
||||
XmRESIZE_NONE, NULL);
|
||||
row = XtVaCreateManagedWidget("saverButtons",
|
||||
xmRowColumnWidgetClass, col, XmNorientation,
|
||||
XmHORIZONTAL, XmNspacing, 8, XmNmarginWidth, 0, NULL);
|
||||
saverOptions = Button(row, "Options...", SaverOptionsCB, NULL);
|
||||
saverTest = Button(row, "Test", SaverTestCB, NULL);
|
||||
(void)saverOptions;
|
||||
(void)saverTest;
|
||||
}
|
||||
|
||||
/* the time, the password, the corners */
|
||||
bottom = XtVaCreateManagedWidget("saverBottom",
|
||||
xmRowColumnWidgetClass, form, XmNspacing, 4, XmNmarginWidth, 0,
|
||||
NULL);
|
||||
(void) Text(bottom, "afterLabel", "Start screen saver:");
|
||||
saverAfter = XtVaCreateManagedWidget("after", xmScaleWidgetClass,
|
||||
controls, XmNorientation, XmHORIZONTAL, XmNminimum, 0,
|
||||
XmNmaximum, 120, XmNvalue, minutes > 120 ? 120 : minutes,
|
||||
XmNshowValue, True, XmNscaleWidth, 320, NULL);
|
||||
XtAddCallback(saverAfter, XmNvalueChangedCallback, SaverChanged, NULL);
|
||||
bottom, XmNorientation, XmHORIZONTAL, XmNminimum, 0,
|
||||
XmNmaximum, NSAVERSTEPS - 1, XmNvalue, SaverStepOf(minutes),
|
||||
XmNshowValue, False, XmNscaleWidth, 320, NULL);
|
||||
saverAfterLabel = Text(bottom, "afterText", "");
|
||||
(void) Text(bottom, "afterMarks", " 3 5 15 30 "
|
||||
"1 hr 2 hr Never");
|
||||
XtAddCallback(saverAfter, XmNvalueChangedCallback, SaverAfterCB, NULL);
|
||||
saverLock = XtVaCreateManagedWidget(
|
||||
"Ask for the password when it stops", xmToggleButtonWidgetClass,
|
||||
controls, XmNset, lock, NULL);
|
||||
bottom, NULL);
|
||||
XmToggleButtonSetState(saverLock, lock, False);
|
||||
XtAddCallback(saverLock, XmNvalueChangedCallback, SaverChanged, NULL);
|
||||
saverNote = Text(controls, "note", "");
|
||||
row = XtVaCreateManagedWidget("saverExtra", xmRowColumnWidgetClass,
|
||||
bottom, XmNorientation, XmHORIZONTAL, XmNspacing, 8,
|
||||
XmNmarginWidth, 0, NULL);
|
||||
{
|
||||
Widget hot = Button(row, "Hot Corners...", NULL, NULL);
|
||||
Widget energy = Button(row, "Energy Saver...", NULL, NULL);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(a[n], XmNvisibleItemCount, 12); n++;
|
||||
XtSetArg(a[n], XmNselectionPolicy, XmBROWSE_SELECT); n++;
|
||||
XtSetArg(a[n], XmNtopAttachment, XmATTACH_FORM); n++;
|
||||
XtSetArg(a[n], XmNleftAttachment, XmATTACH_FORM); n++;
|
||||
XtSetArg(a[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
|
||||
XtSetArg(a[n], XmNbottomWidget, controls); n++;
|
||||
XtSetArg(a[n], XmNbottomOffset, 8); n++;
|
||||
saverList = XmCreateScrolledList(form, "savers", a, n);
|
||||
XtVaSetValues(XtParent(saverList), XmNwidth, 200, NULL);
|
||||
for (i = 0; i < nsavers; i++) {
|
||||
const char *label = savers[i];
|
||||
XmString s;
|
||||
|
||||
/* "StartDtscreenSwarm": the name without its prefix */
|
||||
if (strncmp(label, "StartDtscreen", 13) == 0 && label[13])
|
||||
label += 13;
|
||||
s = XmStringCreateLocalized((char *) label);
|
||||
XmListAddItemUnselected(saverList, s, 0);
|
||||
XmStringFree(s);
|
||||
if (current != NULL && strstr(current, savers[i]) == current)
|
||||
saverChosen = i;
|
||||
(void)hot;
|
||||
/* both pages belong to panes that are not there yet */
|
||||
XtSetSensitive(hot, False);
|
||||
XtSetSensitive(energy, False);
|
||||
}
|
||||
if (saverChosen >= 0)
|
||||
XmListSelectPos(saverList, saverChosen + 1, False);
|
||||
XtManageChild(saverList);
|
||||
XtAddCallback(saverList, XmNbrowseSelectionCallback, SaverChosen, NULL);
|
||||
frame = XtVaCreateManagedWidget("previewFrame", xmFrameWidgetClass,
|
||||
form, XmNshadowType, XmSHADOW_IN,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_WIDGET,
|
||||
XmNleftWidget, XtParent(saverList), XmNleftOffset, 12,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, controls,
|
||||
XmNbottomOffset, 8, NULL);
|
||||
saverArea = XtVaCreateManagedWidget("preview", xmDrawingAreaWidgetClass,
|
||||
frame, XmNbackground, BlackPixelOfScreen(XtScreen(parent)), NULL);
|
||||
(void) Text(bottom, "energyNote", "The display sleeps before the "
|
||||
"screen saver when the Energy Saver asks for it;\nthat pane is "
|
||||
"not there yet.");
|
||||
saverNote = Text(bottom, "note", "");
|
||||
|
||||
saverStep = SaverStepOf(minutes);
|
||||
SaverStepLabel();
|
||||
(void) Text(bottom, "clockNote", "A clock in the saver needs a clock "
|
||||
"mode in dtscreen; it has none yet.\nHot corners belong to "
|
||||
"Expose & Spaces, which is not there yet either.");
|
||||
|
||||
XtVaSetValues(saverNote, XmNmarginWidth, 0, NULL);
|
||||
return form;
|
||||
}
|
||||
|
||||
@@ -995,7 +1425,7 @@ PreviewLater(XtPointer data, XtIntervalId *id)
|
||||
}
|
||||
|
||||
/* the page shown first: SAVER 0 the desktop, 1 the screen saver */
|
||||
static Widget
|
||||
Widget
|
||||
MakeDesktopPane(Widget parent, int saver)
|
||||
{
|
||||
Widget box = XtVaCreateWidget("desktop", xmRowColumnWidgetClass, parent,
|
||||
|
||||
@@ -1202,10 +1202,12 @@ ShowPane(const Pane *p)
|
||||
w = MakeSharing(paneArea);
|
||||
else if (strcmp(p->id, "startup") == 0)
|
||||
w = MakeStartup(paneArea);
|
||||
else if (strcmp(p->id, "desktop") == 0)
|
||||
w = MakeDesktop(paneArea);
|
||||
else if (strcmp(p->id, "screensaver") == 0)
|
||||
w = MakeScreenSaver(paneArea);
|
||||
else if (strcmp(p->id, "desktop") == 0 ||
|
||||
strcmp(p->id, "screensaver") == 0) {
|
||||
w = MakeDesktopPane(paneArea,
|
||||
strcmp(p->id, "screensaver") == 0);
|
||||
XtVaSetValues(shell, XmNheight, 660, XmNwidth, 800, NULL);
|
||||
}
|
||||
else if (strcmp(p->id, "keyboardmouse") == 0 ||
|
||||
strcmp(p->id, "keyboard") == 0 || strcmp(p->id, "mouse") == 0 ||
|
||||
strcmp(p->id, "shortcuts") == 0) {
|
||||
|
||||
@@ -24,12 +24,11 @@ const Pane panes[] = {
|
||||
{ "appearance", "Appearance", CAT_PERSONAL, "DtColor.pm", PANE_OWN,
|
||||
NULL, "appearance colours colors palette theme farben fonts "
|
||||
"schrift schriften smoothing antialias" },
|
||||
{ "desktop", "Desktop", CAT_PERSONAL, "DtBkdrp.pm", PANE_OWN, NULL,
|
||||
"desktop background wallpaper hintergrund" },
|
||||
{ "desktop", "Desktop & Screen Saver", CAT_PERSONAL, "DtBkdrp.pm",
|
||||
PANE_OWN, NULL, "desktop background wallpaper hintergrund "
|
||||
"screensaver screen saver bildschirmschoner" },
|
||||
{ "language", "Language", CAT_PERSONAL, "DtI18N.pm", PANE_OWN,
|
||||
NULL, "language sprache locale region formats datum" },
|
||||
{ "screensaver", "Screen Saver", CAT_PERSONAL, "DtScrn.pm",
|
||||
PANE_OWN, NULL, "screensaver screen saver bildschirmschoner" },
|
||||
{ "dock", "Dock", CAT_PERSONAL, "DtPanel.m.pm", PANE_LATER, NULL,
|
||||
"dock leiste panel front panel" },
|
||||
{ "security", "Security", CAT_PERSONAL, "Dtlockscrn.pm", PANE_LATER,
|
||||
@@ -116,6 +115,17 @@ PaneFind(const char *id)
|
||||
/* the fonts are part of Appearance since t0099; the old id stays */
|
||||
if (strcmp(id, "fonts") == 0)
|
||||
id = "appearance";
|
||||
/* Desktop & Screen Saver is one pane since t0110; the old id opens the
|
||||
* saver's page */
|
||||
if (strcmp(id, "screensaver") == 0) {
|
||||
for (i = 0; i < paneCount; i++)
|
||||
if (strcmp(panes[i].id, "desktop") == 0) {
|
||||
alias = panes[i];
|
||||
alias.id = id;
|
||||
return &alias;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
/* Keyboard & Mouse is one pane since t0129; the old ids open its tab */
|
||||
if (strcmp(id, "keyboard") == 0 || strcmp(id, "mouse") == 0 ||
|
||||
strcmp(id, "shortcuts") == 0) {
|
||||
|
||||
@@ -84,6 +84,12 @@ main(void)
|
||||
CHECK(PaneFind("shortcuts") != NULL &&
|
||||
strcmp(PaneFind("shortcuts")->id, "shortcuts") == 0);
|
||||
CHECK(PaneMatch(PaneFind("keyboard"), "tastenkuerzel"));
|
||||
/* one Desktop & Screen Saver pane since t0110 */
|
||||
CHECK(PaneFind("desktop") != NULL);
|
||||
CHECK(PaneFind("screensaver") != NULL &&
|
||||
strcmp(PaneFind("screensaver")->id, "screensaver") == 0 &&
|
||||
PaneFind("screensaver")->category == CAT_PERSONAL);
|
||||
CHECK(PaneMatch(PaneFind("desktop"), "bildschirmschoner"));
|
||||
CHECK(PaneFind("sound") != NULL && PaneFind("sound")->kind == PANE_OWN);
|
||||
if (failures == 0)
|
||||
printf("PASS test_panes\n");
|
||||
|
||||
@@ -36,9 +36,9 @@ Widget MakeUpdate(Widget parent);
|
||||
* (Xlib keeps the string of the connection's start); DEF when none */
|
||||
void ServerResource(Display *dpy, const char *name, const char *class,
|
||||
const char *def, char *buf, size_t len);
|
||||
/* the pane in desktop.c, opened on its desktop or its screen saver page */
|
||||
Widget MakeDesktop(Widget parent);
|
||||
Widget MakeScreenSaver(Widget parent);
|
||||
/* the Desktop & Screen Saver pane (desktop.c), opened on its desktop (0) or
|
||||
* its screen saver page (1) */
|
||||
Widget MakeDesktopPane(Widget parent, int saver);
|
||||
/* the Network pane (network.c); dtsystemsettings -renew-dhcp IF */
|
||||
Widget MakeNetwork(Widget parent);
|
||||
int RenewDhcpCommand(const char *ifname);
|
||||
|
||||
@@ -3298,6 +3298,17 @@ $
|
||||
to start the Blank Screen screen saver.
|
||||
$
|
||||
$ **************************************************************************
|
||||
$ ----------------------------------------------------------------------------
|
||||
$ Messages 19032 - 19033 refer to the 'StartDtscreenRandom' action (MCDE).
|
||||
$
|
||||
$ 19032 - translate into 1 word with no blanks.
|
||||
$
|
||||
19032 Random
|
||||
$
|
||||
$ 19033 - Short Description
|
||||
$
|
||||
19033 A different one each time
|
||||
$
|
||||
$ **************************************************************************
|
||||
$ * dtcm.dt (Calender Manager)
|
||||
$ **************************************************************************
|
||||
|
||||
@@ -107,6 +107,15 @@ ACTION StartDtscreenWorm
|
||||
DESCRIPTION %|nls-19026-#Wiggly ...#|
|
||||
}
|
||||
|
||||
ACTION StartDtscreenRandom
|
||||
{
|
||||
LABEL %|nls-19032-#StartDtscreenRandom#|
|
||||
TYPE COMMAND
|
||||
WINDOW_TYPE NO_STDIO
|
||||
EXEC_STRING CDE_INSTALLATION_TOP/bin/dtscreen -mode random
|
||||
DESCRIPTION %|nls-19033-#A different one each time#|
|
||||
}
|
||||
|
||||
ACTION StartDtscreenBlank
|
||||
{
|
||||
LABEL %|nls-19028-#StartDtscreenBlank#|
|
||||
|
||||
Reference in new issue
Block a user