1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtwm: fixes to make it build

Removed PORT_NOFORK define in favor of autotools vfork availablility
checking. Use vfork if present.

Got rid of getenv/putenv definitions in favor of including correct
system headers.

Use FD_CLOEXEC in fcntl() call rather than hardcoded '1'.

Added -lm check to configure so dtwm will build.

Renamed internal round() function to wmround() to fix warning about
redefinition of builtin.

Fixed missing backslash in Makefile.am that prevented half the sources
from building.
This commit is contained in:
Jon Trulson 2019-10-30 12:17:32 -06:00
parent 9bc595a0a6
commit 619402b739
4 changed files with 42 additions and 35 deletions

View file

@ -145,7 +145,7 @@ static void SetSegment(
int y1,
int x2,
int y2) ;
static int round(
static int wmround(
double x) ;
static void DrawClockFace(
DtClockGadget g) ;
@ -535,13 +535,13 @@ DrawHand(
wc = width * cosangle;
ws = width * sinangle;
SetSegment (w,
x = w->clock.centerX + round (length * sinangle),
y = w->clock.centerY - round (length * cosangle),
x1 = w->clock.centerX - round (ws + wc),
y1 = w->clock.centerY + round (wc - ws)); /* 1 ---- 2 */
x = w->clock.centerX + wmround (length * sinangle),
y = w->clock.centerY - wmround (length * cosangle),
x1 = w->clock.centerX - wmround (ws + wc),
y1 = w->clock.centerY + wmround (wc - ws)); /* 1 ---- 2 */
SetSegment (w, x1, y1,
x2 = w->clock.centerX - round (ws - wc),
y2 = w->clock.centerY + round (wc + ws)); /* 2 ----- 3 */
x2 = w->clock.centerX - wmround (ws - wc),
y2 = w->clock.centerY + wmround (wc + ws)); /* 2 ----- 3 */
SetSegment (w, x2, y2, x, y); /* 3 ----- 1 (4) */
}
@ -572,7 +572,7 @@ SetSegment(
** round integer.
*/
static int
round(
wmround(
double x )
{
return (x >= 0.0 ? (int) (x + .5) : (int) (x - .5));

View file

@ -2,22 +2,20 @@ configdir = ${prefix}/config/C
bin_PROGRAMS = dtwm dtfplist
dist_config_DATA = sys.dtwmrc
dist_config_DATA = sys.dtwmrc Dtwm.defs
BUILT_SOURCES = sys.dtwmrc Dtwm.defs
AM_CPPFLAGS = -DLARGECURSORS -DR2_COMPAT -DOPAQUE -DSHAPE -DUNMAP_ON_RESTART \
-DBATCH_DRAG_REQUESTS -DCDE_INSTALLATION_TOP=\"${prefix}\" \
-DCDE_CONFIGURATION_TOP=\"$(CDE_CONFIGURATION_TOP)\" \
-I$(TIRPCINC)
$(TIRPCINC)
AM_LDADD = $(LIBXIN) -lXinerama $(LIBPRINT) $(LIBHELP) $(LIBWIDGET) \
$(LIBSVC) $(LIBTT) -lXm $(XTOOLLIB) ${X_LIBS}
dtwm_LDADD = @DTCLIENTLIBS@ $(TIRPCLIB) -lXm -lXext $(XTOOLLIB)
dtfplist_LDADD = @DTCLIENTLIBS@ $(TIRPCLIB) -lXm -lXext $(XTOOLLIB)
if SOLARIS
AM_LDADD += -lintl -lresolv
endif
if HPUX
AM_CFLAGS += -D_HPUX_SOURCE
dtwm_LDADD += -lintl -lresolv
dtfplist_LDADD += -lintl -lresolv
endif
dtwm_SOURCES = WmCDInfo.c WmCDecor.c WmCEvent.c \
@ -29,7 +27,7 @@ dtwm_SOURCES = WmCDInfo.c WmCDecor.c WmCEvent.c \
WmMenu.c WmProperty.c WmProtocol.c \
WmResCvt.c WmResParse.c WmResource.c \
WmSignal.c WmWinConf.c WmWinInfo.c \
WmWinList.c WmWinState.c WmMultiHead.c
WmWinList.c WmWinState.c WmMultiHead.c \
Button.c Callback.c Clock.c \
DataBaseLoad.c PanelS.c Parse.c \
PopupMenu.c Session.c UI.c \
@ -43,10 +41,12 @@ dtfplist_SOURCES = Print.c Parse.c DataBaseLoad.c WmParse.c Session.c
SCRIPTFLAGS = -DCDE_INSTALLATION_TOP=${prefix} \
-DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP)
CPPSRC = Dtwm.defs.src
CPPTARGET = Dtwm.defs
include $(srcdir)/include/cppfile.tmpl
Dtwm.defs: Dtwm.defs.src
$(RM) $@
$(CPP) -P -DXCOMM=# $(AM_CPPFLAGS) - < $< > $@
CPPSRC = sys.dtwmrc.src
CPPTARGET = sys.dtwmrc
include $(srcdir)/include/cppfile.tmpl
sys.dtwmrc: sys.dtwmrc.src
$(RM) $@
$(CPP) -P -DXCOMM=# $(AM_CPPFLAGS) - < $< > $@

View file

@ -44,9 +44,6 @@ header file include flags, and macros (e.g. ABS).
OLD_CODE
Vestigal code.
PORT_NOVFORK
Enable for systems that don't have the vfork() call.
R2_COMPAT
Enables support for old clients that still pass window geometry
hint information in WM_NORMAL_HINTS.

View file

@ -81,19 +81,29 @@
#include <Xm/RowColumnP.h> /* for MS_LastManagedMenuTime */
extern XmMenuState _XmGetMenuState();
extern int putenv ();
extern char * getenv ();
#ifndef PORT_NOVFORK
extern pid_t vfork();
#endif /* PORT_NOVFORK */
#if defined(HAVE_CONFIG_H)
#include <autotools_config.h>
#endif
#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
#include <unistd.h>
#include <stdlib.h>
#if defined(HAVE_VFORK) && defined(HAVE_VFORK_H)
#include <vfork.h>
#endif
static unsigned int GetEventInverseMask(XEvent *event);
#if (defined(__linux__) || defined(sun) || defined(CSRG_BASED)) && !defined(_NFILE)
#define _NFILE FOPEN_MAX
#endif
#define CLOSE_FILES_ON_EXEC() \
{int ifx; for (ifx=3; ifx < _NFILE; ifx++) (void) fcntl (ifx, F_SETFD, 1);}
{int ifx; for (ifx=3; ifx < _NFILE; ifx++) (void) fcntl (ifx, F_SETFD, FD_CLOEXEC);}
/*
* Global Variables:
@ -948,10 +958,10 @@ Boolean F_Exec (String args, ClientData *pCD, XEvent *event)
* Fork a process to exec a shell to run the specified command:
*/
#ifdef PORT_NOVFORK
if ((pid = fork ()) == 0)
#else
#if defined(HAVE_VFORK)
if ((pid = vfork ()) == 0)
#else
if ((pid = fork ()) == 0)
#endif
{