diff options
author | Tim Wiederhake <twied@gmx.net> | 2024-03-03 12:55:11 +0100 |
---|---|---|
committer | Thomas E. Dickey <dickey@his.com> | 2024-03-07 00:42:09 +0000 |
commit | 451e1b036d3dd0fddcf54733b5616169ed5ad570 (patch) | |
tree | 91411707fa9b1393f8f676000617d70454797af8 | |
parent | b603079e08f085a6b23f2fdf3f7eef9ccec86424 (diff) |
Provide defaults for externally defined symbols
AM_CPPFLAGS defines several symbols that do not have to be there. By providing
default values in twm.h, this list can be reduced in size while still allowing
to override these values.
Signed-off-by: Tim Wiederhake <twied@gmx.net>
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/menus.c | 4 | ||||
-rw-r--r-- | src/parse.c | 5 | ||||
-rw-r--r-- | src/twm.c | 2 | ||||
-rw-r--r-- | src/twm.h | 20 |
5 files changed, 25 insertions, 12 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index bb45b53..96fa621 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,12 +28,8 @@ rcdir = ${datadir}/X11/twm dist_rc_DATA = system.twmrc AM_CPPFLAGS = \ - -DAPP_NAME=\"twm\" \ - -DAPP_CLASS=\"twm\" \ -DAPP_VERSION=\"$(VERSION)\" \ - -DXVENDORNAME=\"The\ X.Org\ Foundation\" \ - -DXORG_RELEASE=\"Release\ $(VERSION)\" \ - -DSYSTEM_INIT_FILE=\"${rcdir}/system.twmrc\" + -DDATADIR=\"${datadir}\" AM_CFLAGS = $(TWM_CFLAGS) $(XRANDR_CFLAGS) $(CWARNFLAGS) twm_LDADD = $(TWM_LIBS) $(XRANDR_LIBS) diff --git a/src/menus.c b/src/menus.c index 9b4ecd3..41f5bad 100644 --- a/src/menus.c +++ b/src/menus.c @@ -2529,8 +2529,8 @@ Identify(TwmWindow *t) Window wdummy = None; n = 0; - snprintf(Info[n++], INFO_SIZE, "Twm version: %s, %s", - XVENDORNAME, XORG_RELEASE); + snprintf(Info[n++], INFO_SIZE, "Twm version: %s, Release %s", + XVENDORNAME, APP_VERSION); Info[n++][0] = '\0'; if (t) { diff --git a/src/parse.c b/src/parse.c index c659e53..c841489 100644 --- a/src/parse.c +++ b/src/parse.c @@ -71,9 +71,6 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xatom.h> #include <X11/extensions/sync.h> -#ifndef SYSTEM_INIT_FILE -#define SYSTEM_INIT_FILE "/usr/lib/X11/twm/system.twmrc" -#endif #define BUF_LEN 300 static FILE *twmrc; @@ -200,7 +197,7 @@ ParseTwmrc(char *filename) break; case 3: /* system.twmrc */ - cp = SYSTEM_INIT_FILE; + cp = DATADIR "/X11/twm/system.twmrc"; break; } @@ -316,7 +316,7 @@ main(int argc, char *argv[]) si = XtAppAddSignal(appContext, Done, NULL); - if (!(dpy = XtOpenDisplay(appContext, display_name, "twm", "twm", + if (!(dpy = XtOpenDisplay(appContext, display_name, APP_NAME, APP_CLASS, NULL, 0, &zero, NULL))) { twmError("unable to open display \"%s\"", XDisplayName(display_name)); } @@ -74,6 +74,26 @@ from The Open Group. #include <X11/StringDefs.h> #include <X11/Intrinsic.h> +#ifndef APP_NAME +#define APP_NAME "twm" +#endif + +#ifndef APP_CLASS +#define APP_CLASS "twm" +#endif + +#ifndef APP_VERSION +#define APP_VERSION "unknown" +#endif + +#ifndef DATADIR +#define DATADIR "/usr/local/share" +#endif + +#ifndef XVENDORNAME +#define XVENDORNAME "The X.Org Foundation" +#endif + #ifndef WithdrawnState #define WithdrawnState 0 #endif |