455 Commits
Author SHA1 Message Date
lotherk 353dc1e0fe dtchat: add the --perf-test mode (T10.3)
Builds 50 conversations with 200 messages each (10 000 lines), maps the window, selects the last room and prints startup, selection, CPU, RSS, PSS and max RSS. Standalone run under Xvfb: startup 76.8 ms, selection 44.6 ms, CPU 81.1 ms, RSS 13.3 MB, PSS 7.4 MB, max RSS 12.6 MB (the 8 MB PSS target holds). The in-tree build of the flag is pending: a new foreign release/sourcesets/usb chain took the lock (pid 4040149).
2026-11-17 06:45:52 +00:00
lotherk 79caf69db9 dtchat: fuzz the JSON and IRC parsers (T10.1)
fuzz.c is a deterministic harness: 1,000,000 iterations of random bytes, mutations of valid seeds, generated JSON (valid and broken) and IRC lines (long trailing, NULs, extra params). A parsed document is written and parsed again; an IRC result must have a command and at most 15 parameters; the splitter must finish. The input of iteration I depends only on the seed and I, so a crash reproduces with 'test_fuzz 1 SEED I'. Standalone: 1,000,000 iterations in 6.3 s; ASan/UBSan 1,000,000 clean (the only finding was the harness's own overlapping memcpy, fixed). Built test_fuzz 1M ok; make mcde-host exit=0; tools/mcde-tests.sh 31 ok/0 bad.
2026-11-17 06:42:04 +00:00
lotherk f372fa0981 dtchat: repaint the UI after the local dialogs close
Xvfb without a window manager leaves the area under a closed SAS/offer dialog unpainted; localui.c clears and exposes the main shell after destroying the dialog. make mcde-host exit=0 after the change; the built UI + headless pairing/message run still passes.
2026-11-17 06:33:25 +00:00
lotherk 7025ae866e dtchat: wire the local manager into the UI (T5.8)
localui.c starts the identity, listener, --peer links, pin store and the transfers from the UI: Nearby comes from DcPeers, messages become conversations of the Local peers account, the send hook routes by peer id, the file hooks use the offer dialog and DcFileSend/DcFileRecv with the Xt timer pumping the DcLoop. An unknown pin shows the 6-digit SAS dialog; Codes match stores the pin in peers.json, Reject (or a changed pin) blocks and closes. main.c gains --local/--config/--listen/--peer/--downloads. End-to-end test: a headless peer connected, the dialog was accepted, the pin stored and 'hello ui' appeared in the transcript (screenshot dtchat-t58-pair.png). make mcde-host still blocked by pid 2126511.
2026-11-16 21:06:10 +00:00
lotherk 0e5f00dd1e dtchat: add the local file dialogs (T5.8, second part)
ui_file.c adds the incoming-file dialog (peer, name, human size; Accept/Reject, close counts as reject) and a Motif file selection box for sending to the selected Nearby peer. Conversation > Send File now opens it when a peer is selected and reports 'local mode is not connected' without a manager; the UI exposes dtchat_ui_set_file_send() for the local manager. The smoke opens and destroys the offer dialog. Standalone Motif build and both Xvfb smokes PASS. The transfer wiring (localui) is still open. make mcde-host still blocked by pid 2126511 (sourcesets, ~35 min).
2026-11-16 20:53:23 +00:00
lotherk 2e8d2b7e9b dtchat: add the Nearby section and peer details (T5.8, first part)
The roster now starts with the local peers from DcPeers (presence mark, blocked note), selecting one shows identity, fingerprint, address and state in the transcript, and a double-click opens the peer dialog with the Blocked toggle (applied at once via dc_peer_set_blocked). The demo model drops its old Nearby account in favour of two synthetic peers; --smoke-test selects alice-id, checks the fingerprint in the transcript and opens/closes the dialog. Standalone Motif build and both Xvfb smokes PASS; screenshot build/mcde-shots/dtchat-t58.png. The file send/receive part of T5.8 is still open. make mcde-host still blocked by pid 2126511 (sourcesets, 31 min).
2026-11-16 20:50:23 +00:00
lotherk e9d8d9df4c dtchat: add the pairing SAS and the TOFU pin store (T5.4a)
pair.c derives the 6-digit SAS from both certificate pins (sorted, SHA-256, mod 1000000) so both sides compute the same code; peers.json keeps id -> pin and the blocked flag (0600, atomic store). dc_pins_check answers 1 for a known pin, 0 for an unknown id and -1 for a changed pin; only dc_pins_confirm stores a new pin after the person compared the SAS; a changed pin stays blocked until then. test_pair: known SAS answers (448183 for A+B, 500498 for A+A), order independence, malformed pins, empty store, confirm/check, changed pin, block persistence, save/reload. Standalone and ASan/UBSan clean. make mcde-host still blocked by pid 2126511.
2026-11-16 20:46:19 +00:00
lotherk dc44fc25a3 dtchat: add the headless peer mode (T5.7)
dtchat-headless starts the TLS listener (--listen [HOST:]PORT, port 0 prints the real port) and one reconnecting link per --peer, loads/creates the identity in --config, prints JSON events (ready, peer-online, peer-offline, message, typing, file-offer, error) and takes JSON commands on stdin (send by host:port or peer id, quit). dc_local_peer_conn() and the ack id let a link know its peer. tests/p2p.sh runs two instances over loopback: A listens, B connects, B sends, A answers by id, both quit; standalone run prints 'tests/p2p.sh: all ok'. Wired into noinst_PROGRAMS and mcde-tests.sh (expect 29 ok). make mcde-host still blocked by pid 2126511 (release/sourcesets/usb).
2026-11-16 20:43:06 +00:00
lotherk 7c8642298c dtchat: add local file transfer (T5.6)
filexfer.c offers name/size/sha256, sends 64 KiB chunks as base64 file-data lines and a file-end; the receiver writes NAME.part, enforces the 512 MiB limit, checks size and SHA-256 and renames to a sanitized name without overwriting. Cancel removes the part. Names take the basename, drop dot-dot and control characters. The local connection buffers grow to 128 KiB for one chunk per line; dc_local_conn_busy() lets the sender pace itself. test_filexfer: safe names, 1 MiB+12345 transfer with 64 KiB chunks and matching hash, oversized offer refused, cancel leaves no part file; standalone and ASan/UBSan clean; test_local still green. make mcde-host still blocked by the foreign release/sourcesets/usb chain (pid 2126511).
2026-11-16 20:39:37 +00:00
lotherk ce0b684613 dtchat: add the local text protocol and reconnect (T5.5)
local.c now has the client side of the peer protocol: dc_local_connect verifies that the server's hello-ack pin is the pin of the certificate it actually saw (and against the expected pin), sends our hello after the handshake, and has a 5 s hello-ack timeout. Ready connections exchange presence, msg, msg-ack and typing as JSON lines; the server and client dispatch input line by line from a shifted buffer. dc_local_peer_* wraps a client with 2, 4, 8 ... 60 s reconnect and online/offline callbacks. configure now requires libtls (the ADR does). test_local covers the three T5.4 pin cases, a full protocol round trip (msg -> ack, typing, presence) and a reconnect after the server restarts; standalone and ASan/UBSan clean. make mcde-host is still blocked by the foreign release chain (pid 2126511).
2026-11-16 20:35:47 +00:00
lotherk 3aab4e35c8 dtchat: add the local TLS listener and TOFU hello (T5.4)
local.c binds a nonblocking TLS listener (identity certificate, 127.0.0.1 or all interfaces, port 0 = ephemeral) and drives the handshake from DcLoop. A peer sends one JSON line {type:hello,id,pin}; the listener checks id and pin against what it expects, answers {type:hello-ack,ok:true|false,pin:...} and closes on a wrong pin, a lying or malformed hello. The accepted hello goes to the callback once; connections stay open for the protocol of T5.5. identity.c now also exposes the private key as PEM for libtls. test_local starts a listener per case and connects with a blocking libtls client: matching pin accepted (callback sees id/pin), wrong pin rejected (no callback, ok:false), any-pin accepted. Standalone test all ok; make mcde-host could not run because another agent's release+sourcesets+usb chain holds build/.build.lock (pid 2126511); the next build verifies the wiring.
2026-11-16 20:23:14 +00:00
lotherk 38304c4378 dtchat: add the local peer model (T5.3)
peers.c keeps one peer per identity id: the TXT record (v/id/name/pin/port, ';'-joined) merges by id and marks the peer online; a service that disappears is marked offline, a manual peer stays; blocking is a property that survives announcements. Strings are owned by the peer. test_peers covers announce/merge, port preference, offline per peer, block survival, manual peers and malformed records; built test all ok, make mcde-host exit=0, tools/mcde-tests.sh 26 ok/0 bad.
2026-11-16 19:50:16 +00:00
lotherk 027d797bf0 dtchat: add the Ed25519 identity and certificate (T5.1)
identity.c generates an Ed25519 key, a self-signed X.509 certificate (CN dtchat, ten years) and its SHA-256 pin; identity.json holds version/algo/public/private/cert/pin and is written atomically through the store (dir 0700, file 0600). Load verifies that the pin, the raw public key and the certificate match; a corrupt file is moved to .bad and load_or_create fails instead of replacing the identity. configure requires libcrypto and passes CRYPTOLIB. test_identity covers creation, modes, restart persistence, a second identity, and the corrupt-file path; the built test passes and tools/mcde-tests.sh is 25 ok/0 bad after make mcde-host exit=0.
2026-11-16 19:45:15 +00:00
lotherk 422ffb9848 dtchat: link the IPC library into dtchat and dtchat-irc
The build failed at both links: dtchat-ui_accounts.o called dc_json_array_get from libDtChatIpc.so (DSO missing from the command line) and dtchat-irc called dc_irc_parse/split from libDtChat.so. Both programs now name both libraries. make mcde-host exit=0; tools/mcde-tests.sh 24 ok/0 bad; built dtchat --smoke-test and --demo --smoke-test PASS; the built dtchat-irc passes all five fake-server suites (plain, channels, messages, TLS/SASL, reconnect).
2026-11-16 19:41:07 +00:00
lotherk 39830a378f dtchat: IRC reconnect, backoff and error paths (T3.6)
A dropped socket or ERROR now schedules a reconnect with 2, 4, 8 ... 60 s backoff (reset on 001) and the process stays alive; the 433 collision appends '_' up to three times before giving up; SASL 904/905/906 sends a fatal auth error and a bye and exits; the connect timeout is 5 s per address and TLS errors are reported as code tls. Fake servers: reconnect after a drop (offline, second connection, same nick, same pid) and 433 -> NICK tester_ -> online both pass; plain, channel and message suites still pass. make mcde-host still blocked by pid 1207058.
2026-11-16 19:25:46 +00:00
lotherk a53b7174e2 dtchat: TLS, CAP and SASL PLAIN for the IRC adapter (T3.3)
libtls (installed libtls-dev 3.8.1 on the build host) now wraps the socket: blocking handshake with a 10 s timeout, then nonblocking tls_read/tls_write with WANT_POLLIN/OUT handling; DTCHAT_TLS_CA allows a test or private CA. The adapter sends CAP LS 302, requests sasl when the server offers it and a password exists, answers AUTHENTICATE + with the PLAIN base64 payload, ends CAP on 903/904 and reports auth errors. configure checks libtls and passes -DHAVE_LIBTLS/-ltls; without libtls a tls:true account gets a clear error. The TLS fake server passes both cases: handshake + CAP REQ + AUTHENTICATE + CAP END + online + JOIN, and wrong password -> auth error. Plain/channel/message tests still pass; make mcde-host still blocked by pid 1207058.
2026-11-16 19:23:34 +00:00
lotherk 8665cab421 dtchat: IRC messages, splitting and the send bucket (T3.5)
Incoming PRIVMSG/NOTICE become text/notice messages, CTCP ACTION becomes an action message and direct messages open a direct conversation. dc_irc_split_next() splits at UTF-8 boundaries, prefers spaces and always breaks at newlines; the adapter budgets 512 bytes per PRIVMSG line. Sends go through a 128-line queue with a 4-message burst and 2 messages/s, pumped from the poll timeout. test_irc covers the splitter (ASCII, multibyte, over-wide character, newlines, empty); the fake-server test passes 19/19 with three chunks rejoining exactly, every line <= 512 bytes and a 0.50s max gap under flood. make mcde-host still blocked by pid 1207058.
2026-11-16 19:18:28 +00:00
lotherk 5c7bbfdfc5 dtchat: map IRC channels and members into the roster (T3.4)
The adapter keeps a channel/member table: JOIN/NAMES/MODE/TOPIC/PART/QUIT/KICK/NICK update it and emit conversation, roster, presence and system messages. After 001 it joins the configured channels. The fake-server sequence (353 names with @/+ modes, JOIN, MODE +o, TOPIC, PART, QUIT, NICK) passes 21/21 checks: JOIN sent, conversation and topic, modes, rename, online/offline presence and the system lines. make mcde-host still blocked by pid 1207058 (sourcesets/usb).
2026-11-16 19:14:00 +00:00
lotherk 954bfc70bb dtchat: add the IRC line parser with tests (T3.2)
lib/libDtChat/irc.c parses IRCv3 tags, the prefix, the command, up to 15 parameters and the trailing text into a DcIrcMessage; NUL in the line, a missing command, more than 15 parameters and lines over 1 MiB are clean errors. test_irc covers PRIVMSG, tags+prefix, 001/005/353, PING, MODE, CAP, an empty trailing, repeated spaces, the error cases and 1 MiB of rubbish; all ok and ASan/UBSan clean. The IRC adapter now routes PING/001/ERROR/433 through the parser; the fake-server harness still passes 13/13. Added test_irc to tools/mcde-tests.sh. make mcde-host still held by another agent's sourcesets/usb build (pid 1207058).
2026-11-16 19:11:11 +00:00
lotherk ee43f07e4c dtchat: add the IRC adapter skeleton (T3.1)
dtchat-irc speaks protocol v1 on stdio: hello with the six-field schema (host, port, tls, nick, password, channels), configure, connect, non-blocking getaddrinfo/connect, NICK/USER, PING/PONG, state connecting/online/offline and PRIVMSG on send. TLS, CAP, SASL, channels and the full parser are T3.2-T3.6; tls:true gets a clear non-fatal error instead of a silent plain connection. Verified against a local fake IRC server: 13/13 checks (schema, connecting, online after prefixed 001, NICK/USER, PONG, PRIVMSG, bye, exit 0, empty stderr). Built as noinst dtchat-irc; make mcde-host still waits for the lock.
2026-11-16 19:09:25 +00:00
lotherk 1519328081 dtchat: keyboard completion, history and Esc (T2.8)
The input handler intercepts unshifted Enter (send), Up/Down (64-entry send history with a saved draft), Tab (complete the current word from the conversation's senders, system lines skipped) and Esc (clear). Shift+Enter keeps XmText's newline. The smoke test checks Tab 'al' -> 'alice ', Up/Up/Down/Down through two sends, the draft round trip and Esc; xdotool under Xvfb confirmed Tab and Up in the real widget. Plain and demo smokes PASS; screenshot build/mcde-shots/dtchat-t28.png. make mcde-host still blocked by the build lock.
2026-11-16 19:05:17 +00:00
lotherk e58da8f43f dtchat: add the CDE desktop integration (T2.7)
programs/types/dtchat.dt defines ACTION Dtchat (Chat, icon Dtchat, EXEC dtchat, NO_STDIO) and is merged into every locale through the types template; Internet/Dtchat joins the App-Manager list. Three icon sizes (16/32/48) draw a speech bubble with three dots. Dtchat app-defaults install into app-defaults/C with the fixed fonts and 760x540 geometry, and dtchat.msg builds a dtchat.cat catalog for the UI strings. The action was executed through dtaction with DTDATABASESEARCHPATH (a test copy wrote its marker file), and the icons decode as XPM. make mcde-host is still waiting for the build lock (pid 1207058).
2026-11-16 19:05:08 +00:00
lotherk 24e0c16257 dtchat: wire the demo echo adapter end to end (T2.6)
demo_adapter.c is a real child process speaking protocol v1 (hello with a nick schema, connect opens lobby, send echoes as 'echo', /code asks for a code, answer reports it, disconnect says bye). demo.c owns the DcLoop, pumps it from a 40 ms Xt timeout, applies state/conversation/message/request/error/bye to the model and the UI, and routes sends through dtchat_ui_set_send_hook. --demo uses an empty model plus the adapter; --adapter overrides the path; --demo --smoke-test checks online, selection, a real send round trip and the echoed text. The transcript now word-wraps: XmText's XmNscrollHorizontal is a secondary resource and must be set in the creation arg list, and the text is fitted to the viewport on ConfigureNotify (the horizontal bar is unmanaged). Standalone plain and demo smoke PASS; /code answered with 4242 shows '-demo- answered: 4242'; screenshot build/mcde-shots/dtchat-t26.png. make mcde-host blocked again: build/.build.lock is held by another agent's distfiles fetch (pid 815951).
2026-11-16 18:57:16 +00:00
lotherk 26c66b7444 dtwm: the program switcher stays while Command is held (t0115 follow-up)
Command+Tab raised and focused the next program at once, but the bar closed
by a five-second timer: holding Command longer made it vanish, and letting
Command go did not close it.  The bar now stays as long as Command is held:
dtwm grabs the keyboard while it is up (the Mod4 keycodes come from the
modifier map), KeyRelease of a Command key is looked at in WmMain before the
generic dispatch (McdeSwitcherEvent), and it hides and ungrabs at once.  A
long timer (60 s) only covers a grab that failed or a release that never
came; without the grab the old five-second flash stays.

Repeated Tab while held walks on, Shift+Command+Tab goes back; the chosen
program is raised and focused on every press (unchanged).  MCDE_SW_DEBUG=1
prints the grab and the key events.

Measured on an out-of-tree copy of the configured build (the tree's build
lock was held by another session's release/distfiles run): make dtwm linked
the changed sources, and under Xvfb :93 with two xterms
- keydown Super_L, Tab: the bar "MCDE Switcher" is IsViewable;
- after 7 s still held: IsViewable (the old code hid at 5 s);
- Tab again, keyup Super_L: IsUnMapped within 0.5 s, focus on the chosen
  xterm; the debug log shows the grab with keycodes 133 134 206 and the
  release of 133 closing it.

The official make mcde-linux and the install into /usr/mdt follow when the
build lock is free; the change touches only dtwm.  AGENTS.md describes the
behavior.
2026-11-16 18:57:06 +00:00
lotherk 64979ecebd dtchat: add the request, error and QR dialogs (T2.5)
ui_request.c turns one adapter request object into a Motif dialog: code, password (masked via modifyVerify, the real value kept out of the widget), notice, confirm and qr. The QR bitmap is base64 (one byte per module), drawn into a depth-1 pixmap and shown as XmNlabelPixmap; no QR library. The answer is delivered exactly once from OK/Yes/No, Cancel, the timeout or the window-manager close, and the dialog frees itself before the callback runs. dtchat_error_dialog is the one-button error/notice window. The smoke test exercises all five kinds plus the timeout; --demo-request qr|code|password|error shows one for screenshots. Standalone smoke PASS; QR and masked password verified on Xvfb (build/mcde-shots/dtchat-t25.png). make mcde-host still blocked by the foreign release build holding build/.build.lock (pid 175328).
2026-11-16 18:46:56 +00:00
lotherk b330b3b60a dtchat: add the generic account editor (T2.4)
ui_accounts.c builds the account list and a settings form from the adapter schema: text, secret, int, bool, choice, info and button. Secrets are collected into a separate JSON object and never shown; a modifyVerify callback keeps the masked text while the field stores the real value (this Motif has no XmNechoChar). Add/Delete create or remove accounts through dc_model_remove_account, Save validates required fields and numbers and updates the account label. Wired to File/Accounts... with a demo IRC schema. Standalone build clean; dialog opens on Xvfb, password masked, Save shows 'saved (demo)'; test_conv and ASan/UBSan green. make mcde-host could not run: another agent's release build holds build/.build.lock (pid 175328).
2026-11-16 18:42:58 +00:00
lotherk fc85d65b89 dtchat: stress the T2.3 view cap with 5000 messages
The smoke test pushes 5000 messages through the model and checks that the transcript stays at the 2000-message ring size; standalone smoke PASS in 5.2 s.
2026-11-16 18:33:13 +00:00
lotherk f89c4734f3 dtchat: bind the transcript and input at runtime (T2.3)
The transcript reloads from the model on selection, appends new messages via dtchat_ui_message_added (clearing unread in the active conversation), shows action and system lines, and reloads at 2000 lines. Send and Enter add a DTCHAT_MSG_SELF message to the model through dtchat_ui_send_text, clear the input and append; Shift+Enter stays a newline. The smoke test now injects a runtime message, sends text, pushes past 2000 messages, checks the view cap and verifies '* alice' / '-- bob joined'. Standalone smoke PASS and Enter path verified under Xvfb; the full make mcde-host is blocked by another agent's release build holding the lock.
2026-11-16 18:32:42 +00:00
lotherk 8911994262 dtchat: bind the roster to the model (T2.2)
DcPresence on DcConv (offline default, online/away/dnd); the roster lists accounts and conversations with presence marks and unread counts, 45 demo rooms make it scroll, selection sets the title/topic, fills the transcript from the 2000-message ring and clears unread. The demo model lives in main.c; --smoke-test selects jabber/bob@example.org and checks viewable, selection, transcript and unread==0. make mcde-host exit=0; built smoke PASS; test_conv all ok; screenshot build/mcde-shots/dtchat-t22.png; PSS 5.6 MB.
2026-11-16 18:27:40 +00:00
lotherk 72e129de04 dtchat: add the T2.1 main window and layout
programs/dtchat: a Motif XmForm with File/Edit/View/Conversation/Help, a horizontal paned window (roster left, chat right), a read-only scrolled transcript, a three-line input, a Send button and a status line. --smoke-test maps the window, checks IsViewable and exits 0/1. Wired into configure.ac and programs/Makefile.am; only Xt/Xm/X11 are linked until T2.7 brings DtInitialize. Built smoke PASS; screenshot build/mcde-shots/dtchat-t21.png (760x540); PSS 5.5 MB (RSS 18.6 MB with the shared Xft Motif).
2026-11-16 18:13:23 +00:00
lotherk fa6b5cdfa4 dtchat: enforce the adapter hello timeout
A child that does not send hello within 10 s is killed; the normal restart backoff applies. Aligns adapter.c with the v1 protocol document.
2026-11-16 17:49:11 +00:00
lotherk 581735f013 dtchat: add the single-instance lock and control socket (T1.6)
instance.c: DIR/run 0700, dtchat.lock 0600 with flock(LOCK_EX|LOCK_NB), primary Unix listener at dtchat.sock 0600, one open request per client with a 2 s timeout, non-primary instance plus dc_instance_notify with connect retries, and socket/lock cleanup on close. test_instance covers primary/secondary, modes, open callback, malformed client, notify after close and re-acquisition. make mcde-host exit=0; all eight dtchat tests 'all ok'; ASan/UBSan clean. SIGPIPE is ignored so a dead local client cannot kill the core.
2026-11-16 17:45:58 +00:00
lotherk e162ba645d dtchat: add the adapter process manager (T1.5)
adapter.c spawns a helper, waits for hello (ipc 1), sends configure/connect, routes events, drains stderr, buffers stdin, reaps zombies and restarts with 2..60 s backoff unless the child said bye. fake_adapter.c and test_adapter.c cover normal handshake, send/message echo, join/answer, stop/bye, crash restart and invalid JSON. make mcde-host exit=0; test_adapter 'all ok'; ASan/UBSan clean. test_adapter_DEPENDENCIES now includes libDtChat/libDtChatIpc to avoid the parallel relink race.
2026-11-16 17:35:28 +00:00
lotherk 83741ce6eb dtchat: add the conversation model and text helpers (T1.4)
conv.c: accounts, conversations, topics, idempotent add, a 2000-message ring buffer and unread counts that ignore our own/system messages. text.c: UTF-8 validation, C0 cleaning, mIRC formatting strip and iconv display with ASCII//TRANSLIT and '?' fallbacks. test_conv and test_text cover duplicate adds, ordering, the ring boundary, flags/unread, IRC codes, CR/CRLF and ISO-8859-1/ASCII output. make mcde-host exit=0; all six dtchat tests report 'all ok'; ASan/UBSan clean.
2026-11-16 17:18:12 +00:00
lotherk 82ab2cb4b5 dtchat: add the atomic state store (T1.3)
store.c keeps accounts.json, secrets.json and identity.json in a 0700 directory with 0600 files, writes through a temporary file with fsync/rename/dir-fsync, repairs a wrong file mode on load, moves invalid JSON to NAME.bad and rejects path names. test_store covers accounts/secrets/identity, overwrite, corrupt/missing files, stale tmp, read-only directory, default HOME path and permissions. make mcde-host exit=0; test_json, test_frame, test_loop and test_store all ok; ASan/UBSan clean.
2026-11-16 17:09:27 +00:00
lotherk 4e97d5930d dtchat: add the poll and timer event loop (T1.2)
loop.c: one poll(2) per run, monotonic one-shot timers (sorted, FIFO on equal deadlines), non-blocking wakeup pipe and safe fd dispatch when a callback removes another fd. test_loop covers timer order/cancel, timeout, wakeup, pipe, delete-in-callback, timer-added-timer, monotonicity and invalid arguments. make mcde-host exit=0; test_json, test_frame and test_loop all ok.
2026-11-16 17:00:50 +00:00
lotherk 7dbaad5afa dtchat: build the IPC tests with mcde-host (T1.1)
test_json and test_frame are noinst_PROGRAMS so the native build produces them for tools/mcde-tests.sh; TESTS still runs them under make check.
2026-11-16 16:45:22 +00:00
lotherk ffb067372b dtchat: fail cleanly on a zero-byte frame write
dc_frame_send now returns -1 instead of looping when write(2) returns 0 for the payload or the trailing newline.
2026-11-16 16:38:50 +00:00
lotherk e645e8160d dtchat: add the core API, JSON reader and line framing (T1.1)
include/DtChat/DtChat.h and Ipc.h define the UI-facing core API and the adapter contract. lib/libDtChat builds libDtChatIpc (strict JSON parser/writer, 1 MiB line framing) and the libDtChat core stub; test_json and test_frame cover escapes, UTF-8, depth 32, duplicate keys, overlong lines, CRLF, NUL and the write path. Wired into configure.ac, lib/Makefile.am and the installed headers. Standalone tests pass, ASan/UBSan clean.
2026-11-16 16:35:48 +00:00
lotherk 13deb228d1 mcde: allow dtchat's TLS, XMPP and codec libraries
dtchat needs libtls, libstrophe, libopus and optional libvpx; record the exception in AGENTS.md, the decision in docs/reference/dtchat-architecture.txt, and the program in docs/MCDE-PROGRAMS.md (C5). Tasks: tasksd scope mcde/dtchat.
2026-11-16 15:57:46 +00:00
lotherk 8a0a5ac3f5 MCDE: the IRIX and Solaris Helvetica fonts, the 4Dwm font as the default (t0301)
The Helvetica bitmaps of the reference desktops are in share/fonts: the six
IRIX x_eoe PCFs (helvB10, helvBO10, helvR10, helvR12, helvR14, helvR18) and
the twenty Solaris SUNWxwfnt PCFs (Helvetica 6..14, bold, oblique, bold
oblique); mkfontdir wrote fonts.dir.

Dtwm.defs.src sets the four fontLists of the 4Dwm app-defaults: menus and
client titles -adobe-helvetica-bold-o-normal--14-*, feedback
-adobe-helvetica-bold-r-normal--14-*, icon labels
-adobe-helvetica-medium-r-normal--14-*.

The fonts are core X11 fonts (Motif reads them): dtlogin fontPathTail
(config/Xconfig) puts share/fonts on the X server font path at session
start (ApplyFontPathMods, fontpath.c); 0070.dtfonts keeps the same for a
session that did not come through dtlogin, without a second entry.

Measured: xlsfonts -fn -adobe-helvetica-bold-o-normal--14-* returns the
IRIX 100dpi face; xrmget on the installed Dtwm app-defaults resolves the
four fontLists to the Helvetica names; a session through dtlogin lists
.../share/fonts in xset q Font Path (9 elements); mcde-plist-check ok;
docs/screenshots/desktop/dtwm-4dwm-font.png shows the dtterm title in
Helvetica Bold Oblique.
2026-11-16 15:22:50 +00:00
lotherk b41be1885a MCDE: the dthelp parser generators build for the host (t0230, block 1)
Inventory of build/logs/mcde-allerrors-2026-11-14.log (the last docs-enabled
cross build): 826 error lines, 774 of them Error 127 (a target binary run on
the build host).  The tools that were not found: instant 654 calls,
dtcodegen 44, tt_type_comp 18, dtdocbook2infolib 14; 50 Error 1 come from the
parser's missing context.h (the generators had not run), 2 from XDONE.
instant is the SGML converter for both help volumes and man pages, so it is
the next block.

This block is the dthelp parser's own generators: pass1, canon1 and pass2
run "build" and "eltdef" while the parser is compiled, and they must run on
the build host.  Each of their directories now compiles for the host (CC,
CPPFLAGS, CFLAGS, LDFLAGS from the *_FOR_BUILD values AM_MAKEFLAGS forwards,
the same pattern as util/tradcpp and dtinfo/tools/misc), and links a new
libutil_host.a built in util/ with CC_FOR_BUILD from the same sources as the
target libutil.a (context/fclndir had that already; libutil.a stays target
for the installed parser programs).

Measured: make -C build/mcde-linux/programs/dthelp/parser clean, then
make mcde-linux MCDE_DIRS="programs/dthelp/parser": exit=0, 0 Error lines;
the log shows "ar cru libutil_host.a", "./build < .../hptag.dtd",
"./eltdef ../helptag/help.if"; BDONE and EDONE are written; file(1) says
pass1/build/build, pass1/eltdef/eltdef, pass2/build/build and
pass2/eltdef/eltdef are x86-64 Linux ELF; the generated Makefile carries
"CC = $(CC_FOR_BUILD)" after the configured CC.

Still open for t0230: instant, dtdocbook2infolib and the pass1/2 parser
(dthelp_htag2, run by dtdocbook2sdl) as host tools, then turn docs on in
tools/pkgsrc-cross.mk.conf; man pages follow instant; dtappbuilder's
dtcodegen and tt_type_comp are their own blocks.
2026-11-16 15:06:08 +00:00
lotherk b05823daf3 dtwm/dtbar: the focus leaves a client over an icon or the bar (t0255)
With focus-follows-pointer (sys.resources: Dtwm*keyboardFocusPolicy: pointer)
a move from a terminal straight onto a desktop icon or onto dtbar kept the
terminal as the keyboard focus: the icon windows did not select EnterNotify,
and McdeDesktopEvent returns True for every event of an icon, so the
workspace's root/backdrop enter path (HandleWsEnterNotify -> Do_Focus_Key
(NULL)) never ran.  The bar is a window of its own and dtwm does not focus
it, so hovering it changed nothing either.

- WmMcdeDesktop.c: the icon windows select EnterWindowMask, and their
  EnterNotify calls Do_Focus_Key(NULL, time, ALWAYS_SET_FOCUS) -- the focus
  goes to the pointer root and dtwm clears the active client.
- dtbar.c: the shell already had EnterWindowMask for the menu refresh; on a
  normal enter it now sets the input focus to PointerRoot unless the root or
  the bar already has it.  A menu's grab (NotifyGrab) is left alone, so
  keyboard menu handling is untouched.

Measured under Xvfb :89 (1024x768, pointer policy, Toronto backdrop, dtbar,
two xterms at +56+126 and +406+326):
- before: xterm A -> bar kept xterm A; xterm B -> Computer icon kept xterm B.
- after: A -> icon focus 1 (PointerRoot), B -> icon 1, A -> bar 1,
  B -> backdrop 1; hovering A or B again focuses that xterm; the front panel
  still takes the focus itself, and the client loses it (unchanged).
make mcde-linux MCDE_DIRS="install programs/dtwm programs/dtbar" exit=0;
"check programs/dtbar" 1 PASS, 0 FAIL; MCDE_DIRS=plist
"mcde-plist-check: ok".

AGENTS.md: the window/focus paragraph says what an icon or the bar now does.
2026-11-16 14:53:18 +00:00
lotherk 37d566dac5 mcdesoundd: the session's Start and End tones (t0043)
dtsession starts mcdesoundd at login (config/0075.mcdesoundd) and the daemon
dies with the session; the two theme events Start and End were never played.
Now the daemon plays Start as soon as it owns _MCDE_SOUND_SERVER, and End in
an X I/O error handler: at logout dtlogin resets the X server, the daemon's
connection dies there, it forks the player (which outlives it) and exits.
Both go through the theme (MCDE_SOUND_THEME), not a fixed file; the path does
not need X, so it works in the I/O error handler.

Measured (Xvfb :86, installed Base theme, PULSE_SINK on a private null sink in
the running PulseAudio -- no sound on the real sink):
- start: "mcdesoundd: theme .../themes/Base" and
  "mcdesoundd: Start -> .../themes/Base/start.wav (player)".
- kill the Xvfb (the server reset at logout):
  "mcdesoundd: End -> .../themes/Base/end.wav (player)", and the daemon is
  gone (only the session's own daemon remains).
make mcde-linux MCDE_DIRS="install programs/mcdesoundd" exit=0;
MCDE_DIRS=plist "mcde-plist-check: ok".

The AX_* events of the same task (AccessX and the Keyboard pane) are not in
this commit; t0043 stays open for them.
2026-11-16 14:36:09 +00:00
lotherk 11cd07b560 MCDE: the IRIX cursor font as an Xcursor theme, both themes in Appearance (t0301)
The IRIX cursor font x_eoe usr/lib/X11/fonts/misc/cursor.pcf is extracted
with the sw parser, pcf2bdf turns it into BDF, and bdf-cursors.py makes
58 Xcursor names from the glyphs (form + _mask).  The Solaris and IRIX
themes are in share/icons/Solaris and share/icons/IRIX; the Appearance
pane has a "Cursor theme:" menu (Solaris, IRIX) that keeps the choice in
~/.dt/cursor-theme; 0079.dtcursor exports XCURSOR_THEME from it.
Measured: XcursorLibraryLoadImage("left_ptr", "IRIX", 16) returns a
16x16 image, and the menu shows Solaris/IRIX; choosing Solaris wrote
~/.dt/cursor-theme.
2026-11-16 14:32:23 +00:00
lotherk 12fe1a192b dtfile: Eject in the Selected menu and Command+E (t0093)
The network view's warning names Eject; now dtfile has it.  The Selected
menu carries "Eject" (mnemonic E) after "Put in Trash", and Command+E is
bound in the drawing area's translation block (Mod4<Key>e:McdeKey(@,eject)).
Both call McdeEjectSelection(): it takes the selected folders, asks
mcde_sys_disks for the mounted volume whose mountpoint is one of them, and
unmounts it through mcde_sys_disk_unmount -- never a shell, and McdeSys
refuses what the computer runs from.  No selection or no mounted volume gets
a sentence instead; a refused unmount shows mcde_sys_error() (as a user,
udisksctl asks polkit and fails without an agent -- measured).

The menu table is a fixed XtCalloc(menuItemCount): the new item made it 69
entries, so menuItemCount goes from 68 to 69 (51 to 52 without the Trash
menu).  Without that, opening the Selected menu crashed the window (the
overflow was found by the menu click, not by the build).

Catalog: set 20 messages 173 "Eject", 174 "E", 175/176 the two answers, in
dtfile.msg and the German copy.  The desktop's warning now says "Eject in
the file manager (Command+E) or Unmount in the Disk Utility"; its screenshot
docs/screenshots/leopard/Device-Removal-mcde.png is renewed.

Measured (Xvfb, a 32 MB image with one ext4 partition on /dev/loop0p1):
- as the user on :82: the Selected menu shows "Eject" and the window
  survives (0x60002d, 213x218); Command+E opens the Eject message
  "/usr/bin/udisksctl did not succeed (status 1)." -- the key reaches the
  call, polkit refuses a user.
- as root under a root ttsession on :83 (ttsession -c dtfile): selecting the
  mounted folder and Selected > Eject unmounts; findmnt then prints
  "UNMOUNTED" for /tmp/opencode/ejecttest/mnt.
- after that Eject, a simulated removal of loop0p1 in dtwm
  (MCDE_DESK_TEST_DEVICE) logs only "desktop: loop0p1 (remove)" and opens
  0 dialogs -- a volume that was put away stays quiet.
- make mcde-linux MCDE_DIRS="install programs/dtfile" and "install
  programs/localized/C/msg" exit=0; gencat reads both catalogs;
  MCDE_DIRS=plist "mcde-plist-check: ok".
2026-11-16 14:24:00 +00:00
lotherk 8b94ab17c9 MCDE: the Solaris cursors as a native Xcursor theme (t0301)
The .cursor files are converted once into the Xcursor format: 41
standard cursor names (left_ptr, watch, wait, hand2, xterm, fleur,
copy, crosshair, question_arrow, glass, the eight resize arrows,
dnd-copy/dnd-move, document, ...) in share/icons/Solaris, with
index.theme.  XCURSOR_THEME=Solaris and XCURSOR_PATH in 0079.dtcursor
make GTK, Qt, Firefox and every other program that reads Xcursor use
them natively; dtcursor keeps setting the saved one on the root window
for the Motif programs that inherit it.  Measured with libXcursor:
XcursorLibraryLoadImage("left_ptr", "Solaris", 16) returns a 16x16
image.
2026-11-16 14:19:22 +00:00
lotherk 072d200303 MCDE: the Solaris cursor theme (t0301)
programs/cursors holds the 27 .cursor files of Solaris 2.6; programs/dtcursor
reads the X11 cursor text format (Format_version=1, Width, Height,
Valid_bits_per_item=16, one or two bitmaps) into source and mask bitmaps,
makes the cursor with XCreatePixmapCursor and puts it on the root window
(XDefineCursor; the clients that set none inherit it).  The name is kept
in ~/.dt/cursor; 0079.dtcursor sets it at login.  The Appearance pane has
a "Pointer:" menu of the cursor names; a choice runs dtcursor -set NAME.
Measured under Xvfb: the menu lists black, bullseye, busy, ... gr_root;
choosing busy wrote ~/.dt/cursor and printed "dtcursor: busy".
2026-11-16 14:08:53 +00:00
lotherk f4ec4a1da1 MCDE: the disk-removed warning through the kernel's device events (t0093)
A medium that is pulled while it is still mounted now gets the reference's
one-button "Disk Not Ejected" warning: Motif's error dialog, the device and
its stale mountpoint in the text, the Warning sound.  The desktop (dtwm,
WmMcdeDesktop.c) owns the event descriptor already; it reads each event,
asks what it says, and checks the mount table before it shows anything.

McdeSys:
- mcde_sys_disk_event_info() parses both shapes the read gives: Linux's
  uevent with its NULs turned into spaces ("remove@/... ACTION=remove
  DEVNAME=sdb1 ...") and NetBSD's "device-detach sd0"; 1 when the device
  went away, 0 for add/change/attach, -1 on bad arguments.
- mcde_sys_disk_detached(name, mountpoint, len): looks in the mount table
  for a partition of NAME (sdb takes sdb1, sd0 takes sd0a), copies the
  mountpoint and unmounts it the forced way -- "umount -l" on Linux,
  "umount -f" on NetBSD (disk_linux.c, disk_netbsd.c) -- but never what the
  computer runs from.  0 when nothing of NAME was mounted.
- test_disk_events.c: the uevent and drvctl shapes, add/change/attach,
  missing DEVNAME, the bad arguments.  make check: 8/8 PASS (the seven
  before and this one).

Measured under Xvfb :79 with a real ext4 loop mount at /tmp/opencode/mnt:
- start of dtwm with MCDE_DESK_TEST_DEVICE="remove@/... DEVNAME=loop0":
  log "desktop: loop0 (remove)", "umount: /tmp/opencode/mnt: must be
  superuser to unmount.", "desktop: loop0 was mounted at
  /tmp/opencode/mnt"; the dialog is 354x167 at (335,300), OK as the only
  button (docs/screenshots/leopard/Device-Removal-mcde.png).
- sudo umount /tmp/opencode/mnt, the same event again: log "desktop: loop0
  (remove)" and no "was mounted"; zero dialog windows -- a device that was
  put away stays quiet.
- make mcde-linux MCDE_DIRS="install lib/McdeSys programs/dtwm" exit=0;
  MCDE_DIRS=plist "mcde-plist-check: ok".

MCDE_DESK_TEST_DEVICE is the test hook: one event line through the same
handler a real event takes, without a kernel.  The NetBSD drvctl branch is
unchanged (t0272); the force unmount there is written for it but was not
run.  Still open in t0093: the Eject item in dtfile (Selected menu,
Command+E) and the qemu device_del test in a VM.
2026-11-16 13:56:06 +00:00
lotherk 3eddc96fbe dtfile: the network list asks again when the first browse is empty (t0305)
The empty computer list was not the layout: with MCDE_NET_DEBUG the browse in
the view reports n=3, an XmList that is managed with 3 items, 136x181 and
visibleItemCount 10, and clicking a host fills the right list (SFTP, SSH,
SMB).  The earlier empty window was the first browse after the start: it can
come back before avahi has resolved the services it found (only the "+"
lines, no "=" ones), and the view kept the empty result until Refresh.

Browse now asks once more after two seconds when it found no computer, and
Refresh resets that so a manual refresh may retry too.  The debug line (n,
list and item count, geometry) stays behind MCDE_NET_DEBUG.

Measured (Xvfb :78, avahi-publish of mcdetest on kitt.local, HOME with an
empty Network folder, ttsession): list "N95, lotherk's MacBook Air, KITT",
note "3 computers found."; KITT selected shows Files (SFTP), Terminal (SSH),
SMB; Terminal (SSH) runs the dtterm stub with
	-title KITT -e ssh -- kitt.local
-- from the network view, no shell, the host after "--".  Screenshots
/tmp/opencode/netview-window.png and netview-ssh.png; make mcde-linux
MCDE_DIRS="install programs/dtfile" exit=0.
2026-11-16 13:33:42 +00:00