MCDE dtsystemsettings: Appearance, the four groups and the fonts (t0099)

The pane is the reference's form now: Appearance (a menu of the palettes with
the chosen palette's eight colours as a strip under it, then "In use:"),
Highlight Color (the eight colours of the active palette, written as
*highlightColor and *selectColor for programs started later), the scroll
bars, the number of recent items, font smoothing -- and the fonts, which
lose their own pane (the "fonts" id still opens Appearance, the entry is
gone from the overview).

What the pane writes is what the session reads:

  *<screen>*ColorPalette, *highlightColor, *selectColor   _DtAddToResource
  Dtwm*mcdeTitleBarDoubleClick: none|minimize             then dtwm restarts
  ~/.dt/recent.conf: applications=N, documents=N, servers=N
  ~/.config/fontconfig/conf.d/60-mcde-antialias.conf      antialias=false

dtwm gained the title-bar double click: a new resource (WmResNames.h,
WmGlobal.h, WmResource.c, default "none") and, in CheckButtonPressBuiltin
(WmCEvent.c), the double-click branch on the title -- F_Minimize or
F_Maximize instead of the move.  dtbar's Recent Items and Connect to
Server's history now read their counts from ~/.dt/recent.conf
(ItemsPush/FillRecent, ReadLines/RecentAdd).

Two things the task itself said to drop are dropped, with the reason in the
pane: Motif has no separate arrow buttons at both ends of a scroll bar and no
smooth scrolling (an animation), and a click in a Motif scroll bar pages
while the middle button jumps to the place.

Font smoothing is a fontconfig rule, not *Xft.antialias: measured here, Xft
ignores that X resource (205 grey levels with and without it), while a
<match target="font"> antialias=false rule gives 2.  The rule reaches GTK and
Qt as well (one look).

Measured under Xvfb with xdotool:

  - "Off" + Apply -> the file is written and an Xft render test in the same
    session drops from 205 distinct grey levels to 2; with the size limit 20
    the same test (size 12) gives 2, with 4 it gives 205 -- the rule holds
    only up to the size.
  - the title-bar box + Apply writes Dtwm*mcdeTitleBarDoubleClick: minimize,
    dtwm restarts, and a double click on dtpad's title bar leaves its window
    "Map State: IsUnMapped" (IsViewable before).
  - a palette choice writes *0*ColorPalette: Camouflage.dp (and dtthemesync's
    colours), the strip and the Highlight menu follow it.
  - Documents=5 with eight entries in ~/.dt/recent shows five in the bar's
    Recent Items; Servers=0 leaves the Connect to Server field at "sftp://",
    Servers=10 prefills the stored address.

Pictures: docs/screenshots/leopard/System-Preferences-Appearance-mcde.png
(the four groups) and ...-Appearance-fonts-mcde.png (scrolled to the fonts).
make check: test_panes PASS.

Open: a highlight colour reaches programs started later, not the running
ones; "Applications" has no recent list to feed; the dtwm value takes effect
when the window manager restarts (the Apply button does it); the antialias
rule is read at program start; and the fonts list is six rows inside the
scrolled pane.
This commit is contained in:
lotherk committed 2026-11-14 09:59:02 +00:00
1 parent 4fb6b871b8
commit dc8dfd2cc7
10 files changed
+751 -53

No files matched your search

+38 -4
View File
@@ -58,6 +58,34 @@ static Connect conn;
static void RecentChosen(Widget w, XtPointer client, XtPointer call);
/* how many servers System Settings > Appearance asks for (~/.dt/recent.conf,
* "servers=N"); 10 when the file does not say */
static int
RecentServers(void)
{
char path[600], line[256];
const char *home = getenv("HOME");
FILE *fp;
int n = RECENT_MAX;
if (home == NULL || (size_t) snprintf(path, sizeof path,
"%s/.dt/recent.conf", home) >= sizeof path)
return RECENT_MAX;
if ((fp = fopen(path, "r")) == NULL)
return RECENT_MAX;
while (fgets(line, sizeof line, fp) != NULL) {
line[strcspn(line, "\r\n")] = '\0';
if (strncmp(line, "servers=", 8) == 0)
n = atoi(line + 8);
}
fclose(fp);
if (n < 0)
n = 0;
if (n > RECENT_MAX)
n = RECENT_MAX;
return n;
}
/* ---- the two files ------------------------------------------------------ */
static void
@@ -137,13 +165,19 @@ static void
RecentAdd(const char *address)
{
char *list[RECENT_MAX + 1];
int max = RecentServers();
int n = ReadLines("servers.recent", list, RECENT_MAX), i, m = 0;
char *out[RECENT_MAX];
if (max <= 0) {
WriteLines("servers.recent", out, 0);
FreeLines(list, n);
return;
}
for (i = 0; i < n; i++)
if (strcmp(list[i], address) != 0 && m < RECENT_MAX - 1)
if (strcmp(list[i], address) != 0 && m < max - 1)
out[m++] = list[i];
if (m < RECENT_MAX)
if (m < max)
out[m++] = XtNewString(address);
WriteLines("servers.recent", out, m);
for (i = 0; i < n; i++)
@@ -196,7 +230,7 @@ FillHistory(Widget w, XtPointer client, XtPointer call)
XtVaGetValues(pd, XmNchildren, &kids, XmNnumChildren, &nk, NULL);
for (k = 0; k < nk; k++)
XtDestroyWidget(kids[k]);
n = ReadLines("servers.recent", list, RECENT_MAX);
n = ReadLines("servers.recent", list, RecentServers());
for (i = 0; i < n; i++) {
XmString s = XmStringCreateLocalized(list[i]);
Widget item = XtVaCreateManagedWidget("recentItem",
@@ -488,7 +522,7 @@ _McdeConnectShow(FileMgrRec *rec)
FillFavourites();
{
char *recent[RECENT_MAX];
int n = ReadLines("servers.recent", recent, RECENT_MAX);
int n = ReadLines("servers.recent", recent, RecentServers());
XmTextFieldSetString(conn.address, n > 0 ? recent[0] : "sftp://");
FreeLines(recent, n);