pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wm/ctwm without cmake



Hello!

Thanks for this. I also would like to share my patch for ctwm. This
patch allows you to list applications that should ignore ResizeHint.
for example:
NoResizeHint {
    "XTerm"
}

will remove gaps around the edges when xterm is maximized

On Wed, Mar 9, 2022 at 7:47 AM Greg A. Woods <woods%planix.ca@localhost> wrote:
>
> I've sworn to never ever use CMake, nor to allow it to exist on my
> machines, nor even to be used in my presence.
>
> However I really like ctwm, and in fact I use every day on my main
> desktop machine which is a macOS box, and since I'm now also using
> pkgsrc to build everything on macOS just like I do on NetBSD, and since
> the "minibuild" stuff that comes with the new ctwm release is garbage
> (and because I also really like BSD Makefiles), I've written the
> following.
>
> In case anyone is interested.
>
> First the following Makefile replaces wm/ctwm/Makefile, then below is a
> new Makefile to be put into wm/ctwm/files/Makefile:
>
> Probably the second file could also mostly be used to allow an update of
> the version of CTWM in /usr/src/etxternal/mit/ctwm/bin/ctwm/Makefile too.
>
> ================
> # $NetBSD: Makefile,v 1.39 2019/11/04 21:50:15 rillig Exp $
> #
>
> DISTNAME=       ctwm-4.0.3
> CATEGORIES=     x11 wm
> MASTER_SITES=   http://ctwm.org/dist/
> EXTRACT_SUFX=   .tar.xz
>
> MAINTAINER=     rhialto%NetBSD.org@localhost
> HOMEPAGE=       http://ctwm.org/
> COMMENT=        Window manager with support for multiple virtual screens and EWMH
> LICENSE=        mit
>
> USE_LANGUAGES=          c
> USE_BSD_MAKEFILE=       yes
> BSD_MAKE_BUILD_DIR=     ${WRKDIR}/pkgbuild
> MAKE_ENV+=              MAKEOBJDIRPREFIX=${BSD_MAKE_BUILD_DIR}
>
> DEPENDS+=               asciidoc-[0-9]*:../../textproc/asciidoc
> DEPENDS+=               xmlto-[0-9]*:../../textproc/xmlto
>
> .include "../../mk/bsd.prefs.mk"
>
> # We need an m4 that understands the -s option.
> .if !empty(TOOLS_PLATFORM.m4)
> .  if !empty(:!${ECHO} yes | ${TOOLS_PLATFORM.m4} -s 2>/dev/null||${ECHO}!)
> TOOLS_PLATFORM.gm4?=    ${TOOLS_PLATFORM.m4}
> .  endif
> .endif
> USE_TOOLS+=             gm4:run
> MAKE_FLAGS+=            M4=${TOOLS_PLATFORM.gm4}
>
> CFLAGS.SunOS+=          -D__EXTENSIONS__
>
> AUTO_MKDIRS=            yes
>
> # totally automatic PLIST generation -- probably preferable?
> #
> #GENERATE_PLIST=        cd ${DESTDIR}${PREFIX}; \
> #               ${FIND} * \( -type f -or -type l \) | ${SORT};
> #
> GENERATE_PLIST+=        cd ${DESTDIR}${PREFIX} && \
>                 ${FIND} share/ctwm/images \( -type f -or -type l \) | ${SORT};
>
> post-extract:
>         ${CP} ${FILESDIR}/Makefile ${WRKSRC}/
>
> do-configure:
>         ${MKDIR} ${BSD_MAKE_BUILD_DIR}
>
> # xxx this should be automatic in do-build if USE_BSD_MAKEFILE!
> #
> # xxx otherwise this would be nice, but .WAIT doesn't work on the command line
> #
> #BUILD_TARGET=          obj .WAIT all
> #
> pre-build:
>         cd ${WRKSRC} && ${BUILD_MAKE_CMD} obj
>
> post-install:
> .for f in CHANGES.md README.md
>         ${INSTALL_DATA} ${WRKSRC}/${f} ${DESTDIR}${PREFIX}/share/doc/ctwm/
> .endfor
> .for f in system.ctwmrc
>         ${INSTALL_DATA} ${WRKSRC}/${f} ${DESTDIR}${PREFIX}/share/examples/ctwm/
> .endfor
> .for f in example.ctwmrc levitte.ctwmrc peterc.ctwmrc
>         ${INSTALL_DATA} ${WRKSRC}/examples/${f} \
>             ${DESTDIR}${PREFIX}/share/examples/ctwm/
> .endfor
>         ${INSTALL_DATA} ${FILESDIR}/ctwm.desktop \
>             ${DESTDIR}${PREFIX}/share/xsessions/ctwm.desktop
>
> .include "../../mk/jpeg.buildlink3.mk"
> .include "../../x11/libXext/buildlink3.mk"
> .include "../../x11/libXmu/buildlink3.mk"
> .include "../../x11/libXpm/buildlink3.mk"
> .include "../../mk/bsd.pkg.mk"
> ================
>
> ================
> #       $NetBSD$
>
> .include <bsd.own.mk>
>
> PROG=   ctwm
>
> SRCS+=  add_window.c
> SRCS+=  animate.c
> SRCS+=  captive.c
> SRCS+=  clargs.c
> SRCS+=  clicktofocus.c
> SRCS+=  colormaps.c
> SRCS+=  ctopts.c
> SRCS+=  ctwm_main.c
> #SRCS+= ctwm_shutdown.c                 # xxx next release?
> #SRCS+= ctwm_takeover.c                 # xxx next release?
> SRCS+=  ctwm_wrap.c
> SRCS+=  cursor.c
> SRCS+=  drawing.c
> SRCS+=  event_core.c
> SRCS+=  event_handlers.c
> SRCS+=  event_names.c
> SRCS+=  event_utils.c
> SRCS+=  ewmh.c
> SRCS+=  ewmh_atoms.c
> SRCS+=  functions.c
> SRCS+=  functions_captive.c
> SRCS+=  functions_icmgr_wsmgr.c
> SRCS+=  functions_identify.c
> SRCS+=  functions_misc.c
> SRCS+=  functions_warp.c
> SRCS+=  functions_win.c
> SRCS+=  functions_win_moveresize.c
> SRCS+=  functions_workspaces.c
> SRCS+=  gc.c
> SRCS+=  iconmgr.c
> SRCS+=  icons.c
> SRCS+=  icons_builtin.c
> SRCS+=  image.c
> SRCS+=  image_bitmap.c
> SRCS+=  image_bitmap_builtin.c
> SRCS+=  image_jpeg.c
> SRCS+=  image_xpm.c
> SRCS+=  image_xwd.c
> SRCS+=  list.c
> SRCS+=  mask_screen.c
> SRCS+=  menus.c
> SRCS+=  mwmhints.c
> SRCS+=  occupation.c
> SRCS+=  otp.c
> SRCS+=  parse.c
> SRCS+=  parse_be.c
> SRCS+=  parse_m4.c
> SRCS+=  parse_yacc.c
> #SRCS+= r_area.c                        # xxx next release?
> #SRCS+= r_area_list.c                   # xxx next release?
> #SRCS+= r_layout.c                      # xxx next release?
> SRCS+=  session.c
> #SRCS+= signals.c                       # xxx next release?
> SRCS+=  util.c
> SRCS+=  vscreen.c
> SRCS+=  win_decorations.c
> SRCS+=  win_decorations_init.c
> SRCS+=  win_iconify.c
> SRCS+=  win_ops.c
> SRCS+=  win_regions.c
> SRCS+=  win_resize.c
> #SRCS+= win_ring.c                      # xxx next release?
> SRCS+=  win_utils.c
> SRCS+=  windowbox.c
> SRCS+=  workspace_config.c
> SRCS+=  workspace_manager.c
> SRCS+=  workspace_utils.c
> #SRCS+= xparsegeometry.c                # xxx next release?
> #SRCS+= xrandr.c                        # xxx next release?
>
> # special sources
> SRCS+=  gram.y
> SRCS+=  lex.l
>
> # External libs (note these are in ext/$>.c)
> #
> SRCS+=  repl_str.c
>
> # Generated files
> #
> SRCS+=  ctwm_atoms.c
> SRCS+=  deftwmrc.c
> SRCS+=  version.c
>
> PREFIX?=        /usr
>
> XPMDIR=         ${PREFIX}/share/ctwm/images
>
> # xxx mimic pkgsrc to support systems without <bsd.x11.mk> (which currently
> # include non-NetBSD pkgsrc platforms using bootstrap-mk-files!)
> #
> PKG_SYSCONFSUBDIR?=     X11/ctwm
> PKG_SYSCONFBASEDIR?=    /etc
> PKG_SYSCONFDIR?=        ${PKG_SYSCONFBASEDIR}/${PKG_SYSCONFSUBDIR}
>
> X11ETCDIR?=     ${PKG_SYSCONFBASEDIR}/X11
> CTWMCONFIGDIR=  ${X11ETCDIR}/ctwm
>
> # xxx CONFIGFILES is not (yet) supported by pkgsrc bootstrap-mk-files
> # (note CONFIGFILES still uses ${FILESDIR_${F}:U${FILESDIR}} for dest)
> #
> FILES+=                 system.ctwmrc
> FILESDIR_system.ctwmrc= ${CTWMCONFIGDIR}
>
> .if empty(CPPFLAGS:M*-I.*)
> CPPFLAGS+=      -I.
> .endif
> CPPFLAGS+=      -I${.CURDIR} -I${.CURDIR}/ext
>
> CPPFLAGS+=      -DPIXMAP_DIRECTORY=\"${XPMDIR}\"
>
> CPPFLAGS+=      -DSYSTEM_INIT_FILE=\"${CTWMCONFIGDIR}/system.ctwmrc\"
>
> CPPFLAGS+=      -DEWMH
> CPPFLAGS+=      -DJPEG
> CPPFLAGS+=      -DUSE_SYS_REGEX
> CPPFLAGS+=      -DXPM
> #CPPFLAGS+=     -DXRANDR        # xxx next release?
>
> CPPFLAGS+=      -DUSEM4
> CPPFLAGS+=      -DM4CMD=\"${M4:Um4}\"
>
> # NetBSD make has a wee hack which allows one to include a sub-directory
> # pathname part in the source file given in SRCS and have the object file be
> # created in that same subdir.  However this is not portable and so to avoid
> # complication we'll just copy the source from its subdir and build from that.
> #
> repl_str.c: ${.CURDIR}/ext/repl_str.c
>         cp ${.CURDIR}/ext/repl_str.c $@
>
> YHEADER=1
>
> # xxx this is stupid, but avoids patching a bunch of files with:
> #
> #       s/gram.tab.h/gram.h/
> #
> gram.tab.h: Makefile
>         ln -fs gram.h $@
> ydeps+= add_window.o
> ydeps+= ctwm_main.o
> ydeps+= drawing.o
> ydeps+= event_handlers.o
> ydeps+= gc.o
> ydeps+= iconmgr.o
> ydeps+= mask_screen.o
> ydeps+= menus.o
> ydeps+= parse_be.o
> ydeps+= parse_yacc.o
> ydeps+= util.o
> ydeps+= win_decorations.o
> ydeps+= workspace_manager.o
> ${ydeps}: gram.tab.h
>
> # xxx this is also stupid, but avoids patching a bunch of files to remove it
> #
> ctwm_config.h: Makefile
>         rm -f ctwm_config.h
>         touch ctwm_config.h
>
> ${SRCS:R:S/$/.o/g}: ctwm_config.h
>
> ctwm_atoms.c: ctwm_atoms.in # tools/mk_atoms.sh
>         ${SHELL} ${.CURDIR}/tools/mk_atoms.sh ${.CURDIR}/ctwm_atoms.in ctwm_atoms CTWM
>
> ctwm_atoms.h: ctwm_atoms.c
>
> add_window.o: ctwm_atoms.h
> animate.o: ctwm_atoms.h
> captive.o: ctwm_atoms.h
> ctwm_main.o: ctwm_atoms.h
> event_handlers.o: ctwm_atoms.h
> ewmh.o: ctwm_atoms.h
> functions_win.o: ctwm_atoms.h
> mwmhints.o: ctwm_atoms.h
> occupation.o: ctwm_atoms.h
> otp.o: ctwm_atoms.h
> parse.o: ctwm_atoms.h
> parse_be.o: ctwm_atoms.h
> session.o: ctwm_atoms.h
> vscreen.o: ctwm_atoms.h
> win_utils.o: ctwm_atoms.h
> workspace_manager.o: ctwm_atoms.h
> workspace_utils.o: ctwm_atoms.h
>
> ewmh_atoms.c: ewmh_atoms.in # tools/mk_atoms.sh
>         ${SHELL} ${.CURDIR}/tools/mk_atoms.sh ${.CURDIR}/ewmh_atoms.in ewmh_atoms EWMH
>
> ewmh_atoms.h: ewmh_atoms.c
>
> add_window.o: ewmh_atoms.h
> ewmh.o: ewmh_atoms.h
> win_utils.o: ewmh_atoms.h
> workspace_utils.o: ewmh_atoms.h
>
> deftwmrc.c: system.ctwmrc # tools/mk_deftwmrc.sh
>         ${SHELL} ${.CURDIR}/tools/mk_deftwmrc.sh ${.CURDIR}/system.ctwmrc > deftwmrc.c
>
> event_names_table.h: event_names.list # tools/mk_event_names.sh
>         ${SHELL} ${.CURDIR}/tools/mk_event_names.sh ${.CURDIR}/event_names.list > $@
>
> event_names.o: event_names_table.h
>
> functions_defs.h: functions_defs.list # tools/mk_function_bits.sh
>         ${SHELL} ${.CURDIR}/tools/mk_function_bits.sh ${.CURDIR}/functions_defs.list ${.OBJDIR}
>
> functions_deferral.h functions_parse_table.h functions_dispatch_execution.h: functions_defs.h
>
> event_handlers.o: functions_defs.h
> ewmh.o: functions_defs.h
> functions.o: functions_defs.h
> functions.o: functions_deferral.h
> functions_misc.o: functions_defs.h
> functions_win.o: functions_defs.h
> functions_win_moveresize.o: functions_defs.h
> gram.o: functions_defs.h
> iconmgr.o: functions_defs.h
> lex.o: functions_defs.h
> menus.o: functions_defs.h
> parse_be.o: functions_defs.h
> parse_yacc.o: functions_defs.h
> win_decorations_init.o: functions_defs.h
> win_resize.o: functions_defs.h
>
> functions.o: functions_deferral.h
>
> functions.o: functions_dispatch_execution.h
>
> functions.o: functions_internal.h
> functions_captive.o: functions_internal.h
> functions_icmgr_wsmgr.o: functions_internal.h
> functions_identify.o: functions_internal.h
> functions_misc.o: functions_internal.h
> functions_warp.o: functions_internal.h
> functions_win.o: functions_internal.h
> functions_win_moveresize.o: functions_internal.h
> functions_workspaces.o: functions_internal.h
>
> parse_be.o: functions_parse_table.h
>
> # assume this is building a release with a pre-generated version.c.in
> #
> version.c: version.c.in VERSION # tools/mk_version_in.sh
>         ${SHELL} ${.CURDIR}/tools/mk_version_in.sh ${.CURDIR}/version.c.in |    \
>                 sed -e 's/%%VCSTYPE%%/NULL/'                                    \
>                     -e 's/%%REVISION%%/NULL/' > $@
>
> LDADD+= -ljpeg
> DPADD+= ${LIBJPEG}
>
> LDADD+= -lXpm -lXmu -lXt -lSM -lICE -lXext -lX11 -lxcb -lXau -lXdmcp
> DPADD+= ${LIBXPM} ${LIBXMU} ${LIBXT} ${LIBSM} ${LIBICE} ${LIBXEXT} ${LIBX11} ${LIBXCB} ${LIBXAU} ${LIBXDMCP}
>
> FILESDIR= ${XPMDIR}
>
> #xxx# FILES!= cd ${.CURDIR}/xpm && echo *.xpm
>
> FILES+= 3D_Expand15.xpm
> FILES+= 3D_Iconify15.xpm
> FILES+= 3D_Lightning15.xpm
> FILES+= 3D_Menu15.xpm
> FILES+= 3D_Resize15.xpm
> FILES+= 3D_Zoom15.xpm
> FILES+= 3dcircle.xpm
> FILES+= 3ddimple.xpm
> FILES+= 3ddot.xpm
> FILES+= 3dfeet.xpm
> FILES+= 3dleopard.xpm
> FILES+= 3dpie.xpm
> FILES+= 3dpyramid.xpm
> FILES+= 3dslant.xpm
> FILES+= IslandD.xpm
> FILES+= IslandW.xpm
> FILES+= LRom.xpm
> FILES+= LRom1.xpm
> FILES+= arthur.xpm
> FILES+= audio_editor.xpm
> FILES+= background1.xpm
> FILES+= background2.xpm
> FILES+= background3.xpm
> FILES+= background4.xpm
> FILES+= background5.xpm
> FILES+= background6.xpm
> FILES+= background7.xpm
> FILES+= background8.xpm
> FILES+= background9.xpm
> FILES+= ball1.xpm
> FILES+= ball10.xpm
> FILES+= ball11.xpm
> FILES+= ball12.xpm
> FILES+= ball2.xpm
> FILES+= ball3.xpm
> FILES+= ball4.xpm
> FILES+= ball5.xpm
> FILES+= ball6.xpm
> FILES+= ball7.xpm
> FILES+= ball8.xpm
> FILES+= ball9.xpm
> FILES+= cdrom1.xpm
> FILES+= claude.xpm
> FILES+= clipboard.xpm
> FILES+= datebook.xpm
> FILES+= emacs.xpm
> FILES+= ghostview.xpm
> FILES+= hpterm.xpm
> FILES+= mail0.xpm
> FILES+= mail1.xpm
> FILES+= nothing.xpm
> FILES+= nt1.xpm
> FILES+= nt2.xpm
> FILES+= pixmap.xpm
> FILES+= postit.xpm
> FILES+= skull.xpm
> FILES+= spider.xpm
> FILES+= supman1.xbm
> FILES+= supman2.xbm
> FILES+= supman3.xbm
> FILES+= supman4.xbm
> FILES+= supman5.xbm
> FILES+= supman6.xbm
> FILES+= supman7.xbm
> FILES+= supman8.xbm
> FILES+= supman9.xbm
> FILES+= term.xpm
> FILES+= unknown.xpm
> FILES+= unknown1.xpm
> FILES+= unread.xpm
> FILES+= welcome.xpm
> FILES+= welcome.xwd
> FILES+= xarchie.xpm
> FILES+= xcalc.xpm
> FILES+= xcalc2.xpm
> FILES+= xedit.xpm
> FILES+= xftp.xpm
> FILES+= xgopher.xpm
> FILES+= xgrab.xpm
> FILES+= xhpcalc.xpm
> FILES+= xirc.xpm
> FILES+= xmail.xpm
> FILES+= xman.xpm
> FILES+= xmosaic.xpm
> FILES+= xnomail.xpm
> FILES+= xrn-compose.xpm
> FILES+= xrn.goodnews.xpm
> FILES+= xrn.nonews.xpm
> FILES+= xrn.xpm
> FILES+= xterm.xpm
>
> .PATH:  ${.CURDIR}/xpm
>
> ctwm.1: ctwm.1.docbook
>         xmlto --skip-validation man ctwm.1.docbook
>
> CTWM_VERSION!=  cat ${.CURDIR}/VERSION
>
> ctwm.1.docbook: doc/manual/ctwm.1.adoc VERSION # tools/mk_version_in.sh
>         sed -e 's|@ETCDIR@|${CTWMCONFIGDIR}|'           \
>             -e 's|@ctwm_version_str@|${CTWM_VERSION}|'  \
>                 < ${.CURDIR}/doc/manual/ctwm.1.adoc |   \
>                 asciidoc -d manpage -b docbook -o $@ -
>
> .include <bsd.files.mk>
> .-include <bsd.x11.mk>
> .include <bsd.prog.mk>
> ================
>
>
> --
>                                         Greg A. Woods <gwoods%acm.org@localhost>
>
> Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
> Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>
diff --git a/gram.y b/gram.y
index 5b7293ed..abeec406 100644
--- a/gram.y
+++ b/gram.y
@@ -71,7 +71,7 @@ int yylex(void);
 %token <num> ICONMGR_GEOMETRY ICONMGR_NOSHOW MAKE_TITLE
 %token <num> ICONIFY_BY_UNMAPPING DONT_ICONIFY_BY_UNMAPPING
 %token <num> AUTO_POPUP
