McdeSys implements mcde_sys_wifi_scan and mcde_sys_wifi_join. NetBSD does what sysinst does (src/usr.sbin/sysinst/net.c): a network block in /etc/wpa_supplicant.conf -- a new file gets the example's ctrl_interface for the wheel group, so wpa_cli answers users -- and wpa_supplicant, wpa_supplicant_flags and dhcpcd in rc.conf, each line replaced or added; then both are restarted. Scanning asks wpa_cli scan_results, else ifconfig -v IF list scan (root). Linux uses nmcli. The sources are in docs/reference/wifi.txt. The Network pane lists the networks of the first Wi-Fi card with signal and lock, scanned once the pane is drawn. Join... opens a terminal where su asks for the administrator's password and dtsystemsettings -join-wifi IF SSID-HEX asks for the network's password without echo: the name goes as hexadecimal, the password on no command line of MCDE's (nmcli takes it on its own on Linux; said in linux.c). Measured on the Linux host: test_sysinfo finds 5 networks on wlp0s20f3 (read only); the pane lists them on Xvfb; -join-wifi as a user refuses with "Only the administrator can join" and refuses a bad name. Not measured: joining (never on this host), NetBSD scanning and joining (no Wi-Fi in the build VM). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 KiB
14 KiB
ext/src/mcde -- MCDE, the Makronix Common Desktop Environment
What it is
The Makronix fork of CDE 2.5.3 (IMPORT), on its way to a desktop that works as
one: one System Preferences, a software update, the small things that belong
together (GOAL.md of the Makronix tree, "MCDE"). Makronix ships it in
place of CDE; pkgsrc builds it on any platform from pkgsrc/.
The philosophy -- binding from the first commit (Konrad, 2026-11-09)
- CDE, Motif, Xlib, X11 only. No GTK, no Qt, no compositor, no scripting language as a requirement. It must be fast and run on machines of 1995.
- C99 and POSIX (POSIX.1-2008, XSI where CDE already needs it). New code
compiles with
-std=c99 -D_POSIX_C_SOURCE=200809Land nothing beyond what POSIX and the X/Motif libraries give. MCDE runs on NetBSD and on Linux and builds through pkgsrc on both. - The operating system is behind one layer:
lib/McdeSys. Everything that differs between systems -- users and groups, network and Wi-Fi, time zone, host name, services at boot, software update, later display, sound and printers -- goes through the functions declared ininclude/Mcde/McdeSys.h. A program (the System Preferences, dtlogin's helpers, ...) never callsuseradd,ifconfig,wpa_supplicant,/etc/rc.conforsystemctlitself, and never has an#ifdef __NetBSD__. Each system has one backend inlib/McdeSys/<system>.c(netbsd.cfirst,linux.cnext); a backend uses the system's own tools the documented way. - Installed with pkgsrc, in conflict with CDE.
pkgsrc/MakefilecarriesCONFLICTS+= cde-[0-9]*; MCDE and CDE are never installed together.
What is in it
- The CDE 2.5.3 tree (first commit unchanged), with the nine fixes of pkgsrc
wm/cdefolded in. pkgsrc/-- the recipe (mcde-0.1.0). The distfile anddistinfocome fromtools/mcde-dist.shof the Makronix tree (git archiveof a commit).IMPORT-- where it came from.include/Mcde/McdeSys.h-- the system layer's contract;lib/McdeSys(libMcdeSys) implements the first part:common.c(POSIX),netbsd.c,linux.c(chosen by theNETBSDconditional),mcde_sys_infoandmcde_sys_power.test_sysinfo(make check) prints what the computer tells and checks what must hold; passed on Linux and in the NetBSD build VM.programs/icons/MakronixDtlogo.pm-- the Makronix logo, the default of dtlogin (programs/dtlogin/config/Xresources.src).programs/dtfile/Navigation.c-- the file manager window's navigation: toolbar (back, forward, view, search), sidebar with the places, history per window, free space in the status line. Hooked intoFileMgr.cat four places marked "MCDE"; the search intoFilterFiles(File.c,_McdeNavHidden), its text kept per window in Navigation.c, not in FileMgrData (saved as resources). The first window's directory does not come through ShowNewDirectory: the view buttons and the history are set once its data is attached.ChangeDir.ccompared two empty ToolTalk paths and called every folder "restricted"; it compares real paths only. Tested on Xvfb: Icons pressed at start, List, a place, Back, Forward, the search.programs/dtterm/Tabs.c-- tabs: the window holds an XmTabStack, every tab a page (an XmPanedWindow,mcdeSplit) of whole DtTermViews. Ctrl+Shift+T new tab, Ctrl+Shift+D split (one more view in the page: Xt cannot reparent, so every tab is a page from the start), Ctrl+Shift+W closes the view, the tab with its last, Ctrl+Shift+Left/Right switch; a program's title goes to its tab (TermParse.c), the window shows the front tab's. dtterm draws through Xft (TermPrimRenderXft.c) and reads UTF-8 (setlocale inDtTermMain.c, from MakroDE).programs/dtbar/dtbar.c-- the bar at the top of the screen: the M menu, the menus of the program with the focus, the clock. The protocol isinclude/Mcde/GlobalMenu.h(a selection, properties, client messages); the program side islib/DtSvc/DtUtil2/McdeGlobalMenu.c, started byDtInitialize, so every CDE program takes part without a change of its own and without a Motif patch: an Xt create hook finds its XmMenuBar, the bar hides it and shows its tree, a click calls the button's own callback. The text form isMcdeMenuModel.cwith its test (test_menumodel,make check). A foreign window is registered with a hidden core widget, never with a shell (a shell stops on "Event with wrong window").MCDE_NO_GLOBAL_MENUkeeps a program's menu bar in its window,MCDE_GLOBAL_MENU_DEBUGlogs what the program side does. The M menu: About This Computer (about.c: logo, system, version, processor, memory, startup disk, More Info -- frommcde_sys_info), Software Update (not yet), System Settings, Favourites (~/.dt/favourites) and Recent Items (~/.dt/recent;items.cwithtest_items), Force Quit (forcequit.c, XKillClient), Sleep/Restart/Shut Down (mcde_sys_power, the last two ask first), Lock Screen, Log Out with the user's name. Never test the power items to the end on a development host: dtbar runs as the user there, and the system may let the user shut it down. Right of the menus, left of the clock (status.c): volume (a slider in the menu --menuscale.cgives XmScale Motif's XmQTmenuSavvy trait with XmeTraitSet, so a menu takes it; Mute; the wheel over the speaker), Bluetooth (on/off), network (the cards, not bridges or containers) and, on a machine that has one, the battery (charge, power source, time left; NetBSD's envsys(4) dictionary, Linux's /sys/class/power_supply,docs/reference/battery.txtin the Makronix tree), all through McdeSys; icons are CDE icon files (icons/Mcde*.t.pm). The status menu bar has a fixed width, 30 pixels an icon (StatusWidth): the form sized it before the icons and the bar squeezed them to 10 pixels. Test sound only against a private PulseAudio (null sink, own socket): the slider changes the volume it reaches. dtwm places and maximizes windows below the bar (McdeExcludeBarinprograms/dtwm/WmMultiHead.c); a full-screen window covers it.programs/dtwm/WmSlideshow.c-- backdrops from picture files and the slideshow of a folder. "f.change_backdrop PATH 0 STYLE": pixmap 0 makes dtwm load the file itself (XmGetPixmap: XPM, XBM, PNG, JPEG); the request is read from the end, so a path may hold blanks. "f.mcde_slideshow INTERVAL RANDOM STYLE FOLDER" (minutes, 0 = off) and, at the start, the resource Dtwm*mcdeSlideshow in the same form; every workspace of the screen changes together. Scaled backdrops (Fit, Fill) use Xrender's bilinear filter. Pictures are loaded with McdeImageGetPixmap (include/Mcde/Image.h,lib/DtSvc/DtUtil2/McdeImage.c): PNG through libpng, the rest through XmGetPixmap -- Motif 2.3.8 draws an RGB PNG without alpha as its blue channel only (docs/reference/motif-png.txt in the Makronix tree). Give such pixmaps back with McdeImageFreePixmap.programs/dtsystemsettings-- the settings of the computer in one window: four bands (Personal, Hardware, Internet & Network, System) of icons (panes.c, plain C withtest_panes), a click opens the pane in the window, "Show All" goes back,-pane IDopens one at once (the bar's "... Settings..." items do). Drawn here through McdeSys: Sound, Network, Bluetooth, Date & Time, About, Keyboard, Mouse, Appearance, Fonts, Desktop, Screen Saver; CDE's style manager and printer tool open for their panes until those are drawn here. Accounts (accounts.c): the people (uid 1000..59999), add, delete, password, administrator, all through McdeSys; not as root the pane offers "Unlock...": a terminal wheresu -m rootasks for the password and starts the pane as root. Software Update (update.c): running/available version, new packages, source; "Update Now..." runsdtsystemsettings -apply-update(mcde_sys_update_apply) as root in a terminal. Keyboard and Mouse (input.c): settings of the X server, not of the system, so no McdeSys: Xlib (XChangeKeyboardControl, XkbSetAutoRepeatRate, XChangePointerControl, XSetPointerMapping) at once, and the properties_DT_SM_KEYBOARD_INFO/_DT_SM_POINTER_INFOon dtsession's window as dtstyle sends them, so dtsession saves them at logout. dtsession saves and restores the XKB repeat delay and interval too (SmSave.cPrintRepeatRate,SmRestore.c; resources RepeatDelay, RepeatInterval), and keeps every button of the pointer map (Sm.hpointerMap[256]; it was 5 and the save overflowed it with a mouse of more buttons -- Xvfb has 10). Appearance and Fonts (appearance.c): the palettes (*.dp, where the colour server looks) drawn as rows of their colours; a choice merges "0ColorPalette: NAME.dp" with _DtAddToResource as dtstyle does, and takes effect at the next login (TrueColor: the colour server cannot change allocated colours). Fonts sets *mcde.fontName and mcde.fontSize (sys.resources) the same way, for programs started afterwards; the families come from Xft. dtsession saves RESOURCE_MANAGER at logout (SmSave.c, OutputResource), so both persist. Network lists the Wi-Fi networks in reach (wifi.c, mcde_sys_wifi_scan: NetBSD wpa_cli scan_results, else ifconfig -v IF list scan as root; Linux nmcli -t). "Join..." opens a terminal: su, thendtsystemsettings -join-wifi IF [SSID as hex], which asks the network's password without echo and calls mcde_sys_wifi_join (NetBSD: a network block in /etc/wpa_supplicant.conf, wpa_supplicant and dhcpcd in rc.conf, as sysinst does -- docs/reference/wifi.txt; Linux: nmcli device wifi connect). Never test joining on the development host. Date & Time chooses the time zone (timezone.c): regions and places from mcde_sys_timezones (zone1970.tab); "Set Time Zone" runs mcde_sys_timezone_set as root at once, otherwisedtsystemsettings -set-timezone ZONEin a terminal after su(1). The link /etc/localtime is made beside the old one and renamed over it. Desktop and Screen Saver (desktop.c): one pane, two pages. Desktop: a preview of the backdrop in use, the places on the left (CDE's backdrops, ~/.dt/backdrops, ~/Pictures, folders in ~/.dt/backdrop-folders, "Choose Folder..."), their pictures small on the right -- each cell is made when its picture is (an idle work proc), since a label's pixmap set later was not drawn -- the style, and "Change picture" with interval and random order (dtwm: f.mcde_slideshow, and the resource DtwmmcdeSlideshow for the next login). Screen Saver: the savers of $DTSCREENSAVERLIST with a running preview (_DtSaverStart), the minutes until it starts and the password, to dtsession as dtstyle sends them. Test a session through logout and login with dtaction ExitSession and DTDATABASESEARCHPATH set; a dtsession started without Xsession does not get its resources loaded, so the double-click time is not measured that way.- McdeSys users and update:
users.c(getpwent/getgrnam, useradd/userdel), the backends for password and the administrators' group -- NetBSD hashes with pw_gensalt(3)/crypt(3) forusermod -pand, having no tool to remove a group member (usermod -G only appends, measured), rewrites the group's line the way user.c does (temporary file, rename); Linux uses chpasswd on stdin and gpasswd. Update: NetBSD reads the source from/etc/makronix/update(a release directory whoseRELEASEfile has the first line of its /etc/release), applies with sysupgrade(8) andpkg_add -uu; Linux uses apt-get. Tested as root in the NetBSD build VM: add with password, administrator on and off, new password, delete; the group file afterwards byte for byte as before. programs/dtterm/Dropdown.c--dtterm -dropdown: full width, 40 % high, override-redirect, hidden until its key (dropdownKey, F12), then it slides down below the top bar and takes the keyboard; the key sends it up. The key is grabbed on the root window and taken in dtterm's own event dispatcher (XtSetEventDispatcher): a root window registered with a widget did not bring it. Started byXsession.d/0085.dtdropdown. Test with an XTest event on the key's own keycode:xdotool key F12maps F12 to a spare keycode, which the grab never sees (measured).programs/dtterm/Profiles.c-- terminal profiles (font, colours, command) from~/.dt/dtterm.profiles, elseconfig/dtterm.profiles; the parser is plain C with its own test (test_profiles.c,make check). A view with a profile is namedprofile_<name>: its colours are resources of that name, its font an Xft render table handed to the view (TermView passes it on), its commandDtNsubprocessArgv. Window > New Tab / New Tab with Profile come from a hook inTermViewMenu.c(_DtTermViewMenuSetNewTab);dtterm -profile NAME; the profile "Default" is the starting one.
Building it
- On the Linux build host, for development:
make mcde-linuxin the Makronix root (tools/mcde-linux.sh;MCDE_DIRS=programs/dtfilefor one directory,MCDE_DIRS=installto install intobuild/mcde-root/dt). - For Makronix and any pkgsrc platform: the recipe in
pkgsrc/. - The C dialect is set by
configure.acitself (-std=gnu11and five GCC 14 downgrades, also handed to the ksh93 build of dtksh asMCDE_DIALECT_CFLAGS): no build system needs to know about it.
What may be changed, and how
- Anything; it is ours. Keep the licence headers (LGPL,
COPYING): the "CDE - Common Desktop Environment" lines at the top of the files are attribution, not branding, and stay. - Branding is what a user sees: names in dialogs, the version string
(
DtVERSION_STRING, "MCDE x.y.z (CDE 2.5.3)"), logos.DtVERSION,DtREVISION,DtUPDATE_LEVELstay at 2.5.3: they are the API level programs test against. - Not yet: the install prefix (
${PREFIX}/dt) and the tarnamecde(from it comeshare/cdeandetc/cde); they move together, with the PLIST, in one step. - After a change: commit, then
tools/mcde-dist.sh(archive and distinfo from that commit), then build with pkgsrc. The archive is made from commits only.