Return to BSD News archive
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!EU.net!Austria.EU.net!newsfeed.ACO.net!news.tuwien.ac.at!not-for-mail
From: martin@hal.nt.tuwien.ac.at (Martin Birgmeier)
Newsgroups: comp.os.386bsd.questions
Subject: Re: TVTWM ANYONE???
Date: 31 Aug 1994 15:32:12 +0200
Organization: Dept. of Comm. Engr., Tech. Univ. of Vienna, Austria
Lines: 534
Message-ID: <3420os$1ao@hal.nt.tuwien.ac.at>
References: <33tctf$phj@news.xs4all.nl>
NNTP-Posting-Host: hal.nt.tuwien.ac.at
In article <33tctf$phj@news.xs4all.nl>, Cor Bosman <cor@xs4all.nl> wrote:
>Had ANYONE compiled tvtwm for freebsd? I can compile it..
>(even though it complaints about yylineno and an X function)
>but after compilation it wont run. twm and fvwm work fine.
>Anyone have a working binary?
>Cor
>--
>------------------------------------------------------------------------------
>| Cor Bosman | ____Xs4all Public Access____ | tel: +31-(0)20-620-0294 |
>| cor@xs4all.nl | System Administrator | fax: +31-(0)20-622-2753 |
>------------------------------------------------------------------------------
This is what I've come up with - it also adds raisedelay (someone else did that
for twm initially). Also fixes a bug which can be observed by e.g. running
khoros. Enjoy,
Martin
============================== cut here ==============================
*** tvtwm.pl9b5/tvtwm.man.ORIG Mon Jan 25 19:30:36 1993
--- tvtwm.pl9b5/tvtwm.man Wed Nov 10 13:11:53 1993
***************
*** 393,402 ****
The following variables may be specified at the top of a \fItwm\fP startup
file. Lists of Window name prefix strings are indicated by \fIwin-list\fP.
Optional arguments are shown in square brackets:
! .IP "\fBAutoRaise\fP { \fIwin-list\fP }" 8
! This variable specifies a list of windows that should automatically be
! raised whenever the pointer enters the window. This action can be
! interactively
enabled or disabled on individual windows using the function \fBf.autoraise\fP.
.IP "\fBAutoRelativeResize\fP" 8
This variable indicates that dragging out a window size (either when
--- 393,405 ----
The following variables may be specified at the top of a \fItwm\fP startup
file. Lists of Window name prefix strings are indicated by \fIwin-list\fP.
Optional arguments are shown in square brackets:
! .IP "\fBAutoRaise\fP [{ \fIwin-list\fP }]" 8
! This variable specifies a list of windows
! (all windows if the list is defaulted)
! to be automatically
! raised whenever the pointer has come to rest in a window for the amount of
! time specified by the \fBRaiseDelay\fP variable.
! This action can be interactively
enabled or disabled on individual windows using the function \fBf.autoraise\fP.
.IP "\fBAutoRelativeResize\fP" 8
This variable indicates that dragging out a window size (either when
***************
*** 925,930 ****
--- 928,938 ----
The default for \fITitleHighlight\fP is to use an even stipple pattern.
The \fIVirtualDesktopBackgroundPixmap\fP and \fIPannerBackgroundPixmap\fP
pixmaps can be set as detailed in each of their own sections.
+ .IP "\fBRaiseDelay\fP \fImilliseconds\fP" 8
+ For windows that are to be automatically raised when the pointer enters
+ (see the \fBAutoRaise\fP variable and the \fIf.autoraise\fP function)
+ this variable specifies the length of time the pointer should rest in
+ the window before it is raised. The default is 0 milliseconds.
.IP "\fBRandomPlacement\fP" 8
This variable indicates that windows with no specified geometry should should
be placed in a pseudo-random location instead of having the user drag out
*** tvtwm.pl9b5/twm.c.ORIG Thu Jan 21 02:35:45 1993
--- tvtwm.pl9b5/twm.c Wed Nov 10 13:11:54 1993
***************
*** 910,915 ****
--- 910,916 ----
Scr->SizeStringOffset = 0;
Scr->BorderWidth = BW;
Scr->IconBorderWidth = BW;
+ Scr->AutoRaiseDefault = FALSE;
Scr->NumAutoRaises = 0;
Scr->NoDefaults = FALSE;
Scr->UsePPosition = PPOS_OFF;
*** tvtwm.pl9b5/gram.y.ORIG Sat May 9 04:26:34 1992
--- tvtwm.pl9b5/gram.y Wed Nov 10 13:11:54 1993
***************
*** 251,256 ****
--- 251,258 ----
win_list
| AUTO_RAISE { list = &Scr->AutoRaise; }
win_list
+ | AUTO_RAISE { if (Scr->FirstTime)
+ Scr->AutoRaiseDefault = TRUE; }
| STICKY { list = &Scr->StickyL; }
win_list
| FUNCTION string { root = GetRoot($2, NULLSTR, NULLSTR); }
*** tvtwm.pl9b5/events.c.ORIG Thu Jan 21 00:14:51 1993
--- tvtwm.pl9b5/events.c Wed Nov 10 13:11:53 1993
***************
*** 120,125 ****
--- 120,126 ----
***********************************************************************/
#include <stdio.h>
+ #include <sys/time.h>
#include "twm.h"
#include <X11/Xatom.h>
#include "add_window.h"
***************
*** 2438,2443 ****
--- 2439,2445 ----
XEnterWindowEvent *ewp = &Event.xcrossing;
HENScanArgs scanArgs;
XEvent dummy;
+ extern int RaiseDelay;
/*
* if we aren't in the middle of menu processing
***************
*** 2467,2472 ****
--- 2469,2544 ----
InstallWindowColormaps(EnterNotify, &Scr->TwmRoot);
return;
}
+
+ /* Handle RaiseDelay, if any.....
+ */
+ if (RaiseDelay > 0) {
+ if (Tmp_win && Tmp_win->auto_raise
+ && (!Tmp_win->list || Tmp_win->list->w != ewp->window)) {
+ ColormapWindow *cwin;
+ static struct timeval timeout = {0,12500};
+
+ if (XFindContext(dpy, Tmp_win->w, ColormapContext,
+ (caddr_t *)&cwin) == XCNOENT) {
+ cwin = (ColormapWindow *)NULL;
+ }
+
+ if ((ewp->detail != NotifyInferior
+ || Tmp_win->frame == ewp->window)
+ && (!cwin || cwin->visibility != VisibilityUnobscured)) {
+ int x, y, px, py, d, i;
+ Window w;
+
+ XQueryPointer(dpy, Scr->Root, &w, &w, &px, &py,
+ &d, &d, (unsigned int *)&d);
+
+ /* The granularity of RaiseDelay is about 25 ms.
+ * The timeout variable is set to 12.5 ms since we
+ * pass this way twice each time a twm window is
+ * entered.
+ */
+ for (i = 25; i < RaiseDelay; i += 25) {
+ select(0, 0, 0, 0, &timeout);
+ /* Did we leave this window already? */
+ scanArgs.w = ewp->window;
+ scanArgs.leaves = scanArgs.enters = False;
+ (void) XCheckIfEvent(dpy, &dummy, HENQueueScanner,
+ (char *) &scanArgs);
+ if (scanArgs.leaves && !scanArgs.inferior) return;
+
+ XQueryPointer(dpy, Scr->Root, &w, &w, &x, &y,
+ &d, &d, (unsigned int *)&d);
+
+ /* Has the pointer moved? If so reset the loop cnt.
+ * We want the pointer to be still for RaiseDelay
+ * milliseconds before terminating the loop
+ */
+ if (x != px || y != py) {
+ i = 0; px = x; py = y;
+ }
+ }
+ }
+ }
+
+ /*
+ * Scan for Leave and Enter Notify events to see if we can avoid some
+ * unnecessary processing.
+ */
+ scanArgs.w = ewp->window;
+ scanArgs.leaves = scanArgs.enters = False;
+ (void) XCheckIfEvent(dpy, &dummy, HENQueueScanner, (char *) &scanArgs);
+
+ /*
+ * if entering root window, restore twm default colormap so that
+ * titlebars are legible
+ */
+ if (ewp->window == Scr->Root) {
+ if (!scanArgs.leaves && !scanArgs.enters)
+ InstallWindowColormaps(EnterNotify, &Scr->TwmRoot);
+ return;
+ }
+ }
+ /* End of RaiseDelay modification. */
/*
* if we have an event for a specific one of our windows
*** tvtwm.pl9b5/lex.l.ORIG Wed Feb 19 03:18:40 1992
--- tvtwm.pl9b5/lex.l Wed Nov 10 13:11:54 1993
***************
*** 43,48 ****
--- 43,56 ----
extern int ParseError;
+ #ifdef FLEX_SCANNER
+ #undef YY_INPUT
+ #define YY_INPUT(buf, result, max_size) \
+ result = ((buf[0] = (*twmInputFunc)()) ? 1 : 0)
+
+ int yylineno = 1;
+ #endif
+
%}
string \"([^"]|\\.)*\"
***************
*** 83,90 ****
{number} { (void)sscanf(yytext, "%d", &yylval.num);
return (NUMBER);
}
! \#[^\n]*\n {;}
! [\n\t ] {;}
. {
twmrc_error_prefix();
fprintf (stderr,
--- 91,109 ----
{number} { (void)sscanf(yytext, "%d", &yylval.num);
return (NUMBER);
}
! \#[^\n]*\n {
! #ifdef FLEX_SCANNER
! yylineno++
! #endif
! ;
! }
! [\t ] {;}
! \n {
! #ifdef FLEX_SCANNER
! yylineno++
! #endif
! ;
! }
. {
twmrc_error_prefix();
fprintf (stderr,
***************
*** 93,98 ****
--- 112,118 ----
ParseError = 1;
}
%%
+ #ifndef FLEX_SCANNER
yywrap() { return(1);}
#undef unput
***************
*** 103,105 ****
--- 123,126 ----
#define input() (*twmInputFunc)()
#define output(c) TwmOutput(c)
#define feof() (1)
+ #endif
*** tvtwm.pl9b5/screen.h.ORIG Thu Apr 9 23:51:15 1992
--- tvtwm.pl9b5/screen.h Wed Nov 10 13:11:53 1993
***************
*** 308,313 ****
--- 308,314 ----
short WrapVirtual; /* wrap-around on the virtual desktop panning */
short SetupDone;
char *AfterSetupRun; /* program to run when tvtwm is running */
+ short AutoRaiseDefault; /* AutoRaise all windows if true */
FuncKey FuncKeyRoot;
} ScreenInfo;
*** tvtwm.pl9b5/parse.c.ORIG Thu Jan 21 01:25:21 1993
--- tvtwm.pl9b5/parse.c Wed Nov 10 13:11:54 1993
***************
*** 81,86 ****
--- 81,88 ----
int ConstrainedMoveTime = 400; /* milliseconds, event times */
+ int RaiseDelay = 0; /* msec, for AutoRaise */
+
static int twmFileInput(), twmStringListInput(), twmMenuInput();
void twmUnput();
int (*twmInputFunc)();
***************
*** 523,528 ****
--- 525,531 ----
#define kwn_TitleFontPadding 14
#define kwn_PopupSensitivity 15
#define kwn_MenuShadowWidth 16
+ #define kwn_RaiseDelay 17
#define kwcl_BorderColor 1
#define kwcl_IconManagerHighlight 2
***************
*** 769,774 ****
--- 772,778 ----
{ "popupsensitivity", NKEYWORD, kwn_PopupSensitivity },
{ "pullrightpixmap", PKEYWORD, kwp_PullRightPixmap },
{ "r", ROOT, 0 },
+ { "raisedelay", NKEYWORD, kwn_RaiseDelay },
{ "randomplacement", KEYWORD, kw0_RandomPlacement },
{ "rememberscreenposition", KEYWORD, kw0_RememberScreenPosition },
{ "resclass", MKEYWORD, kwm_ResClass },
***************
*** 1207,1212 ****
--- 1211,1220 ----
case kwn_TitleButtonBorderWidth:
if (Scr->FirstTime) Scr->TBInfo.border = num;
+ return 1;
+
+ case kwn_RaiseDelay:
+ RaiseDelay = num;
return 1;
case kwn_PopupSensitivity:
*** tvtwm.pl9b5/menus.c.ORIG Wed Mar 10 15:38:26 1993
--- tvtwm.pl9b5/menus.c Wed Nov 10 13:14:23 1993
***************
*** 208,214 ****
extern char *Action;
extern int Context;
! extern TwmWindow *ButtonWindow, *Tmp_win;
extern XEvent Event, ButtonEvent;
extern char *InitFile;
static void Identify();
--- 208,214 ----
extern char *Action;
extern int Context;
! extern TwmWindow *ButtonWindow;
extern XEvent Event, ButtonEvent;
extern char *InitFile;
static void Identify();
*** tvtwm.pl9b5/move.c.ORIG Mon Oct 26 21:29:54 1992
--- tvtwm.pl9b5/move.c Wed Nov 10 13:15:43 1993
***************
*** 451,456 ****
--- 451,457 ----
Window junkChild;
int doingFine;
XEvent event,bakevent;
+ ScreenInfo *bakScr;
int xdest, ydest;
unsigned mask;
***************
*** 557,565 ****
--- 558,568 ----
/* handle other generic events here */
case Expose:
bakevent = Event;
+ bakScr = Scr;
Event=event;
DispatchEvent();
Event=bakevent;
+ Scr = bakScr;
break;
}
}
*** tvtwm.pl9b5/util.c.ORIG Wed Mar 10 15:36:30 1993
--- tvtwm.pl9b5/util.c Wed Nov 10 13:16:28 1993
***************
*** 94,99 ****
--- 94,108 ----
lastRoot = root;
r = outline;
+ #define ADDSEGMENT(a, b, c, e) \
+ { \
+ r->x1 = a; \
+ r->y1 = b; \
+ r->x2 = c; \
+ r->y2 = e; \
+ r++; \
+ }
+
#define DRAWIT() \
if (lastWidth || lastHeight) \
{ \
***************
*** 108,167 ****
xthird = (xinnerr - xinnerl) / 3; \
ythird = (yinnerb - yinnert) / 3; \
\
! r->x1 = xl; \
! r->y1 = yt; \
! r->x2 = xr; \
! r->y2 = yt; \
! r++; \
\
- r->x1 = xl; \
- r->y1 = yb; \
- r->x2 = xr; \
- r->y2 = yb; \
- r++; \
- \
- r->x1 = xl; \
- r->y1 = yt; \
- r->x2 = xl; \
- r->y2 = yb; \
- r++; \
- \
- r->x1 = xr; \
- r->y1 = yt; \
- r->x2 = xr; \
- r->y2 = yb; \
- r++; \
- \
- r->x1 = xinnerl + xthird; \
- r->y1 = yinnert; \
- r->x2 = r->x1; \
- r->y2 = yinnerb; \
- r++; \
- \
- r->x1 = xinnerl + (2 * xthird); \
- r->y1 = yinnert; \
- r->x2 = r->x1; \
- r->y2 = yinnerb; \
- r++; \
- \
- r->x1 = xinnerl; \
- r->y1 = yinnert + ythird; \
- r->x2 = xinnerr; \
- r->y2 = r->y1; \
- r++; \
- \
- r->x1 = xinnerl; \
- r->y1 = yinnert + (2 * ythird); \
- r->x2 = xinnerr; \
- r->y2 = r->y1; \
- r++; \
- \
if (lastTH != 0) { \
! r->x1 = xl; \
! r->y1 = yt + lastTH; \
! r->x2 = xr; \
! r->y2 = r->y1; \
! r++; \
} \
}
--- 117,138 ----
xthird = (xinnerr - xinnerl) / 3; \
ythird = (yinnerb - yinnert) / 3; \
\
! ADDSEGMENT(xl, yt, xr, yt); \
! ADDSEGMENT(xl, yb, xr, yb); \
! ADDSEGMENT(xl, yt, xl, yb); \
! ADDSEGMENT(xr, yt, xr, yb); \
! ADDSEGMENT(xinnerl + xthird, yinnert, \
! xinnerl + xthird, yinnerb); \
! ADDSEGMENT(xinnerl + 2 * xthird, yinnert, \
! xinnerl + 2 * xthird, yinnerb); \
! ADDSEGMENT(xinnerl, yinnert + ythird, \
! xinnerr, yinnert + ythird); \
! ADDSEGMENT(xinnerl, yinnert + 2 * ythird, \
! xinnerr, yinnert + 2 * ythird); \
\
if (lastTH != 0) { \
! ADDSEGMENT(xl, yt + lastTH, \
! xr, yt + lastTH); \
} \
}
***************
*** 179,185 ****
DRAWIT ();
#undef DRAWIT
!
if (r != outline)
{
--- 150,156 ----
DRAWIT ();
#undef DRAWIT
! #undef ADDSEGMENT
if (r != outline)
{
*** tvtwm.pl9b5/Imakefile.ORIG Mon Jan 25 09:02:24 1993
--- tvtwm.pl9b5/Imakefile Wed Nov 10 13:11:54 1993
***************
*** 65,70 ****
--- 65,72 ----
#endif
TWM_DEFS = $(XLOADIM_DEF) $(M4_DEF) $(WAITPID_DEF)
+ CDEBUGFLAGS = -O2 -g
+
LOCAL_LIBRARIES = $(XMULIB) $(EXTENSIONLIB) $(XPMLIB) $(XLIB)
LINTLIBS = $(LINTXMU) $(LINTEXTENSIONLIB) $(LINTXLIB)
DEFINES = -DSHAPE $(RELEASE_DEFINES) $(LOCAL_DEFINES) $(SIGNAL_DEFINES)
*** tvtwm.pl9b5/add_window.c.ORIG Wed Nov 4 02:27:24 1992
--- tvtwm.pl9b5/add_window.c Wed Nov 10 13:11:53 1993
***************
*** 247,253 ****
(!(short)(int) LookInList(Scr->NoTitleHighlight, tmp_win->full_name,
&tmp_win->class));
! tmp_win->auto_raise = (short)(int) LookInList(Scr->AutoRaise,
tmp_win->full_name,
&tmp_win->class);
if (tmp_win->auto_raise) Scr->NumAutoRaises++;
--- 247,254 ----
(!(short)(int) LookInList(Scr->NoTitleHighlight, tmp_win->full_name,
&tmp_win->class));
! tmp_win->auto_raise = Scr->AutoRaiseDefault ||
! (short)(int) LookInList(Scr->AutoRaise,
tmp_win->full_name,
&tmp_win->class);
if (tmp_win->auto_raise) Scr->NumAutoRaises++;
***************
*** 857,863 ****
*/
if ((tmp_win->root == Scr->VirtualDesktop) &&
((!FromVirtualDesktop && tmp_win->transient) ||
! (ask_user == FALSE && (tmp_win->hints.flags & PPosition))))
{
tmp_win->frame_x += Scr->vdtPositionX;
tmp_win->frame_y += Scr->vdtPositionY;
--- 858,865 ----
*/
if ((tmp_win->root == Scr->VirtualDesktop) &&
((!FromVirtualDesktop && tmp_win->transient) ||
! (ask_user == FALSE &&
! ((tmp_win->hints.flags & PPosition) || tmp_win->sticky))))
{
tmp_win->frame_x += Scr->vdtPositionX;
tmp_win->frame_y += Scr->vdtPositionY;
============================== cut here ==============================
--
Martin Birgmeier Martin.Birgmeier@nt.tuwien.ac.at
Technische Universitaet Wien mbirgmei@email.tuwien.ac.at
Institut fuer Nachrichtentechnik und Hochfrequenztechnik