Index: head/x11-wm/tvtwm/Makefile =================================================================== --- head/x11-wm/tvtwm/Makefile (revision 404721) +++ head/x11-wm/tvtwm/Makefile (revision 404722) @@ -1,26 +1,28 @@ # Created by: gpalmer # $FreeBSD$ PORTNAME= tvtwm PORTVERSION= pl11 PORTREVISION= 1 CATEGORIES= x11-wm MASTER_SITES= XCONTRIB/window_managers DISTNAME= ${PORTNAME}.${PORTVERSION} MAINTAINER= ports@FreeBSD.org COMMENT= Twm with a virtual desktop +LICENSE= MIT + WRKSRC= ${WRKDIR}/tvtwm USES= imake USE_XORG= xbitmaps xpm xmu PLIST_FILES= bin/tvtwm \ man/man1/tvtwm.1.gz CFLAGS+= -Wno-return-type do-install: ${INSTALL_PROGRAM} ${WRKSRC}/tvtwm ${STAGEDIR}${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/tvtwm.man ${STAGEDIR}${MANPREFIX}/man/man1/tvtwm.1 .include Index: head/x11-wm/tvtwm/files/patch-Imakefile =================================================================== --- head/x11-wm/tvtwm/files/patch-Imakefile (revision 404721) +++ head/x11-wm/tvtwm/files/patch-Imakefile (revision 404722) @@ -1,59 +1,33 @@ -*** Imakefile.orig Thu Feb 2 18:25:44 1995 ---- Imakefile Sun May 30 11:42:08 1999 -*************** -*** 25,31 **** - XCOMM will define yylineno. If you get an "Undefined symbol: _yylineno" - XCOMM when linking, adjust this to work on your system. - -! #if defined(i386BsdArchitecture) || defined(LinuxArchitecture) - # ifdef LexCmd - LEX = LexCmd -l - # else ---- 25,31 ---- - XCOMM will define yylineno. If you get an "Undefined symbol: _yylineno" - XCOMM when linking, adjust this to work on your system. - -! #if defined(FreeBSDArchitecture) || defined(LinuxArchitecture) - # ifdef LexCmd - LEX = LexCmd -l - # else -*************** -*** 100,106 **** - SpecialObjectRule(LocPixmap.o,NullParameter,'-DBITMAPDIR="$(INCDIR)/bitmaps"') - SpecialObjectRule(twm.o,NullParameter,$(TWM_DEFS)) - -! #if defined(UltrixArchitecture) || defined(AlphaArchitecture) - SpecialObjectRule(menus.o,NullParameter,-Olimit 700) - #endif - ---- 100,106 ---- - SpecialObjectRule(LocPixmap.o,NullParameter,'-DBITMAPDIR="$(INCDIR)/bitmaps"') - SpecialObjectRule(twm.o,NullParameter,$(TWM_DEFS)) - -! #if !defined(FreeBSDArchitecture) && (defined(UltrixArchitecture) || defined(AlphaArchitecture)) - SpecialObjectRule(menus.o,NullParameter,-Olimit 700) - #endif - -*************** -*** 120,129 **** - XCOMM ln $(BINDIR)/tvtwm $(BINDIR)/twm - - #if (ProjectX < 5) -! InstallNonExec(system.twmrc,$(TWMDIR)) - /* InstallProgram(ssetroot,$(BINDIR)/xsetroot) */ - #else -! InstallNonExecFile(system.twmrc,$(TWMDIR)) - /* InstallNamedProg(ssetroot,xsetroot,$(BINDIR)) */ - #endif - ---- 120,129 ---- - XCOMM ln $(BINDIR)/tvtwm $(BINDIR)/twm - - #if (ProjectX < 5) -! /* InstallNonExec(system.twmrc,$(TWMDIR))*/ - /* InstallProgram(ssetroot,$(BINDIR)/xsetroot) */ - #else -! /* InstallNonExecFile(system.twmrc,$(TWMDIR)) */ - /* InstallNamedProg(ssetroot,xsetroot,$(BINDIR)) */ - #endif - +--- Imakefile.orig 1995-02-03 00:25:44 UTC ++++ Imakefile +@@ -25,7 +25,7 @@ XCOMM the maximum level of compatibility + XCOMM will define yylineno. If you get an "Undefined symbol: _yylineno" + XCOMM when linking, adjust this to work on your system. + +-#if defined(i386BsdArchitecture) || defined(LinuxArchitecture) ++#if defined(FreeBSDArchitecture) || defined(LinuxArchitecture) + # ifdef LexCmd + LEX = LexCmd -l + # else +@@ -100,7 +100,7 @@ SpecialObjectRule(vdt.o,NullParameter,$( + SpecialObjectRule(LocPixmap.o,NullParameter,'-DBITMAPDIR="$(INCDIR)/bitmaps"') + SpecialObjectRule(twm.o,NullParameter,$(TWM_DEFS)) + +-#if defined(UltrixArchitecture) || defined(AlphaArchitecture) ++#if !defined(FreeBSDArchitecture) && (defined(UltrixArchitecture) || defined(AlphaArchitecture)) + SpecialObjectRule(menus.o,NullParameter,-Olimit 700) + #endif + +@@ -120,10 +120,10 @@ XCOMM rm -f $(BINDIR)/twm + XCOMM ln $(BINDIR)/tvtwm $(BINDIR)/twm + + #if (ProjectX < 5) +-InstallNonExec(system.twmrc,$(TWMDIR)) ++/* InstallNonExec(system.twmrc,$(TWMDIR))*/ + /* InstallProgram(ssetroot,$(BINDIR)/xsetroot) */ + #else +-InstallNonExecFile(system.twmrc,$(TWMDIR)) ++/* InstallNonExecFile(system.twmrc,$(TWMDIR)) */ + /* InstallNamedProg(ssetroot,xsetroot,$(BINDIR)) */ + #endif + Index: head/x11-wm/tvtwm/files/patch-gram.y =================================================================== --- head/x11-wm/tvtwm/files/patch-gram.y (revision 404721) +++ head/x11-wm/tvtwm/files/patch-gram.y (revision 404722) @@ -1,19 +1,11 @@ -*** gram.y.orig Mon Dec 5 07:35:28 1994 ---- gram.y Mon Dec 5 07:36:42 1994 -*************** -*** 79,85 **** - extern int do_single_keyword(), do_string_keyword(), do_number_keyword(); - extern name_list **do_colorlist_keyword(); - extern int do_color_keyword(), do_string_savecolor(); -! extern int yylineno; - %} - - %union ---- 79,85 ---- - extern int do_single_keyword(), do_string_keyword(), do_number_keyword(); - extern name_list **do_colorlist_keyword(); - extern int do_color_keyword(), do_string_savecolor(); -! int yylineno; - %} - - %union +--- gram.y.orig 1993-11-22 20:10:49 UTC ++++ gram.y +@@ -79,7 +79,7 @@ unsigned int mods_used = (ShiftMask | Co + extern int do_single_keyword(), do_string_keyword(), do_number_keyword(); + extern name_list **do_colorlist_keyword(); + extern int do_color_keyword(), do_string_savecolor(); +-extern int yylineno; ++int yylineno; + %} + + %union Index: head/x11-wm/tvtwm/files/patch-icons.c =================================================================== --- head/x11-wm/tvtwm/files/patch-icons.c (revision 404721) +++ head/x11-wm/tvtwm/files/patch-icons.c (revision 404722) @@ -1,31 +1,31 @@ ---- icons.c-orig 2009-10-10 20:22:14.000000000 +0200 -+++ icons.c 2009-10-10 20:22:13.000000000 +0200 -@@ -233,10 +233,12 @@ +--- icons.c.orig 1995-02-03 00:37:34 UTC ++++ icons.c +@@ -233,10 +233,12 @@ int *final_x, *final_y; *final_x = ie->x + (ie->w - iconWidth (tmp_win)) / 2; *final_y = ie->y + (ie->h - iconHeight (tmp_win)) / 2; } else { +/* if (tmp_win->root == Scr->VirtualDesktop) { def_x += Scr->vdtPositionX; def_y += Scr->vdtPositionY; } +*/ *final_x = def_x; *final_y = def_y; } -@@ -299,6 +301,7 @@ +@@ -299,6 +301,7 @@ IconUp (tmp_win) if (!ir) return; /* outside icon regions, leave alone */ } +#ifdef NOTREACHED defx = -100; defy = -100; PlaceIcon(tmp_win, defx, defy, &x, &y); -@@ -310,6 +313,7 @@ +@@ -310,6 +313,7 @@ IconUp (tmp_win) MoveIcon(tmp_win, x, y); tmp_win->icon_moved = FALSE; /* since we've restored it */ } +#endif } static IconEntry * Index: head/x11-wm/tvtwm/files/patch-lex.l =================================================================== --- head/x11-wm/tvtwm/files/patch-lex.l (revision 404721) +++ head/x11-wm/tvtwm/files/patch-lex.l (revision 404722) @@ -1,47 +1,35 @@ -*** lex.l.orig Wed Mar 10 20:57:51 1993 ---- lex.l Mon Dec 5 08:06:40 1994 -*************** -*** 43,48 **** ---- 43,61 ---- - - extern int ParseError; - -+ #undef YY_INPUT -+ #define YY_INPUT(buf,result,max_size) \ -+ { \ -+ int res = (*twmInputFunc)(); \ -+ if (res == NULL) \ -+ result = YY_NULL; \ -+ else \ -+ { \ -+ buf[0] = res; \ -+ result = 1; \ -+ } \ -+ } -+ - %} - - string \"([^"]|\\.)*\" -*************** -*** 98,107 **** - #endif - - #undef unput -! #undef input - #undef output - #undef feof - #define unput(c) twmUnput(c) -! #define input() (*twmInputFunc)() - #define output(c) TwmOutput(c) - #define feof() (1) ---- 111,120 ---- - #endif - - #undef unput -! /*#undef input*/ - #undef output - #undef feof - #define unput(c) twmUnput(c) -! /*#define input() (*twmInputFunc)()*/ - #define output(c) TwmOutput(c) - #define feof() (1) +--- lex.l.orig 1993-03-10 20:57:51 UTC ++++ lex.l +@@ -43,6 +43,19 @@ extern char *ProgramName; + + extern int ParseError; + ++#undef YY_INPUT ++#define YY_INPUT(buf,result,max_size) \ ++ { \ ++ int res = (*twmInputFunc)(); \ ++ if (res == NULL) \ ++ result = YY_NULL; \ ++ else \ ++ { \ ++ buf[0] = res; \ ++ result = 1; \ ++ } \ ++ } ++ + %} + + string \"([^"]|\\.)*\" +@@ -98,10 +111,10 @@ yywrap() { return(1);} + #endif + + #undef unput +-#undef input ++/*#undef input*/ + #undef output + #undef feof + #define unput(c) twmUnput(c) +-#define input() (*twmInputFunc)() ++/*#define input() (*twmInputFunc)()*/ + #define output(c) TwmOutput(c) + #define feof() (1) Index: head/x11-wm/tvtwm/files/patch-menus.c =================================================================== --- head/x11-wm/tvtwm/files/patch-menus.c (revision 404721) +++ head/x11-wm/tvtwm/files/patch-menus.c (revision 404722) @@ -1,88 +1,88 @@ ---- menus.c-orig 2009-10-10 20:22:14.000000000 +0200 -+++ menus.c 2009-10-10 20:22:13.000000000 +0200 -@@ -2674,14 +2674,20 @@ +--- menus.c.orig 1995-02-09 20:09:18 UTC ++++ menus.c +@@ -2674,14 +2674,20 @@ ExecuteFunction(func, action, sub, w, tm if (DeferExecution(context, func, action, Scr->SelectCursor)) return TRUE; - if (tmp_win->isicon || !tmp_win->mapped ) - { + if (tmp_win->isicon || !tmp_win->mapped ) { DeIconify(tmp_win); } - else if (func == F_ICONIFY) - { - Iconify (tmp_win, eventp->xbutton.x_root - 5, - eventp->xbutton.y_root - 5); + else if (func == F_ICONIFY) { + if ( tmp_win->root == Scr->VirtualDesktop ) { + Iconify (tmp_win, + eventp->xbutton.x_root - 5 + Scr->vdtPositionX, + eventp->xbutton.y_root - 5 + Scr->vdtPositionY + ); + } + else { + Iconify (tmp_win, eventp->xbutton.x_root - 5, + eventp->xbutton.y_root - 5); + } } break; -@@ -3091,6 +3097,50 @@ +@@ -3091,6 +3097,50 @@ ExecuteFunction(func, action, sub, w, tm RelativeMove(tmp_win, action); break; + case F_DUMPSTATE: + printf("doing dumpstate\n"); + { + Window RootW; + Window root, parent, *children; + unsigned int nchildren; + unsigned int numscr; + unsigned int i; + unsigned int scr; + + numscr = ScreenCount(dpy); + printf("# of screens: %d\n",numscr); + for(scr = 0; scr <= (numscr-1); scr++) { + RootW = RootWindow(dpy, scr); + printf("rootw: 0x%x\n",RootW); + XGrabServer(dpy); + XSync(dpy, 0); + XQueryTree(dpy, RootW, &root, &parent, &children, &nchildren); + for (i = 0; i < nchildren; i++) { + if (children[i]) { + XWMHints *wmhintsp = XGetWMHints (dpy, children[i]); + if (wmhintsp) { + if (wmhintsp->flags) { + printf("i: %d wmhints w: 0x%x flags: %d ", + i,children[i], wmhintsp->flags + ); + if ( wmhintsp->flags & StateHint ) { + printf("state: %d ", + wmhintsp->initial_state); + } + printf("\n"); + } + } + } + else { + printf(" NOT DEFINED\n"); + } + } + } + XUngrabServer(dpy); + XFree(children); + } + break; + case F_QUIT: Done(); break; -@@ -3188,6 +3238,7 @@ +@@ -3188,6 +3238,7 @@ int func; case F_DESTROY: case F_DELETE: case F_DELETEORDESTROY: + case F_DUMPSTATE: case F_WINREFRESH: case F_ZOOM: case F_FULLZOOM: Index: head/x11-wm/tvtwm/files/patch-parse.c =================================================================== --- head/x11-wm/tvtwm/files/patch-parse.c (revision 404721) +++ head/x11-wm/tvtwm/files/patch-parse.c (revision 404722) @@ -1,27 +1,27 @@ ---- parse.c.orig 2009-10-10 20:22:13.000000000 +0200 -+++ parse.c 2009-10-10 20:22:13.000000000 +0200 -@@ -646,6 +646,7 @@ +--- parse.c.orig 1995-02-03 00:17:00 UTC ++++ parse.c +@@ -646,6 +646,7 @@ static TwmKeyword keytable[] = { { "f.deltastop", FKEYWORD, F_DELTASTOP }, { "f.destroy", FKEYWORD, F_DESTROY }, { "f.downiconmgr", FKEYWORD, F_DOWNICONMGR }, + { "f.dumpstate", FKEYWORD, F_DUMPSTATE }, { "f.exec", FSKEYWORD, F_EXEC }, { "f.file", FSKEYWORD, F_FILE }, { "f.focus", FKEYWORD, F_FOCUS }, -@@ -1609,6 +1610,8 @@ +@@ -1609,6 +1610,8 @@ do_squeeze_entry (list, name, type, just } } +static char *m4_defs(); + static FILE *start_m4(fraw) FILE *fraw; { -@@ -1627,7 +1630,6 @@ +@@ -1627,7 +1630,6 @@ FILE *fraw; if (fres == 0) { extern Display *dpy; extern char *display_name; - static char *m4_defs(); char *tmp_file; /* Child */ Index: head/x11-wm/tvtwm/files/patch-parse.h =================================================================== --- head/x11-wm/tvtwm/files/patch-parse.h (revision 404721) +++ head/x11-wm/tvtwm/files/patch-parse.h (revision 404722) @@ -1,10 +1,10 @@ ---- parse.h-orig 2009-10-10 20:22:14.000000000 +0200 -+++ parse.h 2009-10-10 20:22:13.000000000 +0200 -@@ -102,6 +102,7 @@ +--- parse.h.orig 1993-12-01 21:01:13 UTC ++++ parse.h +@@ -102,6 +102,7 @@ extern void TwmOutput(); #define F_CONSTRAINEDMOVE 55 #define F_OPAQUEMOVE 56 #define F_DELETEORDESTROY 57 +#define F_DUMPSTATE 58 #define F_MENU 101 /* string */ #define F_WARPTO 102 /* string */ Index: head/x11-wm/tvtwm/files/patch-twm.c =================================================================== --- head/x11-wm/tvtwm/files/patch-twm.c (revision 404721) +++ head/x11-wm/tvtwm/files/patch-twm.c (revision 404722) @@ -1,229 +1,229 @@ ---- twm.c-orig 2009-10-10 20:22:14.000000000 +0200 -+++ twm.c 2009-10-10 20:31:33.000000000 +0200 -@@ -185,6 +185,9 @@ +--- twm.c.orig 1995-02-03 00:14:17 UTC ++++ twm.c +@@ -185,6 +185,9 @@ static int RedirectError; /* TRUE ==> an static int CatchRedirectError(); /* for settting RedirectError */ static int TwmErrorHandler(); /* for everything else */ static void SetRootProperties(); /* leave note on root window */ +static void DisplayHints(XSizeHints *); /* PI-FIX */ +static void calcgeo(Display *, Drawable, int *, int *, int *, int *); /* PI-FIX */ + char Info[INFO_LINES][INFO_SIZE]; /* info strings to print */ int InfoLines; char *InitFile = NULL; -@@ -248,6 +251,14 @@ +@@ -248,6 +251,14 @@ main(argc, argv, environ) int i, j, sync = FALSE; unsigned long valuemask; /* mask for create windows */ XSetWindowAttributes attributes; /* attributes for create windows */ +/* PI-FIX */ + XSizeHints mywmhints; + long mylong; + int res; + int minx = 0, miny = 0; + int *relx, *rely; + int rx, ry; +/* PI-FIX */ int numManaged, firstscrn, lastscrn, scrnum; extern ColormapWindow *CreateColormapWindow(); SIGNAL_T QueueRestartTwm(); -@@ -631,6 +640,67 @@ +@@ -629,6 +640,67 @@ main(argc, argv, environ) Scr->iconmgr.twm_win->isicon = TRUE; /* + * allocate some space for relx, rely values + */ + relx = (int *) malloc(nchildren * sizeof(int)); + rely = (int *) malloc(nchildren * sizeof(int)); + + /* + * print a lot of information for each children + */ + for (i = 0; i < nchildren; i++) { + if (children[i]) { + XWMHints *wmhintsp = XGetWMHints (dpy, children[i]); + +#ifdef DEBUG + if (wmhintsp) { + if (wmhintsp->flags) { + printf(" wmhints i: %d w: 0x%x flags: %d ", + i,children[i], wmhintsp->flags + ); + if ( wmhintsp->flags & StateHint ) { + printf("state: %d ",wmhintsp->initial_state); + } + printf("\n"); + } + } + res = XGetWMNormalHints(dpy, children[i], &mywmhints, &mylong); + if (res != 0) { + DisplayHints(&mywmhints); + } + res = XGetWMSizeHints(dpy, children[i], &mywmhints, &mylong, + XA_WM_ZOOM_HINTS); + if ( res != 0 ) { + DisplayHints(&mywmhints); + } + else { + printf(" no zoom hints\n"); + } +#endif + calcgeo(dpy, children[i], &minx, &miny, &rx, &ry); + relx[i] = rx; + rely[i] = ry; + } + } + +#ifdef DEBUG + printf("minx: %d miny: %d\n", minx, miny); +#endif + + /* + * move each children in the positive + */ + for (i = 0; i < nchildren; i++) { + if (children[i]) { + if ( children[i] != Scr->Panner && + children[i] != Scr->VirtualDesktop) { + /* HACK: only relx gets corrected */ + res = XMoveWindow(dpy, children[i], relx[i]-minx, rely[i]); + } + } + } + + /* * weed out icon windows */ for (i = 0; i < nchildren; i++) { -@@ -786,6 +856,7 @@ +@@ -784,6 +856,7 @@ QueueRestartTwm() { XClientMessageEvent ev; +printf("restart requested\n"); ev.type = ClientMessage; ev.window = Scr->Root; ev.message_type = _XA_TWM_RESTART; -@@ -1248,3 +1319,125 @@ +@@ -1246,3 +1319,125 @@ InternUsefulAtoms () _XA_TWM_MACHINE = XInternAtom (dpy, "_TWM_MACHINE", False); } + +/* stolen from xwininfo */ +/* + * Display a set of size hints + */ +static void +DisplayHints(XSizeHints *hints) +{ + long flags; + + flags = hints->flags; + + if (flags & USPosition) + printf(" User supplied location: %d, %d\n", + hints->x, hints->y); + + if (flags & PPosition) + printf(" Program supplied location: %d, %d\n", + hints->x, hints->y); + + if (flags & USSize) { + printf(" User supplied size: %d by %d\n", + hints->width, hints->height); + } + + if (flags & PSize) + printf(" Program supplied size: %d by %d\n", + hints->width, hints->height); + + if (flags & PMinSize) + printf(" Program supplied minimum size: %d by %d\n", + hints->min_width, hints->min_height); + + if (flags & PMaxSize) + printf(" Program supplied maximum size: %d by %d\n", + hints->max_width, hints->max_height); + + if (flags & PBaseSize) { + printf(" Program supplied base size: %d by %d\n", + hints->base_width, hints->base_height); + } + + if (flags & PResizeInc) { + printf(" Program supplied x resize increment: %d\n", + hints->width_inc); + printf(" Program supplied y resize increment: %d\n", + hints->height_inc); + if (hints->width_inc != 0 && hints->height_inc != 0) { + if (flags & USSize) + printf(" User supplied size in resize increments: %d/%d by %d/%d\n", + hints->width, hints->width_inc, + hints->height, hints->height_inc); + if (flags & PSize) + printf(" Program supplied size in resize increments: %d/%d by %d/%d\n", + hints->width, hints->width_inc, + hints->height, hints->height_inc); + if (flags & PMinSize) + printf(" Program supplied minimum size in resize increments: %d/%d by %d/%d\n", + hints->min_width, hints->width_inc, + hints->min_height, hints->height_inc); + if (flags & PBaseSize) + printf(" Program supplied base size in resize increments: %d/%d by %d/%d\n", + hints->base_width, hints->width_inc, + hints->base_height, hints->height_inc); + } + } + + if (flags & PAspect) { + printf(" Program supplied min aspect ratio: %d/%d\n", + hints->min_aspect.x, hints->min_aspect.y); + printf(" Program supplied max aspect ratio: %d/%d\n", + hints->max_aspect.x, hints->max_aspect.y); + } + + if (flags & PWinGravity) { + printf(" Program supplied window gravity: %d\n", + hints->win_gravity); + } +} + +/* stolen from xwininfo */ +/* + * print geometry + */ +static void +calcgeo(Display *dpy, Drawable d, int *minxp, int *minyp, int *rxp, int *ryp) +{ + int rel_x, rel_y, abs_x, abs_y; + unsigned int width, height, border, depth; + Window root; + Window child; + + if (XGetGeometry(dpy, d, &root, + &rel_x, &rel_y, &width, &height, &border, &depth)) { + +#ifdef DEBUG + printf (" %ux%u+%d+%d", width, height, rel_x, rel_y); +#endif + *rxp = rel_x; + *ryp = rel_y; +#ifdef DEBUG + printf(" vorher min: %d %d", *minxp, *minyp); +#endif + if ( *minxp > rel_x ) { + *minxp = rel_x; + } + if ( *minyp > rel_y ) { + *minyp = rel_y; + } +#ifdef DEBUG + printf(" nachher min: %d %d\n", *minxp, *minyp); +#endif + if (XTranslateCoordinates (dpy, d, root, + 0 ,0, &abs_x, &abs_y, &child)) { +#ifdef DEBUG + printf (" +%d+%d\n", abs_x - border, abs_y - border); +#endif + } + } + +} +