-%token <num> NO_BORDER NO_ICON_TITLE NO_TITLE AUTO_RAISE NO_HILITE ICON_REGION
+%token <num> NO_BORDER NO_RESIZEHINT NO_ICON_TITLE NO_TITLE AUTO_RAISE NO_HILITE ICON_REGION
 %token <num> WINDOW_REGION META SHIFT LOCK CONTROL WINDOW TITLE ICON ROOT FRAME
 %token <num> COLON EQUALS SQUEEZE_TITLE DONT_SQUEEZE_TITLE
 %token <num> WARP_ON_DEICONIFY
@@ -316,6 +316,8 @@ stmt		: error
 						Scr->StackMode = false; }
 		| NO_BORDER		{ curplist = &Scr->NoBorder; }
 		  win_list
+		| NO_RESIZEHINT { curplist = &Scr->NoResizeHint; }
+		  win_list
 		| AUTO_POPUP		{ Scr->AutoPopup = true; }
 		| AUTO_POPUP		{ curplist = &Scr->AutoPopupL; }
 		  win_list
diff --git a/parse_be.c b/parse_be.c
index ee9fef0b..fc71d705 100644
--- a/parse_be.c
+++ b/parse_be.c
@@ -370,6 +370,7 @@ static const TwmKeyword keytable[] = {
 	{ "noraiseonmove",          KEYWORD, kw0_NoRaiseOnMove },
 	{ "noraiseonresize",        KEYWORD, kw0_NoRaiseOnResize },
 	{ "noraiseonwarp",          KEYWORD, kw0_NoRaiseOnWarp },
+	{ "noresizehint",           NO_RESIZEHINT, 0 },
 	{ "norestartpreviousstate", KEYWORD, kw0_NoRestartPreviousState },
 	{ "north",                  GRAVITY, GRAV_NORTH },
 	{ "nosaveunders",           KEYWORD, kw0_NoSaveUnders },
diff --git a/screen.h b/screen.h
index a3ce43c4..dd335370 100644
--- a/screen.h
+++ b/screen.h
@@ -572,6 +572,9 @@ struct ScreenInfo {
 	/// NoBorder config var.  Windows without borders.
 	name_list *NoBorder;
 
+	/// NoResizeHint config var.  Windows to ignore resize increment hints.
+	name_list *NoResizeHint;
+
 	/// NoIconTitle config var (list).  Windows to not show a title on
 	/// the icons for.  \sa ScreenInfo.NoIconTitlebar
 	name_list *NoIconTitle;
diff --git a/win_utils.c b/win_utils.c
index f48aa2bf..2b13b521 100644
--- a/win_utils.c
+++ b/win_utils.c
@@ -96,6 +96,10 @@ GetWindowSizeHints(TwmWindow *tmp)
 			}
 		}
 	}
+
+    if(LookInListWin(Scr->NoResizeHint, tmp)) {
+        hints->flags &= ~(PResizeInc);
+    }
 }
 
 


Home | Main Index | Thread Index | Old Index