Files
mcde/programs/dtsystemsettings/ui.h
T
lotherk d72634fd62 MCDE: the web browser as the desktop's default program (t0179)
A web page has one action on the desktop now, McdeWeb
(programs/types/datatypes.dt.src): it runs "dtsystemsettings -open-web
%Arg_1%", which reads the browser from ~/.dt/defaults (web:, chosen in the
Default Programs pane) and starts it with execlp -- no shell, and an argument
with a shell character is refused.  -open-web is handled before Xt is set up,
so an action needs no display.

The .html and .htm criteria of programs/types/firefox.dt map their Open to
McdeWeb: a double click in dtfile now follows the file's choice instead of a
hard-wired Firefox.  McdeWeb takes ARG_TYPE * -- an action that names a data
type the file does not have is refused ("Either action ... does not apply",
measured), and it is only named by the types that may use it.

dtthemesync gained the Firefox part: every profile under ~/.mozilla/firefox
with a prefs.js gets a user.js (downloads into ~/Downloads, reduced motion,
no cosmetic animations, no smooth scrolling, ui.key.accelKey 91 -- Command is
Mod4 in MCDE) and a chrome/userChrome.css written from the palette.

Measured under Xvfb with xdotool and a wrapper that records its arguments:

  - dtsystemsettings -open-web http://example.org with web: true answers
    "Opened in true: http://example.org" and exits 0, without a display;
  - -open-web "http://x;rm -rf /" answers "That is not an address" and exits
    1; -open-web "" answers "No address was given";
  - a double click on page.html in dtfile with web: mcdetest-browser hands
    exactly that path to the wrapper (cat of what it got);
  - the same double click with web: firefox opens a "Mozilla Firefox" window;
  - dtthemesync -v in a test home with a fake profile writes user.js and
    chrome/userChrome.css; user.js carries browser.download.dir
    <home>/Downloads, prefersReducedMotion 1, cosmeticAnimations false,
    smoothScroll false, ui.key.accelKey 91, and the CSS starts with
    --toolbar-bgcolor: #c6b2a8 (the palette Default.dp);
  - the Default Programs pane shows web: firefox and, after the fix, the
    links choice that the file has ("in a tab of the window that is there")
    -- docs/screenshots/leopard/web-browser-default-mcde.png;
  - make programs/dtsystemsettings, programs/dtthemesync, programs/types
    exit=0; check programs/dtsystemsettings: test_panes PASS; check lib/DtSvc
    PASS.

Not measured: Firefox's own Cmd+T/W/L in a running window (the user.js sets
the accelerator; that needs a person at the keyboard), and dtexplorer -- the
Motif browser of the task -- which is its own program and a follow-up.
2026-11-14 15:54:22 +00:00

103 lines
4.4 KiB
C

/*
* ui.h -- dtsystemsettings: what the panes share (main.c)
*
* License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
*/
#ifndef _dtsystemsettings_ui_h
#define _dtsystemsettings_ui_h
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
extern XtAppContext app;
XmRenderTable PaneFont(Widget w, int size, Boolean bold);
Widget Text(Widget parent, const char *name, const char *text);
void SetText(Widget w, const char *text);
Widget Button(Widget parent, const char *label, XtCallbackProc cb,
XtPointer data);
Widget PaneButton(Widget parent, const char *label, XtCallbackProc cb,
XtPointer data);
Widget Table(Widget parent, const char *const *rows, int n, Widget *values);
Pixmap Icon(Widget w, const char *file);
void Spawn(const char *command);
/* a message in a small window; ERROR: an error */
void Message(Widget parent, const char *text, int error);
/* the command line that runs COMMAND as root in a terminal, after su(1)
* asked for the password there ("Unlock..."); into BUF */
void AsRoot(const char *title, const char *command, char *buf, size_t len);
/* the panes in accounts.c and update.c */
Widget MakeAccounts(Widget parent);
Widget MakeUpdate(Widget parent);
/* the value of a resource in the server's RESOURCE_MANAGER, read anew
* (Xlib keeps the string of the connection's start); DEF when none */
void ServerResource(Display *dpy, const char *name, const char *class,
const char *def, char *buf, size_t len);
/* the Desktop & Screen Saver pane (desktop.c), opened on its desktop (0) or
* its screen saver page (1) */
Widget MakeDesktopPane(Widget parent, int saver);
/* the Network pane (network.c); dtsystemsettings -renew-dhcp IF */
Widget MakeNetwork(Widget parent);
int RenewDhcpCommand(const char *ifname);
/* the Wi-Fi tab of a card in the Network pane (wifi.c); IFNAME NULL: the
* first Wi-Fi card, NULL returned without one */
Widget MakeWifi(Widget parent, const char *ifname);
/* dtsystemsettings -join-wifi IF [SSID in hex]: the terminal of "Join..." */
int JoinWifiCommand(const char *ifname, const char *hexssid);
/* the Backup pane (backup.c) */
Widget MakeBackup(Widget parent);
/* the Sharing pane (sharing.c) */
Widget MakeSharing(Widget parent);
/* the Startup pane (startup.c) */
Widget MakeStartup(Widget parent);
/* the time zone in Date & Time (timezone.c) */
Widget MakeZoneChooser(Widget parent);
/* dtsystemsettings -set-timezone ZONE: what the terminal of "Set Time Zone"
* runs */
int SetTimezoneCommand(const char *zone);
/* the panes in appearance.c */
Widget MakeAppearance(Widget parent);
Widget MakeFonts(Widget parent);
/* the Language pane (language.c), ~/.dt/language at login
* (Xsession.d/0010.language) */
Widget MakeLanguage(Widget parent);
/* the Keyboard & Mouse pane (input.c): three tabs, WHICH is "keyboard"
* (the default), "mouse" or "shortcuts" */
Widget MakeInput(Widget parent, const char *which);
/* the Sound pane (sound.c): Sound Effects | Output | Input */
Widget MakeSound(Widget parent);
/* the Security pane (security.c): General | Encryption | Firewall */
Widget MakeSecurity(Widget parent);
/* the Printers pane (printers.c) and the commands its root buttons run */
Widget MakePrinters(Widget parent);
/* the Parental Controls (parental.c): Programs | Time Limits | Log */
Widget MakeParental(Widget parent);
/* the CDs & DVDs pane (cds.c): the choice per kind of medium */
Widget MakeCDs(Widget parent);
/* the Energy Saver pane (energy.c) */
Widget MakeEnergy(Widget parent);
/* the Internet accounts pane (internet.c) */
Widget MakeInternet(Widget parent);
/* the default programs (defaults.c), ~/.dt/defaults */
Widget MakeDefaults(Widget parent);
/* dtsystemsettings -open-web URL: the browser of ~/.dt/defaults (t0179) */
int OpenWebCommand(const char *arg);
/* what this computer is (sysinfo.c): Hardware | Network | Software */
Widget MakeSysinfo(Widget parent);
/* the Startup Disk pane (startupdisk.c) */
Widget MakeStartupDisk(Widget parent);
int SetDefaultPrinterCommand(const char *name);
int AddPrinterCommand(const char *name, const char *uri);
int RemovePrinterCommand(const char *name);
/* the Displays pane (displays.c) and dtsystemsettings -apply-displays,
* ~/.dt/displays at login (Xsession.d/0071.displays) */
Widget MakeDisplays(Widget parent);
int ApplyDisplaysCommand(Display *dpy);
/* dtsystemsettings -apply-update: what the terminal of "Update Now" runs */
int ApplyUpdate(void);
#endif /* _dtsystemsettings_ui_h */