mcde: the work of the Makronix tree (27 commits since 118b19a171) merged into the fork

The plain-file ext/src/mcde of the Makronix tree carried dtphoto (layers, PSD,
clipboard shape, JPEG/GIF/XPM writers), dtbar, dtsystemsettings (Startup Disk,
dock), dtwm and icon changes that this fork did not have.  Resolved by hand:
dtphoto.c, McdeThumb.c, Thumb.h, dtsystemsettings, dtphoto.msg, AGENTS.md take
the Makronix side (a strict continuation of what the fork mirrored); the fork's
own changes are kept (M_PI guard and the front[] fix of 4e51d6dd, 'No
dttoolchest menu', DeskLowerBackdrops, distinfo until the next ext-dist).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
lotherkandClaude Sonnet 5.5 committed 2026-11-23 08:34:35 +00:00
1 parent bf039cafc3
commit 222417e6bb
16 files changed
+7827 -1674

No files matched your search

+80
View File
@@ -2187,3 +2187,83 @@ lib/DtMmdb/schema/token.C
# the pkgsrc recipe of Motif is not a generated Makefile: the bare "Makefile"
# above hid it, so it lived only in the working tree (found 2026-11-13)
!pkgsrc-motif/Makefile
# build outputs of an in-tree build (generated; do not commit)
/fonts/fonts.conf
/lib/McdeSys/test_audio
/lib/McdeSys/test_netwatch
/lib/libDtChat/fake_adapter
/lib/libDtChat/test_adapter
/lib/libDtChat/test_audio_opus
/lib/libDtChat/test_capture
/lib/libDtChat/test_conv
/lib/libDtChat/test_filexfer
/lib/libDtChat/test_frame
/lib/libDtChat/test_fuzz
/lib/libDtChat/test_i18n
/lib/libDtChat/test_identity
/lib/libDtChat/test_instance
/lib/libDtChat/test_irc
/lib/libDtChat/test_json
/lib/libDtChat/test_local
/lib/libDtChat/test_loop
/lib/libDtChat/test_media_call
/lib/libDtChat/test_media_packet
/lib/libDtChat/test_media_sync
/lib/libDtChat/test_pair
/lib/libDtChat/test_peers
/lib/libDtChat/test_store
/lib/libDtChat/test_text
/lib/libDtChat/test_video_packet
/lib/libDtChat/test_video_render
/lib/libDtChat/test_video_vp8
/motif/clients/uil/UilDBDef.h
/motif/clients/uil/UilParser.c
/motif/clients/uil/uil
/motif/config/util/makestrs
/motif/include/config.h
/motif/include/stamp-h1
/motif/lib/Xm/Xm.h
/motif/lib/Xm/stamp-h2
/motif/tools/wml/motif.wmd
/motif/tools/wml/wml
/motif/tools/wml/wml-uil.mm
/motif/tools/wml/wml.report
/motif/tools/wml/wmldbcreate
/motif/tools/wml/wmluiltok
/programs/dtactivity/dtactivity
/programs/dtappscan/dtappscan
/programs/dtbackup/dtbackup
/programs/dtbar/dtbar
/programs/dtchat/dtchat
/programs/dtchat/dtchat-demo
/programs/dtchat/dtchat-headless
/programs/dtchat/dtchat-irc
/programs/dtchat/dtchat-telegram
/programs/dtchat/dtchat-whatsapp
/programs/dtchat/dtchat-xmpp
/programs/dtcmprefs/dtcmprefs
/programs/dtconsole/dtconsole
/programs/dtcursor/dtcursor
/programs/dtdiskutility/dtdiskutility
/programs/dterror/dterror.ds
/programs/dtimage/dtimage
/programs/dtkeys/dtkeys
/programs/dtlaunch/dtlaunch
/programs/dtnetutility/dtnetutility
/programs/dtpaint/dtpaint
/programs/dtphoto/dtphoto
/programs/dtscreenshot/dtscreenshot
/programs/dtsystemsettings/dtsystemsettings
/programs/dtthemesync/dtthemesync
/programs/dttoolbox/dttoolbox
/programs/localized/C/msg/dtbar.cat
/programs/localized/C/msg/dtchat.cat
/programs/localized/C/msg/dtlaunch.cat
/programs/localized/C/msg/dtpaint.cat
/programs/localized/C/msg/dtphoto.cat
/programs/localized/C/msg/dtsystemsettings.cat
/programs/localized/C/msg/dttoolbox.cat
/programs/localized/C/msg/mcdesys.cat
/programs/mcdesoundd/mcdesoundd
/test-driver
+66 -4
View File
@@ -94,8 +94,10 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
gives a position outside the canvas, which moved the picture back).
Crop drags a rectangle and crops to it on release. Type opens a prompt
and draws one line with the GC font over an undo snapshot.
`dtphoto -movetest|-croptest|-typetest|-selecttest|-retouchtest` are the
headless proofs (no display needed beyond Xvfb): exact pixel sets for
`dtphoto -movetest|-croptest|-typetest|-selecttest|-retouchtest|-layertest`
`|-cliptest|-viewtest|-drawtest|-selmodtest|-optest|-menutest` are the
headless proofs (no display needed beyond Xvfb): exact
pixel sets for
wand/inverse/lasso/clear, a 10x10 block moved (10,5) with its mask and a
background hole left behind, a crop to 20x30 that keeps only blue, a
text line with dark pixels and an untouched corner, and all six
@@ -209,6 +211,33 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
unreachable (measured 2026-11-22, the click landed in the eraser field).
`DTPHOTO_OPTIONS=1` opens the box at startup, which is how the test
reaches it without a mouse.
The layer stack is real and the palette shows it (2026-11-22): one row
per layer, the top of the stack first, an eye that hides a layer and a
name that makes it active. Before this the palette was a single label
and a layer could only be reached through the Layer menu. The rows are
rebuilt where the *stack* changes (new, duplicate, delete, merge), never
from inside a row's own callback -- that would destroy the widget whose
handler is running. A layer carries coverage (0-255 per pixel) as well
as RGB, because an empty layer has to let the one below show through:
without it a new layer was a white sheet that hid the picture, and
`LayerAbsorb` copied the whole composite into it, so the layer below
appeared twice. The background has no coverage buffer (it covers
everything), a new layer starts with an empty one, and `WritePatch`
sets the coverage of the layer being painted so a stroke is opaque
while the rest of the layer stays clear. `Layer Options` sets opacity
and blend mode (0 normal, 1 multiply, 2 screen) through `FieldDialog`
and *without* absorbing first: a property is not new pixels, and
reading the composite back into the layer baked the old blend in, so
50% showed 127,0,0 and multiply over white went black (measured
2026-11-22). `-layertest` drives the real `CanvasInput` in the order
that matters -- stack first, then the stroke -- because a `LayerEnsure`
after the stroke reads the pixmap back into the layer and hides the
fault: eleven checks, that the stroke lands in the painted layer and
not the one below, that every visible layer is composited whichever is
active, that hiding it brings the background back, that the palette
holds one row per layer and a click on the top row makes that layer
active, and that opacity 100/50 and multiply change what reaches the
screen.
Painting is clipped to the selection, as in the original: the pencil
(a hard square tip of 2r+1), the brush (a round one) and the eraser all
go through `PaintTip`, which reads the box around the dab once, mixes by
@@ -217,6 +246,24 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
its radius entirely (one XDrawPoint). `-optest` proves both: a tip laid
across the edge of a 2 px selection changes only those two columns, and
the wand at tolerance 0 takes one pixel where tolerance 100 takes six.
The clipboard carries the *shape* of the selection, not its bounding
box (2026-11-22): `clipRGB` plus one coverage byte per pixel instead of
a pixmap, so a lasso pastes its outline and a feathered edge blends.
Three faults fell out of that the same day. Copy took the rectangle,
so Paste brought back the pixels the lasso had excluded. Cut cleared
the *whole* picture -- it was MaskClear plus a full XFillRectangle, so
cutting a lasso wiped everything outside it. Paste Into called
PasteFromClip() with no limit and was a second Paste. `-cliptest`
checks all three plus the soft paste against exact pixels, and the
menu path through a mouse: a dragged 60x60 box gives
`dtphoto: copied 60x60`, and after Select > None the same Copy gives
`copied 1024x768`.
`MaskFromRect` claims the selection itself. `MaskClear` drops `hasSel`
and every caller set it *before* the call, so the rectangle produced a
mask nothing believed in: Copy fell back to the whole picture and
Clear/Fill/Crop ignored the marquee. A rectangle put into the mask is
a selection; the function that puts it there says so, and no caller has
to remember.
dtpaint builds its menus in code and its labels are catalogued
(`dtpaint.msg`, 51 messages from 1-53, 52 unused: menus, the
tool/file/error/discard/attributes/colour/print dialogs, Help and About);
@@ -245,8 +292,23 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
(1/4/8/24/32 bpp, alpha 0 composited on the background; PNG-compressed
icons refused) go through the program's own reader; PNG, JPEG, GIF and
XPM come from `McdeThumbRead` (libDtSvc), so the program carries no
second decoder. Saving writes the format the name ends in, `.png` and
`.bmp` through `McdeThumbWrite`, anything else as 24-bit BMP. Measured
second decoder. PSD is its own reader and writer (a layer stack cannot
live in a flat pixmap): every channel plane goes through PackBits unless
packing does not make it smaller, and the channel length in the layer
record is measured by the same routine that then writes it, because a
length guessed from `w*h` and two bytes put the reader at the wrong
offset. The RLE layout is the one Photoshop writes: all the row lengths
first, then the rows -- the first version interleaved them, and the
program's own reader made the same mistake, so only a foreign decoder
could catch it. ImageMagick reported `InvalidLength` until both sides
changed; after that it reads the composite and the layer at the pixels
the test wrote. Measured 2026-11-22: a 64x64 picture with one hard edge
is 2436 bytes packed against about 12530 raw, and `-rletest` checks both
the size and the pixels. `-psdread` reads a file ImageMagick wrote (16x12,
alpha as coverage) so the reader is not only tested against the writer.
Saving writes the format the name ends in, `.png` and
`.bmp` through `McdeThumbWrite`, `.psd` through the layer writer,
anything else as 24-bit BMP. Measured
2026-11-22 on Xvfb depth 24: a 40x30 PNG written back is 1200 of 1200
pixels identical, a GIF 0 of 1200 different, JPEG q100 at most 3 steps
per channel; on depth 8 a 32-colour picture comes back exact and the
+18
View File
@@ -0,0 +1,18 @@
Package: @PACKAGE@
Version: @VERSION@
Section: x11
Priority: optional
Architecture: @ARCH@
Maintainer: Konrad Lother <konrad.lother@gmail.com>
Depends: @DEPENDS@
Installed-Size: @INSIZE@
Description: Makronix Common Desktop Environment, with its own Motif
MCDE is the Makronix fork of CDE 2.5.3. It installs under @PREFIX@ with
its configuration in /etc/mdt, and carries the Motif it is built from --
libXm, libMrm and libUil, the uil compiler and the headers -- so the
desktop runs from its own toolkit and never from the system's libxm4.
.
It is the Linux side of the Makronix build host: Makronix itself gets MCDE
through pkgsrc. A session starts with @PREFIX@/bin/Xsession.
.
Built from @VERSION@ on @DATE@.
+7
View File
@@ -0,0 +1,7 @@
[Desktop Entry]
Type=XSession
Exec=/usr/mdt/bin/dtsession
TryExec=/usr/mdt/bin/dtsession
DesktopNames=MCDE
Name=MCDE
Comment=Makronix Common Desktop Environment (a CDE 2.5.3 fork)
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
#
# postinst of the MCDE package: what a package manager cannot do for the
# desktop. $1 is configure (install or upgrade), abort-*, or triggered.
#
# The font index. MCDE installs its own fonts below /usr/mdt/fonts and a
# fonts.dir for the directory it knows; a font in a subdirectory is invisible
# to the X server without an index of its own. Debian's xfonts-utils brings
# mkfontdir, which is in the dependency list of the package for this reason.
# A host without it is not an error: the fonts of the session are also in the
# X server's own path.
set -e
case ${1:-} in
configure) ;;
*) exit 0 ;;
esac
PREFIX=/usr/mdt
if command -v mkfontdir >/dev/null 2>&1; then
find "$PREFIX/fonts" -type d 2>/dev/null | while IFS= read -r d; do
case $d in */hack) continue ;; esac
mkfontdir "$d" >/dev/null 2>&1 || true
done
fi
exit 0
+5 -1
View File
@@ -52,7 +52,11 @@ int McdeThumbScale(const unsigned char *src, int sw, int sh, int maxw,
int maxh, unsigned char **dst, int *w, int *h);
/* IMAGE (8-bit RGB) written to PATH. The format comes from the name's
* ending: .png and .bmp are written, anything else is refused. A picture
* ending: .png, .bmp, .jpg/.jpeg, .gif and .xpm are written, anything else
* is refused. PNG, BMP and XPM come back exactly; JPEG is lossy by its own
* nature. GIF carries at most 256 colours, so a picture with more than that
* goes through a 6x5x6 cube (largest deviation 25 of 255, measured
* 2026-11-22), while one that fits keeps its own colours exactly. A picture
* written here is read back by McdeThumbRead() pixel for pixel, which is
* what the test checks. 0 on success, -1 on a bad argument, an unknown
* ending or a write error. */
+534 -10
View File
@@ -787,7 +787,7 @@ ReadGif(const char *path, unsigned char **rgbp, int *wp, int *hp)
}
if (kind == 0x2c) {
int left, top, iw, ih, ipacked, min_size;
size_t room, used;
size_t room, used, after;
if (at + 9 > len)
break;
@@ -818,23 +818,41 @@ ReadGif(const char *path, unsigned char **rgbp, int *wp, int *hp)
min_size = buf[at++];
if (min_size < 2 || min_size > 8)
goto bad;
room = (size_t) iw * ih;
if ((data = malloc(room)) == NULL)
goto bad;
used = GifBlocks(buf, len, at, data, room);
/* find where the data ended, to go on after it */
/*
* The compressed stream is not bounded by the
* pixel count: 8-bit codes need more than one byte
* per pixel and a short stream is padded. The
* buffer has to hold the whole sub-block chain, so
* the chain is measured first. Until 2026-11-22
* this allocated iw*ih, which was too small for
* every picture that was not mostly a repeat: the
* data was silently cut and GifLzw failed on it
* (measured: a 12x9 GIF with 108 colours, 124
* compressed bytes in a 108 byte buffer).
*/
{
size_t p = at;
while (p < len && buf[p] != 0)
room = 0;
while (p < len && buf[p] != 0) {
size_t n = buf[p];
if (p + 1 + n > len)
n = len - p - 1;
room += n;
p += buf[p] + 1;
at = p < len ? p + 1 : len;
}
after = p < len ? p + 1 : len;
}
if ((out = malloc(room)) == NULL)
if (room == 0 || (data = malloc(room)) == NULL)
goto bad;
used = GifBlocks(buf, len, at, data, room);
at = after;
if ((out = malloc((size_t) iw * ih)) == NULL)
goto bad;
{
int n = GifLzw(data, used, min_size, out,
(long) room);
(long) iw * ih);
if (n < 0)
goto bad;
@@ -1659,6 +1677,506 @@ WriteBmp(const char *path, const unsigned char *rgb, int w, int h)
return fclose(fp) == 0 ? 0 : -1;
}
/*
* A JPEG, as the decoder reads it: libjpeg's compressor, 4:4:4 so that a
* small picture keeps its colours instead of being smeared by chroma
* subsampling. Quality 92 is a photograph setting, not a thumbnail one.
*/
static int
WriteJpeg(const char *path, const unsigned char *rgb, int w, int h)
{
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
FILE *fp;
unsigned char *row;
int y;
if ((fp = fopen(path, "wb")) == NULL)
return -1;
if ((row = malloc((size_t) w * 3)) == NULL) {
fclose(fp);
return -1;
}
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
jpeg_stdio_dest(&cinfo, fp);
cinfo.image_width = (JDIMENSION) w;
cinfo.image_height = (JDIMENSION) h;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&cinfo);
jpeg_set_quality(&cinfo, 92, TRUE);
/* 4:4:4: a small picture must not lose its colours */
cinfo.comp_info[0].h_samp_factor = 1;
cinfo.comp_info[0].v_samp_factor = 1;
jpeg_start_compress(&cinfo, TRUE);
while (cinfo.next_scanline < cinfo.image_height) {
JSAMPROW r = row;
y = (int) cinfo.next_scanline;
memcpy(row, rgb + (size_t) y * (size_t) w * 3,
(size_t) w * 3);
jpeg_write_scanlines(&cinfo, &r, 1);
}
jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo);
free(row);
return fclose(fp) == 0 ? 0 : -1;
}
/* the colour cube a GIF and an XPM share: 6 x 7 x 6 = 252 entries */
#define CUBE_R 6
#define CUBE_G 7
#define CUBE_B 6
#define CUBE_N (CUBE_R * CUBE_G * CUBE_B)
/*
* The picture's own colours as a GIF table, when there are no more than
* 256 of them. Writes the palette and the pixel indices, and returns the
* count, or 0 when the picture has too many colours for this to be exact.
*/
static int
ExactPalette(const unsigned char *rgb, int w, int h,
unsigned char *pal, unsigned char *idx)
{
/*
* A hash of the colours seen so far. Open addressing over 1024
* slots: the table is at most half full, so a probe chain stays
* short without any deleting.
*/
static int seen[1024];
int used = 1024;
int n = 0, i, p;
for (i = 0; i < 1024; i++)
seen[i] = -1;
for (i = 0; i < w * h; i++) {
const unsigned char *s = rgb + (size_t) i * 3;
unsigned long key = ((unsigned long) s[0] << 16) |
((unsigned long) s[1] << 8) | s[2];
unsigned long slot = (key * 2654435761UL) & 1023;
for (;;) {
if (seen[slot] == -1) {
if (n == 256)
return 0;
seen[slot] = n;
pal[n * 3] = s[0];
pal[n * 3 + 1] = s[1];
pal[n * 3 + 2] = s[2];
idx[i] = (unsigned char) n;
n++;
break;
}
if (pal[seen[slot] * 3] == s[0] &&
pal[seen[slot] * 3 + 1] == s[1] &&
pal[seen[slot] * 3 + 2] == s[2]) {
idx[i] = (unsigned char) seen[slot];
break;
}
slot = (slot + 1) & 1023;
}
}
/*
* The unused cells stay black: the encoder always writes the full
* 256 entries, so the file says what the indices mean even where
* no pixel uses them.
*/
for (p = n; p < 256; p++)
pal[p * 3] = pal[p * 3 + 1] = pal[p * 3 + 2] = 0;
return n;
}
static int
CubeIndex(const unsigned char *s)
{
int r = (s[0] * (CUBE_R - 1) + 127) / 255;
int g = (s[1] * (CUBE_G - 1) + 127) / 255;
int b = (s[2] * (CUBE_B - 1) + 127) / 255;
return (r * CUBE_G + g) * CUBE_B + b;
}
static void
CubePalette(unsigned char *pal)
{
int i, r, g, b, k = 0;
memset(pal, 0, 256 * 3);
for (r = 0; r < CUBE_R; r++)
for (g = 0; g < CUBE_G; g++)
for (b = 0; b < CUBE_B; b++) {
pal[k * 3] = (unsigned char)
(r * 255 / (CUBE_R - 1));
pal[k * 3 + 1] = (unsigned char)
(g * 255 / (CUBE_G - 1));
pal[k * 3 + 2] = (unsigned char)
(b * 255 / (CUBE_B - 1));
k++;
}
for (i = k; i < 256; i++)
pal[i * 3] = pal[i * 3 + 1] = pal[i * 3 + 2] = 0;
}
/*
* A GIF87a with a global colour table of the cube above. GIF carries at
* most 256 colours, so a 24-bit picture has to be reduced to be a GIF at
* all; 6x7x6 is the cube an 8-bit desktop could show. The LZW is the
* format's own compressor, with the hash table the reference uses so that
* the cost per pixel stays constant.
*/
static int
WriteGif(const char *path, const unsigned char *rgb, int w, int h)
{
FILE *fp;
unsigned char *idx, pal[256 * 3];
unsigned char hdr[7], desc[10];
int x, y, k;
if (w > 65535 || h > 65535)
return -1;
if ((fp = fopen(path, "wb")) == NULL)
return -1;
if ((idx = malloc((size_t) w * h)) == NULL) {
fclose(fp);
return -1;
}
/*
* A picture with at most 256 distinct colours needs no quantisation
* at all: its own colours become the table, and every pixel keeps
* its exact value. The cube below is the fallback for everything
* else. Measured 2026-11-22: a 16x12 test picture came back with a
* delta of 8 through the cube, 0 through the exact table.
*/
if (ExactPalette(rgb, w, h, pal, idx) <= 0) {
/*
* More colours than a table holds: the fixed cube decides
* both the table and every pixel's index. (This step went
* missing once and the file carried an untouched index
* buffer -- measured: a 64x64 picture lost 90% of its
* raster.)
*/
CubePalette(pal);
for (y = 0; y < h; y++)
for (x = 0; x < w; x++)
idx[(size_t) y * w + x] = (unsigned char)
CubeIndex(rgb +
((size_t) y * w + x) * 3);
}
fputs("GIF87a", fp);
hdr[0] = (unsigned char) (w & 0xFF);
hdr[1] = (unsigned char) ((w >> 8) & 0xFF);
hdr[2] = (unsigned char) (h & 0xFF);
hdr[3] = (unsigned char) ((h >> 8) & 0xFF);
hdr[4] = (unsigned char) (0x80 | 0x70 | 7); /* table, 8 bits */
hdr[5] = 0; /* background */
hdr[6] = 0; /* aspect */
if (fwrite(hdr, 1, sizeof hdr, fp) != sizeof hdr)
goto bad;
if (fwrite(pal, 1, sizeof pal, fp) != sizeof pal)
goto bad;
desc[0] = 0x2C; /* image descriptor */
desc[1] = desc[2] = desc[3] = desc[4] = 0; /* left, top */
desc[5] = (unsigned char) (w & 0xFF);
desc[6] = (unsigned char) ((w >> 8) & 0xFF);
desc[7] = (unsigned char) (h & 0xFF);
desc[8] = (unsigned char) ((h >> 8) & 0xFF);
desc[9] = 0; /* no local table */
if (fwrite(desc, 1, sizeof desc, fp) != sizeof desc)
goto bad;
if (fputc(8, fp) == EOF) /* LZW minimum code size */
goto bad;
{
/*
* The dictionary: prefix chains in a hash table of the
* reference encoder, so a lookup is one probe and not a walk
* over 4096 entries for every pixel.
*/
static const int HASH_SIZE = 5003;
int *hashTab, *codetab;
unsigned char *out;
size_t outn = 0, outcap;
int next = 258, codeSize = 9, prev = -1;
long bitbuf = 0;
int nbits = 0;
int shift;
/*
* Worst case: one 12-bit code per pixel plus the clear and
* end codes, so 2 bytes per pixel is ample. The old bound
* (w*h + 1024) silently truncated a 1024x768 picture and
* the file came out empty (measured 2026-11-22).
*/
outcap = (size_t) w * h * 2 + 4096;
hashTab = malloc(sizeof(int) * HASH_SIZE);
codetab = malloc(sizeof(int) * HASH_SIZE);
out = malloc(outcap);
if (hashTab == NULL || codetab == NULL || out == NULL) {
free(hashTab);
free(codetab);
free(out);
goto bad;
}
for (k = 0; k < HASH_SIZE; k++)
hashTab[k] = -1;
#define GPIOUT(c) do { \
bitbuf |= (long) (c) << nbits; \
nbits += codeSize; \
while (nbits >= 8) { \
if (outn >= outcap) { \
free(out); \
free(hashTab); \
free(codetab); \
goto bad; \
} \
out[outn++] = (unsigned char) (bitbuf & 0xFF); \
bitbuf >>= 8; \
nbits -= 8; \
} \
} while (0)
GPIOUT(256); /* clear */
for (y = 0; y < h; y++)
for (x = 0; x < w; x++) {
int c = idx[(size_t) y * w + x];
if (prev < 0) {
prev = c;
continue;
}
/* (prev, c) already in the table? */
{
long fcode = (long) prev * 256 + c;
int i = (int) ((fcode >> 12) ^
(fcode & 0xFFF));
if (i >= HASH_SIZE)
i -= HASH_SIZE;
/*
* The step must not be a multiple of
* the table size, or the probe keeps
* landing on the same slot. At i = 0
* the step was exactly HASH_SIZE and
* the encoder never returned (measured
* 2026-11-22: a 128x128 picture hung on
* the first colour pair whose hash
* collapsed to slot 0).
*/
if (i <= 0) {
i = 0;
shift = 1;
} else
shift = HASH_SIZE - i;
for (;;) {
if (hashTab[i] < 0)
break;
if (hashTab[i] == fcode) {
prev = codetab[i];
goto have;
}
i -= shift;
if (i < 0)
i += HASH_SIZE;
}
/* not there: emit and add it */
GPIOUT(prev);
if (next < 4096) {
codetab[i] = next;
hashTab[i] = (int) fcode;
next++;
/*
* The width goes up only
* after the code that
* filled the range: the
* reader adds its entry for
* the *previous* code, so it
* is always one behind.
* `>=` here desynchronised
* every reader from code 512
* on (checked against
* giftopnm 2026-11-22: the
* `>` rule decodes, `>=`
* does not).
*/
if (next > (1 << codeSize) &&
codeSize < 12)
codeSize++;
} else {
GPIOUT(256);
next = 258;
codeSize = 9;
for (k = 0; k < HASH_SIZE; k++)
hashTab[k] = -1;
}
prev = c;
}
have:
;
}
if (prev >= 0)
GPIOUT(prev);
GPIOUT(257); /* end of information */
if (nbits > 0) {
if (outn >= outcap) {
free(out);
free(hashTab);
free(codetab);
goto bad;
}
out[outn++] = (unsigned char) (bitbuf & 0xFF);
}
#undef GPIOUT
/* data in blocks of at most 255 bytes, a zero byte ends it */
{
size_t p = 0;
while (p < outn) {
size_t n = outn - p;
if (n > 255)
n = 255;
if (fputc((int) n, fp) == EOF ||
fwrite(out + p, 1, n, fp) != n) {
free(out);
free(hashTab);
free(codetab);
goto bad;
}
p += n;
}
}
free(out);
free(hashTab);
free(codetab);
}
if (fputc(0, fp) == EOF || fputc(';', fp) == EOF)
goto bad;
free(idx);
return fclose(fp) == 0 ? 0 : -1;
bad:
free(idx);
fclose(fp);
return -1;
}
/*
* An XPM3. The colour table comes from the colours the picture actually
* has while they fit in 256, so a flat picture keeps its exact values; a
* photographic one is reduced to the same cube the GIF writer uses. The
* codes come from the 92 printable characters, one per colour while they
* fit and two after that.
*/
static int
WriteXpm(const char *path, const unsigned char *rgb, int w, int h)
{
/*
* Every printable ASCII character except '"' and '\\', which
* cannot appear in an XPM key without escaping, and the space,
* which leads. 93 distinct keys, so two-character keys work up
* to 93 * 93 = 8649 colours. The table held the duplicates 'X',
* 'o' and 'O' twice until 2026-11-22: from 93 colours on, two
* palette entries got the same key and the picture read back
* wrong (measured: 12x9 with 108 colours, 9 bytes off).
*/
static const char chars[] =
" !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"[]^_`abcdefghijklmnopqrstuvwxyz{|}~";
FILE *fp;
unsigned long key[256];
unsigned char pal[256 * 3];
int nkey = 0, i, x, y, cpp, cap = (int) (sizeof chars - 1);
int *idx;
int useCube = 0;
if ((fp = fopen(path, "wb")) == NULL)
return -1;
idx = malloc(sizeof(int) * (size_t) w * h);
if (idx == NULL) {
fclose(fp);
return -1;
}
/*
* A flat picture keeps its exact colours: the first pass collects
* them while they fit in 256. A photographic one cannot, and is
* reduced to the cube the GIF writer uses, so the two agree.
*/
for (y = 0; y < h && !useCube; y++)
for (x = 0; x < w; x++) {
const unsigned char *s =
rgb + ((size_t) y * w + x) * 3;
unsigned long k = ((unsigned long) s[0] << 16) |
((unsigned long) s[1] << 8) | s[2];
for (i = 0; i < nkey; i++)
if (key[i] == k)
break;
if (i == nkey) {
if (nkey == 256) {
useCube = 1;
break;
}
key[nkey] = k;
pal[nkey * 3] = s[0];
pal[nkey * 3 + 1] = s[1];
pal[nkey * 3 + 2] = s[2];
nkey++;
}
}
if (useCube) {
CubePalette(pal);
nkey = CUBE_N;
}
for (y = 0; y < h; y++)
for (x = 0; x < w; x++) {
const unsigned char *s =
rgb + ((size_t) y * w + x) * 3;
if (useCube) {
idx[(size_t) y * w + x] = CubeIndex(s);
} else {
unsigned long k =
((unsigned long) s[0] << 16) |
((unsigned long) s[1] << 8) | s[2];
for (i = 0; i < nkey; i++)
if (key[i] == k)
break;
idx[(size_t) y * w + x] = i < nkey ? i : 0;
}
}
cpp = nkey > cap ? 2 : 1;
fprintf(fp, "/* XPM */\nstatic char *picture_xpm[] = {\n");
fprintf(fp, "\"%d %d %d %d\",\n", w, h, nkey, cpp);
for (i = 0; i < nkey; i++) {
if (cpp == 1)
fprintf(fp, "\"%c c #%02X%02X%02X\",\n",
chars[i % cap], pal[i * 3], pal[i * 3 + 1],
pal[i * 3 + 2]);
else
fprintf(fp, "\"%c%c c #%02X%02X%02X\",\n",
chars[(i / cap) % cap], chars[i % cap],
pal[i * 3], pal[i * 3 + 1], pal[i * 3 + 2]);
}
for (y = 0; y < h; y++) {
fputc('"', fp);
for (x = 0; x < w; x++) {
int v = idx[(size_t) y * w + x];
if (cpp == 1) {
fputc(chars[v % cap], fp);
} else {
fputc(chars[(v / cap) % cap], fp);
fputc(chars[v % cap], fp);
}
}
fputc('"', fp);
fputs(y == h - 1 ? "\n" : ",\n", fp);
}
fputs("};\n", fp);
free(idx);
return fclose(fp) == 0 ? 0 : -1;
}
int
McdeThumbWrite(const char *path, const unsigned char *rgb, int w, int h)
{
@@ -1670,5 +2188,11 @@ McdeThumbWrite(const char *path, const unsigned char *rgb, int w, int h)
return WritePng(path, rgb, w, h);
if (SameEnding(path, "bmp"))
return WriteBmp(path, rgb, w, h);
if (SameEnding(path, "jpg") || SameEnding(path, "jpeg"))
return WriteJpeg(path, rgb, w, h);
if (SameEnding(path, "gif"))
return WriteGif(path, rgb, w, h);
if (SameEnding(path, "xpm"))
return WriteXpm(path, rgb, w, h);
return -1;
}
+2451 -1347
View File
File diff suppressed because it is too large. Load diff
+132
View File
@@ -1,3 +1,119 @@
/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */
#ifndef YY_YY_WMLPARSE_H_INCLUDED
# define YY_YY_WMLPARSE_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
YYEMPTY = -2,
YYEOF = 0, /* "end of file" */
YYerror = 256, /* error */
YYUNDEF = 257, /* "invalid token" */
CLASS = 1, /* CLASS */
RESOURCE = 2, /* RESOURCE */
DATATYPE = 3, /* DATATYPE */
CONTROLLIST = 4, /* CONTROLLIST */
ENUMERATIONSET = 5, /* ENUMERATIONSET */
ENUMERATIONVALUE = 6, /* ENUMERATIONVALUE */
CHARACTERSET = 7, /* CHARACTERSET */
CHILD = 50, /* CHILD */
DOCNAME = 8, /* DOCNAME */
CONVFUNC = 9, /* CONVFUNC */
ALIAS = 10, /* ALIAS */
TYPE = 11, /* TYPE */
RESOURCELITERAL = 12, /* RESOURCELITERAL */
RELATED = 13, /* RELATED */
INTERNALLITERAL = 14, /* INTERNALLITERAL */
XRMRESOURCE = 15, /* XRMRESOURCE */
EXCLUDE = 16, /* EXCLUDE */
RESOURCES = 17, /* RESOURCES */
SUPERCLASS = 18, /* SUPERCLASS */
CONTROLS = 19, /* CONTROLS */
WIDGETCLASS = 20, /* WIDGETCLASS */
DIALOGCLASS = 21, /* DIALOGCLASS */
DEFAULT = 22, /* DEFAULT */
ENUMLITERAL = 23, /* ENUMLITERAL */
XMSTRINGCHARSETNAME = 24, /* XMSTRINGCHARSETNAME */
DIRECTION = 25, /* DIRECTION */
PARSEDIRECTION = 26, /* PARSEDIRECTION */
CHARACTERSIZE = 27, /* CHARACTERSIZE */
CTRLMAPSRESOURCE = 28, /* CTRLMAPSRESOURCE */
CHILDREN = 51, /* CHILDREN */
PARENTCLASS = 52, /* PARENTCLASS */
METACLASS = 29, /* METACLASS */
WIDGET = 30, /* WIDGET */
GADGET = 31, /* GADGET */
ARGUMENT = 32, /* ARGUMENT */
REASON = 33, /* REASON */
CONSTRAINT = 34, /* CONSTRAINT */
SUBRESOURCE = 35, /* SUBRESOURCE */
ATTRTRUE = 36, /* ATTRTRUE */
ATTRFALSE = 37, /* ATTRFALSE */
LEFTTORIGHT = 38, /* LEFTTORIGHT */
RIGHTTOLEFT = 39, /* RIGHTTOLEFT */
ONEBYTE = 40, /* ONEBYTE */
TWOBYTE = 41, /* TWOBYTE */
MIXED1_2BYTE = 42, /* MIXED1_2BYTE */
COLON = 43, /* COLON */
SEMICOLON = 44, /* SEMICOLON */
EQUALS = 45, /* EQUALS */
LBRACE = 46, /* LBRACE */
RBRACE = 47, /* RBRACE */
STRING = 48, /* STRING */
ERRORTOKEN = 49 /* ERRORTOKEN */
};
typedef enum yytokentype yytoken_kind_t;
#endif
/* Token kinds. */
#define YYEMPTY -2
#define YYEOF 0
#define YYerror 256
#define YYUNDEF 257
#define CLASS 1
#define RESOURCE 2
#define DATATYPE 3
@@ -50,3 +166,19 @@
#define RBRACE 47
#define STRING 48
#define ERRORTOKEN 49
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_WMLPARSE_H_INCLUDED */
File diff suppressed because it is too large. Load diff
+4273 -98
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -34,6 +34,7 @@ item Quit | Ctrl+Q
menu Edit
item Undo | Ctrl+Z
item Redo | Ctrl+Shift+Z
sep
item Cut | Ctrl+X
item Copy | Ctrl+C
+1 -1
View File
@@ -7,7 +7,7 @@ bin_PROGRAMS = dtsystemsettings
dtsystemsettings_SOURCES = main.c panes.c panes.h ui.h accounts.c update.c \
network.c \
input.c appearance.c desktop.c timezone.c wifi.c \
startup.c sharing.c backup.c displays.c language.c sound.c printers.c parental.c cds.c dock.c energy.c internet.c defaults.c sysinfo.c \
startup.c sharing.c backup.c displays.c language.c sound.c printers.c parental.c cds.c dock.c energy.c internet.c defaults.c sysinfo.c startupdisk.c \
security.c
dtsystemsettings_CPPFLAGS = -I$(top_srcdir)/include $(DT_INCDIR) \
-I$(top_builddir)/include $(XFT_CFLAGS) \
+2
View File
@@ -160,6 +160,8 @@ AddOk(Widget w, XtPointer cd, XtPointer call)
base = strrchr(cmd, '/');
base = base != NULL ? base + 1 : cmd;
(void) snprintf(cls, sizeof cls, "%s", base);
if (cls[0] >= 'a' && cls[0] <= 'z')
cls[0] = (char) (cls[0] - 'a' + 'A');
if (napps < MAXAPPS) {
(void) snprintf(apps[napps], sizeof apps[0], "%s\t%s",
cls, cmd);
+3
View File
@@ -1110,6 +1110,9 @@ ShowPane(const Pane *p)
else if (strcmp(p->id, "printers") == 0) {
w = MakePrinters(paneArea);
}
else if (strcmp(p->id, "startupdisk") == 0) {
w = MakeStartupDisk(paneArea);
}
else if (strcmp(p->id, "sysinfo") == 0) {
w = MakeSysinfo(paneArea);
}
@@ -8,3 +8,5 @@ $set 1
4 Das Bild konnte nicht geöffnet werden.
5 Das Bild konnte nicht gespeichert werden.
6 Werkzeugoptionen
7 Nichts konnte platziert werden.
8 Das Bild konnte nicht exportiert werden.