From: Jon Trulson Date: Wed, 30 Oct 2019 18:17:32 +0000 (-0600) Subject: dtwm: fixes to make it build X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=619402b739259c20c85290ff4d72a392a2ad2ed8;p=oweals%2Fcde.git 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. --- diff --git a/cde/programs/dtwm/Clock.c b/cde/programs/dtwm/Clock.c index 5dc7785d..d653bea7 100644 --- a/cde/programs/dtwm/Clock.c +++ b/cde/programs/dtwm/Clock.c @@ -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)); diff --git a/cde/programs/dtwm/Makefile.am b/cde/programs/dtwm/Makefile.am index 675a1449..3c6ca1db 100644 --- a/cde/programs/dtwm/Makefile.am +++ b/cde/programs/dtwm/Makefile.am @@ -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) - < $< > $@ + diff --git a/cde/programs/dtwm/README b/cde/programs/dtwm/README index 8c0b66db..2b50a9da 100644 --- a/cde/programs/dtwm/README +++ b/cde/programs/dtwm/README @@ -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. diff --git a/cde/programs/dtwm/WmFunction.c b/cde/programs/dtwm/WmFunction.c index 4ab4446e..3f52e2c3 100644 --- a/cde/programs/dtwm/WmFunction.c +++ b/cde/programs/dtwm/WmFunction.c @@ -81,19 +81,29 @@ #include /* 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 +#endif + +#if defined(HAVE_SYS_TYPES_H) +#include +#endif + +#include +#include + +#if defined(HAVE_VFORK) && defined(HAVE_VFORK_H) +#include +#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 {