mcde: builds on Linux (GCC 15); dtfile gets toolbar, sidebar, history, free space; make mcde-linux, mcde-shot
- configure.ac: the C dialect (-std=gnu11 and five GCC 14 downgrades) is configure's own, also handed to dtksh's ksh93 build (MCDE_DIALECT_CFLAGS). - The pkgsrc placeholders folded in from wm/cde (@PREFIX@, @VARBASE@, @PKG_SYSCONFDIR@) are configure options now: --with-logfiles-dir, --with-config-dir, --with-local-bindir; and --with-pamdir (dtlogin, dtsession) and --with-calendar-dir (dtcm, rpc.cmsd) replace paths that were fixed. Defaults unchanged; the recipe passes its paths. - dtfile: programs/dtfile/Navigation.c -- Back/Forward with a history per window, views Icons/Small/List, places in a sidebar, free space in the status line (statvfs). Screenshot: build/mcde-shots/dtfile-7.png. - make mcde-linux (tools/mcde-linux.sh): the development build on this host, every system path under build/mcde-root. tools/mcde-shot.sh: run a program on a private Xvfb with ttsession and dtwm, empty environment and its own HOME, take a screenshot. tools/ext-sync.sh: ext recipes into pkgsrc/<cat>/<name>. Measured: build/logs/mcde-linux-install3-2026-11-09.log (mcde-linux exit=0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6850b1c481
commit
94f116c272
16 files changed
+500
-26
No files matched your search
@@ -2,9 +2,9 @@
|
||||
|
||||
## What it is
|
||||
|
||||
The Makronix fork of CDE 2.5.3 (`IMPORT`), on its way to a desktop like Mac OS X
|
||||
10.4 to 10.6: one System Preferences, a software update, the small things that
|
||||
belong together (`GOAL.md` of the Makronix tree, "MCDE"). Makronix ships it in
|
||||
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)
|
||||
@@ -38,6 +38,19 @@ place of CDE; pkgsrc builds it on any platform from `pkgsrc/`.
|
||||
next step is `lib/McdeSys` with `netbsd.c` and its place in `configure.ac`).
|
||||
- `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), sidebar with the places, history per window, free space
|
||||
in the status line. Hooked into `FileMgr.c` at four places marked "MCDE".
|
||||
|
||||
## Building it
|
||||
|
||||
- On the Linux build host, for development: `make mcde-linux` in the Makronix
|
||||
root (`tools/mcde-linux.sh`; `MCDE_DIRS=programs/dtfile` for one directory,
|
||||
`MCDE_DIRS=install` to install into `build/mcde-root/dt`).
|
||||
- For Makronix and any pkgsrc platform: the recipe in `pkgsrc/`.
|
||||
- The C dialect is set by `configure.ac` itself (`-std=gnu11` and five GCC 14
|
||||
downgrades, also handed to the ksh93 build of dtksh as
|
||||
`MCDE_DIALECT_CFLAGS`): no build system needs to know about it.
|
||||
|
||||
## What may be changed, and how
|
||||
|
||||
|
||||
+47
-4
@@ -41,8 +41,26 @@ dnl These must be up here for the compiler search list to actually work
|
||||
AC_PROG_CC([cc gcc clang])
|
||||
AC_PROG_CXX([c++ g++ clang++])
|
||||
|
||||
dnl MCDE: the C dialect. CDE declares functions K&R style (`int f();`), which
|
||||
dnl C23 reads as `int f(void)`; GCC 15 defaults to C23. gnu11 is the dialect
|
||||
dnl NetBSD builds its own tree with (share/mk/bsd.sys.mk). GCC 14 also made
|
||||
dnl five old diagnostics errors that CDE trips; they stay warnings here. New
|
||||
dnl MCDE code must be valid C99 and POSIX on its own (AGENTS.md).
|
||||
dnl MCDE_DIALECT_CFLAGS: the accepted flags, for builds that ignore CFLAGS
|
||||
dnl (programs/dtksh builds ksh93 with its own tool and cc from PATH).
|
||||
MCDE_DIALECT_CFLAGS=
|
||||
for mcde_flag in -std=gnu11 -Wno-error=implicit-function-declaration \
|
||||
-Wno-error=implicit-int -Wno-error=int-conversion \
|
||||
-Wno-error=incompatible-pointer-types -Wno-error=return-mismatch; do
|
||||
mcde_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS $mcde_flag"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [MCDE_DIALECT_CFLAGS="$MCDE_DIALECT_CFLAGS $mcde_flag"],
|
||||
[CFLAGS=$mcde_save_CFLAGS])
|
||||
done
|
||||
AC_SUBST(MCDE_DIALECT_CFLAGS)
|
||||
|
||||
LT_INIT
|
||||
AC_PREFIX_DEFAULT(@PREFIX@/dt)
|
||||
AC_PREFIX_DEFAULT(/usr/dt)
|
||||
|
||||
|
||||
PKG_PROG_PKG_CONFIG
|
||||
@@ -297,9 +315,34 @@ CP="cp -f"
|
||||
AC_SUBST(CP)
|
||||
|
||||
dnl these should be configurable someday...
|
||||
CDE_INSTALLATION_TOP="$ac_default_prefix"
|
||||
CDE_LOGFILES_TOP=@VARBASE@/dt
|
||||
CDE_CONFIGURATION_TOP=@PKG_SYSCONFDIR@/dt
|
||||
dnl MCDE: where CDE keeps its files, as configure options (pkgsrc used to
|
||||
dnl patch placeholders into this file). The installation top is --prefix.
|
||||
CDE_INSTALLATION_TOP="$prefix"
|
||||
test "x$CDE_INSTALLATION_TOP" = xNONE && CDE_INSTALLATION_TOP="$ac_default_prefix"
|
||||
AC_ARG_WITH([logfiles-dir],
|
||||
[AS_HELP_STRING([--with-logfiles-dir=DIR], [dtlogin logs and state (default /var/dt)])],
|
||||
[CDE_LOGFILES_TOP=$withval], [CDE_LOGFILES_TOP=/var/dt])
|
||||
AC_ARG_WITH([config-dir],
|
||||
[AS_HELP_STRING([--with-config-dir=DIR], [site configuration (default /etc/dt)])],
|
||||
[CDE_CONFIGURATION_TOP=$withval], [CDE_CONFIGURATION_TOP=/etc/dt])
|
||||
AC_ARG_WITH([local-bindir],
|
||||
[AS_HELP_STRING([--with-local-bindir=DIR], [added to the PATH of a dtlogin session (default /usr/local/bin)])],
|
||||
[MCDE_LOCAL_BINDIR=$withval], [MCDE_LOCAL_BINDIR=/usr/local/bin])
|
||||
AC_SUBST(MCDE_LOCAL_BINDIR)
|
||||
dnl where dtlogin's PAM file goes; the defaults are what the Makefile.am had
|
||||
AC_ARG_WITH([pamdir],
|
||||
[AS_HELP_STRING([--with-pamdir=DIR], [PAM configuration (default /etc/pam.d; /usr/local/etc/pam.d on FreeBSD)])],
|
||||
[MCDE_PAMDIR=$withval],
|
||||
[case "$host_os" in
|
||||
freebsd*) MCDE_PAMDIR=/usr/local/etc/pam.d ;;
|
||||
*) MCDE_PAMDIR=/etc/pam.d ;;
|
||||
esac])
|
||||
AC_SUBST(MCDE_PAMDIR)
|
||||
dnl the calendar server's spool (rpc.cmsd, programs/dtcm/server/log.h)
|
||||
AC_ARG_WITH([calendar-dir],
|
||||
[AS_HELP_STRING([--with-calendar-dir=DIR], [calendar spool of rpc.cmsd (default /var/spool/calendar)])],
|
||||
[MCDE_CALENDAR_DIR=$withval], [MCDE_CALENDAR_DIR=/var/spool/calendar])
|
||||
AC_SUBST(MCDE_CALENDAR_DIR)
|
||||
CDE_USER_TOP=.dt
|
||||
|
||||
AC_SUBST(CDE_INSTALLATION_TOP)
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
MCDE, the Makronix Common Desktop Environment, is a fork of CDE 2.5.3 (the
|
||||
Common Desktop Environment of Sun, HP, IBM, DEC, SCO, Fujitsu and Hitachi,
|
||||
open source since 2012). It stays with CDE, Motif and Xlib -- fast enough for
|
||||
the machines of 1995 -- and grows towards the integrated desktop of Mac OS X
|
||||
10.4 to 10.6: one place for the system settings, software update, a coherent
|
||||
look. Written in C99 against POSIX; the operating system is behind one layer,
|
||||
so it builds and runs on NetBSD and Linux. It conflicts with wm/cde.
|
||||
open source since 2012). It keeps the look of CDE and Motif and stays fast
|
||||
enough for the machines of 1995, and makes the desktop work as one: the
|
||||
system settings in one place, software update, the same behaviour in every
|
||||
program. Written in C99 against POSIX; the operating system is behind one
|
||||
layer, so it builds and runs on NetBSD and Linux. It conflicts with wm/cde.
|
||||
+5
-2
@@ -49,6 +49,10 @@ CONFIGURE_ARGS+= --with-tcl=${BUILDLINK_PREFIX.tcl}/lib
|
||||
CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}/dt
|
||||
CONFIGURE_ARGS+= --with-utmp-file=${VARBASE}/run/utmp
|
||||
CONFIGURE_ARGS+= --with-wtmp-file=${VARBASE}/log/wtmp
|
||||
# MCDE: these were placeholders patched into configure.ac by pkgsrc
|
||||
CONFIGURE_ARGS+= --with-logfiles-dir=${VARBASE}/dt
|
||||
CONFIGURE_ARGS+= --with-config-dir=${PKG_SYSCONFDIR}/dt
|
||||
CONFIGURE_ARGS+= --with-local-bindir=${PREFIX}/bin
|
||||
|
||||
.include "options.mk"
|
||||
|
||||
@@ -79,9 +83,8 @@ SUBST_MESSAGE.iconv= Fix for GNU iconv.
|
||||
|
||||
SUBST_CLASSES+= paths
|
||||
SUBST_STAGE.paths= pre-configure
|
||||
SUBST_FILES.paths+= configure.ac
|
||||
SUBST_FILES.paths+= pkgsrc/cde.desktop pkgsrc/startcde
|
||||
SUBST_FILES.paths+= pkgsrc/README.* programs/dtlogin/Makefile.am
|
||||
SUBST_FILES.paths+= pkgsrc/README.*
|
||||
SUBST_VARS.paths= PKG_SYSCONFDIR PREFIX REAL_ROOT_GROUP VARBASE X11BASE
|
||||
SUBST_MESSAGE.paths= Replacing path placeholders.
|
||||
|
||||
|
||||
@@ -42,4 +42,4 @@ dtcm_editor_SOURCES = datefield.c deskset.c dssw.c \
|
||||
reminders.c rfp.c
|
||||
|
||||
install-exec-hook:
|
||||
$(INSTALL) -m 0755 -d $(DESTDIR)/var/spool/calendar
|
||||
$(INSTALL) -m 0755 -d $(DESTDIR)$(MCDE_CALENDAR_DIR)
|
||||
@@ -2,7 +2,8 @@ MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
bin_PROGRAMS = rpc.cmsd
|
||||
|
||||
rpc_cmsd_CFLAGS = -I../../../lib/csa $(DT_INCDIR) $(CSA_INCDIR)
|
||||
rpc_cmsd_CFLAGS = -I../../../lib/csa $(DT_INCDIR) $(CSA_INCDIR) \
|
||||
-D_DtCMS_DEFAULT_DIR='"$(MCDE_CALENDAR_DIR)"'
|
||||
|
||||
rpc_cmsd_LDADD = $(LIBCSA) $(DTCLIENTLIBS) $(TIRPCLIB) $(XTOOLLIB)
|
||||
|
||||
|
||||
@@ -40,7 +40,10 @@
|
||||
#define _DtCMS_DEFAULT_BAK ".calbak"
|
||||
#define _DtCMS_DEFAULT_TMP ".caltmp"
|
||||
#define _DtCMS_DEFAULT_DEL ".caldel"
|
||||
/* MCDE: configure --with-calendar-dir gives it (programs/dtcm/server/Makefile.am) */
|
||||
#ifndef _DtCMS_DEFAULT_DIR
|
||||
#define _DtCMS_DEFAULT_DIR "/var/spool/calendar"
|
||||
#endif
|
||||
#define _DtCMS_DEFAULT_MODE (S_IRUSR|S_IRGRP|S_IWGRP)
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -158,6 +158,7 @@
|
||||
#include "FileMgr.h"
|
||||
#include "Desktop.h"
|
||||
#include "Main.h"
|
||||
#include "Navigation.h"
|
||||
#include "Common.h"
|
||||
#include "Filter.h"
|
||||
#include "Find.h"
|
||||
@@ -579,6 +580,7 @@ Create(
|
||||
Widget current_directory_icon;
|
||||
Widget directory_list_form;
|
||||
Widget work_frame;
|
||||
Widget nav_form;
|
||||
Widget status_form;
|
||||
Widget status_separator;
|
||||
Widget status_line;
|
||||
@@ -609,6 +611,8 @@ Create(
|
||||
/* Allocate the change directory dialog instance record. */
|
||||
|
||||
file_mgr_rec = (FileMgrRec *) XtMalloc (sizeof (FileMgrRec));
|
||||
file_mgr_rec->mcde_toolbar = NULL; /* MCDE: no navigation parts yet (Navigation.c) */
|
||||
file_mgr_rec->mcde_back = NULL;
|
||||
file_mgr_rec->action_pane_file_type = NULL;
|
||||
|
||||
/* set up translations in main edit widget */
|
||||
@@ -699,7 +703,13 @@ Create(
|
||||
XtSetArg (args[1], XmNshadowType, XmSHADOW_OUT);
|
||||
XtSetArg (args[2], XmNmarginWidth, 5);
|
||||
XtSetArg (args[3], XmNmarginHeight, 5);
|
||||
work_frame = XmCreateFrame (mainWidget, "work_frame", args, 4);
|
||||
/* MCDE: toolbar and sidebar around the work area;
|
||||
* the Trash window stays as CDE made it. */
|
||||
nav_form = TrashView ? NULL : _McdeNavCreate(file_mgr_rec, mainWidget);
|
||||
work_frame = XmCreateFrame (nav_form ? nav_form : mainWidget,
|
||||
"work_frame", args, 4);
|
||||
if (nav_form)
|
||||
_McdeNavAttachWork(file_mgr_rec, work_frame);
|
||||
XtManageChild (work_frame);
|
||||
|
||||
|
||||
@@ -943,7 +953,7 @@ Create(
|
||||
/* areas of the main windows. */
|
||||
|
||||
XmMainWindowSetAreas (mainWidget, menu, file_mgr_rec->header_frame,
|
||||
NULL, NULL, work_frame);
|
||||
NULL, NULL, nav_form ? nav_form : work_frame);
|
||||
XtSetArg (args[0], XmNmessageWindow, status_form);
|
||||
XtSetValues(mainWidget, args, 1);
|
||||
|
||||
@@ -2790,6 +2800,7 @@ UpdateStatusLine(
|
||||
else
|
||||
{
|
||||
GetStatusMsg(file_mgr_data, buf);
|
||||
_McdeNavFreeSpace(file_mgr_data->current_directory, buf, sizeof buf);
|
||||
label_string = XmStringCreateLocalized(buf);
|
||||
}
|
||||
XtSetArg (args[0], XmNlabelString, label_string);
|
||||
@@ -3189,6 +3200,9 @@ ShowNewDirectory(
|
||||
}
|
||||
DtDtsFreeDataType(tmp_type);
|
||||
|
||||
/* MCDE: the window's history for Back and Forward (Navigation.c) */
|
||||
_McdeNavVisit((FileMgrRec *) file_mgr_data->file_mgr_rec, directory_name);
|
||||
|
||||
if (openDirType == NEW)
|
||||
{
|
||||
DialogData *dialog_data;
|
||||
|
||||
@@ -319,6 +319,9 @@ typedef struct
|
||||
} FileMgrData, * FileMgrDataPtr;
|
||||
|
||||
|
||||
/* MCDE: the views offered on the toolbar (Navigation.c) */
|
||||
#define MCDE_NVIEWS 3
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Widget shell;
|
||||
@@ -351,6 +354,17 @@ typedef struct
|
||||
Widget preferencesBtn_child;
|
||||
Widget defaultEnvBtn_child;
|
||||
Widget filterBtn_child;
|
||||
/* MCDE: the navigation parts of the window (Navigation.c) */
|
||||
Widget mcde_toolbar;
|
||||
Widget mcde_back;
|
||||
Widget mcde_forward;
|
||||
Widget mcde_view[MCDE_NVIEWS];
|
||||
Widget mcde_sidebar;
|
||||
Widget mcde_sidebar_frame;
|
||||
char ** mcde_history;
|
||||
int mcde_history_len;
|
||||
int mcde_history_pos;
|
||||
Boolean mcde_navigating;
|
||||
} FileMgrRec;
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -39,7 +39,8 @@ dtfile_SOURCES = ChangeDir.c ChangeDirP.c Command.c Common.c \
|
||||
IconicPath.c Main.c Menu.c MkDir.c \
|
||||
ModAttr.c ModAttrP.c MultiView.c OverWrite.c \
|
||||
Prefs.c PrefsP.c SharedMsgs.c SharedProcs.c \
|
||||
ToolTalk.c Trash.c Utils.c fsDialog.c
|
||||
ToolTalk.c Trash.c Utils.c fsDialog.c \
|
||||
Navigation.c
|
||||
|
||||
# Mind the quoting here...
|
||||
SCRIPTFLAGS = -DSHAPE -D_ILS_MACROS -DSUN_PERF \
|
||||
|
||||
@@ -0,0 +1,363 @@
|
||||
/*
|
||||
* Navigation.c -- MCDE: the navigation of the file manager window: a toolbar
|
||||
* (back, forward, the view), a sidebar with the places, a history per window,
|
||||
* and the free space in the status line.
|
||||
*
|
||||
* Copyright (c) 2026 The Makronix project. GNU LGPL 2.0 or later, as CDE.
|
||||
*
|
||||
* Written in C99 against POSIX and Motif (ext/src/mcde/AGENTS.md); nothing
|
||||
* here knows the operating system. The rest of dtfile is CDE's: this file
|
||||
* only adds widgets around its work area and calls its own functions to
|
||||
* change the directory (ChangeDirectoryToParent, which checks the path the
|
||||
* way the "Go To" dialog does) and the view (as PrefsP.c applies a new view).
|
||||
*
|
||||
* First step (2026-11-09): toolbar, places, history, free space. Not yet:
|
||||
* icons on the toolbar buttons, the column view, devices in the sidebar,
|
||||
* the search field, localized strings (catgets).
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <Xm/RowColumn.h>
|
||||
#include <Xm/PushB.h>
|
||||
#include <Xm/ToggleB.h>
|
||||
#include <Xm/List.h>
|
||||
#include <Xm/Frame.h>
|
||||
#include <Xm/Separator.h>
|
||||
|
||||
#include <Dt/Connect.h>
|
||||
#include <Dt/SharedProcs.h>
|
||||
|
||||
#include "Encaps.h"
|
||||
#include "SharedProcs.h"
|
||||
#include "FileMgr.h"
|
||||
#include "Desktop.h"
|
||||
#include "Main.h"
|
||||
#include "Prefs.h"
|
||||
#include "Navigation.h"
|
||||
|
||||
#define SIDEBAR_WIDTH 150
|
||||
|
||||
/* the places of the sidebar: a label and a path below $HOME, or absolute */
|
||||
static const struct {
|
||||
const char *label;
|
||||
const char *path; /* "~" is $HOME, "~/x" below it */
|
||||
} places[] = {
|
||||
{ "Computer", "/" },
|
||||
{ "Home", "~" },
|
||||
{ "Desktop", "~/Desktop" },
|
||||
{ "Documents", "~/Documents" },
|
||||
{ "Downloads", "~/Downloads" },
|
||||
};
|
||||
#define NPLACES (sizeof places / sizeof places[0])
|
||||
|
||||
/* the three views of the toolbar, as dtfile names them (Prefs.h) */
|
||||
static const struct {
|
||||
const char *label;
|
||||
int view;
|
||||
} views[MCDE_NVIEWS] = {
|
||||
{ "Icons", BY_NAME_AND_ICON },
|
||||
{ "Small", BY_NAME_AND_SMALL_ICON },
|
||||
{ "List", BY_ATTRIBUTES },
|
||||
};
|
||||
|
||||
static FileMgrData *
|
||||
DataOf(FileMgrRec *rec)
|
||||
{
|
||||
DialogData *dd = _DtGetInstanceData((XtPointer)rec);
|
||||
|
||||
return dd != NULL ? (FileMgrData *)dd->data : NULL;
|
||||
}
|
||||
|
||||
/* "~/x" -> "$HOME/x"; the result is XtMalloc'd */
|
||||
static char *
|
||||
ExpandPlace(const char *path)
|
||||
{
|
||||
const char *home = getenv("HOME");
|
||||
size_t len;
|
||||
char *s;
|
||||
|
||||
if (path[0] != '~')
|
||||
return XtNewString(path);
|
||||
if (home == NULL || home[0] == '\0')
|
||||
home = "/";
|
||||
len = strlen(home) + strlen(path);
|
||||
s = XtMalloc(len + 1);
|
||||
(void)snprintf(s, len + 1, "%s%s", home, path + 1);
|
||||
return s;
|
||||
}
|
||||
|
||||
static void
|
||||
GoTo(FileMgrRec *rec, const char *path, Boolean from_history)
|
||||
{
|
||||
char *p = XtNewString(path);
|
||||
|
||||
rec->mcde_navigating = from_history;
|
||||
ChangeDirectoryToParent(rec, p); /* checks the path, shows errors */
|
||||
XtFree(p);
|
||||
rec->mcde_navigating = False;
|
||||
}
|
||||
|
||||
static void
|
||||
UpdateButtons(FileMgrRec *rec)
|
||||
{
|
||||
if (rec->mcde_back == NULL)
|
||||
return;
|
||||
XtSetSensitive(rec->mcde_back, rec->mcde_history_pos > 0);
|
||||
XtSetSensitive(rec->mcde_forward,
|
||||
rec->mcde_history_pos + 1 < rec->mcde_history_len);
|
||||
}
|
||||
|
||||
static void
|
||||
BackCB(Widget w, XtPointer client, XtPointer call)
|
||||
{
|
||||
FileMgrRec *rec = (FileMgrRec *)client;
|
||||
|
||||
(void)w; (void)call;
|
||||
if (rec->mcde_history_pos > 0) {
|
||||
rec->mcde_history_pos--;
|
||||
GoTo(rec, rec->mcde_history[rec->mcde_history_pos], True);
|
||||
UpdateButtons(rec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ForwardCB(Widget w, XtPointer client, XtPointer call)
|
||||
{
|
||||
FileMgrRec *rec = (FileMgrRec *)client;
|
||||
|
||||
(void)w; (void)call;
|
||||
if (rec->mcde_history_pos + 1 < rec->mcde_history_len) {
|
||||
rec->mcde_history_pos++;
|
||||
GoTo(rec, rec->mcde_history[rec->mcde_history_pos], True);
|
||||
UpdateButtons(rec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ViewCB(Widget w, XtPointer client, XtPointer call)
|
||||
{
|
||||
FileMgrRec *rec = (FileMgrRec *)client;
|
||||
XmToggleButtonCallbackStruct *cbs = (XmToggleButtonCallbackStruct *)call;
|
||||
FileMgrData *data;
|
||||
int i;
|
||||
|
||||
if (!cbs->set || (data = DataOf(rec)) == NULL)
|
||||
return;
|
||||
for (i = 0; i < MCDE_NVIEWS; i++)
|
||||
if (rec->mcde_view[i] == w)
|
||||
break;
|
||||
if (i == MCDE_NVIEWS || data->view == views[i].view)
|
||||
return;
|
||||
/* as PrefsP.c applies a view chosen in the Preferences dialog */
|
||||
data->view = views[i].view;
|
||||
if (data->show_type == SINGLE_DIRECTORY)
|
||||
data->view_single = views[i].view;
|
||||
else
|
||||
data->view_tree = views[i].view;
|
||||
data->newSize = True;
|
||||
FileMgrRedisplayFiles(rec, data, False);
|
||||
}
|
||||
|
||||
static void
|
||||
PlaceCB(Widget w, XtPointer client, XtPointer call)
|
||||
{
|
||||
FileMgrRec *rec = (FileMgrRec *)client;
|
||||
XmListCallbackStruct *cbs = (XmListCallbackStruct *)call;
|
||||
int i = cbs->item_position - 1;
|
||||
char *path;
|
||||
|
||||
(void)w;
|
||||
if (i < 0 || (size_t)i >= NPLACES)
|
||||
return;
|
||||
path = ExpandPlace(places[i].path);
|
||||
GoTo(rec, path, False);
|
||||
XtFree(path);
|
||||
}
|
||||
|
||||
static Widget
|
||||
Button(Widget parent, const char *name, const char *label,
|
||||
XtCallbackProc cb, XtPointer client)
|
||||
{
|
||||
XmString s = XmStringCreateLocalized((char *)label);
|
||||
Arg args[2];
|
||||
Widget b;
|
||||
|
||||
XtSetArg(args[0], XmNlabelString, s);
|
||||
XtSetArg(args[1], XmNtraversalOn, False);
|
||||
b = XmCreatePushButton(parent, (char *)name, args, 2);
|
||||
XmStringFree(s);
|
||||
XtAddCallback(b, XmNactivateCallback, cb, client);
|
||||
XtManageChild(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
Widget
|
||||
_McdeNavCreate(FileMgrRec *rec, Widget parent)
|
||||
{
|
||||
Widget form, bar, views_rc, frame;
|
||||
XmString items[NPLACES];
|
||||
Arg args[12];
|
||||
size_t k;
|
||||
int i, n;
|
||||
|
||||
rec->mcde_history = NULL;
|
||||
rec->mcde_history_len = 0;
|
||||
rec->mcde_history_pos = -1;
|
||||
rec->mcde_navigating = False;
|
||||
|
||||
form = XmCreateForm(parent, "mcdeNavigation", NULL, 0);
|
||||
|
||||
/* the toolbar: back, forward, then the views */
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
|
||||
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
|
||||
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
|
||||
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
|
||||
XtSetArg(args[n], XmNspacing, 4); n++;
|
||||
XtSetArg(args[n], XmNmarginHeight, 4); n++;
|
||||
bar = XmCreateRowColumn(form, "mcdeToolbar", args, n);
|
||||
rec->mcde_toolbar = bar;
|
||||
rec->mcde_back = Button(bar, "mcdeBack", "< Back", BackCB, rec);
|
||||
rec->mcde_forward = Button(bar, "mcdeForward", "Forward >", ForwardCB,
|
||||
rec);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
|
||||
XtSetArg(args[n], XmNradioBehavior, True); n++;
|
||||
XtSetArg(args[n], XmNradioAlwaysOne, True); n++;
|
||||
XtSetArg(args[n], XmNspacing, 0); n++;
|
||||
views_rc = XmCreateRowColumn(bar, "mcdeViews", args, n);
|
||||
for (i = 0; i < MCDE_NVIEWS; i++) {
|
||||
XmString s = XmStringCreateLocalized((char *)views[i].label);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNlabelString, s); n++;
|
||||
XtSetArg(args[n], XmNindicatorOn, False); n++;
|
||||
XtSetArg(args[n], XmNshadowThickness, 2); n++;
|
||||
XtSetArg(args[n], XmNtraversalOn, False); n++;
|
||||
rec->mcde_view[i] = XmCreateToggleButton(views_rc,
|
||||
"mcdeView", args, n);
|
||||
XmStringFree(s);
|
||||
XtAddCallback(rec->mcde_view[i], XmNvalueChangedCallback,
|
||||
ViewCB, rec);
|
||||
XtManageChild(rec->mcde_view[i]);
|
||||
}
|
||||
XtManageChild(views_rc);
|
||||
XtManageChild(bar);
|
||||
/* the form gives children without a size of their own what is left, and
|
||||
* that is nothing once dtfile sets the window to its saved size: the
|
||||
* toolbar keeps the height it asks for */
|
||||
{
|
||||
XtWidgetGeometry pref;
|
||||
|
||||
if (XtQueryGeometry(bar, NULL, &pref) != XtGeometryNo &&
|
||||
(pref.request_mode & CWHeight))
|
||||
XtVaSetValues(bar, XmNheight, pref.height, NULL);
|
||||
}
|
||||
UpdateButtons(rec);
|
||||
|
||||
/* the sidebar: the places */
|
||||
for (k = 0; k < NPLACES; k++)
|
||||
items[k] = XmStringCreateLocalized((char *)places[k].label);
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
|
||||
XtSetArg(args[n], XmNtopWidget, bar); n++;
|
||||
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
|
||||
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
|
||||
XtSetArg(args[n], XmNshadowType, XmSHADOW_IN); n++;
|
||||
XtSetArg(args[n], XmNwidth, SIDEBAR_WIDTH + 4); n++;
|
||||
frame = XmCreateFrame(form, "mcdeSidebarFrame", args, n);
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNitems, items); n++;
|
||||
XtSetArg(args[n], XmNitemCount, (int)NPLACES); n++;
|
||||
XtSetArg(args[n], XmNvisibleItemCount, (int)NPLACES); n++;
|
||||
XtSetArg(args[n], XmNselectionPolicy, XmBROWSE_SELECT); n++;
|
||||
XtSetArg(args[n], XmNwidth, SIDEBAR_WIDTH); n++;
|
||||
XtSetArg(args[n], XmNlistMarginWidth, 6); n++;
|
||||
XtSetArg(args[n], XmNlistMarginHeight, 6); n++;
|
||||
XtSetArg(args[n], XmNshadowThickness, 0); n++;
|
||||
rec->mcde_sidebar = XmCreateList(frame, "mcdeSidebar", args, n);
|
||||
for (k = 0; k < NPLACES; k++)
|
||||
XmStringFree(items[k]);
|
||||
XtAddCallback(rec->mcde_sidebar, XmNbrowseSelectionCallback, PlaceCB,
|
||||
rec);
|
||||
XtManageChild(rec->mcde_sidebar);
|
||||
XtManageChild(frame);
|
||||
rec->mcde_sidebar_frame = frame;
|
||||
|
||||
XtManageChild(form);
|
||||
return form;
|
||||
}
|
||||
|
||||
void
|
||||
_McdeNavAttachWork(FileMgrRec *rec, Widget work)
|
||||
{
|
||||
Arg args[6];
|
||||
int n = 0;
|
||||
|
||||
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
|
||||
XtSetArg(args[n], XmNtopWidget, rec->mcde_toolbar); n++;
|
||||
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
|
||||
XtSetArg(args[n], XmNleftWidget, rec->mcde_sidebar_frame); n++;
|
||||
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
|
||||
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
|
||||
XtSetValues(work, args, n);
|
||||
}
|
||||
|
||||
void
|
||||
_McdeNavVisit(FileMgrRec *rec, const char *dir)
|
||||
{
|
||||
FileMgrData *data;
|
||||
int i;
|
||||
|
||||
if (rec == NULL || rec->mcde_toolbar == NULL || dir == NULL)
|
||||
return;
|
||||
if (!rec->mcde_navigating) {
|
||||
if (rec->mcde_history_pos >= 0 &&
|
||||
strcmp(rec->mcde_history[rec->mcde_history_pos], dir) == 0)
|
||||
return;
|
||||
/* a new way: what was ahead of us is forgotten */
|
||||
for (i = rec->mcde_history_pos + 1; i < rec->mcde_history_len;
|
||||
i++)
|
||||
XtFree(rec->mcde_history[i]);
|
||||
rec->mcde_history_len = rec->mcde_history_pos + 1;
|
||||
rec->mcde_history = (char **)XtRealloc(
|
||||
(char *)rec->mcde_history,
|
||||
(Cardinal)((rec->mcde_history_len + 1) * sizeof(char *)));
|
||||
rec->mcde_history[rec->mcde_history_len++] = XtNewString(dir);
|
||||
rec->mcde_history_pos = rec->mcde_history_len - 1;
|
||||
}
|
||||
UpdateButtons(rec);
|
||||
|
||||
/* the view buttons follow the window's view */
|
||||
if ((data = DataOf(rec)) != NULL)
|
||||
for (i = 0; i < MCDE_NVIEWS; i++)
|
||||
XmToggleButtonSetState(rec->mcde_view[i],
|
||||
data->view == views[i].view, False);
|
||||
}
|
||||
|
||||
void
|
||||
_McdeNavFreeSpace(const char *dir, char *buf, size_t len)
|
||||
{
|
||||
struct statvfs sv;
|
||||
double bytes;
|
||||
size_t used = strlen(buf);
|
||||
|
||||
if (dir == NULL || statvfs(dir, &sv) != 0 || used + 1 >= len)
|
||||
return;
|
||||
bytes = (double)sv.f_bavail * (double)sv.f_frsize;
|
||||
if (bytes >= 1e9)
|
||||
(void)snprintf(buf + used, len - used, ", %.1f GB available",
|
||||
bytes / 1e9);
|
||||
else
|
||||
(void)snprintf(buf + used, len - used, ", %.0f MB available",
|
||||
bytes / 1e6);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Navigation.h -- MCDE: the navigation parts of the file manager window (Navigation.c)
|
||||
*
|
||||
* Copyright (c) 2026 The Makronix project. GNU LGPL 2.0 or later, as CDE.
|
||||
*/
|
||||
|
||||
#ifndef _Navigation_h
|
||||
#define _Navigation_h
|
||||
|
||||
/* the form that holds toolbar, sidebar and (after _McdeNavAttachWork) the
|
||||
* work area; it becomes the main window's work window */
|
||||
extern Widget _McdeNavCreate(FileMgrRec *rec, Widget parent);
|
||||
extern void _McdeNavAttachWork(FileMgrRec *rec, Widget work);
|
||||
/* called by ShowNewDirectory for every directory the window shows */
|
||||
extern void _McdeNavVisit(FileMgrRec *rec, const char *dir);
|
||||
/* appends ", 12.3 GB available" to the status text in buf */
|
||||
extern void _McdeNavFreeSpace(const char *dir, char *buf, size_t len);
|
||||
|
||||
#endif /* _Navigation_h */
|
||||
@@ -59,7 +59,7 @@ dtksh_SOURCES = init.c \
|
||||
msgs.c
|
||||
|
||||
ksh93/bin/ksh:
|
||||
ksh93/bin/package flat make CCFLAGS='$(KSH93_SHOPTS)'
|
||||
ksh93/bin/package flat make CCFLAGS='$(KSH93_SHOPTS) $(MCDE_DIALECT_CFLAGS)'
|
||||
|
||||
init.c: ksh93/bin/ksh
|
||||
$(CP) ksh93/src/cmd/ksh93/sh/init.c ./
|
||||
|
||||
@@ -6,8 +6,8 @@ XDMDIR = $(CDE_LOGFILES_TOP)
|
||||
XBINDIR = @X11BASE@/bin
|
||||
|
||||
DEF_SERVER = $(XBINDIR)/X
|
||||
DEF_USER_PATH = /bin:/usr/bin:@PREFIX@/bin:$(XBINDIR)
|
||||
DEF_SYSTEM_PATH = /bin:/usr/bin:@PREFIX@/bin:$(XBINDIR)
|
||||
DEF_USER_PATH = /bin:/usr/bin:$(MCDE_LOCAL_BINDIR):$(XBINDIR)
|
||||
DEF_SYSTEM_PATH = /bin:/usr/bin:$(MCDE_LOCAL_BINDIR):$(XBINDIR)
|
||||
|
||||
DEF_BM_PATH = $(CDE_CONFIGURATION_TOP)/appconfig/icons/%L/%B%M.bm:$(CDE_CONFIGURATION_TOP)/appconfig/icons/%L/%B%M.pm:$(CDE_CONFIGURATION_TOP)/appconfig/icons/%L/%B:$(CDE_CONFIGURATION_TOP)/appconfig/icons/C/%B%M.bm:$(CDE_CONFIGURATION_TOP)/appconfig/icons/C/%B%M.pm:$(CDE_CONFIGURATION_TOP)/appconfig/icons/C/%B:$(CDE_INSTALLATION_TOP)/appconfig/icons/%L/%B%M.bm:$(CDE_INSTALLATION_TOP)/appconfig/icons/%L/%B%M.pm:$(CDE_INSTALLATION_TOP)/appconfig/icons/%L/%B:$(CDE_INSTALLATION_TOP)/appconfig/icons/C/%B%M.bm:$(CDE_INSTALLATION_TOP)/appconfig/icons/C/%B%M.pm:$(CDE_INSTALLATION_TOP)/appconfig/icons/C/%B
|
||||
DEF_PM_PATH = $(CDE_CONFIGURATION_TOP)/appconfig/icons/%L/%B%M.pm:$(CDE_CONFIGURATION_TOP)/appconfig/icons/%L/%B%M.bm:$(CDE_CONFIGURATION_TOP)/appconfig/icons/%L/%B:$(CDE_CONFIGURATION_TOP)/appconfig/icons/C/%B%M.pm:$(CDE_CONFIGURATION_TOP)/appconfig/icons/C/%B%M.bm:$(CDE_CONFIGURATION_TOP)/appconfig/icons/C/%B:$(CDE_INSTALLATION_TOP)/appconfig/icons/%L/%B%M.pm:$(CDE_INSTALLATION_TOP)/appconfig/icons/%L/%B%M.bm:$(CDE_INSTALLATION_TOP)/appconfig/icons/%L/%B:$(CDE_INSTALLATION_TOP)/appconfig/icons/C/%B%M.pm:$(CDE_INSTALLATION_TOP)/appconfig/icons/C/%B%M.bm:$(CDE_INSTALLATION_TOP)/appconfig/icons/C/%B
|
||||
|
||||
@@ -19,11 +19,11 @@ if HAS_PAM_LIBRARY
|
||||
CPP_TARGETS += dtlogin
|
||||
dist_pam_DATA = dtlogin
|
||||
if FREEBSD
|
||||
pamdir = /usr/local/etc/pam.d
|
||||
pamdir = @MCDE_PAMDIR@
|
||||
PAM_AUTHENTICATION_MODULE = /usr/local/lib/security/pam_pwauth_suid.so
|
||||
AM_CPPFLAGS += -DPAM_AUTHENTICATION_MODULE=$(PAM_AUTHENTICATION_MODULE)
|
||||
else
|
||||
pamdir = /etc/pam.d
|
||||
pamdir = @MCDE_PAMDIR@
|
||||
if NETBSD
|
||||
PAM_AUTHENTICATION_MODULE = /usr/pkg/lib/security/pam_pwauth_suid.so
|
||||
AM_CPPFLAGS += -DPAM_AUTHENTICATION_MODULE=$(PAM_AUTHENTICATION_MODULE)
|
||||
|
||||
@@ -4,11 +4,11 @@ if HAS_PAM_LIBRARY
|
||||
CPP_TARGET = dtsession
|
||||
dist_pam_DATA = $(CPP_TARGET)
|
||||
if FREEBSD
|
||||
pamdir = /usr/local/etc/pam.d
|
||||
pamdir = @MCDE_PAMDIR@
|
||||
PAM_AUTHENTICATION_MODULE = /usr/local/lib/security/pam_pwauth_suid.so
|
||||
AM_CPPFLAGS = -DPAM_AUTHENTICATION_MODULE=$(PAM_AUTHENTICATION_MODULE)
|
||||
else
|
||||
pamdir = /etc/pam.d
|
||||
pamdir = @MCDE_PAMDIR@
|
||||
if NETBSD
|
||||
PAM_AUTHENTICATION_MODULE = /usr/pkg/lib/security/pam_pwauth_suid.so
|
||||
AM_CPPFLAGS = -DPAM_AUTHENTICATION_MODULE=$(PAM_AUTHENTICATION_MODULE)
|
||||
|
||||
Reference in new issue
Block a user