This patch should be applied to an un-modified XFree86 version 4.7.0 source tree. It is patch 4 of 4 patches that will will convert the source tree to XFree86 version 4.8.0. To apply this patch, run the following from the directory containing your 'xc' directory: patch -p0 -E < XFree86-4.7.0-4.8.0.diff1 patch -p0 -E < XFree86-4.7.0-4.8.0.diff2 patch -p0 -E < XFree86-4.7.0-4.8.0.diff3 patch -p0 -E < XFree86-4.7.0-4.8.0.diff4 sh XFree86-4.7.0-4.8.0-cleanup.sh gzip -d < XFree86-4.7.0-4.8.0-diff0.tgz | tar vxf - ------------------------------------------------------------------------------- Prereq: 4.7.0 Index: xc/programs/Xserver/hw/xfree86/vbe/vbe.c diff -u xc/programs/Xserver/hw/xfree86/vbe/vbe.c:1.19 xc/programs/Xserver/hw/xfree86/vbe/vbe.c:1.20 --- xc/programs/Xserver/hw/xfree86/vbe/vbe.c:1.19 Thu Mar 16 08:50:35 2006 +++ xc/programs/Xserver/hw/xfree86/vbe/vbe.c Wed Jul 16 10:01:43 2008 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe.c,v 1.19 2006/03/16 16:50:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe.c,v 1.20 2008/07/16 17:01:43 tsi Exp $ */ /* * XFree86 vbe module @@ -989,6 +989,9 @@ AX := VBE Return Status */ + if (set && !data) + return NULL; + pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f09; if (!secondary) Index: xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c:1.20 xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c:1.21 --- xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c:1.20 Fri Oct 14 08:17:11 2005 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c Sat Sep 15 19:54:57 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c,v 1.20 2005/10/14 15:17:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c,v 1.21 2007/09/16 02:54:57 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -76,10 +76,11 @@ } if(pGC->depth != 32) { - if(pGC->bgPixel == -1) /* -1 is reserved for transparency */ - pGC->bgPixel = 0x7fffffff; - if(pGC->fgPixel == -1) /* -1 is reserved for transparency */ - pGC->fgPixel = 0x7fffffff; + /* (unsigned int)(-1) is reserved for transparency */ + if(pGC->bgPixel == (unsigned int)(-1)) + pGC->bgPixel = (unsigned int)(-1) >> 1; + if(pGC->fgPixel == (unsigned int)(-1)) + pGC->fgPixel = (unsigned int)(-1) >> 1; } if((pDraw->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDraw)){ Index: xc/programs/Xserver/hw/xfree86/xaa/xaaTEText.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaTEText.c:1.8 xc/programs/Xserver/hw/xfree86/xaa/xaaTEText.c:1.9 --- xc/programs/Xserver/hw/xfree86/xaa/xaaTEText.c:1.8 Fri Oct 14 08:17:11 2005 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaTEText.c Wed Mar 26 10:46:01 2008 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaTEText.c,v 1.8 2005/10/14 15:17:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaTEText.c,v 1.9 2008/03/26 17:46:01 tsi Exp $ */ /******************************************************************** @@ -249,6 +249,7 @@ RightEdge = min(Right, pbox->x2); if(RightEdge > LeftEdge) { /* we have something to draw */ + unsigned int *fallbackBits = NULL; ytop = max(Top, pbox->y1); ybot = min(Bottom, pbox->y2); @@ -261,9 +262,22 @@ int count; glyphs = (unsigned int**)(infoRec->PreAllocMem); - for(count = 0; count < nglyph; count++) + for(count = 0; count < nglyph; count++) { glyphs[count] = (unsigned int*) FONTGLYPHBITS(gBase,*ppci++); + if (!glyphs[count]) { + /* Glyphs with NULL bits do exist in the wild. + Replace with blank bits in that case */ + + if (!fallbackBits) { + int fontHeight = Bottom - Top + 1; + fallbackBits = xcalloc (glyphWidth * fontHeight, 1); + if (!fallbackBits) + return; + } + glyphs[count] = fallbackBits; + } + } /* our new unrolled TE code only writes DWORDS at a time so it can read up to 6 characters past the last one @@ -276,12 +290,15 @@ glyphs[count + 5] = glyphs[0]; } - /* x, y, w, h, skipleft, skiptop, glyphp, glyphWidth, fg, bg, rop, pm */ + /* x, y, w, h, skipleft, skiptop, glyphp, glyphWidth, fg, bg, rop, pm */ (*infoRec->TEGlyphRenderer)( pScrn, LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop, skippix, ytop - Top, glyphs + skipglyphs, glyphWidth, - fg, bg, rop, planemask); + fg, bg, rop, planemask); + + if (fallbackBits) + xfree (fallbackBits); } nbox--; pbox++; Index: xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c:1.12 xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c:1.13 --- xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c:1.12 Fri Oct 14 08:17:11 2005 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c Wed Mar 26 10:46:01 2008 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c,v 1.12 2005/10/14 15:17:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaWideLine.c,v 1.13 2008/03/26 17:46:01 tsi Exp $ */ /* @@ -15,7 +15,8 @@ */ #ifndef XFree86LOADER -#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) +#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) || \ + (defined(sun) && defined(__SVR4)) #include #else #define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ @@ -823,20 +824,6 @@ return; } - if (mode == CoordModePrevious) { - pPts->x += xorg; - pPts->y += yorg; - } else if(xorg | yorg) { - register int n = npt; - register DDXPointPtr pts = pPts; - - while(n--) { - pts->x += xorg; - pts->y += yorg; - pts++; - } - } - x2 = pPts->x; y2 = pPts->y; if (npt > 1) { @@ -874,6 +861,8 @@ infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1); } + x2 += xorg; + y2 += yorg; while (--npt) { x1 = x2; y1 = y2; @@ -883,6 +872,9 @@ if (mode == CoordModePrevious) { x2 += x1; y2 += y1; + } else { + x2 += xorg; + y2 += yorg; } if ((x1 != x2) || (y1 != y2)) { somethingDrawn = TRUE; Index: xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c:1.6 xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c:1.7 --- xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c:1.6 Mon Jan 9 07:00:27 2006 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c Fri May 2 08:09:13 2008 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c,v 1.6 2006/01/09 15:00:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/offscreen.c,v 1.7 2008/05/02 15:09:13 tsi Exp $ */ /* * Copyright 1993 Gerrit Jan Akkerman * @@ -297,25 +297,6 @@ } void -xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes ) -WindowPtr pWin; /* GJA */ -unsigned char *data; -int x, y, w, h ; -unsigned long int fg ; -int alu ; -unsigned long int planes; -{ - - if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) ) - return ; - - DoMono( pWin, w, x, y, (const unsigned char *) data, h, - w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0, alu, - (int)planes, (int)fg) ; - -} - -void xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc ) WindowPtr pWin; /* GJA */ register PixmapPtr const pStipple ; Index: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c:1.7 xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c:1.8 --- xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c:1.7 Sun Mar 27 18:51:07 2005 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c Fri May 2 08:09:13 2008 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c,v 1.7 2005/03/28 02:51:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaStipple.c,v 1.8 2008/05/02 15:09:13 tsi Exp $ */ /* * Copyright IBM Corporation 1987,1988,1989 * @@ -584,41 +584,6 @@ return ( color & VGA_ALLPLANES ) | data_rotate_value | invert_existing_data ; } -static void -vgaDrawMonoImage(WindowPtr pWin, unsigned char *data, int x, int y, - int w, int h, unsigned long int fg, int alu, - unsigned long int planes) -{ -unsigned long regState ; - -if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) { - xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes ); - return; -} - -if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) ) - return ; - -#ifndef PC98_EGC -if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) { - vgaDrawMonoImage( pWin, data, x, y, w, h, - VGA_ALLPLANES, GXinvert, planes ) ; - regState &= ~DO_RECURSE ; -} -#else -regState = vgaCalcMonoMode(alu, (char)fg); -#endif - - -vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ; - -DoMonoSingle( pWin, w, x, y, (const unsigned char *) data, h, - w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0 ) ; - - -return ; -} - void xf4bppFillStipple(WindowPtr pWin, PixmapPtr const pStipple, unsigned long fg, const int alu, unsigned long planes, Index: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h:1.11 xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h:1.12 --- xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h:1.11 Fri Oct 14 08:17:13 2005 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h Fri May 2 08:09:13 2008 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h,v 1.11 2005/10/14 15:17:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h,v 1.12 2008/05/02 15:09:13 tsi Exp $ */ #ifndef __XF4BPP_H__ @@ -479,17 +479,6 @@ int, const int ); -void xf4bppOffDrawMonoImage( - WindowPtr, - unsigned char *, - int, - int, - int, - int, - unsigned long int, - int, - unsigned long int -); void xf4bppOffFillStipple( WindowPtr, const PixmapPtr, Index: xc/programs/Xserver/hw/xnest/Window.c diff -u xc/programs/Xserver/hw/xnest/Window.c:3.9 xc/programs/Xserver/hw/xnest/Window.c:3.10 --- xc/programs/Xserver/hw/xnest/Window.c:3.9 Fri Oct 14 08:17:15 2005 +++ xc/programs/Xserver/hw/xnest/Window.c Fri Jan 4 09:50:12 2008 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xnest/Window.c,v 3.9 2005/10/14 15:17:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Window.c,v 3.10 2008/01/04 17:50:12 tsi Exp $ */ /* Copyright 1993 by Davor Matic @@ -542,5 +542,36 @@ ShapeClip, 0, 0, None, ShapeSet); } } + + if (!xnestRegionEqual(xnestWindowPriv(pWin)->input_shape, + wInputShape(pWin))) { + + if (wInputShape(pWin)) { + REGION_COPY(pWin->drawable.pScreen, + xnestWindowPriv(pWin)->input_shape, wInputShape(pWin)); + + reg = XCreateRegion(); + pBox = REGION_RECTS(xnestWindowPriv(pWin)->input_shape); + for (i = 0; + i < REGION_NUM_RECTS(xnestWindowPriv(pWin)->input_shape); + i++) { + rect.x = pBox[i].x1; + rect.y = pBox[i].y1; + rect.width = pBox[i].x2 - pBox[i].x1; + rect.height = pBox[i].y2 - pBox[i].y1; + XUnionRectWithRegion(&rect, reg, reg); + } + XShapeCombineRegion(xnestDisplay, xnestWindow(pWin), + ShapeInput, 0, 0, reg, ShapeSet); + XDestroyRegion(reg); + } + else { + REGION_EMPTY(pWin->drawable.pScreen, + xnestWindowPriv(pWin)->input_shape); + + XShapeCombineMask(xnestDisplay, xnestWindow(pWin), + ShapeInput, 0, 0, None, ShapeSet); + } + } } #endif /* SHAPE */ Index: xc/programs/Xserver/hw/xnest/XNWindow.h diff -u xc/programs/Xserver/hw/xnest/XNWindow.h:1.5 xc/programs/Xserver/hw/xnest/XNWindow.h:1.6 --- xc/programs/Xserver/hw/xnest/XNWindow.h:1.5 Mon Jan 9 07:00:30 2006 +++ xc/programs/Xserver/hw/xnest/XNWindow.h Fri Jan 4 09:50:12 2008 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/hw/xnest/XNWindow.h,v 1.6 2008/01/04 17:50:12 tsi Exp $ */ /* Copyright 1993 by Davor Matic @@ -11,7 +12,6 @@ is" without express or implied warranty. */ -/* $XFree86: xc/programs/Xserver/hw/xnest/XNWindow.h,v 1.5 2006/01/09 15:00:30 dawes Exp $ */ #ifndef XNESTWINDOW_H #define XNESTWINDOW_H @@ -28,6 +28,7 @@ #ifdef SHAPE RegionPtr bounding_shape; RegionPtr clip_shape; + RegionPtr input_shape; #endif /* SHAPE */ } xnestPrivWin; Index: xc/programs/Xserver/include/Imakefile diff -u xc/programs/Xserver/include/Imakefile:3.23 xc/programs/Xserver/include/Imakefile:3.24 --- xc/programs/Xserver/include/Imakefile:3.23 Sun Mar 27 18:51:08 2005 +++ xc/programs/Xserver/include/Imakefile Sat Sep 15 20:36:21 2007 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/include/Imakefile,v 3.23 2005/03/28 02:51:08 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/include/Imakefile,v 3.24 2007/09/16 03:36:21 tsi Exp $ #if defined(XFree86Version) || defined(BSDOSArchitecture) #if DoLoadableServer @@ -9,6 +9,7 @@ LinkSourceFile(xf86_ansic.h,$(XF86OSSRC)) LinkSourceFile(xf86Version.h,$(XF86SRC)) LinkSourceFile(compiler.h,$(XF86COMSRC)) +LinkSourceFile(xf86Pci.h,$(XF86OSSRC)/bus) #endif LinkSourceFile(osdep.h,../os) Index: xc/programs/Xserver/include/os.h diff -u xc/programs/Xserver/include/os.h:3.71 xc/programs/Xserver/include/os.h:3.72 --- xc/programs/Xserver/include/os.h:3.71 Mon Apr 2 17:21:13 2007 +++ xc/programs/Xserver/include/os.h Thu May 1 09:13:23 2008 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/os.h,v 3.71 2007/04/03 00:21:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/include/os.h,v 3.72 2008/05/01 16:13:23 tsi Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -47,7 +47,7 @@ ******************************************************************/ /* - * Copyright (c) 1996-2006 by The XFree86 Project, Inc. + * Copyright (c) 1996-2008 by The XFree86 Project, Inc. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining @@ -546,7 +546,8 @@ XLOG_FLUSH, XLOG_SYNC, XLOG_VERBOSITY, - XLOG_FILE_VERBOSITY + XLOG_FILE_VERBOSITY, + XLOG_STDERR /* Redirect stderr to the log */ } LogParameter; /* Flags for log messages. */ Index: xc/programs/Xserver/include/windowstr.h diff -u xc/programs/Xserver/include/windowstr.h:1.9 xc/programs/Xserver/include/windowstr.h:1.10 --- xc/programs/Xserver/include/windowstr.h:1.9 Sun Feb 19 07:51:31 2006 +++ xc/programs/Xserver/include/windowstr.h Fri Jan 4 09:50:13 2008 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/windowstr.h,v 1.9 2006/02/19 15:51:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/include/windowstr.h,v 1.10 2008/01/04 17:50:13 tsi Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -85,6 +85,7 @@ #ifdef SHAPE RegionPtr boundingShape; /* default: NULL */ RegionPtr clipShape; /* default: NULL */ + RegionPtr inputShape; /* default: NULL */ #endif #ifdef XINPUT struct _OtherInputMasks *inputMasks; /* default: NULL */ @@ -175,6 +176,7 @@ #ifdef SHAPE #define wBoundingShape(w) wUseDefault(w, boundingShape, NULL) #define wClipShape(w) wUseDefault(w, clipShape, NULL) +#define wInputShape(w) wUseDefault(w, inputShape, NULL) #endif #define wClient(w) (clients[CLIENT_ID((w)->drawable.id)]) #define wBorderWidth(w) ((int) (w)->borderWidth) Index: xc/programs/Xserver/mi/mibank.c diff -u xc/programs/Xserver/mi/mibank.c:1.19 xc/programs/Xserver/mi/mibank.c:1.20 --- xc/programs/Xserver/mi/mibank.c:1.19 Mon Jan 1 08:08:21 2007 +++ xc/programs/Xserver/mi/mibank.c Mon Dec 31 16:40:13 2007 @@ -1,5 +1,6 @@ +/* $XFree86: xc/programs/Xserver/mi/mibank.c,v 1.20 2008/01/01 00:40:13 tsi Exp $ */ /* - * Copyright 1997 through 2007 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2008 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -44,8 +45,6 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/mi/mibank.c,v 1.19 2007/01/01 16:08:21 tsi Exp $ */ - /* * This thing originated from an idea of Edwin Goei and his bank switching * code for the DEC TX board. Index: xc/programs/Xserver/mi/mibank.h diff -u xc/programs/Xserver/mi/mibank.h:1.14 xc/programs/Xserver/mi/mibank.h:1.15 --- xc/programs/Xserver/mi/mibank.h:1.14 Mon Jan 1 08:08:21 2007 +++ xc/programs/Xserver/mi/mibank.h Mon Dec 31 16:40:13 2007 @@ -1,5 +1,6 @@ +/* $XFree86: xc/programs/Xserver/mi/mibank.h,v 1.15 2008/01/01 00:40:13 tsi Exp $ */ /* - * Copyright 1997 through 2007 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * Copyright 1997 through 2008 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -20,8 +21,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/mi/mibank.h,v 1.14 2007/01/01 16:08:21 tsi Exp $ */ - #ifndef __MIBANK_H__ #define __MIBANK_H__ 1 Index: xc/programs/Xserver/os/log.c diff -u xc/programs/Xserver/os/log.c:1.17 xc/programs/Xserver/os/log.c:1.18 --- xc/programs/Xserver/os/log.c:1.17 Fri Nov 3 13:43:24 2006 +++ xc/programs/Xserver/os/log.c Thu May 1 09:13:24 2008 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/os/log.c,v 1.18 2008/05/01 16:13:24 tsi Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -50,7 +51,7 @@ */ /* - * Copyright (c) 1997-2006 by The XFree86 Project, Inc. + * Copyright (c) 1997-2008 by The XFree86 Project, Inc. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining @@ -96,8 +97,6 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $XFree86: xc/programs/Xserver/os/log.c,v 1.17 2006/11/03 21:43:24 tsi Exp $ */ - #include #include #include @@ -117,6 +116,8 @@ static Bool logSync = FALSE; static int logVerbosity = DEFAULT_LOG_VERBOSITY; static int logFileVerbosity = DEFAULT_LOG_FILE_VERBOSITY; +static char *logFileName = NULL; + /* Buffer to information logged before the log file is opened. */ static char *saveBuffer = NULL; @@ -167,8 +168,6 @@ const char * LogInit(const char *fname, const char *backup) { - char *logFileName = NULL; - if (fname && *fname) { xasprintf(&logFileName, fname, display); if (!logFileName) @@ -249,6 +248,20 @@ case XLOG_FILE_VERBOSITY: logFileVerbosity = value; return TRUE; + case XLOG_STDERR: + /* Redirect the server's stderr to log */ + if (!logFileName || (logFile == stderr)) + return FALSE; + + LogWrite(-1, "Redirecting server stderr to \"%s\"\n", logFileName); + fclose(logFile); + logFile = freopen(logFileName, "a+", stderr); + if (!logFile) + abort(); + if (logVerbosity < logFileVerbosity) + logVerbosity = logFileVerbosity; + logFileVerbosity = -2; + return TRUE; default: return FALSE; } @@ -260,23 +273,32 @@ LogVWrite(int verb, const char *f, va_list args) { static char tmpBuffer[1024]; - int len = 0; + int len; + + if ((verb > logFileVerbosity) && (verb > logVerbosity)) + return; /* * Since a va_list can only be processed once, write the string to a * buffer, and then write the buffer out to the appropriate output * stream(s). */ - if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) { - vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args); - len = strlen(tmpBuffer); - } - if ((verb < 0 || logVerbosity >= verb) && len > 0) + vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args); + len = strlen(tmpBuffer); + if (len <= 0) + return; + + if (verb <= logVerbosity) { fwrite(tmpBuffer, len, 1, stderr); - if ((verb < 0 || logFileVerbosity >= verb) && len > 0) { + if (logFile == stderr) + goto FlushLog; + } + + if (verb <= logFileVerbosity) { if (logFile) { fwrite(tmpBuffer, len, 1, logFile); if (logFlush || logSync) { + FlushLog: fflush(logFile); if (logSync) fsync(fileno(logFile)); Index: xc/programs/Xserver/os/osinit.c diff -u xc/programs/Xserver/os/osinit.c:3.34 xc/programs/Xserver/os/osinit.c:3.35 --- xc/programs/Xserver/os/osinit.c:3.34 Thu Mar 16 13:44:00 2006 +++ xc/programs/Xserver/os/osinit.c Fri Oct 31 12:10:42 2008 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.34 2006/03/16 21:44:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.35 2008/10/31 19:10:42 tsi Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -276,11 +276,12 @@ void OsCleanup(Bool terminating) { + if (!terminating) + return; + + CloseWellKnownConnections(); #ifdef SERVER_LOCK - if (terminating) - { - UnlockServer(); - } + UnlockServer(); #endif } Index: xc/programs/Xserver/os/utils.c diff -u xc/programs/Xserver/os/utils.c:3.115 xc/programs/Xserver/os/utils.c:3.116 --- xc/programs/Xserver/os/utils.c:3.115 Tue Jan 23 10:03:12 2007 +++ xc/programs/Xserver/os/utils.c Mon Dec 31 18:02:35 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.116 2008/01/01 02:02:35 tsi Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -48,7 +49,6 @@ OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.115 2007/01/23 18:03:12 tsi Exp $ */ /* * Copyright (c) 1996-2006 by The XFree86 Project, Inc. * All rights reserved. @@ -1886,24 +1886,26 @@ ErrorF("Popen: `%s', fp = %p\n", command, iop); #endif - return iop; #else int ruid, euid; ruid = getuid(); euid = geteuid(); - if (seteuid(ruid) == -1) { - return NULL; - } + if (seteuid(ruid) == -1) + return NULL; + iop = fopen(file, type); if (seteuid(euid) == -1) { + if (iop) fclose(iop); - return NULL; + return NULL; } - return iop; + #endif /* HAS_SAVED_IDS_AND_SETEUID */ + + return iop; } int Index: xc/programs/Xserver/record/record.c diff -u xc/programs/Xserver/record/record.c:1.15 xc/programs/Xserver/record/record.c:1.16 --- xc/programs/Xserver/record/record.c:1.15 Wed Jan 3 18:48:13 2007 +++ xc/programs/Xserver/record/record.c Wed Oct 15 13:59:13 2008 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/record/record.c,v 1.16 2008/10/15 20:59:13 tsi Exp $ */ /* Copyright 1995, 1998 The Open Group @@ -30,7 +31,6 @@ and Jim Haggerty of Metheus. */ -/* $XFree86: xc/programs/Xserver/record/record.c,v 1.15 2007/01/04 02:48:13 tsi Exp $ */ #define NEED_EVENTS #include "dixstruct.h" @@ -2662,7 +2662,7 @@ } /* SProcRecordQueryVersion */ -static void +static int SwapCreateRegister(xRecordRegisterClientsReq *stuff) { register char n; @@ -2673,11 +2673,19 @@ swapl(&stuff->nClients, n); swapl(&stuff->nRanges, n); pClientID = (XID *)&stuff[1]; + if (stuff->nClients > + (stuff->length - (sz_xRecordRegisterClientsReq >> 2))) + return BadLength; for (i = 0; i < stuff->nClients; i++, pClientID++) { swapl(pClientID, n); } + if (stuff->nRanges > + (stuff->length - stuff->nClients - + (sz_xRecordRegisterClientsReq >> 2))) + return BadLength; RecordSwapRanges((xRecordRange *)pClientID, stuff->nRanges); + return Success; } /* SwapCreateRegister */ @@ -2685,11 +2693,13 @@ SProcRecordCreateContext(ClientPtr client) { REQUEST(xRecordCreateContextReq); + int status; register char n; swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq); - SwapCreateRegister((pointer)stuff); + if ((status = SwapCreateRegister((pointer)stuff)) != Success) + return status; return ProcRecordCreateContext(client); } /* SProcRecordCreateContext */ @@ -2698,11 +2708,13 @@ SProcRecordRegisterClients(ClientPtr client) { REQUEST(xRecordRegisterClientsReq); + int status; register char n; swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq); - SwapCreateRegister((pointer)stuff); + if ((status = SwapCreateRegister((pointer)stuff)) != Success) + return status; return ProcRecordRegisterClients(client); } /* SProcRecordRegisterClients */ Index: xc/programs/Xserver/render/glyph.c diff -u xc/programs/Xserver/render/glyph.c:1.7 xc/programs/Xserver/render/glyph.c:1.8 --- xc/programs/Xserver/render/glyph.c:1.7 Wed Jun 30 13:21:46 2004 +++ xc/programs/Xserver/render/glyph.c Wed Oct 15 13:59:13 2008 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/glyph.c,v 1.7 2004/06/30 20:21:46 martin Exp $ + * $XFree86: xc/programs/Xserver/render/glyph.c,v 1.8 2008/10/15 20:59:13 tsi Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -74,9 +74,9 @@ #define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0])) -const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 }; +static const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 }; -GlyphHashRec globalGlyphs[GlyphFormatNum]; +static GlyphHashRec globalGlyphs[GlyphFormatNum]; GlyphHashSetPtr FindGlyphHashSet (CARD32 filled) @@ -328,10 +328,14 @@ GlyphPtr AllocateGlyph (xGlyphInfo *gi, int fdepth) { - int size; + int size, padded_width; GlyphPtr glyph; - size = gi->height * PixmapBytePad (gi->width, glyphDepths[fdepth]); + padded_width = PixmapBytePad(gi->width, glyphDepths[fdepth]); + if (gi->height && (padded_width > + ((((unsigned int)(-1)) - sizeof(GlyphRec)) / gi->height))) + return 0; + size = gi->height * padded_width; glyph = (GlyphPtr) xalloc (size + sizeof (GlyphRec)); if (!glyph) return 0; Index: xc/programs/Xserver/render/glyphstr.h diff -u xc/programs/Xserver/render/glyphstr.h:1.6 xc/programs/Xserver/render/glyphstr.h:1.7 --- xc/programs/Xserver/render/glyphstr.h:1.6 Fri Oct 14 08:17:27 2005 +++ xc/programs/Xserver/render/glyphstr.h Wed Oct 15 13:59:13 2008 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.6 2005/10/14 15:17:27 tsi Exp $ + * $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.7 2008/10/15 20:59:13 tsi Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -89,8 +89,6 @@ PictFormatPtr format; } GlyphListRec, *GlyphListPtr; -extern GlyphHashRec globalGlyphs[GlyphFormatNum]; - GlyphHashSetPtr FindGlyphHashSet (CARD32 filled); Index: xc/programs/Xserver/render/render.c diff -u xc/programs/Xserver/render/render.c:1.36 xc/programs/Xserver/render/render.c:1.37 --- xc/programs/Xserver/render/render.c:1.36 Thu Jun 14 07:30:19 2007 +++ xc/programs/Xserver/render/render.c Wed Oct 15 13:59:13 2008 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/render.c,v 1.36 2007/06/14 14:30:19 tsi Exp $ + * $XFree86: xc/programs/Xserver/render/render.c,v 1.37 2008/10/15 20:59:13 tsi Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -1457,8 +1457,9 @@ pScreen = pSrc->pDrawable->pScreen; width = pSrc->pDrawable->width; height = pSrc->pDrawable->height; - if ( stuff->x > width - || stuff->y > height ) + if (height && width > ((unsigned int)(-1) / (height * sizeof(CARD32)))) + return (BadAlloc); + if ((stuff->x > width) || (stuff->y > height)) return (BadMatch); argbbits = xalloc (width * height * sizeof (CARD32)); if (!argbbits) Index: xc/programs/Xserver/xkb/xkbLEDs.c diff -u xc/programs/Xserver/xkb/xkbLEDs.c:3.10 xc/programs/Xserver/xkb/xkbLEDs.c:3.11 --- xc/programs/Xserver/xkb/xkbLEDs.c:3.10 Fri Oct 14 08:17:28 2005 +++ xc/programs/Xserver/xkb/xkbLEDs.c Tue Mar 18 13:24:05 2008 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/xkb/xkbLEDs.c,v 3.11 2008/03/18 20:24:05 tsi Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -23,7 +24,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbLEDs.c,v 3.10 2005/10/14 15:17:28 tsi Exp $ */ #include #include @@ -60,6 +60,9 @@ sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); + if (!sli) + return update; + if (state_changes&(XkbModifierStateMask|XkbGroupStateMask)) update|= sli->usesEffective; if (state_changes&(XkbModifierBaseMask|XkbGroupBaseMask)) Index: xc/programs/lbxproxy/Imakefile diff -u xc/programs/lbxproxy/Imakefile:1.16 xc/programs/lbxproxy/Imakefile:1.17 --- xc/programs/lbxproxy/Imakefile:1.16 Sat Jan 28 18:31:23 2006 +++ xc/programs/lbxproxy/Imakefile Wed Mar 26 10:47:27 2008 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/lbxproxy/Imakefile,v 1.16 2006/01/29 02:31:23 tsi Exp $ +XCOMM $XFree86: xc/programs/lbxproxy/Imakefile,v 1.17 2008/03/26 17:47:27 tsi Exp $ #include #define IHaveSubdirs @@ -19,10 +19,6 @@ #endif #endif -os/LibraryTargetName(os): os - -di/LibraryTargetName(dilbx): di - ServerTarget(lbxproxy,$(SUBDIRS),di/main.o,$(LBXLIBS),$(OTHERLIBS)) LinkConfDirectory(lbxproxy,.,lbxproxy,.) Index: xc/programs/mkfontscale/mkfontscale.c diff -u xc/programs/mkfontscale/mkfontscale.c:1.25 xc/programs/mkfontscale/mkfontscale.c:1.26 --- xc/programs/mkfontscale/mkfontscale.c:1.25 Mon Apr 25 17:44:07 2005 +++ xc/programs/mkfontscale/mkfontscale.c Sat Sep 15 20:44:18 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/mkfontscale/mkfontscale.c,v 1.26 2007/09/16 03:44:18 tsi Exp $ */ /* Copyright (c) 2002-2003 by Juliusz Chroboczek @@ -19,7 +20,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/mkfontscale/mkfontscale.c,v 1.25 2005/04/26 00:44:07 dawes Exp $ */ #include #include @@ -447,9 +447,7 @@ } } weightL[i] = '\0'; - if(!weightL) - return NULL; - else return weightL; + return weightL; } static int Index: xc/programs/twm/Imakefile diff -u xc/programs/twm/Imakefile:3.17 xc/programs/twm/Imakefile:3.18 --- xc/programs/twm/Imakefile:3.17 Mon Jan 9 07:00:53 2006 +++ xc/programs/twm/Imakefile Tue Oct 9 17:31:38 2007 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/twm/Imakefile,v 3.17 2006/01/09 15:00:53 dawes Exp $ +XCOMM $XFree86: xc/programs/twm/Imakefile,v 3.18 2007/10/10 00:31:38 tsi Exp $ #if HasMkstemp MKTMP_DEFINES = -DHAS_MKSTEMP @@ -10,12 +10,12 @@ DEFINES = $(SIGNAL_DEFINES) $(MKTMP_DEFINES) XkbClientDefines SRCS = gram.c lex.c deftwmrc.c add_window.c gc.c list.c twm.c \ - parse.c menus.c events.c resize.c util.c version.c iconmgr.c \ - cursor.c icons.c session.c + parse.c menus.c events.c resize.c util.c version.c \ + iconmgr.c cursor.c icons.c session.c OBJS = gram.o lex.o deftwmrc.o add_window.o gc.o list.o twm.o \ - parse.o menus.o events.o resize.o util.o version.o iconmgr.o \ - cursor.o icons.o session.o + parse.o menus.o events.o resize.o util.o version.o \ + iconmgr.o cursor.o icons.o session.o all:: @@ -28,9 +28,9 @@ YaccFile(gram,$(YFLAGS)) -includes:: deftwmrc.c +includes:: deftwmrc.c -depend:: deftwmrc.c +depend:: deftwmrc.c clean:: RemoveFile(deftwmrc.c) Index: xc/programs/twm/add_window.c diff -u xc/programs/twm/add_window.c:1.16 xc/programs/twm/add_window.c:1.18 --- xc/programs/twm/add_window.c:1.16 Sun Dec 10 07:58:34 2006 +++ xc/programs/twm/add_window.c Wed Oct 10 08:23:02 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/add_window.c,v 1.16 2006/12/10 15:58:34 tsi Exp $ */ +/* $XFree86: xc/programs/twm/add_window.c,v 1.18 2007/10/10 15:23:02 tsi Exp $ */ /*****************************************************************************/ /* @@ -100,13 +100,11 @@ * Procedure: * GetGravityOffsets - map gravity to (x,y) offset signs for adding * to x and y when window is mapped to get proper placement. - * + * ************************************************************************ */ void -GetGravityOffsets (tmp, xp, yp) - TwmWindow *tmp; /* window from which to get gravity */ - int *xp, *yp; /* return values */ +GetGravityOffsets (TwmWindow *tmp, int *xp, int *yp) { static struct _gravity_offset { int x, y; @@ -123,8 +121,8 @@ { 1, 1 }, /* SouthEastGravity */ { 0, 0 }, /* StaticGravity */ }; - register int g = ((tmp->hints.flags & PWinGravity) - ? tmp->hints.win_gravity : NorthWestGravity); + int g = ((tmp->hints.flags & PWinGravity) ? + tmp->hints.win_gravity : NorthWestGravity); if (g < ForgetGravity || g > StaticGravity) { *xp = *yp = 0; @@ -154,10 +152,7 @@ */ TwmWindow * -AddWindow(w, iconm, iconp) -Window w; -int iconm; -IconMgr *iconp; +AddWindow(Window w, int iconm, IconMgr *iconp) { TwmWindow *tmp_win; /* new twm window structure */ int stat; @@ -225,7 +220,7 @@ tmp_win->widthEverChangedByUser = width_ever_changed_by_user; tmp_win->heightEverChangedByUser = height_ever_changed_by_user; - + if (width_ever_changed_by_user) tmp_win->attr.width = saved_width; @@ -269,7 +264,7 @@ } } - if (tmp_win->wmhints && (tmp_win->wmhints->flags & WindowGroupHint)) + if (tmp_win->wmhints && (tmp_win->wmhints->flags & WindowGroupHint)) tmp_win->group = tmp_win->wmhints->window_group; else tmp_win->group = tmp_win->w/* NULL */; @@ -283,26 +278,26 @@ tmp_win->nameChanged = 0; if (tmp_win->class.res_name == NULL) - tmp_win->class.res_name = NoName; + tmp_win->class.res_name = NoName; if (tmp_win->class.res_class == NULL) - tmp_win->class.res_class = NoName; + tmp_win->class.res_class = NoName; tmp_win->full_name = strdup(tmp_win->name); namelen = strlen (tmp_win->name); - tmp_win->highlight = Scr->Highlight && - (!(short)(long) LookInList(Scr->NoHighlight, tmp_win->full_name, + tmp_win->highlight = Scr->Highlight && + (!(short)(long) LookInList(Scr->NoHighlight, tmp_win->full_name, &tmp_win->class)); tmp_win->stackmode = Scr->StackMode && - (!(short)(long) LookInList(Scr->NoStackModeL, tmp_win->full_name, + (!(short)(long) LookInList(Scr->NoStackModeL, tmp_win->full_name, &tmp_win->class)); - tmp_win->titlehighlight = Scr->TitleHighlight && - (!(short)(long) LookInList(Scr->NoTitleHighlight, tmp_win->full_name, + tmp_win->titlehighlight = Scr->TitleHighlight && + (!(short)(long) LookInList(Scr->NoTitleHighlight, tmp_win->full_name, &tmp_win->class)); - tmp_win->auto_raise = (short)(long) LookInList(Scr->AutoRaise, + tmp_win->auto_raise = (short)(long) LookInList(Scr->AutoRaise, tmp_win->full_name, &tmp_win->class); if (tmp_win->auto_raise) Scr->NumAutoRaises++; @@ -313,7 +308,7 @@ !(short)(long) LookInList(Scr->DontIconify, tmp_win->full_name, &tmp_win->class); } - tmp_win->iconify_by_unmapping |= + tmp_win->iconify_by_unmapping |= (short)(long) LookInList(Scr->IconifyByUn, tmp_win->full_name, &tmp_win->class); @@ -337,7 +332,7 @@ * since it is coming from the screen list */ if (HasShape) { - if (!LookInList (Scr->DontSqueezeTitleL, tmp_win->full_name, + if (!LookInList (Scr->DontSqueezeTitleL, tmp_win->full_name, &tmp_win->class)) { tmp_win->squeeze_info = (SqueezeInfo *) LookInList (Scr->SqueezeTitleL, tmp_win->full_name, @@ -353,19 +348,19 @@ tmp_win->old_bw = tmp_win->attr.border_width; if (Scr->ClientBorderWidth) { - tmp_win->frame_bw = tmp_win->old_bw; + tmp_win->frame_bw = tmp_win->old_bw; } else { - tmp_win->frame_bw = Scr->BorderWidth; + tmp_win->frame_bw = Scr->BorderWidth; } bw2 = tmp_win->frame_bw * 2; tmp_win->title_height = Scr->TitleHeight + tmp_win->frame_bw; if (Scr->NoTitlebar) - tmp_win->title_height = 0; + tmp_win->title_height = 0; if (LookInList(Scr->MakeTitle, tmp_win->full_name, &tmp_win->class)) - tmp_win->title_height = Scr->TitleHeight + tmp_win->frame_bw; + tmp_win->title_height = Scr->TitleHeight + tmp_win->frame_bw; if (LookInList(Scr->NoTitle, tmp_win->full_name, &tmp_win->class)) - tmp_win->title_height = 0; + tmp_win->title_height = 0; /* if it is a transient window, don't put a title on it */ if (tmp_win->transient && !Scr->DecorateTransients) @@ -400,19 +395,19 @@ /* * Don't bother user if: - * + * * o the window is a transient, or - * + * * o a USPosition was requested, or - * + * * o a PPosition was requested and UsePPosition is ON or * NON_ZERO if the window is at other than (0,0) */ ask_user = TRUE; - if (tmp_win->transient || + if (tmp_win->transient || (tmp_win->hints.flags & USPosition) || - ((tmp_win->hints.flags & PPosition) && Scr->UsePPosition && - (Scr->UsePPosition == PPOS_ON || + ((tmp_win->hints.flags & PPosition) && Scr->UsePPosition && + (Scr->UsePPosition == PPOS_ON || tmp_win->attr.x != 0 || tmp_win->attr.y != 0))) ask_user = FALSE; @@ -436,7 +431,7 @@ { Bool firsttime = True; - /* better wait until all the mouse buttons have been + /* better wait until all the mouse buttons have been * released. */ while (TRUE) @@ -446,7 +441,7 @@ XGrabServer(dpy); JunkMask = 0; - if (!XQueryPointer (dpy, Scr->Root, &JunkRoot, + if (!XQueryPointer (dpy, Scr->Root, &JunkRoot, &JunkChild, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask)) JunkMask = 0; @@ -459,7 +454,7 @@ */ if (firsttime) { if (JunkRoot != Scr->Root) { - register int scrnum; + int scrnum; for (scrnum = 0; scrnum < NumScreens; scrnum++) { if (JunkRoot == RootWindow (dpy, scrnum)) break; @@ -475,7 +470,7 @@ */ if (JunkMask != 0) continue; - /* + /* * this will cause a warp to the indicated root */ stat = XGrabPointer(dpy, Scr->Root, False, @@ -491,7 +486,7 @@ width = (SIZE_HINDENT + MyFont_TextWidth (&Scr->SizeFont, tmp_win->name, namelen)); height = Scr->SizeFont.height + SIZE_VINDENT * 2; - + XResizeWindow (dpy, Scr->SizeWindow, width + SIZE_HINDENT, height); XMapRaised(dpy, Scr->SizeWindow); InstallRootColormap(); @@ -506,24 +501,24 @@ AddingW = tmp_win->attr.width + bw2; AddingH = tmp_win->attr.height + tmp_win->title_height + bw2; - - if (Scr->DontMoveOff) { - /* - * Make sure the initial outline comes up on the screen. - */ - if (AddingX < 0) - AddingX = 0; - if (AddingX > Scr->MyDisplayWidth - AddingW) - AddingX = Scr->MyDisplayWidth - AddingW; - - if (AddingY < 0) - AddingY = 0; - if (AddingY > Scr->MyDisplayHeight - AddingH) - AddingY = Scr->MyDisplayHeight - AddingH; - } + + if (Scr->DontMoveOff) { + /* + * Make sure the initial outline comes up on the screen. + */ + if (AddingX < 0) + AddingX = 0; + if (AddingX > Scr->MyDisplayWidth - AddingW) + AddingX = Scr->MyDisplayWidth - AddingW; + + if (AddingY < 0) + AddingY = 0; + if (AddingY > Scr->MyDisplayHeight - AddingH) + AddingY = Scr->MyDisplayHeight - AddingH; + } MoveOutline(Scr->Root, AddingX, AddingY, AddingW, AddingH, - tmp_win->frame_bw, tmp_win->title_height); + tmp_win->frame_bw, tmp_win->title_height); while (TRUE) { @@ -536,30 +531,30 @@ if (Event.type == ButtonPress) break; } - + if (event.type == ButtonPress) { AddingX = event.xbutton.x_root; AddingY = event.xbutton.y_root; - + /* DontMoveOff prohibits user form off-screen placement */ - if (Scr->DontMoveOff) - { + if (Scr->DontMoveOff) + { int AddingR, AddingB; - + AddingR = AddingX + AddingW; AddingB = AddingY + AddingH; - + if (AddingX < 0) AddingX = 0; if (AddingR > Scr->MyDisplayWidth) AddingX = Scr->MyDisplayWidth - AddingW; - + if (AddingY < 0) AddingY = 0; if (AddingB > Scr->MyDisplayHeight) AddingY = Scr->MyDisplayHeight - AddingH; - - } + + } break; } @@ -576,11 +571,11 @@ AddingR = AddingX + AddingW; AddingB = AddingY + AddingH; - + if (AddingX < 0) - AddingX = 0; + AddingX = 0; if (AddingR > Scr->MyDisplayWidth) - AddingX = Scr->MyDisplayWidth - AddingW; + AddingX = Scr->MyDisplayWidth - AddingW; if (AddingY < 0) AddingY = 0; @@ -607,7 +602,7 @@ if (0/*Scr->AutoRelativeResize*/) { int dx = (tmp_win->attr.width / 4); int dy = (tmp_win->attr.height / 4); - + #define HALF_AVE_CURSOR_SIZE 8 /* so that it is visible */ if (dx < HALF_AVE_CURSOR_SIZE) dx = HALF_AVE_CURSOR_SIZE; if (dy < HALF_AVE_CURSOR_SIZE) dy = HALF_AVE_CURSOR_SIZE; @@ -653,7 +648,7 @@ /* * XXX - if we are going to do a loop, we ought to consider - * using multiple GXxor lines so that we don't need to + * using multiple GXxor lines so that we don't need to * grab the server. */ XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, @@ -668,7 +663,7 @@ } } - } + } else if (event.xbutton.button == Button3) { int maxw = Scr->MyDisplayWidth - AddingX - bw2; @@ -711,7 +706,7 @@ #ifdef DEBUG - fprintf(stderr, " position window %d, %d %dx%d\n", + fprintf(stderr, " position window %d, %d %dx%d\n", tmp_win->attr.x, tmp_win->attr.y, tmp_win->attr.width, @@ -750,9 +745,9 @@ /* * Make sure the client window still exists. We don't want to leave an - * orphan frame window if it doesn't. Since we now have the server - * grabbed, the window can't disappear later without having been - * reparented, so we'll get a DestroyNotify for it. We won't have + * orphan frame window if it doesn't. Since we now have the server + * grabbed, the window can't disappear later without having been + * reparented, so we'll get a DestroyNotify for it. We won't have * gotten one for anything up to here, however. */ if (XGetGeometry(dpy, tmp_win->w, &JunkRoot, &JunkX, &JunkY, @@ -811,7 +806,7 @@ attributes.background_pixmap = None; attributes.border_pixel = tmp_win->border; attributes.cursor = Scr->FrameCursor; - attributes.event_mask = (SubstructureRedirectMask | + attributes.event_mask = (SubstructureRedirectMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask); if (tmp_win->attr.save_under) { @@ -820,14 +815,14 @@ } tmp_win->frame = XCreateWindow (dpy, Scr->Root, tmp_win->frame_x, - tmp_win->frame_y, + tmp_win->frame_y, (unsigned int) tmp_win->frame_width, (unsigned int) tmp_win->frame_height, (unsigned int) tmp_win->frame_bw, Scr->d_depth, (unsigned int) CopyFromParent, Scr->d_visual, valuemask, &attributes); - + if (tmp_win->title_height) { valuemask = (CWEventMask | CWBorderPixel | CWBackPixel); @@ -835,10 +830,10 @@ ButtonReleaseMask | ExposureMask); attributes.border_pixel = tmp_win->border; attributes.background_pixel = tmp_win->title.back; - tmp_win->title_w = XCreateWindow (dpy, tmp_win->frame, + tmp_win->title_w = XCreateWindow (dpy, tmp_win->frame, -tmp_win->frame_bw, -tmp_win->frame_bw, - (unsigned int) tmp_win->attr.width, + (unsigned int) tmp_win->attr.width, (unsigned int) Scr->TitleHeight, (unsigned int) tmp_win->frame_bw, Scr->d_depth, @@ -853,8 +848,8 @@ if (tmp_win->highlight) { - tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, - gray_bits, gray_width, gray_height, + tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, + gray_bits, gray_width, gray_height, tmp_win->border_tile.fore, tmp_win->border_tile.back, Scr->d_depth); @@ -863,7 +858,7 @@ else tmp_win->gray = None; - + if (tmp_win->title_w) { CreateWindowTitlebarButtons (tmp_win); ComputeTitleLocation (tmp_win); @@ -881,7 +876,7 @@ if (HasShape) XShapeSelectInput (dpy, tmp_win->w, ShapeNotifyMask); - + if (tmp_win->title_w) { XMapWindow (dpy, tmp_win->title_w); } @@ -900,7 +895,7 @@ if (!tmp_win->iconmgr) XAddToSaveSet(dpy, tmp_win->w); - + XReparentWindow(dpy, tmp_win->w, tmp_win->frame, 0, tmp_win->title_height); /* * Reparenting generates an UnmapNotify event, followed by a MapNotify. @@ -914,7 +909,7 @@ tmp_win->frame_width, tmp_win->frame_height, -1, True); /* wait until the window is iconified and the icon window is mapped - * before creating the icon window + * before creating the icon window */ tmp_win->icon_w = (Window) 0; @@ -953,7 +948,7 @@ XUngrabServer(dpy); /* if we were in the middle of a menu activated function, regrab - * the pointer + * the pointer */ if (RootFunction) ReGrab(); @@ -979,8 +974,7 @@ */ int -MappedNotOverride(w) - Window w; +MappedNotOverride(Window w) { XWindowAttributes wa; @@ -990,14 +984,13 @@ /*********************************************************************** - * + * * Procedure: * AddDefaultBindings - attach default bindings so that naive users * don't get messed up if they provide a minimal twmrc. */ -static void do_add_binding (button, context, modifier, func) - int button, context, modifier; - int func; +static void +do_add_binding (int button, int context, int modifier, int func) { MouseButton *mb = &Scr->Mouse[button][context][modifier]; @@ -1008,7 +1001,7 @@ } void -AddDefaultBindings () +AddDefaultBindings (void) { /* * The bindings are stored in Scr->Mouse, indexed by @@ -1043,8 +1036,7 @@ */ void -GrabButtons(tmp_win) -TwmWindow *tmp_win; +GrabButtons(TwmWindow *tmp_win) { int i, j; @@ -1054,12 +1046,12 @@ { if (Scr->Mouse[i][C_WINDOW][j].func != 0) { - /* twm used to do this grab on the application main window, - * tmp_win->w . This was not ICCCM complient and was changed. + /* twm used to do this grab on the application main window, + * tmp_win->w . This was not ICCCM complient and was changed. */ - XGrabButton(dpy, i, j, tmp_win->frame, + XGrabButton(dpy, i, j, tmp_win->frame, True, ButtonPressMask | ButtonReleaseMask, - GrabModeAsync, GrabModeAsync, None, + GrabModeAsync, GrabModeAsync, None, Scr->FrameCursor); } } @@ -1078,8 +1070,7 @@ */ void -GrabKeys(tmp_win) -TwmWindow *tmp_win; +GrabKeys(TwmWindow *tmp_win) { FuncKey *tmp; IconMgr *p; @@ -1134,8 +1125,8 @@ } } -static Window CreateHighlightWindow (tmp_win) - TwmWindow *tmp_win; +static Window +CreateHighlightWindow (TwmWindow *tmp_win) { XSetWindowAttributes attributes; /* attributes for create windows */ Pixmap pm = None; @@ -1155,12 +1146,12 @@ * Pixmaps { TitleHighlight "hline2" } * * (or whatever the horizontal line bitmap is named) in the startup - * file. If all else fails, use the foreground color to look like a + * file. If all else fails, use the foreground color to look like a * solid line. */ if (!Scr->hilitePm) { - Scr->hilitePm = XCreateBitmapFromData (dpy, tmp_win->title_w, - gray_bits, gray_width, + Scr->hilitePm = XCreateBitmapFromData (dpy, tmp_win->title_w, + gray_bits, gray_width, gray_height); Scr->hilite_pm_width = gray_width; Scr->hilite_pm_height = gray_height; @@ -1176,7 +1167,7 @@ (GCForeground|GCBackground|GCGraphicsExposures), &gcv); if (gc) { - XCopyPlane (dpy, Scr->hilitePm, pm, gc, 0, 0, + XCopyPlane (dpy, Scr->hilitePm, pm, gc, 0, 0, Scr->hilite_pm_width, Scr->hilite_pm_height, 0, 0, 1); XFreeGC (dpy, gc); @@ -1203,7 +1194,8 @@ } -void ComputeCommonTitleOffsets () +void +ComputeCommonTitleOffsets (void) { int buttonwidth = (Scr->TBInfo.width + Scr->TBInfo.pad); @@ -1217,27 +1209,23 @@ Scr->TBInfo.rightoff += (Scr->ButtonIndent + ((Scr->TBInfo.nright * buttonwidth) - Scr->TBInfo.pad)); - return; } -void ComputeWindowTitleOffsets (tmp_win, width, squeeze) - TwmWindow *tmp_win; - int width; - Bool squeeze; +void +ComputeWindowTitleOffsets (TwmWindow *tmp_win, int width, Bool squeeze) { tmp_win->highlightx = (Scr->TBInfo.titlex + tmp_win->name_width); - if (tmp_win->hilite_w || Scr->TBInfo.nright > 0) + if (tmp_win->hilite_w || Scr->TBInfo.nright > 0) tmp_win->highlightx += Scr->TitlePadding; tmp_win->rightx = width - Scr->TBInfo.rightoff; if (squeeze && tmp_win->squeeze_info) { - int rx = (tmp_win->highlightx + + int rx = (tmp_win->highlightx + (tmp_win->hilite_w ? Scr->TBInfo.width * 2 : 0) + (Scr->TBInfo.nright > 0 ? Scr->TitlePadding : 0) + Scr->FramePadding); if (rx < tmp_win->rightx) tmp_win->rightx = rx; } - return; } @@ -1246,14 +1234,14 @@ * to take the frame_bw into account since we want (0,0) of the title window * to line up with (0,0) of the frame window. */ -void ComputeTitleLocation (tmp) - register TwmWindow *tmp; +void +ComputeTitleLocation (TwmWindow *tmp) { tmp->title_x = -tmp->frame_bw; tmp->title_y = -tmp->frame_bw; if (tmp->squeeze_info) { - register SqueezeInfo *si = tmp->squeeze_info; + SqueezeInfo *si = tmp->squeeze_info; int basex; int maxwidth = tmp->frame_width; int tw = tmp->title_width; @@ -1297,8 +1285,8 @@ } -static void CreateWindowTitlebarButtons (tmp_win) - TwmWindow *tmp_win; +static void +CreateWindowTitlebarButtons (TwmWindow *tmp_win) { unsigned long valuemask; /* mask for create windows */ XSetWindowAttributes attributes; /* attributes for create windows */ @@ -1336,7 +1324,7 @@ if (nb > 0) { tmp_win->titlebuttons = (TBWindow *) malloc (nb * sizeof(TBWindow)); if (!tmp_win->titlebuttons) { - fprintf (stderr, "%s: unable to allocate %d titlebuttons\n", + fprintf (stderr, "%s: unable to allocate %d titlebuttons\n", ProgramName, nb); } else { TBWindow *tbw; @@ -1365,19 +1353,17 @@ } } - tmp_win->hilite_w = (tmp_win->titlehighlight + tmp_win->hilite_w = (tmp_win->titlehighlight ? CreateHighlightWindow (tmp_win) : None); XMapSubwindows(dpy, tmp_win->title_w); if (tmp_win->hilite_w) XUnmapWindow(dpy, tmp_win->hilite_w); - return; } void -SetHighlightPixmap (filename) - char *filename; +SetHighlightPixmap (char *filename) { Pixmap pm = GetBitmap (filename); @@ -1393,16 +1379,15 @@ void -FetchWmProtocols (tmp) - TwmWindow *tmp; +FetchWmProtocols (TwmWindow *tmp) { unsigned long flags = 0L; Atom *protocols = NULL; int n; if (XGetWMProtocols (dpy, tmp->w, &protocols, &n)) { - register int i; - register Atom *ap; + int i; + Atom *ap; for (i = 0, ap = protocols; i < n; i++, ap++) { if (*ap == _XA_WM_TAKE_FOCUS) flags |= DoesWmTakeFocus; @@ -1415,8 +1400,7 @@ } TwmColormap * -CreateTwmColormap(c) - Colormap c; +CreateTwmColormap(Colormap c) { TwmColormap *cmap; cmap = (TwmColormap *) malloc(sizeof(TwmColormap)); @@ -1434,10 +1418,7 @@ } ColormapWindow * -CreateColormapWindow(w, creating_parent, property_window) - Window w; - Bool creating_parent; - Bool property_window; +CreateColormapWindow(Window w, Bool creating_parent, Bool property_window) { ColormapWindow *cwin; TwmColormap *cmap; @@ -1490,11 +1471,10 @@ return (cwin); } -void -FetchWmColormapWindows (tmp) - TwmWindow *tmp; +void +FetchWmColormapWindows (TwmWindow *tmp) { - register int i, j; + int i, j; Window *cmap_windows = NULL; Bool can_free_cmap_windows = False; int number_cmap_windows = 0; @@ -1503,14 +1483,14 @@ number_cmap_windows = 0; - if (/* SUPPRESS 560 */(previously_installed = + if (/* SUPPRESS 560 */(previously_installed = (Scr->cmapInfo.cmaps == &tmp->cmaps && tmp->cmaps.number_cwins))) { cwins = tmp->cmaps.cwins; for (i = 0; i < tmp->cmaps.number_cwins; i++) cwins[i]->colormap->state = 0; } - if (XGetWMColormapWindows (dpy, tmp->w, &cmap_windows, + if (XGetWMColormapWindows (dpy, tmp->w, &cmap_windows, &number_cmap_windows) && number_cmap_windows > 0) { @@ -1526,7 +1506,7 @@ (Window *) malloc (sizeof(Window) * (number_cmap_windows + 1)); if (!new_cmap_windows) { - fprintf (stderr, + fprintf (stderr, "%s: unable to allocate %d element colormap window array\n", ProgramName, number_cmap_windows+1); goto done; @@ -1602,9 +1582,9 @@ tmp->cmaps.cwins = cwins; tmp->cmaps.number_cwins = number_cmap_windows; if (number_cmap_windows > 1) - tmp->cmaps.scoreboard = + tmp->cmaps.scoreboard = (char *) calloc(1, ColormapsScoreboardLength(&tmp->cmaps)); - + if (previously_installed) InstallWindowColormaps(PropertyNotify, (TwmWindow *) NULL); @@ -1615,13 +1595,11 @@ else XFree ((char *) cmap_windows); } - - return; } -void GetWindowSizeHints (tmp) - TwmWindow *tmp; +void +GetWindowSizeHints (TwmWindow *tmp) { long supplied = 0; @@ -1638,7 +1616,7 @@ NorthEastGravity, NorthWestGravity }; int right = tmp->attr.x + tmp->attr.width + 2 * tmp->old_bw; int bottom = tmp->attr.y + tmp->attr.height + 2 * tmp->old_bw; - tmp->hints.win_gravity = + tmp->hints.win_gravity = gravs[((Scr->MyDisplayHeight - bottom < tmp->title_height) ? 0 : 2) | ((Scr->MyDisplayWidth - right < tmp->title_height) ? 0 : 1)]; tmp->hints.flags |= PWinGravity; Index: xc/programs/twm/add_window.h diff -u xc/programs/twm/add_window.h:1.7 xc/programs/twm/add_window.h:1.9 --- xc/programs/twm/add_window.h:1.7 Mon Jan 9 07:00:53 2006 +++ xc/programs/twm/add_window.h Wed Oct 10 08:23:02 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/add_window.h,v 1.9 2007/10/10 15:23:02 tsi Exp $ */ /*****************************************************************************/ /* @@ -48,7 +49,6 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/add_window.h,v 1.7 2006/01/09 15:00:53 dawes Exp $ */ /********************************************************************** @@ -78,10 +78,9 @@ extern void GrabKeys ( TwmWindow *tmp_win ); extern int MappedNotOverride ( Window w ); extern void SetHighlightPixmap ( char *filename ); -extern int AddingX; +extern int AddingX; extern int AddingY; extern int AddingW; extern int AddingH; #endif /* _ADD_WINDOW_ */ - Index: xc/programs/twm/cursor.c diff -u xc/programs/twm/cursor.c:1.6 xc/programs/twm/cursor.c:1.7 --- xc/programs/twm/cursor.c:1.6 Mon Jan 9 07:00:53 2006 +++ xc/programs/twm/cursor.c Tue Oct 9 17:31:39 2007 @@ -1,5 +1,6 @@ +/* $XFree86: xc/programs/twm/cursor.c,v 1.7 2007/10/10 00:31:39 tsi Exp $ */ /* - * + * Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -22,7 +23,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ -/* $XFree86: xc/programs/twm/cursor.c,v 1.6 2006/01/09 15:00:53 dawes Exp $ */ /*********************************************************************** * @@ -123,10 +123,8 @@ {"xterm", XC_xterm, None}, }; -void -NewFontCursor (cp, str) - Cursor *cp; - char *str; +void +NewFontCursor (Cursor *cp, char *str) { int i; @@ -141,14 +139,12 @@ return; } } - fprintf (stderr, "%s: unable to find font cursor \"%s\"\n", + fprintf (stderr, "%s: unable to find font cursor \"%s\"\n", ProgramName, str); } void -NewBitmapCursor(cp, source, mask) - Cursor *cp; - char *source, *mask; +NewBitmapCursor(Cursor *cp, char *source, char *mask) { int hotx, hoty; int sx, sy, mx, my; @@ -166,7 +162,7 @@ XGetGeometry(dpy, mpm, &JunkRoot, &mx, &my, &mw, &mh, &JunkBW,&JunkDepth); if (sw != mw || sh != mh) { - fprintf (stderr, + fprintf (stderr, "%s: cursor bitmaps \"%s\" and \"%s\" not the same size\n", ProgramName, source, mask); return; Index: xc/programs/twm/events.c diff -u xc/programs/twm/events.c:1.16 xc/programs/twm/events.c:1.18 --- xc/programs/twm/events.c:1.16 Mon Jan 9 07:00:53 2006 +++ xc/programs/twm/events.c Wed Oct 10 08:23:02 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/events.c,v 1.16 2006/01/09 15:00:53 dawes Exp $ */ +/* $XFree86: xc/programs/twm/events.c,v 1.18 2007/10/10 15:23:02 tsi Exp $ */ /*****************************************************************************/ /* @@ -84,8 +84,8 @@ XEvent Event; /* the current event */ TwmWindow *Tmp_win; /* the current twm window */ -/* Used in HandleEnterNotify to remove border highlight from a window - * that has not recieved a LeaveNotify event because of a pointer grab +/* Used in HandleEnterNotify to remove border highlight from a window + * that has not recieved a LeaveNotify event because of a pointer grab */ TwmWindow *UnHighLight_win = NULL; @@ -115,8 +115,8 @@ int Cancel = FALSE; -void AutoRaiseWindow (tmp) - TwmWindow *tmp; +void +AutoRaiseWindow (TwmWindow *tmp) { XRaiseWindow (dpy, tmp->frame); XSync (dpy, 0); @@ -125,8 +125,8 @@ raise_win = tmp; } -void SetRaiseWindow (tmp) - TwmWindow *tmp; +void +SetRaiseWindow (TwmWindow *tmp) { enter_flag = TRUE; enter_win = NULL; @@ -145,7 +145,7 @@ */ void -InitEvents() +InitEvents(void) { int i; @@ -184,8 +184,8 @@ Time lastTimestamp = CurrentTime; /* until Xlib does this for us */ -Bool StashEventTime (ev) - register XEvent *ev; +Bool +StashEventTime (XEvent *ev) { switch (ev->type) { case KeyPress: @@ -226,8 +226,8 @@ * window may not be the same as XEvent.xany.window (the first window listed * in the structure). */ -Window WindowOfEvent (e) - XEvent *e; +Window +WindowOfEvent (XEvent *e) { /* * Each window subfield is marked with whether or not it is the same as @@ -277,7 +277,7 @@ /*********************************************************************** * * Procedure: - * DispatchEvent2 - + * DispatchEvent2 - * handle a single X event stored in global var Event * this rouitine for is for a call during an f.move * @@ -285,7 +285,7 @@ */ Bool -DispatchEvent2() +DispatchEvent2(void) { Window w = Event.xany.window; StashEventTime (&Event); @@ -320,7 +320,7 @@ */ Bool -DispatchEvent() +DispatchEvent(void) { Window w = Event.xany.window; StashEventTime (&Event); @@ -352,7 +352,7 @@ */ void -HandleEvents() +HandleEvents(void) { while (TRUE) { @@ -390,7 +390,7 @@ */ void -HandleColormapNotify() +HandleColormapNotify(void) { XColormapEvent *cevent = (XColormapEvent *) &Event; ColormapWindow *cwin, **cwins; @@ -547,7 +547,7 @@ */ void -HandleVisibilityNotify() +HandleVisibilityNotify(void) { XVisibilityEvent *vevent = (XVisibilityEvent *) &Event; ColormapWindow *cwin; @@ -555,7 +555,7 @@ if (XFindContext(dpy, vevent->window, ColormapContext, (caddr_t *)&cwin) == XCNOENT) return; - + /* * when Saber complains about retreiving an from an * just type "touch vevent->state" and "cont" @@ -585,7 +585,7 @@ int MovedFromKeyPress = False; void -HandleKeyPress() +HandleKeyPress(void) { KeySym ks; FuncKey *key; @@ -617,18 +617,18 @@ ks = XLookupKeysym((XKeyEvent *) &Event, /* KeySyms index */ 0); for (key = Scr->FuncKeyRoot.next; key != NULL; key = key->next) { - if (key->keysym == ks && + if (key->keysym == ks && key->mods == modifier && (key->cont == Context || key->cont == C_NAME)) { /* weed out the functions that don't make sense to execute - * from a key press + * from a key press */ if (key->func == F_RESIZE) return; - /* special case for F_MOVE/F_FORCEMOVE activated from a keypress */ - if (key->func == F_MOVE || key->func == F_FORCEMOVE) - MovedFromKeyPress = True; + /* special case for F_MOVE/F_FORCEMOVE activated from a keypress */ + if (key->func == F_MOVE || key->func == F_FORCEMOVE) + MovedFromKeyPress = True; if (key->cont != C_NAME) { @@ -693,24 +693,22 @@ */ if (Tmp_win) { - if (Event.xany.window == Tmp_win->icon_w || + if (Event.xany.window == Tmp_win->icon_w || Event.xany.window == Tmp_win->frame || Event.xany.window == Tmp_win->title_w || (Tmp_win->list && (Event.xany.window == Tmp_win->list->w))) - { - Event.xkey.window = Tmp_win->w; - XSendEvent(dpy, Tmp_win->w, False, KeyPressMask, &Event); - } + { + Event.xkey.window = Tmp_win->w; + XSendEvent(dpy, Tmp_win->w, False, KeyPressMask, &Event); + } } } -static void -free_window_names (tmp, nukefull, nukename, nukeicon) - TwmWindow *tmp; - Bool nukefull, nukename, nukeicon; +static void +free_window_names (TwmWindow *tmp, Bool nukefull, Bool nukename, Bool nukeicon) { /* * XXX - are we sure that nobody ever sets these to another constant (check @@ -722,14 +720,12 @@ if (nukefull && tmp->full_name) free (tmp->full_name); if (nukename && tmp->name) free (tmp->name); if (nukeicon && tmp->icon_name) free (tmp->icon_name); - return; } -void -free_cwins (tmp) - TwmWindow *tmp; +void +free_cwins (TwmWindow *tmp) { int i; TwmColormap *cmap; @@ -766,7 +762,7 @@ */ void -HandlePropertyNotify() +HandlePropertyNotify(void) { char *name = NULL; unsigned long valuemask; /* mask for create windows */ @@ -780,7 +776,7 @@ switch (Event.xproperty.state) { case PropertyNewValue: - if (XGetRGBColormaps (dpy, Scr->Root, &maps, &nmaps, + if (XGetRGBColormaps (dpy, Scr->Root, &maps, &nmaps, Event.xproperty.atom)) { /* if got one, then replace any existing entry */ InsertRGBColormap (Event.xproperty.atom, maps, nmaps, True); @@ -817,7 +813,7 @@ /* * if the icon name is NoName, set the name of the icon to be - * the same as the window + * the same as the window */ if (Tmp_win->icon_name == NoName) { Tmp_win->icon_name = Tmp_win->name; @@ -860,7 +856,7 @@ if (!Tmp_win->forced && Tmp_win->wmhints && Tmp_win->wmhints->flags & IconWindowHint) { if (Tmp_win->icon_w) { - int icon_x, icon_y; + int icon_x, icon_y; /* * There's already an icon window. @@ -919,7 +915,7 @@ if (Tmp_win->icon_w && !Tmp_win->forced && Tmp_win->wmhints && (Tmp_win->wmhints->flags & IconPixmapHint)) { if (!XGetGeometry (dpy, Tmp_win->wmhints->icon_pixmap, &JunkRoot, - &JunkX, &JunkY, (unsigned int *)&Tmp_win->icon_width, + &JunkX, &JunkY, (unsigned int *)&Tmp_win->icon_width, (unsigned int *)&Tmp_win->icon_height, &JunkBW, &JunkDepth)) { return; } @@ -1013,7 +1009,7 @@ */ void -RedoIconName() +RedoIconName(void) { int x, y; @@ -1065,7 +1061,7 @@ */ void -HandleClientMessage() +HandleClientMessage(void) { if (Event.xclient.message_type == _XA_WM_CHANGE_STATE) { @@ -1099,7 +1095,7 @@ */ void -HandleExpose() +HandleExpose(void) { MenuRoot *tmp; if (XFindContext(dpy, Event.xany.window, MenuContext, (caddr_t *)&tmp) == 0) @@ -1122,12 +1118,12 @@ height = Scr->DefaultFont.height+2; for (i = 0; i < InfoLines; i++) { - MyFont_DrawString(dpy, Scr->InfoWindow, &Scr->DefaultFont, - Scr->NormalGC, 5, (i*height) + Scr->DefaultFont.y, Info[i], + MyFont_DrawString(dpy, Scr->InfoWindow, &Scr->DefaultFont, + Scr->NormalGC, 5, (i*height) + Scr->DefaultFont.y, Info[i], strlen(Info[i])); } flush_expose (Event.xany.window); - } + } else if (Tmp_win != NULL) { Region new_region; @@ -1153,7 +1149,7 @@ XDestroyRegion(new_region); MyFont_DrawString (dpy, Tmp_win->title_w, &Scr->TitleBarFont, - Scr->NormalGC, Scr->TBInfo.titlex, Scr->TitleBarFont.y, + Scr->NormalGC, Scr->TBInfo.titlex, Scr->TitleBarFont.y, Tmp_win->name, strlen(Tmp_win->name)); valuemask = GCClipMask; @@ -1195,12 +1191,12 @@ { int i; Window w = Event.xany.window; - register TBWindow *tbw; + TBWindow *tbw; int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; for (i = 0, tbw = Tmp_win->titlebuttons; i < nb; i++, tbw++) { if (w == tbw->window) { - register TitleButton *tb = tbw->info; + TitleButton *tb = tbw->info; FB(Tmp_win->title.fore, Tmp_win->title.back); XCopyPlane (dpy, tb->bitmap, w, Scr->NormalGC, @@ -1235,14 +1231,14 @@ flush_expose (Event.xany.window); return; } - } + } } } -static void remove_window_from_ring (tmp) - TwmWindow *tmp; +static void +remove_window_from_ring (TwmWindow *tmp) { TwmWindow *prev = tmp->ring.prev, *next = tmp->ring.next; @@ -1259,7 +1255,7 @@ */ if (prev) prev->ring.next = next; if (next) next->ring.prev = prev; - if (Scr->Ring == tmp) + if (Scr->Ring == tmp) Scr->Ring = (next != tmp ? next : (TwmWindow *) NULL); if (!Scr->Ring || Scr->RingLeader == tmp) Scr->RingLeader = Scr->Ring; @@ -1276,7 +1272,7 @@ */ void -HandleDestroyNotify() +HandleDestroyNotify(void) { int i; @@ -1319,7 +1315,7 @@ XDeleteContext (dpy, Tmp_win->titlebuttons[i].window, ScreenContext); } - } + } } if (Scr->cmapInfo.cmaps == &Tmp_win->cmaps) @@ -1327,7 +1323,7 @@ /* * TwmWindows contain the following pointers - * + * * 1. full_name * 2. name * 3. icon_name @@ -1374,7 +1370,7 @@ void -HandleCreateNotify() +HandleCreateNotify(void) { #ifdef DEBUG_EVENTS fprintf(stderr, "CreateNotify w = 0x%x\n", Event.xcreatewindow.window); @@ -1395,7 +1391,7 @@ */ void -HandleMapRequest() +HandleMapRequest(void) { int stat; int zoom_save; @@ -1435,7 +1431,7 @@ (state == NormalState || state == IconicState))) state = Tmp_win->wmhints->initial_state; - switch (state) + switch (state) { case DontCareState: case NormalState: @@ -1465,8 +1461,8 @@ -void SimulateMapRequest (w) - Window w; +void +SimulateMapRequest (Window w) { Event.xmaprequest.window = w; HandleMapRequest (); @@ -1483,7 +1479,7 @@ */ void -HandleMapNotify() +HandleMapNotify(void) { if (Tmp_win == NULL) return; @@ -1522,7 +1518,7 @@ */ void -HandleUnmapNotify() +HandleUnmapNotify(void) { int dstx, dsty; Window dumwin; @@ -1550,8 +1546,8 @@ * The program may have unmapped the client window, from either * NormalState or IconicState. Handle the transition to WithdrawnState. * - * We need to reparent the window back to the root (so that twm exiting - * won't cause it to get mapped) and then throw away all state (pretend + * We need to reparent the window back to the root (so that twm exiting + * won't cause it to get mapped) and then throw away all state (pretend * that we've received a DestroyNotify). */ @@ -1559,12 +1555,12 @@ if (XTranslateCoordinates (dpy, Event.xunmap.window, Tmp_win->attr.root, 0, 0, &dstx, &dsty, &dumwin)) { XEvent ev; - Bool reparented = XCheckTypedWindowEvent (dpy, Event.xunmap.window, + Bool reparented = XCheckTypedWindowEvent (dpy, Event.xunmap.window, ReparentNotify, &ev); SetMapStateProp (Tmp_win, WithdrawnState); if (reparented) { if (Tmp_win->old_bw) XSetWindowBorderWidth (dpy, - Event.xunmap.window, + Event.xunmap.window, Tmp_win->old_bw); if (Tmp_win->wmhints && (Tmp_win->wmhints->flags & IconWindowHint)) XUnmapWindow (dpy, Tmp_win->wmhints->icon_window); @@ -1592,7 +1588,7 @@ */ void -HandleMotionNotify() +HandleMotionNotify(void) { if (ResizeWindow != (Window) 0) { @@ -1624,12 +1620,12 @@ */ void -HandleButtonRelease() +HandleButtonRelease(void) { int xl, xr, yt, yb, w, h; unsigned mask; - if (InfoLines) /* delete info box on 2nd button release */ + if (InfoLines) /* delete info box on 2nd button release */ if (Context == C_IDENTIFY) { XUnmapWindow(dpy, Scr->InfoWindow); InfoLines = 0; @@ -1670,7 +1666,7 @@ xl = ConstMoveX; } } - + if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE) { xr = xl + w; @@ -1798,10 +1794,8 @@ -static void -do_menu (menu, w) - MenuRoot *menu; /* menu to pop up */ - Window w; /* invoking window or None */ +static void +do_menu (MenuRoot *menu, Window w) { int x = Event.xbutton.x_root; int y = Event.xbutton.y_root; @@ -1836,7 +1830,7 @@ */ void -HandleButtonPress() +HandleButtonPress(void) { unsigned int modifier; Cursor cur; @@ -1895,8 +1889,8 @@ /* check the title bar buttons */ if (Tmp_win && Tmp_win->title_height && Tmp_win->titlebuttons) { - register int i; - register TBWindow *tbw; + int i; + TBWindow *tbw; int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; for (i = 0, tbw = Tmp_win->titlebuttons; i < nb; i++, tbw++) { @@ -1931,7 +1925,7 @@ { Tmp_win = Tmp_win->list->iconmgr->twm_win; XTranslateCoordinates(dpy, Event.xany.window, Tmp_win->w, - Event.xbutton.x, Event.xbutton.y, + Event.xbutton.x, Event.xbutton.y, &JunkX, &JunkY, &JunkChild); Event.xbutton.x = JunkX; @@ -1943,7 +1937,7 @@ { Context = C_TITLE; } - else if (Event.xany.window == Tmp_win->w) + else if (Event.xany.window == Tmp_win->w) { printf("ERROR! ERROR! ERROR! YOU SHOULD NOT BE HERE!!!\n"); Context = C_WINDOW; @@ -1952,24 +1946,24 @@ { Context = C_ICON; } - else if (Event.xany.window == Tmp_win->frame) + else if (Event.xany.window == Tmp_win->frame) { /* since we now place a button grab on the frame instead - * of the window, (see GrabButtons() in add_window.c), we - * need to figure out where the pointer exactly is before - * assigning Context. If the pointer is on the application - * window we will change the event structure to look as if - * it came from the application window. + * of the window, (see GrabButtons() in add_window.c), we + * need to figure out where the pointer exactly is before + * assigning Context. If the pointer is on the application + * window we will change the event structure to look as if + * it came from the application window. */ if (Event.xbutton.subwindow == Tmp_win->w) { Event.xbutton.window = Tmp_win->w; - Event.xbutton.y -= Tmp_win->title_height; + Event.xbutton.y -= Tmp_win->title_height; /***** - Event.xbutton.x -= Tmp_win->frame_bw; + Event.xbutton.x -= Tmp_win->frame_bw; *****/ Context = C_WINDOW; } - else Context = C_FRAME; + else Context = C_FRAME; } else if (Tmp_win->list && (Event.xany.window == Tmp_win->list->w || @@ -1994,8 +1988,8 @@ * inside of a client that was getting button press events. */ XTranslateCoordinates(dpy, Scr->Root, Scr->Root, - Event.xbutton.x, - Event.xbutton.y, + Event.xbutton.x, + Event.xbutton.y, &JunkX, &JunkY, &Event.xany.window); if (Event.xany.window == 0 || @@ -2008,8 +2002,8 @@ } XTranslateCoordinates(dpy, Scr->Root, Event.xany.window, - Event.xbutton.x, - Event.xbutton.y, + Event.xbutton.x, + Event.xbutton.y, &JunkX, &JunkY, &JunkChild); Event.xbutton.x = JunkX; @@ -2029,7 +2023,7 @@ ButtonEvent = Event; ButtonWindow = Tmp_win; - /* if we get to here, we have to execute a function or pop up a + /* if we get to here, we have to execute a function or pop up a * menu */ modifier = (Event.xbutton.state & mods_used); @@ -2090,10 +2084,7 @@ /* ARGSUSED*/ static Bool -HENQueueScanner(dpy, ev, args) - Display *dpy; - XEvent *ev; - char *args; +HENQueueScanner(Display *dpy, XEvent *ev, char *args) { if (ev->type == LeaveNotify) { if (ev->xcrossing.window == ((HENScanArgs *) args)->w && @@ -2124,13 +2115,13 @@ */ void -HandleEnterNotify() +HandleEnterNotify(void) { MenuRoot *mr; XEnterWindowEvent *ewp = &Event.xcrossing; HENScanArgs scanArgs; XEvent dummy; - + /* * Save the id of the window entered. This will be used to remove * border highlight on entering the next application window. @@ -2165,7 +2156,7 @@ (void) XCheckIfEvent(dpy, &dummy, HENQueueScanner, (char *) &scanArgs); /* - * if entering root window, restore twm default colormap so that + * if entering root window, restore twm default colormap so that * titlebars are legible */ if (ewp->window == Scr->Root) { @@ -2193,7 +2184,7 @@ XUnmapWindow(dpy, Scr->Focus->hilite_w); /* - * If entering the frame or the icon manager, then do + * If entering the frame or the icon manager, then do * "window activation things": * * 1. turn on highlight window (if any) @@ -2271,7 +2262,6 @@ ActiveMenu = mr; MenuDepth--; } - return; } @@ -2296,10 +2286,7 @@ /* ARGSUSED*/ static Bool -HLNQueueScanner(dpy, ev, args) - Display *dpy; - XEvent *ev; - char *args; +HLNQueueScanner(Display *dpy, XEvent *ev, char *args) { if (ev->type == EnterNotify && ev->xcrossing.mode != NotifyGrab) { ((HLNScanArgs *) args)->enters = True; @@ -2321,7 +2308,7 @@ */ void -HandleLeaveNotify() +HandleLeaveNotify(void) { HLNScanArgs scanArgs; XEvent dummy; @@ -2386,7 +2373,6 @@ } } XSync (dpy, 0); - return; } } @@ -2401,7 +2387,7 @@ */ void -HandleConfigureRequest() +HandleConfigureRequest(void) { XWindowChanges xwc; unsigned long xwcm; @@ -2442,7 +2428,7 @@ * to configuration requests for windows which have never been mapped. */ if (!Tmp_win || Tmp_win->icon_w == cre->window) { - xwcm = cre->value_mask & + xwcm = cre->value_mask & (CWX | CWY | CWWidth | CWHeight | CWBorderWidth); xwc.x = cre->x; xwc.y = cre->y; @@ -2461,7 +2447,7 @@ (caddr_t *) &otherwin) == XCSUCCESS)) ? otherwin->frame : cre->above); xwc.stack_mode = cre->detail; - XConfigureWindow (dpy, Tmp_win->frame, + XConfigureWindow (dpy, Tmp_win->frame, cre->value_mask & (CWSibling | CWStackMode), &xwc); } @@ -2479,8 +2465,8 @@ * This means that we need to adjust for the additional title height as * well as for any border width changes that we decide to allow. The * current window gravity is to be used in computing the adjustments, just - * as when initially locating the window. Note that if we do decide to - * allow border width changes, we will need to send the synthetic + * as when initially locating the window. Note that if we do decide to + * allow border width changes, we will need to send the synthetic * ConfigureNotify event. */ GetGravityOffsets (Tmp_win, &gravx, &gravy); @@ -2518,7 +2504,7 @@ /* * SetupWindow (x,y) are the location of the upper-left outer corner and * are passed directly to XMoveResizeWindow (frame). The (width,height) - * are the inner size of the frame. The inner width is the same as the + * are the inner size of the frame. The inner width is the same as the * requested client window width; the inner height is the same as the * requested client window height plus any title bar slop. */ @@ -2536,7 +2522,7 @@ */ void -HandleShapeNotify () +HandleShapeNotify (void) { XShapeEvent *sev = (XShapeEvent *) &Event; @@ -2563,7 +2549,7 @@ */ void -HandleUnknown() +HandleUnknown(void) { #ifdef DEBUG_EVENTS fprintf(stderr, "type = %d\n", Event.type); @@ -2588,8 +2574,7 @@ */ int -Transient(w, propw) - Window w, *propw; +Transient(Window w, Window *propw) { return (XGetTransientForHint(dpy, w, propw)); } @@ -2611,8 +2596,7 @@ */ ScreenInfo * -FindScreenInfo(w) - Window w; +FindScreenInfo(Window w) { XWindowAttributes attr; int scrnum; @@ -2632,8 +2616,8 @@ -static void flush_expose (w) - Window w; +static void +flush_expose (Window w) { XEvent dummy; @@ -2657,9 +2641,7 @@ */ void -InstallWindowColormaps (type, tmp) - int type; - TwmWindow *tmp; +InstallWindowColormaps (int type, TwmWindow *tmp) { int i, j, n, number_cwins, state; ColormapWindow **cwins, *cwin, **maxcwin = NULL; @@ -2690,7 +2672,7 @@ (*cwins)->colormap->state &= ~CM_INSTALLABLE; Scr->cmapInfo.cmaps = &tmp->cmaps; break; - + case PropertyNotify: case VisibilityNotify: case ColormapNotify: @@ -2713,8 +2695,8 @@ cmap->w = cwin->w; } for (i = n = 0; i < number_cwins; i++) { - cwin = cwins[i]; - cmap = cwin->colormap; + cwin = cwins[i]; + cmap = cwin->colormap; if (cwin->visibility != VisibilityFullyObscured && n < Scr->cmapInfo.maxCmaps) { row = scoreboard + (i*(i-1)/2); @@ -2768,7 +2750,7 @@ */ void -InstallRootColormap() +InstallRootColormap(void) { TwmWindow *tmp; if (Scr->cmapInfo.root_pushes == 0) { @@ -2788,10 +2770,7 @@ /* ARGSUSED*/ static Bool -UninstallRootColormapQScanner(dpy, ev, args) - Display *dpy; - XEvent *ev; - char *args; +UninstallRootColormapQScanner(Display *dpy, XEvent *ev, char *args) { if (!*args) { if (ev->type == EnterNotify) { @@ -2808,14 +2787,14 @@ void -UninstallRootColormap() +UninstallRootColormap(void) { char args; XEvent dummy; if (Scr->cmapInfo.root_pushes) Scr->cmapInfo.root_pushes--; - + if (!Scr->cmapInfo.root_pushes) { /* * If we have subsequent Enter or Leave Notify events, @@ -2832,8 +2811,7 @@ #ifdef TRACE void -dumpevent (e) - XEvent *e; +dumpevent (XEvent *e) { char *name = NULL; @@ -2880,4 +2858,3 @@ } } #endif /* TRACE */ - Index: xc/programs/twm/gc.c diff -u xc/programs/twm/gc.c:1.7 xc/programs/twm/gc.c:1.8 --- xc/programs/twm/gc.c:1.7 Mon Jan 9 07:00:53 2006 +++ xc/programs/twm/gc.c Tue Oct 9 17:31:39 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/gc.c,v 1.8 2007/10/10 00:31:39 tsi Exp $ */ /*****************************************************************************/ /* @@ -48,7 +49,6 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/gc.c,v 1.7 2006/01/09 15:00:53 dawes Exp $ */ /********************************************************************** @@ -75,7 +75,7 @@ */ void -CreateGCs() +CreateGCs(void) { static ScreenInfo *prevScr = NULL; XGCValues gcv; @@ -88,31 +88,33 @@ /* create GC's */ - gcm = 0; - gcm |= GCFunction; gcv.function = GXxor; - gcm |= GCLineWidth; gcv.line_width = 0; - gcm |= GCForeground; gcv.foreground = Scr->XORvalue; - gcm |= GCSubwindowMode; gcv.subwindow_mode = IncludeInferiors; + gcm = GCFunction | GCLineWidth | GCForeground | GCSubwindowMode; + gcv.function = GXxor; + gcv.line_width = 0; + gcv.foreground = Scr->XORvalue; + gcv.subwindow_mode = IncludeInferiors; Scr->DrawGC = XCreateGC(dpy, Scr->Root, gcm, &gcv); - gcm = 0; - gcm |= GCForeground; gcv.foreground = Scr->MenuC.fore; - gcm |= GCBackground; gcv.background = Scr->MenuC.back; - if (!use_fontset) - {gcm |= GCFont; gcv.font = Scr->MenuFont.font->fid;} + gcm = GCForeground | GCBackground; + gcv.foreground = Scr->MenuC.fore; + gcv.background = Scr->MenuC.back; + if (!use_fontset) { + gcm |= GCFont; + gcv.font = Scr->MenuFont.font->fid; + } Scr->MenuGC = XCreateGC(dpy, Scr->Root, gcm, &gcv); - gcm = 0; - gcm |= GCPlaneMask; gcv.plane_mask = AllPlanes; + gcm = GCPlaneMask | GCGraphicsExposures | GCLineWidth; + gcv.plane_mask = AllPlanes; /* * Prevent GraphicsExpose and NoExpose events. We'd only get NoExpose * events anyway; they cause BadWindow errors from XGetWindowAttributes * call in FindScreenInfo (events.c) (since drawable is a pixmap). */ - gcm |= GCGraphicsExposures; gcv.graphics_exposures = False; - gcm |= GCLineWidth; gcv.line_width = 0; + gcv.graphics_exposures = False; + gcv.line_width = 0; Scr->NormalGC = XCreateGC(dpy, Scr->Root, gcm, &gcv); } Index: xc/programs/twm/gram.y diff -u xc/programs/twm/gram.y:3.10 xc/programs/twm/gram.y:3.11 --- xc/programs/twm/gram.y:3.10 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/gram.y Tue Oct 9 17:31:39 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/gram.y,v 3.11 2007/10/10 00:31:39 tsi Exp $ */ /*****************************************************************************/ /* @@ -48,7 +49,6 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/gram.y,v 3.10 2006/01/09 15:00:55 dawes Exp $ */ /*********************************************************************** * @@ -104,19 +104,19 @@ }; %token LB RB LP RP MENUS MENU BUTTON DEFAULT_FUNCTION PLUS MINUS -%token ALL OR CURSORS PIXMAPS ICONS COLOR SAVECOLOR MONOCHROME FUNCTION +%token ALL OR CURSORS PIXMAPS ICONS COLOR SAVECOLOR MONOCHROME FUNCTION %token ICONMGR_SHOW ICONMGR WINDOW_FUNCTION ZOOM ICONMGRS %token ICONMGR_GEOMETRY ICONMGR_NOSHOW MAKE_TITLE GRAYSCALE -%token ICONIFY_BY_UNMAPPING DONT_ICONIFY_BY_UNMAPPING -%token NO_TITLE AUTO_RAISE NO_HILITE ICON_REGION -%token META SHIFT LOCK CONTROL WINDOW TITLE ICON ROOT FRAME +%token ICONIFY_BY_UNMAPPING DONT_ICONIFY_BY_UNMAPPING +%token NO_TITLE AUTO_RAISE NO_HILITE ICON_REGION +%token META SHIFT LOCK CONTROL WINDOW TITLE ICON ROOT FRAME %token COLON EQUALS SQUEEZE_TITLE DONT_SQUEEZE_TITLE %token START_ICONIFIED NO_TITLE_HILITE TITLE_HILITE -%token MOVE RESIZE WAIT SELECT KILL LEFT_TITLEBUTTON RIGHT_TITLEBUTTON -%token NUMBER KEYWORD NKEYWORD CKEYWORD CLKEYWORD FKEYWORD FSKEYWORD +%token MOVE RESIZE WAIT SELECT KILL LEFT_TITLEBUTTON RIGHT_TITLEBUTTON +%token NUMBER KEYWORD NKEYWORD CKEYWORD CLKEYWORD FKEYWORD FSKEYWORD %token SKEYWORD DKEYWORD JKEYWORD WINDOW_RING WARP_CURSOR ERRORTOKEN %token NO_STACKMODE -%token STRING +%token STRING %type string %type pixmap_list cursor_list color_list save_color_list stmt @@ -124,7 +124,7 @@ %type noarg sarg error narg squeeze color_entry %type action button number signed_number full fullkey -%start twmrc +%start twmrc %% twmrc : stmts @@ -156,18 +156,18 @@ Scr->ZoomCount = $2; } } - | ZOOM { if (Scr->FirstTime) + | ZOOM { if (Scr->FirstTime) Scr->DoZoom = TRUE; } | PIXMAPS pixmap_list {} | CURSORS cursor_list {} | ICONIFY_BY_UNMAPPING { list = &Scr->IconifyByUn; } win_list - | ICONIFY_BY_UNMAPPING { if (Scr->FirstTime) + | ICONIFY_BY_UNMAPPING { if (Scr->FirstTime) Scr->IconifyByUnmapping = TRUE; } - | LEFT_TITLEBUTTON string EQUALS action { + | LEFT_TITLEBUTTON string EQUALS action { GotTitleButton ($2, $4, False); } - | RIGHT_TITLEBUTTON string EQUALS action { + | RIGHT_TITLEBUTTON string EQUALS action { GotTitleButton ($2, $4, True); } | button string { root = GetRoot($2, NULLSTR, NULLSTR); @@ -183,7 +183,7 @@ else { root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); - Scr->Mouse[$1][C_ROOT][0].item = + Scr->Mouse[$1][C_ROOT][0].item = AddToMenu(root,"x",Action, NULL,$2,NULLSTR,NULLSTR); } @@ -226,20 +226,20 @@ | MENU string LP string COLON string RP { root = GetRoot($2, $4, $6); } menu { root->real_menu = TRUE;} - | MENU string { root = GetRoot($2, NULLSTR, NULLSTR); } + | MENU string { root = GetRoot($2, NULLSTR, NULLSTR); } menu { root->real_menu = TRUE; } | FUNCTION string { root = GetRoot($2, NULLSTR, NULLSTR); } function - | ICONS { list = &Scr->IconNames; } + | ICONS { list = &Scr->IconNames; } icon_list - | COLOR { color = COLOR; } + | COLOR { color = COLOR; } + color_list + | GRAYSCALE { color = GRAYSCALE; } + color_list + | SAVECOLOR + save_color_list + | MONOCHROME { color = MONOCHROME; } color_list - | GRAYSCALE { color = GRAYSCALE; } - color_list - | SAVECOLOR - save_color_list - | MONOCHROME { color = MONOCHROME; } - color_list | DEFAULT_FUNCTION action { Scr->DefaultFunction.func = $2; if ($2 == F_MENU) { @@ -249,7 +249,7 @@ else { root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); - Scr->DefaultFunction.item = + Scr->DefaultFunction.item = AddToMenu(root,"x",Action, NULL,$2, NULLSTR, NULLSTR); } @@ -258,7 +258,7 @@ } | WINDOW_FUNCTION action { Scr->WindowFunction.func = $2; root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); - Scr->WindowFunction.item = + Scr->WindowFunction.item = AddToMenu(root,"x",Action, NULL,$2, NULLSTR, NULLSTR); Action = ""; @@ -266,7 +266,7 @@ } | WARP_CURSOR { list = &Scr->WarpCursorL; } win_list - | WARP_CURSOR { if (Scr->FirstTime) + | WARP_CURSOR { if (Scr->FirstTime) Scr->WarpCursor = TRUE; } | WINDOW_RING { list = &Scr->WindowRingL; } win_list @@ -321,7 +321,7 @@ | CONTROL { mods |= ControlMask; } | META number { if ($2 < 1 || $2 > 5) { twmrc_error_prefix(); - fprintf (stderr, + fprintf (stderr, "bad modifier number (%d), must be 1-5\n", $2); ParseError = 1; @@ -467,16 +467,16 @@ } ; -save_color_list : LB s_color_entries RB - ; +save_color_list : LB s_color_entries RB + ; s_color_entries : /* Empty */ - | s_color_entries s_color_entry - ; + | s_color_entries s_color_entry + ; s_color_entry : string { do_string_savecolor(color, $1); } - | CLKEYWORD { do_var_savecolor($1); } - ; + | CLKEYWORD { do_var_savecolor($1); } + ; win_color_list : LB win_color_entries RB ; @@ -490,10 +490,10 @@ AddToList(list, $1, $2); } ; -squeeze : SQUEEZE_TITLE { +squeeze : SQUEEZE_TITLE { if (HasShape) Scr->SqueezeTitle = TRUE; } - | SQUEEZE_TITLE { list = &Scr->SqueezeTitleL; + | SQUEEZE_TITLE { list = &Scr->SqueezeTitleL; if (HasShape && Scr->SqueezeTitle == -1) Scr->SqueezeTitle = TRUE; } @@ -607,9 +607,9 @@ case F_WARPTOSCREEN: if (!CheckWarpScreenArg (Action)) { twmrc_error_prefix(); - fprintf (stderr, - "ignoring invalid f.warptoscreen argument \"%s\"\n", - Action); + fprintf (stderr, + "ignoring invalid f.warptoscreen argument \"%s\"\n", + Action); $$ = F_NOP; } break; @@ -619,7 +619,7 @@ } else { twmrc_error_prefix(); fprintf (stderr, - "ignoring invalid f.colormap argument \"%s\"\n", + "ignoring invalid f.colormap argument \"%s\"\n", Action); $$ = F_NOP; } @@ -667,9 +667,9 @@ void RemoveDQuote(char *str) { - register char *i, *o; - register int n; - register int count; + char *i, *o; + int n; + int count; for (i=str+1, o=str; *i && *i != '\"'; o++) { @@ -748,9 +748,8 @@ *o = '\0'; } -static MenuRoot *GetRoot(name, fore, back) -char *name; -char *fore, *back; +static MenuRoot * +GetRoot(char *name, char *fore, char *back) { MenuRoot *tmp; @@ -772,8 +771,8 @@ return tmp; } -static void GotButton(butt, func) -int butt, func; +static void +GotButton(int butt, int func) { int i; @@ -802,17 +801,16 @@ mods = 0; } -static void GotKey(key, func) -char *key; -int func; +static void +GotKey(char *key, int func) { int i; for (i = 0; i < NUM_CONTEXTS; i++) { - if ((cont & (1 << i)) == 0) + if ((cont & (1 << i)) == 0) continue; - if (!AddFuncKey(key, i, mods, func, Name, Action)) + if (!AddFuncKey(key, i, mods, func, Name, Action)) break; } @@ -824,14 +822,12 @@ } -static void GotTitleButton (bitmapname, func, rightside) - char *bitmapname; - int func; - Bool rightside; +static void +GotTitleButton (char *bitmapname, int func, Bool rightside) { if (!CreateTitleButton (bitmapname, func, Action, pull, rightside, True)) { twmrc_error_prefix(); - fprintf (stderr, + fprintf (stderr, "unable to create %s titlebutton \"%s\"\n", rightside ? "right" : "left", bitmapname); } @@ -839,8 +835,8 @@ pull = NULL; } -static Bool CheckWarpScreenArg (s) - register char *s; +static Bool +CheckWarpScreenArg (char *s) { XmuCopyISOLatin1Lowered (s, s); @@ -854,8 +850,8 @@ } -static Bool CheckWarpRingArg (s) - register char *s; +static Bool +CheckWarpRingArg (char *s) { XmuCopyISOLatin1Lowered (s, s); @@ -867,8 +863,8 @@ } -static Bool CheckColormapArg (s) - register char *s; +static Bool +CheckColormapArg (char *s) { XmuCopyISOLatin1Lowered (s, s); @@ -882,7 +878,7 @@ void -twmrc_error_prefix () +twmrc_error_prefix (void) { fprintf (stderr, "%s: line %d: ", ProgramName, yylineno); } Index: xc/programs/twm/iconmgr.c diff -u xc/programs/twm/iconmgr.c:1.7 xc/programs/twm/iconmgr.c:1.8 --- xc/programs/twm/iconmgr.c:1.7 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/iconmgr.c Tue Oct 9 17:31:39 2007 @@ -1,5 +1,6 @@ +/* $XFree86: xc/programs/twm/iconmgr.c,v 1.8 2007/10/10 00:31:39 tsi Exp $ */ /* - * + * Copyright 1989,1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -22,7 +23,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ -/* $XFree86: xc/programs/twm/iconmgr.c,v 1.7 2006/01/09 15:00:55 dawes Exp $ */ /*********************************************************************** * @@ -67,7 +67,8 @@ *********************************************************************** */ -void CreateIconManagers() +void +CreateIconManagers(void) { IconMgr *p; int mask; @@ -91,7 +92,7 @@ (unsigned int *) &p->width, (unsigned int *)&p->height); if (mask & XNegative) - JunkX = Scr->MyDisplayWidth - p->width - + JunkX = Scr->MyDisplayWidth - p->width - (2 * Scr->BorderWidth) + JunkX; if (mask & YNegative) @@ -139,11 +140,8 @@ *********************************************************************** */ -IconMgr *AllocateIconManager(name, icon_name, geom, columns) - char *name; - char *geom; - char *icon_name; - int columns; +IconMgr * +AllocateIconManager(char *name, char *geom, char *icon_name, int columns) { IconMgr *p; @@ -199,8 +197,8 @@ *********************************************************************** */ -void MoveIconManager(dir) - int dir; +void +MoveIconManager(int dir) { IconMgr *ip; WList *tmp = NULL; @@ -268,7 +266,7 @@ new_row = 0; if (new_col >= ip->cur_columns) new_col = 0; - + /* Now let's go through the list to see if there is an entry with this * new position */ @@ -284,8 +282,8 @@ if (!got_it) { - fprintf (stderr, - "%s: unable to find window (%d, %d) in icon manager\n", + fprintf (stderr, + "%s: unable to find window (%d, %d) in icon manager\n", ProgramName, new_row, new_col); return; } @@ -318,14 +316,14 @@ * * Inputs: * dir - one of the following: - * F_NEXTICONMGR - go to the next icon manager + * F_NEXTICONMGR - go to the next icon manager * F_PREVICONMGR - go to the previous one * *********************************************************************** */ -void JumpIconManager(dir) - register int dir; +void +JumpIconManager(int dir) { IconMgr *ip, *tmp_ip = NULL; int got_it = FALSE; @@ -393,8 +391,8 @@ *********************************************************************** */ -WList *AddIconManager(tmp_win) - TwmWindow *tmp_win; +WList * +AddIconManager(TwmWindow *tmp_win) { WList *tmp; int h; @@ -445,7 +443,7 @@ tmp->me = ip->count; tmp->x = -1; tmp->y = -1; - + valuemask = (CWBackPixel | CWBorderPixel | CWEventMask | CWCursor); attributes.background_pixel = tmp->back; attributes.border_pixel = tmp->back; @@ -453,8 +451,8 @@ ButtonReleaseMask | ExposureMask | EnterWindowMask | LeaveWindowMask); attributes.cursor = Scr->IconMgrCursor; - tmp->w = XCreateWindow (dpy, ip->w, 0, 0, (unsigned int) 1, - (unsigned int) h, (unsigned int) 0, + tmp->w = XCreateWindow (dpy, ip->w, 0, 0, (unsigned int) 1, + (unsigned int) h, (unsigned int) 0, CopyFromParent, (unsigned int) CopyFromParent, (Visual *) CopyFromParent, valuemask, &attributes); @@ -498,7 +496,7 @@ /*********************************************************************** * * Procedure: - * InsertInIconManager - put an allocated entry into an icon + * InsertInIconManager - put an allocated entry into an icon * manager * * Inputs: @@ -508,14 +506,12 @@ *********************************************************************** */ -void InsertInIconManager(ip, tmp, tmp_win) - IconMgr *ip; - WList *tmp; - TwmWindow *tmp_win; +void +InsertInIconManager(IconMgr *ip, WList *tmp, TwmWindow *tmp_win) { WList *tmp1; int added; - int (*compar)(const char *, const char *) + int (*compar)(const char *, const char *) = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); added = FALSE; @@ -553,9 +549,8 @@ } } -void RemoveFromIconManager(ip, tmp) - IconMgr *ip; - WList *tmp; +void +RemoveFromIconManager(IconMgr *ip, WList *tmp) { if (tmp->prev == NULL) ip->first = tmp->next; @@ -579,8 +574,8 @@ *********************************************************************** */ -void RemoveIconManager(tmp_win) - TwmWindow *tmp_win; +void +RemoveIconManager(TwmWindow *tmp_win) { IconMgr *ip; WList *tmp; @@ -593,7 +588,7 @@ ip = tmp->iconmgr; RemoveFromIconManager(ip, tmp); - + XDeleteContext(dpy, tmp->icon, TwmContext); XDeleteContext(dpy, tmp->icon, ScreenContext); XDestroyWindow(dpy, tmp->icon); @@ -613,8 +608,8 @@ } -void ActiveIconManager(active) - WList *active; +void +ActiveIconManager(WList *active) { active->active = TRUE; Active = active; @@ -622,31 +617,29 @@ DrawIconManagerBorder(active); } -void NotActiveIconManager(active) - WList *active; +void +NotActiveIconManager(WList *active) { active->active = FALSE; DrawIconManagerBorder(active); } -void DrawIconManagerBorder(tmp) - WList *tmp; +void +DrawIconManagerBorder(WList *tmp) { - { - XSetForeground(dpy, Scr->NormalGC, tmp->fore); - XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 2, 2, - tmp->width-5, tmp->height-5); + XSetForeground(dpy, Scr->NormalGC, tmp->fore); + XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 2, 2, + tmp->width-5, tmp->height-5); - if (tmp->active && Scr->Highlight) - XSetForeground(dpy, Scr->NormalGC, tmp->highlight); - else - XSetForeground(dpy, Scr->NormalGC, tmp->back); + if (tmp->active && Scr->Highlight) + XSetForeground(dpy, Scr->NormalGC, tmp->highlight); + else + XSetForeground(dpy, Scr->NormalGC, tmp->back); - XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 0, 0, - tmp->width-1, tmp->height-1); - XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 1, 1, - tmp->width-3, tmp->height-3); - } + XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 0, 0, + tmp->width-1, tmp->height-1); + XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 1, 1, + tmp->width-3, tmp->height-3); } /*********************************************************************** @@ -660,12 +653,12 @@ *********************************************************************** */ -void SortIconManager(ip) - IconMgr *ip; +void +SortIconManager(IconMgr *ip) { WList *tmp1, *tmp2; int done; - int (*compar)(const char *, const char *) + int (*compar)(const char *, const char *) = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); if (ip == NULL) @@ -706,8 +699,8 @@ *********************************************************************** */ -void PackIconManager(ip) - IconMgr *ip; +void +PackIconManager(IconMgr *ip) { int newwidth, i, row, col, maxcol, colinc, rowinc, wheight, wwidth; int new_x, new_y; @@ -760,7 +753,7 @@ ip->cur_columns = maxcol; ip->height = row * rowinc; if (ip->height == 0) - ip->height = rowinc; + ip->height = rowinc; newwidth = maxcol * colinc; if (newwidth == 0) newwidth = colinc; Index: xc/programs/twm/iconmgr.h diff -u xc/programs/twm/iconmgr.h:1.7 xc/programs/twm/iconmgr.h:1.8 --- xc/programs/twm/iconmgr.h:1.7 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/iconmgr.h Tue Oct 9 17:31:39 2007 @@ -1,5 +1,6 @@ +/* $XFree86: xc/programs/twm/iconmgr.h,v 1.8 2007/10/10 00:31:39 tsi Exp $ */ /* - * + * Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -22,7 +23,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ -/* $XFree86: xc/programs/twm/iconmgr.h,v 1.7 2006/01/09 15:00:55 dawes Exp $ */ /*********************************************************************** * Index: xc/programs/twm/icons.c diff -u xc/programs/twm/icons.c:1.9 xc/programs/twm/icons.c:1.11 --- xc/programs/twm/icons.c:1.9 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/icons.c Wed Oct 10 08:23:02 2007 @@ -1,5 +1,6 @@ +/* $XFree86: xc/programs/twm/icons.c,v 1.11 2007/10/10 15:23:02 tsi Exp $ */ /* - * + * Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -22,7 +23,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ -/* $XFree86: xc/programs/twm/icons.c,v 1.9 2006/01/09 15:00:55 dawes Exp $ */ /********************************************************************** * @@ -50,12 +50,9 @@ static void mergeEntries ( IconEntry *old, IconEntry *ie ); static void -splitEntry (ie, grav1, grav2, w, h) - IconEntry *ie; - int grav1, grav2; - int w, h; +splitEntry (IconEntry *ie, int grav1, int grav2, int w, int h) { - IconEntry *new; + IconEntry *new; switch (grav1) { case D_NORTH: @@ -110,10 +107,7 @@ } void -PlaceIcon(tmp_win, def_x, def_y, final_x, final_y) - TwmWindow *tmp_win; - int def_x, def_y; - int *final_x, *final_y; +PlaceIcon(TwmWindow *tmp_win, int def_x, int def_y, int *final_x, int *final_y) { IconRegion *ir; IconEntry *ie; @@ -142,13 +136,10 @@ *final_x = def_x; *final_y = def_y; } - return; } static IconEntry * -FindIconEntry (tmp_win, irp) - TwmWindow *tmp_win; - IconRegion **irp; +FindIconEntry (TwmWindow *tmp_win, IconRegion **irp) { IconRegion *ir; IconEntry *ie; @@ -165,8 +156,7 @@ } void -IconUp (tmp_win) - TwmWindow *tmp_win; +IconUp (TwmWindow *tmp_win) { int x, y; int defx, defy; @@ -206,9 +196,7 @@ } static IconEntry * -prevIconEntry (ie, ir) - IconEntry *ie; - IconRegion *ir; +prevIconEntry (IconEntry *ie, IconRegion *ir) { IconEntry *ip; @@ -224,8 +212,7 @@ */ static void -mergeEntries (old, ie) - IconEntry *old, *ie; +mergeEntries (IconEntry *old, IconEntry *ie) { if (old->y == ie->y) { ie->w = old->w + ie->w; @@ -239,8 +226,7 @@ } void -IconDown (tmp_win) - TwmWindow *tmp_win; +IconDown (TwmWindow *tmp_win) { IconEntry *ie, *ip, *in; IconRegion *ir; @@ -254,21 +240,21 @@ for (;;) { if (ip && ip->used == 0 && ((ip->x == ie->x && ip->w == ie->w) || - (ip->y == ie->y && ip->h == ie->h))) + (ip->y == ie->y && ip->h == ie->h))) { - ip->next = ie->next; - mergeEntries (ie, ip); - free ((char *) ie); + ip->next = ie->next; + mergeEntries (ie, ip); + free ((char *) ie); ie = ip; - ip = prevIconEntry (ip, ir); + ip = prevIconEntry (ip, ir); } else if (in && in->used == 0 && ((in->x == ie->x && in->w == ie->w) || - (in->y == ie->y && in->h == ie->h))) + (in->y == ie->y && in->h == ie->h))) { - ie->next = in->next; - mergeEntries (in, ie); - free ((char *) in); - in = ie->next; + ie->next = in->next; + mergeEntries (in, ie); + free ((char *) in); + in = ie->next; } else break; } @@ -276,10 +262,7 @@ } void -AddIconRegion(geom, grav1, grav2, stepx, stepy) -char *geom; -int grav1, grav2; -int stepx, stepy; +AddIconRegion(char *geom, int grav1, int grav2, int stepx, int stepy) { IconRegion *ir; int mask; @@ -322,8 +305,7 @@ #ifdef comment void -FreeIconEntries (ir) - IconRegion *ir; +FreeIconEntries (IconRegion *ir) { IconEntry *ie, *tmp; @@ -335,7 +317,7 @@ } void -FreeIconRegions() +FreeIconRegions(void) { IconRegion *ir, *tmp; @@ -352,9 +334,7 @@ #endif void -CreateIconWindow(tmp_win, def_x, def_y) - TwmWindow *tmp_win; - int def_x, def_y; +CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) { unsigned long event_mask; unsigned long valuemask; /* mask for create windows */ @@ -369,7 +349,7 @@ tmp_win->forced = FALSE; tmp_win->icon_not_ours = FALSE; - /* now go through the steps to get an icon window, if ForceIcon is + /* now go through the steps to get an icon window, if ForceIcon is * set, then no matter what else is defined, the bitmap from the * .twmrc file is used */ @@ -379,7 +359,7 @@ Pixmap bm; icon_name = LookInNameList(Scr->IconNames, tmp_win->full_name); - if (icon_name == NULL) + if (icon_name == NULL) icon_name = LookInList(Scr->IconNames, tmp_win->full_name, &tmp_win->class); @@ -417,9 +397,9 @@ if (pm == None && tmp_win->wmhints && tmp_win->wmhints->flags & IconPixmapHint) { - + XGetGeometry(dpy, tmp_win->wmhints->icon_pixmap, - &JunkRoot, &JunkX, &JunkY, + &JunkRoot, &JunkX, &JunkY, (unsigned int *)&tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height, &JunkBW, &JunkDepth); pm = XCreatePixmap(dpy, Scr->Root, @@ -430,7 +410,7 @@ 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); } - /* if we still haven't got an icon, let's look in the Icon list + /* if we still haven't got an icon, let's look in the Icon list * if ForceIcon is not set */ if (pm == None && !Scr->ForceIcon) @@ -439,7 +419,7 @@ Pixmap bm; icon_name = LookInNameList(Scr->IconNames, tmp_win->full_name); - if (icon_name == NULL) + if (icon_name == NULL) icon_name = LookInList(Scr->IconNames, tmp_win->full_name, &tmp_win->class); @@ -555,7 +535,7 @@ &attributes); } - /* I need to figure out where to put the icon window now, because + /* I need to figure out where to put the icon window now, because * getting here means that I am going to make the icon visible */ if (tmp_win->wmhints && @@ -585,5 +565,4 @@ XSaveContext(dpy, tmp_win->icon_w, ScreenContext, (caddr_t)Scr); XDefineCursor(dpy, tmp_win->icon_w, Scr->IconCursor); if (pm) XFreePixmap (dpy, pm); - return; } Index: xc/programs/twm/icons.h diff -u xc/programs/twm/icons.h:1.6 xc/programs/twm/icons.h:1.7 --- xc/programs/twm/icons.h:1.6 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/icons.h Tue Oct 9 17:31:39 2007 @@ -1,5 +1,6 @@ +/* $XFree86: xc/programs/twm/icons.h,v 1.7 2007/10/10 00:31:39 tsi Exp $ */ /* - * + * Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -22,7 +23,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ -/* $XFree86: xc/programs/twm/icons.h,v 1.6 2006/01/09 15:00:55 dawes Exp $ */ /********************************************************************** * @@ -49,15 +49,15 @@ struct IconEntry *next; int x, y, w, h; TwmWindow *twm_win; - short used; + short used; }IconEntry; extern int roundUp ( int v, int multiple ); -extern void PlaceIcon ( TwmWindow *tmp_win, int def_x, int def_y, +extern void PlaceIcon ( TwmWindow *tmp_win, int def_x, int def_y, int *final_x, int *final_y ); extern void IconUp ( TwmWindow *tmp_win ); extern void IconDown ( TwmWindow *tmp_win ); -extern void AddIconRegion ( char *geom, int grav1, int grav2, +extern void AddIconRegion ( char *geom, int grav1, int grav2, int stepx, int stepy ); extern void CreateIconWindow ( TwmWindow *tmp_win, int def_x, int def_y ); Index: xc/programs/twm/lex.l diff -u xc/programs/twm/lex.l:3.16 xc/programs/twm/lex.l:3.17 --- xc/programs/twm/lex.l:3.16 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/lex.l Tue Oct 9 17:31:39 2007 @@ -1,4 +1,5 @@ %{ +/* $XFree86: xc/programs/twm/lex.l,v 3.17 2007/10/10 00:31:39 tsi Exp $ */ /*****************************************************************************/ /* @@ -57,7 +58,6 @@ * 12-Nov-87 Thomas E. LaStrange File created * ***********************************************************************/ -/* $XFree86: xc/programs/twm/lex.l,v 3.16 2006/01/09 15:00:55 dawes Exp $ */ /* #include */ /* lex already includes stdio.h */ #include "twm.h" @@ -103,15 +103,15 @@ "-" { return MINUS; } "|" { return OR; } -[a-zA-Z\.]+ { int token = parse_keyword ((char *)yytext, +[a-zA-Z\.]+ { int token = parse_keyword ((char *)yytext, &yylval.num); if (token == ERRORTOKEN) { twmrc_error_prefix(); fprintf (stderr, - "ignoring unknown keyword: %s\n", + "ignoring unknown keyword: %s\n", yytext); ParseError = 1; - } else + } else return token; } @@ -126,7 +126,7 @@ [\r\n\t ] {;} . { twmrc_error_prefix(); - fprintf (stderr, + fprintf (stderr, "ignoring character \"%s\"\n", yytext); ParseError = 1; Index: xc/programs/twm/list.c diff -u xc/programs/twm/list.c:1.10 xc/programs/twm/list.c:1.11 --- xc/programs/twm/list.c:1.10 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/list.c Tue Oct 9 17:31:39 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/list.c,v 1.11 2007/10/10 00:31:39 tsi Exp $ */ /*****************************************************************************/ /* @@ -48,7 +49,6 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/list.c,v 1.10 2006/01/09 15:00:55 dawes Exp $ */ /********************************************************************** @@ -80,23 +80,20 @@ * * Inputs: * list - the address of the pointer to the head of a list - * name - a pointer to the name of the window + * name - a pointer to the name of the window * ptr - pointer to list dependent data * * Special Considerations - * If the list does not use the ptr value, a non-null value + * If the list does not use the ptr value, a non-null value * should be placed in it. LookInList returns this ptr value - * and procedures calling LookInList will check for a non-null + * and procedures calling LookInList will check for a non-null * return value as an indication of success. * *********************************************************************** */ void -AddToList(list_head, name, ptr) -name_list **list_head; -char *name; -char *ptr; +AddToList(name_list **list_head, char *name, char *ptr) { name_list *nptr; @@ -115,7 +112,7 @@ nptr->name = name; nptr->ptr = (ptr == NULL) ? (char *)TRUE : ptr; *list_head = nptr; -} +} /*********************************************************************** * @@ -123,7 +120,7 @@ * LookInList - look through a list for a window name, or class * * Returned Value: - * the ptr field of the list structure or NULL if the name + * the ptr field of the list structure or NULL if the name * or class was not found in the list * * Inputs: @@ -135,10 +132,7 @@ */ char * -LookInList(list_head, name, class) -name_list *list_head; -char *name; -XClassHint *class; +LookInList(name_list *list_head, char *name, XClassHint *class) { name_list *nptr; @@ -163,9 +157,7 @@ } char * -LookInNameList(list_head, name) -name_list *list_head; -char *name; +LookInNameList(name_list *list_head, char *name) { return (LookInList(list_head, name, NULL)); } @@ -190,11 +182,9 @@ *********************************************************************** */ -int GetColorFromList(list_head, name, class, ptr) -name_list *list_head; -char *name; -XClassHint *class; -Pixel *ptr; +int +GetColorFromList(name_list *list_head, char *name, XClassHint *class, + Pixel *ptr) { int save; name_list *nptr; @@ -242,8 +232,8 @@ *********************************************************************** */ -void FreeList(list) -name_list **list; +void +FreeList(name_list **list) { name_list *nptr; name_list *tmp; Index: xc/programs/twm/list.h diff -u xc/programs/twm/list.h:1.6 xc/programs/twm/list.h:1.8 --- xc/programs/twm/list.h:1.6 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/list.h Wed Oct 10 08:23:02 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/list.h,v 1.8 2007/10/10 15:23:02 tsi Exp $ */ /*****************************************************************************/ /* @@ -48,7 +49,6 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/list.h,v 1.6 2006/01/09 15:00:55 dawes Exp $ */ /********************************************************************** @@ -71,12 +71,11 @@ extern void AddToList ( name_list **list_head, char *name, char *ptr ); extern void FreeList ( name_list **list ); -extern int GetColorFromList ( name_list *list_head, char *name, +extern int GetColorFromList ( name_list *list_head, char *name, XClassHint *class, Pixel *ptr ); -extern char * LookInList ( name_list *list_head, char *name, +extern char * LookInList ( name_list *list_head, char *name, XClassHint *class ); extern char * LookInNameList ( name_list *list_head, char *name ); #endif /* _LIST_ */ - Index: xc/programs/twm/menus.c diff -u xc/programs/twm/menus.c:1.25 xc/programs/twm/menus.c:1.27 --- xc/programs/twm/menus.c:1.25 Sun Feb 19 16:14:38 2006 +++ xc/programs/twm/menus.c Wed Oct 10 08:23:02 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/menus.c,v 1.25 2006/02/20 00:14:38 dawes Exp $ */ +/* $XFree86: xc/programs/twm/menus.c,v 1.27 2007/10/10 15:23:02 tsi Exp $ */ /*****************************************************************************/ /* @@ -96,7 +96,7 @@ int ConstMoveXR; int ConstMoveYT; int ConstMoveYB; - + /* Globals used to keep track of whether the mouse has moved during a resize function. */ int ResizeOrigX; @@ -128,7 +128,7 @@ */ void -InitMenus() +InitMenus(void) { int i, j, k; FuncKey *key, *tmp; @@ -176,11 +176,9 @@ *********************************************************************** */ -Bool AddFuncKey (name, cont, mods, func, win_name, action) - char *name; - int cont, mods, func; - char *win_name; - char *action; +Bool +AddFuncKey (char *name, int cont, int mods, int func, char *win_name, + char *action) { FuncKey *tmp; KeySym keysym; @@ -226,13 +224,9 @@ -int CreateTitleButton (name, func, action, menuroot, rightside, append) - char *name; - int func; - char *action; - MenuRoot *menuroot; - Bool rightside; - Bool append; +int +CreateTitleButton (char *name, int func, char *action, MenuRoot *menuroot, + Bool rightside, Bool append) { TitleButton *tb = (TitleButton *) malloc (sizeof(TitleButton)); @@ -260,7 +254,7 @@ /* * Cases for list: - * + * * 1. empty list, prepend left put at head of list * 2. append left, prepend right put in between left and right * 3. append right put at tail of list @@ -272,13 +266,13 @@ tb->next = Scr->TBInfo.head; Scr->TBInfo.head = tb; } else if (append && rightside) { /* 3 */ - register TitleButton *t; + TitleButton *t; for /* SUPPRESS 530 */ (t = Scr->TBInfo.head; t->next; t = t->next); t->next = tb; tb->next = NULL; } else { /* 2 */ - register TitleButton *t, *prev = NULL; + TitleButton *t, *prev = NULL; for (t = Scr->TBInfo.head; t && !t->rightside; t = t->next) { prev = t; } @@ -302,7 +296,8 @@ * find the question mark, something is wrong and we are probably going to be * in trouble later on. */ -void InitTitlebarButtons () +void +InitTitlebarButtons (void) { TitleButton *tb; int h; @@ -372,10 +367,7 @@ void -PaintEntry(mr, mi, exposure) -MenuRoot *mr; -MenuItem *mi; -int exposure; +PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) { int y_offset; int text_y; @@ -422,7 +414,7 @@ else gc = Scr->MenuGC; - MyFont_DrawString(dpy, mr->w, &Scr->MenuFont, gc, + MyFont_DrawString(dpy, mr->w, &Scr->MenuFont, gc, mi->x, text_y, mi->item, mi->strlen); } @@ -462,12 +454,10 @@ text_y, mi->item, mi->strlen); } } - + void -PaintMenu(mr, e) -MenuRoot *mr; -XEvent *e; +PaintMenu(MenuRoot *mr, XEvent *e) { MenuItem *mi; @@ -492,7 +482,7 @@ static Bool fromMenu; void -UpdateMenu() +UpdateMenu(void) { MenuItem *mi; int i, x, y, x_root, y_root, entry; @@ -504,7 +494,7 @@ while (TRUE) { /* block until there is an event */ - if (!menuFromFrameOrWindowOrTitlebar) { + if (!menuFromFrameOrWindowOrTitlebar) { XMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask | EnterWindowMask | ExposureMask | @@ -568,7 +558,7 @@ done = TRUE; /* if we weren't on the active entry, let's turn the old - * active one off + * active one off */ if (!done && ActiveItem->func != F_TITLE) { @@ -578,7 +568,7 @@ } /* if we weren't on the active item, change the active item and turn - * it on + * it on */ if (!done) { @@ -591,16 +581,16 @@ } /* now check to see if we were over the arrow of a pull right entry */ - if (ActiveItem->func == F_MENU && + if (ActiveItem->func == F_MENU && ((ActiveMenu->width - x) < (ActiveMenu->width >> 1))) { MenuRoot *save = ActiveMenu; - int savex = MenuOrigins[MenuDepth - 1].x; + int savex = MenuOrigins[MenuDepth - 1].x; int savey = MenuOrigins[MenuDepth - 1].y; if (MenuDepth < MAXMENUDEPTH) { - PopUpMenu (ActiveItem->sub, - (savex + (ActiveMenu->width >> 1)), + PopUpMenu (ActiveItem->sub, + (savex + (ActiveMenu->width >> 1)), (savey + ActiveItem->item_num * Scr->EntryHeight) /*(savey + ActiveItem->item_num * Scr->EntryHeight + (Scr->EntryHeight >> 1))*/, False); @@ -640,8 +630,7 @@ */ MenuRoot * -NewMenuRoot(name) - char *name; +NewMenuRoot(char *name) { MenuRoot *tmp; @@ -715,12 +704,8 @@ */ MenuItem * -AddToMenu(menu, item, action, sub, func, fore, back) - MenuRoot *menu; - char *item, *action; - MenuRoot *sub; - int func; - char *fore, *back; +AddToMenu(MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func, + char *fore, char *back) { MenuItem *tmp; int width; @@ -784,7 +769,7 @@ void -MakeMenus() +MakeMenus(void) { MenuRoot *mr; @@ -799,8 +784,7 @@ void -MakeMenu(mr) -MenuRoot *mr; +MakeMenu(MenuRoot *mr) { MenuItem *start, *end, *cur, *tmp; XColor f1, f2, f3; @@ -854,10 +838,10 @@ attributes.save_under = True; } mr->shadow = XCreateWindow (dpy, Scr->Root, 0, 0, - (unsigned int) mr->width, + (unsigned int) mr->width, (unsigned int) mr->height, (unsigned int)0, - CopyFromParent, + CopyFromParent, (unsigned int) CopyFromParent, (Visual *) CopyFromParent, valuemask, &attributes); @@ -1004,17 +988,14 @@ *********************************************************************** */ -Bool -PopUpMenu (menu, x, y, center) - MenuRoot *menu; - int x, y; - Bool center; +Bool +PopUpMenu (MenuRoot *menu, int x, int y, Bool center) { int WindowNameCount; TwmWindow **WindowNames; TwmWindow *tmp_win2,*tmp_win3; int i; - int (*compar)(const char *, const char *) = + int (*compar)(const char *, const char *) = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); if (!menu) return False; @@ -1034,40 +1015,40 @@ menu->items = 0; menu->width = 0; menu->mapped = NEVER_MAPPED; - AddToMenu(menu, "TWM Windows", NULLSTR, NULL, F_TITLE,NULLSTR,NULLSTR); - - for(tmp_win = Scr->TwmRoot.next , WindowNameCount=0; - tmp_win != NULL; - tmp_win = tmp_win->next) - WindowNameCount++; - if (WindowNameCount != 0) - { - WindowNames = - (TwmWindow **)malloc(sizeof(TwmWindow *)*WindowNameCount); - WindowNames[0] = Scr->TwmRoot.next; - for(tmp_win = Scr->TwmRoot.next->next , WindowNameCount=1; - tmp_win != NULL; - tmp_win = tmp_win->next,WindowNameCount++) - { - tmp_win2 = tmp_win; - for (i=0;iname,WindowNames[i]->name) < 0) - { - tmp_win3 = tmp_win2; - tmp_win2 = WindowNames[i]; - WindowNames[i] = tmp_win3; - } - } - WindowNames[WindowNameCount] = tmp_win2; - } - for (i=0; iname, (char *)WindowNames[i], - NULL, F_POPUP, NULL, NULL); - } - free(WindowNames); - } + AddToMenu(menu, "TWM Windows", NULLSTR, NULL, F_TITLE,NULLSTR,NULLSTR); + + for(tmp_win = Scr->TwmRoot.next , WindowNameCount=0; + tmp_win != NULL; + tmp_win = tmp_win->next) + WindowNameCount++; + if (WindowNameCount != 0) + { + WindowNames = + (TwmWindow **)malloc(sizeof(TwmWindow *)*WindowNameCount); + WindowNames[0] = Scr->TwmRoot.next; + for(tmp_win = Scr->TwmRoot.next->next , WindowNameCount=1; + tmp_win != NULL; + tmp_win = tmp_win->next,WindowNameCount++) + { + tmp_win2 = tmp_win; + for (i=0;iname,WindowNames[i]->name) < 0) + { + tmp_win3 = tmp_win2; + tmp_win2 = WindowNames[i]; + WindowNames[i] = tmp_win3; + } + } + WindowNames[WindowNameCount] = tmp_win2; + } + for (i=0; iname, (char *)WindowNames[i], + NULL, F_POPUP, NULL, NULL); + } + free(WindowNames); + } MakeMenu(menu); } @@ -1140,7 +1121,7 @@ *********************************************************************** */ void -PopDownMenu() +PopDownMenu(void) { MenuRoot *tmp; @@ -1179,17 +1160,16 @@ * FindMenuRoot - look for a menu root * * Returned Value: - * (MenuRoot *) - a pointer to the menu root structure + * (MenuRoot *) - a pointer to the menu root structure * * Inputs: - * name - the name of the menu root + * name - the name of the menu root * *********************************************************************** */ MenuRoot * -FindMenuRoot(name) - char *name; +FindMenuRoot(char *name) { MenuRoot *tmp; @@ -1203,19 +1183,17 @@ -static Bool -belongs_to_twm_window (t, w) - register TwmWindow *t; - register Window w; +static Bool +belongs_to_twm_window (TwmWindow *t, Window w) { if (!t) return False; if (w == t->frame || w == t->title_w || w == t->hilite_w || w == t->icon_w || w == t->icon_bm_w) return True; - + if (t && t->titlebuttons) { - register TBWindow *tbw; - register int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; + TBWindow *tbw; + int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; for (tbw = t->titlebuttons; nb > 0; tbw++, nb--) { if (tbw->window == w) return True; } @@ -1235,10 +1213,8 @@ */ -void -resizeFromCenter(w, tmp_win) - Window w; - TwmWindow *tmp_win; +void +resizeFromCenter(Window w, TwmWindow *tmp_win) { int lastx, lasty, bw2; XEvent event; @@ -1257,11 +1233,11 @@ height = Scr->SizeFont.height + SIZE_VINDENT * 2; #endif XGetGeometry(dpy, w, &JunkRoot, &origDragX, &origDragY, - (unsigned int *)&DragWidth, (unsigned int *)&DragHeight, + (unsigned int *)&DragWidth, (unsigned int *)&DragHeight, &JunkBW, &JunkDepth); XWarpPointer(dpy, None, w, - 0, 0, 0, 0, DragWidth/2, DragHeight/2); - XQueryPointer (dpy, Scr->Root, &JunkRoot, + 0, 0, 0, 0, DragWidth/2, DragHeight/2); + XQueryPointer (dpy, Scr->Root, &JunkRoot, &JunkChild, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); #if 0 @@ -1287,7 +1263,7 @@ { XMaskEvent(dpy, ButtonPressMask | PointerMotionMask, &event); - + if (event.type == MotionNotify) { /* discard any extra motion events before a release */ while(XCheckMaskEvent(dpy, @@ -1295,38 +1271,38 @@ if (event.type == ButtonPress) break; } - + if (event.type == ButtonPress) { MenuEndResize(tmp_win); XMoveResizeWindow(dpy, w, AddingX, AddingY, AddingW, AddingH); break; } - + /* if (!DispatchEvent ()) continue; */ if (event.type != MotionNotify) { continue; } - + /* * XXX - if we are going to do a loop, we ought to consider - * using multiple GXxor lines so that we don't need to + * using multiple GXxor lines so that we don't need to * grab the server. */ XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); - + if (lastx != AddingX || lasty != AddingY) { MenuDoResize(AddingX, AddingY, tmp_win); - + lastx = AddingX; lasty = AddingY; } - + } -} +} @@ -1337,7 +1313,7 @@ * * Inputs: * func - the function to execute - * action - the menu action to execute + * action - the menu action to execute * w - the window to execute this function on * tmp_win - the twm window structure * event - the event that caused the function @@ -1354,28 +1330,21 @@ #define true 1 #define false 0 int -WarpThere(t) - TwmWindow* t; +WarpThere(TwmWindow* t) { if (Scr->WarpUnmapped || t->mapped) { - if (!t->mapped) DeIconify (t); - if (!Scr->NoRaiseWarp) XRaiseWindow (dpy, t->frame); - WarpToWindow (t); - return true; - } + if (!t->mapped) DeIconify (t); + if (!Scr->NoRaiseWarp) XRaiseWindow (dpy, t->frame); + WarpToWindow (t); + return true; + } return false; } int -ExecuteFunction(func, action, w, tmp_win, eventp, context, pulldown) - int func; - char *action; - Window w; - TwmWindow *tmp_win; - XEvent *eventp; - int context; - int pulldown; +ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, + XEvent *eventp, int context, int pulldown) { static Time last_time = 0; char tmp[200]; @@ -1415,10 +1384,10 @@ case F_COLORMAP: break; default: - XGrabPointer(dpy, Scr->Root, True, - ButtonPressMask | ButtonReleaseMask, - GrabModeAsync, GrabModeAsync, - Scr->Root, Scr->WaitCursor, CurrentTime); + XGrabPointer(dpy, Scr->Root, True, + ButtonPressMask | ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->WaitCursor, CurrentTime); break; } @@ -1451,12 +1420,12 @@ case F_FORWICONMGR: case F_BACKICONMGR: MoveIconManager(func); - break; + break; case F_NEXTICONMGR: case F_PREVICONMGR: JumpIconManager(func); - break; + break; case F_SHOWLIST: if (Scr->NoIconManagers) @@ -1485,7 +1454,7 @@ SortIconManager((IconMgr *) NULL); else if (tmp_win->iconmgr) SortIconManager(tmp_win->iconmgrp); - else + else Bell(XkbBI_Info,0,tmp_win->w); Scr->SortIconMgr = save_sort; @@ -1540,40 +1509,40 @@ PopDownMenu(); if (pulldown) - XWarpPointer(dpy, None, Scr->Root, + XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, eventp->xbutton.x_root, eventp->xbutton.y_root); if (w != tmp_win->icon_w) { /* can't resize icons */ if ((Context == C_FRAME || Context == C_WINDOW || Context == C_TITLE) - && fromMenu) + && fromMenu) resizeFromCenter(w, tmp_win); else { /* * see if this is being done from the titlebar */ - fromtitlebar = + fromtitlebar = belongs_to_twm_window (tmp_win, eventp->xbutton.window); - + /* Save pointer position so we can tell if it was moved or not during the resize. */ ResizeOrigX = eventp->xbutton.x_root; ResizeOrigY = eventp->xbutton.y_root; - + StartResize (eventp, tmp_win, fromtitlebar); - + do { XMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | ButtonMotionMask, &Event); - + if (fromtitlebar && Event.type == ButtonPress) { fromtitlebar = False; continue; } - - if (Event.type == MotionNotify) { + + if (Event.type == MotionNotify) { /* discard any extra motion events before a release */ while (XCheckMaskEvent @@ -1581,13 +1550,13 @@ if (Event.type == ButtonRelease) break; } - + if (!DispatchEvent ()) continue; - + } while (!(Event.type == ButtonRelease || Cancel)); return TRUE; } - } + } break; @@ -1614,7 +1583,7 @@ MoveFunction = func; if (pulldown) - XWarpPointer(dpy, None, Scr->Root, + XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, eventp->xbutton.x_root, eventp->xbutton.y_root); EventHandler[EnterNotify] = HandleUnknown; @@ -1640,8 +1609,8 @@ else if (w != tmp_win->icon_w) { XTranslateCoordinates(dpy, w, tmp_win->frame, - eventp->xbutton.x, - eventp->xbutton.y, + eventp->xbutton.x, + eventp->xbutton.y, &DragX, &DragY, &JunkChild); w = tmp_win->frame; @@ -1662,7 +1631,7 @@ * only do the constrained move if timer is set; need to check it * in case of stupid or wicked fast servers */ - if (ConstrainedMoveTime && + if (ConstrainedMoveTime && (eventp->xbutton.time - last_time) < ConstrainedMoveTime) { int width, height; @@ -1721,18 +1690,18 @@ if (menuFromFrameOrWindowOrTitlebar) { /* warp the pointer to the middle of the window */ - XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, - origDragX + DragWidth / 2, + XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, + origDragX + DragWidth / 2, origDragY + DragHeight / 2); XFlush(dpy); } - + while (TRUE) { - long releaseEvent = menuFromFrameOrWindowOrTitlebar ? - ButtonPress : ButtonRelease; + long releaseEvent = menuFromFrameOrWindowOrTitlebar ? + ButtonPress : ButtonRelease; long movementMask = menuFromFrameOrWindowOrTitlebar ? - PointerMotionMask : ButtonMotionMask; + PointerMotionMask : ButtonMotionMask; /* block until there is an interesting event */ XMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask | @@ -1742,7 +1711,7 @@ /* throw away enter and leave events until release */ if (Event.xany.type == EnterNotify || - Event.xany.type == LeaveNotify) continue; + Event.xany.type == LeaveNotify) continue; if (Event.type == MotionNotify) { /* discard any extra motion events before a logical release */ @@ -1754,13 +1723,13 @@ /* test to see if we have a second button press to abort move */ if (!menuFromFrameOrWindowOrTitlebar && !MovedFromKeyPress) { - if (Event.type == ButtonPress && DragWindow != None) { + if (Event.type == ButtonPress && DragWindow != None) { if (Scr->OpaqueMove) XMoveWindow (dpy, DragWindow, origDragX, origDragY); else - MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); DragWindow = None; - } + } } if (fromtitlebar && Event.type == ButtonPress) { fromtitlebar = False; @@ -1789,7 +1758,7 @@ CurrentDragY != origDragY))) tmp_win->icon_moved = TRUE; if (!Scr->OpaqueMove && menuFromFrameOrWindowOrTitlebar) - XMoveWindow(dpy, DragWindow, + XMoveWindow(dpy, DragWindow, Event.xbutton.x_root - DragWidth / 2, Event.xbutton.y_root - DragHeight / 2); break; @@ -1805,7 +1774,7 @@ if (DragWindow == None && abs(eventp->xmotion.x_root - origX) < Scr->MoveDelta && - abs(eventp->xmotion.y_root - origY) < Scr->MoveDelta) + abs(eventp->xmotion.y_root - origY) < Scr->MoveDelta) continue; WindowMoved = TRUE; @@ -1870,7 +1839,7 @@ XMoveWindow(dpy, DragWindow, xl, yt); else MoveOutline(eventp->xmotion.root, xl, yt, w, h, - tmp_win->frame_bw, + tmp_win->frame_bw, moving_icon ? 0 : tmp_win->title_height); } } @@ -1884,7 +1853,7 @@ else { xl = eventp->xmotion.x_root - (DragWidth / 2); yt = eventp->xmotion.y_root - (DragHeight / 2); - } + } w = DragWidth + 2 * JunkBW; h = DragHeight + 2 * JunkBW; @@ -1915,13 +1884,13 @@ } } - MovedFromKeyPress = False; + MovedFromKeyPress = False; if (!Scr->OpaqueMove && DragWindow == None) UninstallRootColormap(); - break; + break; case F_FUNCTION: { @@ -1930,7 +1899,7 @@ if ((mroot = FindMenuRoot(action)) == NULL) { - fprintf (stderr, "%s: couldn't find function \"%s\"\n", + fprintf (stderr, "%s: couldn't find function \"%s\"\n", ProgramName, action); return TRUE; } @@ -1958,7 +1927,7 @@ { DeIconify(tmp_win); } - else if (func == F_ICONIFY) + else if (func == F_ICONIFY) { Iconify (tmp_win, eventp->xbutton.x_root - 5, eventp->xbutton.y_root - 5); @@ -1978,13 +1947,13 @@ XConfigureWindow (dpy, w, CWStackMode, &xwc); } break; - + case F_RAISE: if (DeferExecution(context, func, Scr->SelectCursor)) return TRUE; /* check to make sure raise is not from the WindowFunction */ - if (w == tmp_win->icon_w && Context != C_ROOT) + if (w == tmp_win->icon_w && Context != C_ROOT) XRaiseWindow(dpy, tmp_win->icon_w); else XRaiseWindow(dpy, tmp_win->frame); @@ -2081,7 +2050,7 @@ while (TRUE) { XMaskEvent(dpy, KeyPressMask | ExposureMask | - PropertyChangeMask, &Event); + PropertyChangeMask, &Event); if (!DispatchEvent ()) continue; @@ -2176,12 +2145,12 @@ if (count > 0) XStoreBytes (dpy, buff, count); close(fd); } else { - fprintf (stderr, - "%s: unable to open cut file \"%s\"\n", + fprintf (stderr, + "%s: unable to open cut file \"%s\"\n", ProgramName, tmp); } if (ptr != tmp) free (ptr); - } + } } else { XFree(ptr); } @@ -2219,7 +2188,7 @@ case F_WARPPREV: case F_WARPNEXT: { - register TwmWindow *t; + TwmWindow *t; static TwmWindow *savedwarp = NULL; TwmWindow *of, *l, *n; int c=0; @@ -2252,29 +2221,29 @@ case F_WARPTO: { - register TwmWindow *t; + TwmWindow *t; int len; len = strlen(action); for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { - if (!strncmp(action, t->name, len)) - if (WarpThere(t)) break; + if (!strncmp(action, t->name, len)) + if (WarpThere(t)) break; } if (!t) { for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { - if (!strncmp(action, t->class.res_name, len)) - if (WarpThere(t)) break; + if (!strncmp(action, t->class.res_name, len)) + if (WarpThere(t)) break; } if (!t) { for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { - if (!strncmp(action, t->class.res_class, len)) - if (WarpThere(t)) break; + if (!strncmp(action, t->class.res_class, len)) + if (WarpThere(t)) break; } } } - if (!t) + if (!t) Bell(XkbBI_MinorError,0,None); } break; @@ -2314,7 +2283,7 @@ } } break; - + case F_WARPRING: switch (action[0]) { case 'n': @@ -2342,7 +2311,7 @@ } else { - fprintf (stderr, "%s: unable to open file \"%s\"\n", + fprintf (stderr, "%s: unable to open file \"%s\"\n", ProgramName, action); } break; @@ -2395,7 +2364,7 @@ if (DeferExecution (context, func, Scr->SelectCursor)) return TRUE; (void)XSyncSetPriority(dpy, tmp_win->w, atoi(action)); - } + } break; case F_STARTWM: execlp("/bin/sh", "sh", "-c", action, (void *)NULL); @@ -2425,9 +2394,7 @@ */ int -DeferExecution(context, func, cursor) -int context, func; -Cursor cursor; +DeferExecution(int context, int func, Cursor cursor) { if (context == C_ROOT) { @@ -2441,7 +2408,7 @@ return (TRUE); } - + return (FALSE); } @@ -2455,7 +2422,7 @@ *********************************************************************** */ void -ReGrab() +ReGrab(void) { XGrabPointer(dpy, Scr->Root, True, ButtonPressMask | ButtonReleaseMask, @@ -2477,8 +2444,7 @@ *********************************************************************** */ Bool -NeedToDefer(root) -MenuRoot *root; +NeedToDefer(MenuRoot *root) { MenuItem *mitem; @@ -2502,10 +2468,10 @@ case F_TOTALZOOM: case F_FULLZOOM: case F_HORIZOOM: - case F_RIGHTZOOM: - case F_LEFTZOOM: - case F_TOPZOOM: - case F_BOTTOMZOOM: + case F_RIGHTZOOM: + case F_LEFTZOOM: + case F_TOPZOOM: + case F_BOTTOMZOOM: case F_AUTORAISE: case F_CHANGELABEL: return TRUE; @@ -2528,7 +2494,7 @@ */ #if defined(sun) && defined(SVR4) -static int +static int System (char *s) { int pid, status; @@ -2543,8 +2509,7 @@ #endif void -Execute(s) - char *s; +Execute(char *s) { static char buf[256]; char *ds = DisplayString (dpy); @@ -2595,7 +2560,7 @@ */ void -FocusOnRoot() +FocusOnRoot(void) { SetFocus ((TwmWindow *) NULL, LastTimestamp()); if (Scr->Focus != NULL) @@ -2609,8 +2574,7 @@ } void -DeIconify(tmp_win) -TwmWindow *tmp_win; +DeIconify(TwmWindow *tmp_win) { TwmWindow *t; @@ -2663,7 +2627,7 @@ Zoom(t->icon_w, t->frame); else Zoom(tmp_win->icon_w, t->frame); - + XMapWindow(dpy, t->w); t->mapped = TRUE; if (Scr->NoRaiseDeicon) @@ -2671,7 +2635,7 @@ else XMapRaised(dpy, t->frame); SetMapStateProp(t, NormalState); - + if (t->icon_w) { XUnmapWindow(dpy, t->icon_w); IconDown (t); @@ -2681,15 +2645,13 @@ t->icon_on = FALSE; } } - + XSync (dpy, 0); } void -Iconify(tmp_win, def_x, def_y) -TwmWindow *tmp_win; -int def_x, def_y; +Iconify(TwmWindow *tmp_win, int def_x, int def_y) { TwmWindow *t; int iconify; @@ -2723,7 +2685,7 @@ else Zoom(t->frame, tmp_win->icon_w); } - + /* * Prevent the receipt of an UnmapNotify, since that would * cause a transition to the Withdrawn state. @@ -2747,8 +2709,8 @@ t->icon = TRUE; t->icon_on = FALSE; } - } - + } + if (iconify) Zoom(tmp_win->frame, tmp_win->icon_w); @@ -2780,9 +2742,8 @@ -static void -Identify (t) - TwmWindow *t; +static void +Identify (TwmWindow *t) { int i, n, twidth, width, height; int x, y; @@ -2824,7 +2785,7 @@ width = 1; for (i = 0; i < n; i++) { - twidth = MyFont_TextWidth(&Scr->DefaultFont, Info[i], + twidth = MyFont_TextWidth(&Scr->DefaultFont, Info[i], strlen(Info[i])); if (twidth > width) width = twidth; @@ -2836,9 +2797,9 @@ &dummy, &dummy, &udummy)) { px -= (width / 2); py -= (height / 3); - if (px + width + BW2 >= Scr->MyDisplayWidth) + if (px + width + BW2 >= Scr->MyDisplayWidth) px = Scr->MyDisplayWidth - width - BW2; - if (py + height + BW2 >= Scr->MyDisplayHeight) + if (py + height + BW2 >= Scr->MyDisplayHeight) py = Scr->MyDisplayHeight - height - BW2; if (px < 0) px = 0; if (py < 0) py = 0; @@ -2846,33 +2807,28 @@ px = py = 0; } XMoveResizeWindow(dpy, Scr->InfoWindow, px, py, width, height); - XMapRaised(dpy, Scr->InfoWindow); + XMapRaised(dpy, Scr->InfoWindow); InfoLines = n; } void -SetMapStateProp(tmp_win, state) - TwmWindow *tmp_win; - int state; +SetMapStateProp(TwmWindow *tmp_win, int state) { unsigned long data[2]; /* "suggested" by ICCCM version 1 */ - + data[0] = (unsigned long) state; - data[1] = (unsigned long) (tmp_win->iconify_by_unmapping ? None : + data[1] = (unsigned long) (tmp_win->iconify_by_unmapping ? None : tmp_win->icon_w); - XChangeProperty (dpy, tmp_win->w, _XA_WM_STATE, _XA_WM_STATE, 32, + XChangeProperty (dpy, tmp_win->w, _XA_WM_STATE, _XA_WM_STATE, 32, PropModeReplace, (unsigned char *) data, 2); } -Bool -GetWMState (w, statep, iwp) - Window w; - int *statep; - Window *iwp; +Bool +GetWMState (Window w, int *statep, Window *iwp) { Atom actual_type; int actual_format; @@ -2897,8 +2853,7 @@ void -WarpToScreen (n, inc) - int n, inc; +WarpToScreen (int n, int inc) { Window dumwin; int x, y, dumint; @@ -2907,7 +2862,7 @@ while (!newscr) { /* wrap around */ - if (n < 0) + if (n < 0) n = NumScreens - 1; else if (n >= NumScreens) n = 0; @@ -2918,7 +2873,7 @@ n += inc; continue; } - fprintf (stderr, "%s: unable to warp to unmanaged screen %d\n", + fprintf (stderr, "%s: unable to warp to unmanaged screen %d\n", ProgramName, n); Bell(XkbBI_MinorError,0,None); return; @@ -2932,7 +2887,6 @@ &dumint, &dumint, &dummask); XWarpPointer (dpy, None, newscr->Root, 0, 0, 0, 0, x, y); - return; } @@ -2942,9 +2896,7 @@ * BumpWindowColormap - rotate our internal copy of WM_COLORMAP_WINDOWS */ void -BumpWindowColormap (tmp, inc) - TwmWindow *tmp; - int inc; +BumpWindowColormap (TwmWindow *tmp, int inc) { int i, j, previously_installed; ColormapWindow **cwins; @@ -2954,10 +2906,10 @@ if (inc && tmp->cmaps.number_cwins > 0) { cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *)* tmp->cmaps.number_cwins); - if (cwins) { + if (cwins) { if ((previously_installed = /* SUPPRESS 560 */(Scr->cmapInfo.cmaps == &tmp->cmaps && - tmp->cmaps.number_cwins))) { + tmp->cmaps.number_cwins))) { for (i = tmp->cmaps.number_cwins; i-- > 0; ) tmp->cmaps.cwins[i]->colormap->state = 0; } @@ -2976,7 +2928,7 @@ tmp->cmaps.cwins = cwins; if (tmp->cmaps.number_cwins > 1) - bzero (tmp->cmaps.scoreboard, + bzero (tmp->cmaps.scoreboard, ColormapsScoreboardLength(&tmp->cmaps)); if (previously_installed) @@ -2988,7 +2940,7 @@ void -HideIconManager () +HideIconManager (void) { SetMapStateProp (Scr->iconmgr.twm_win, WithdrawnState); XUnmapWindow(dpy, Scr->iconmgr.twm_win->frame); @@ -3001,18 +2953,16 @@ void -SetBorder (tmp, onoroff) - TwmWindow *tmp; - Bool onoroff; +SetBorder (TwmWindow *tmp, Bool onoroff) { if (tmp->highlight) { if (onoroff) { XSetWindowBorder (dpy, tmp->frame, tmp->border); - if (tmp->title_w) + if (tmp->title_w) XSetWindowBorder (dpy, tmp->title_w, tmp->border); } else { XSetWindowBorderPixmap (dpy, tmp->frame, tmp->gray); - if (tmp->title_w) + if (tmp->title_w) XSetWindowBorderPixmap (dpy, tmp->title_w, tmp->gray); } } @@ -3020,8 +2970,7 @@ void -DestroyMenu (menu) - MenuRoot *menu; +DestroyMenu (MenuRoot *menu) { MenuItem *item; @@ -3044,16 +2993,14 @@ /* * warping routines */ -void -WarpAlongRing (ev, forward) - XButtonEvent *ev; - Bool forward; +void +WarpAlongRing (XButtonEvent *ev, Bool forward) { TwmWindow *r, *head; if (Scr->RingLeader) head = Scr->RingLeader; - else if (!(head = Scr->Ring)) + else if (!(head = Scr->Ring)) return; if (forward) { @@ -3078,9 +3025,9 @@ p->ring.cursor_valid = True; p->ring.curs_x = ev->x_root - t->frame_x; p->ring.curs_y = ev->y_root - t->frame_y; - if (p->ring.curs_x < -p->frame_bw || + if (p->ring.curs_x < -p->frame_bw || p->ring.curs_x >= p->frame_width + p->frame_bw || - p->ring.curs_y < -p->frame_bw || + p->ring.curs_y < -p->frame_bw || p->ring.curs_y >= p->frame_height + p->frame_bw) { /* somehow out of window */ p->ring.curs_x = p->frame_width / 2; @@ -3092,9 +3039,8 @@ -void -WarpToWindow (t) - TwmWindow *t; +void +WarpToWindow (TwmWindow *t) { int x, y; @@ -3123,11 +3069,8 @@ * data[0] message atom * data[1] time stamp */ -static void -send_clientmessage (w, a, timestamp) - Window w; - Atom a; - Time timestamp; +static void +send_clientmessage (Window w, Atom a, Time timestamp) { XClientMessageEvent ev; @@ -3141,25 +3084,19 @@ } void -SendDeleteWindowMessage (tmp, timestamp) - TwmWindow *tmp; - Time timestamp; +SendDeleteWindowMessage (TwmWindow *tmp, Time timestamp) { send_clientmessage (tmp->w, _XA_WM_DELETE_WINDOW, timestamp); } void -SendSaveYourselfMessage (tmp, timestamp) - TwmWindow *tmp; - Time timestamp; +SendSaveYourselfMessage (TwmWindow *tmp, Time timestamp) { send_clientmessage (tmp->w, _XA_WM_SAVE_YOURSELF, timestamp); } void -SendTakeFocusMessage (tmp, timestamp) - TwmWindow *tmp; - Time timestamp; +SendTakeFocusMessage (TwmWindow *tmp, Time timestamp) { send_clientmessage (tmp->w, _XA_WM_TAKE_FOCUS, timestamp); } Index: xc/programs/twm/parse.c diff -u xc/programs/twm/parse.c:1.20 xc/programs/twm/parse.c:1.21 --- xc/programs/twm/parse.c:1.20 Tue Jul 19 17:32:38 2005 +++ xc/programs/twm/parse.c Tue Oct 9 17:31:39 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/parse.c,v 1.20 2005/07/20 00:32:38 dawes Exp $ */ +/* $XFree86: xc/programs/twm/parse.c,v 1.21 2007/10/10 00:31:39 tsi Exp $ */ /*****************************************************************************/ /* @@ -67,7 +67,7 @@ #include "util.h" #include "gram.h" #include "parse.h" -#include +#include #include #ifndef SYSTEM_INIT_FILE @@ -106,10 +106,8 @@ *********************************************************************** */ -static int doparse (ifunc, srctypename, srcname) - int (*ifunc)(void); - char *srctypename; - char *srcname; +static int +doparse (int (*ifunc)(void), char *srctypename, char *srcname) { mods = 0; ptr = 0; @@ -165,8 +163,8 @@ } -int ParseTwmrc (filename) - char *filename; +int +ParseTwmrc (char *filename) { int i; char *home = NULL; @@ -232,8 +230,8 @@ } } -int ParseStringList (sl) - char **sl; +int +ParseStringList (char **sl) { stringListSource = sl; currentString = *sl; @@ -252,7 +250,8 @@ *********************************************************************** */ -static int twmFileInput() +static int +twmFileInput(void) { if (overflowlen) return (int) overflowbuff[--overflowlen]; @@ -267,7 +266,8 @@ return ((int)buff[ptr++]); } -static int twmStringListInput() +static int +twmStringListInput(void) { if (overflowlen) return (int) overflowbuff[--overflowlen]; @@ -296,8 +296,8 @@ *********************************************************************** */ -void twmUnput (c) - int c; +void +twmUnput (int c) { if (overflowlen < sizeof overflowbuff) { overflowbuff[overflowlen++] = (unsigned char) c; @@ -321,8 +321,7 @@ */ void -TwmOutput(c) - int c; +TwmOutput(int c) { putchar(c); } @@ -331,7 +330,7 @@ /********************************************************************** * * Parsing table and routines - * + * ***********************************************************************/ typedef struct _TwmKeyword { @@ -419,7 +418,7 @@ * in lowercase and only contain the letters a-z). It is fed to a binary * search to parse keywords. */ -static TwmKeyword keytable[] = { +static TwmKeyword keytable[] = { { "all", ALL, 0 }, { "autoraise", AUTO_RAISE, 0 }, { "autorelativeresize", KEYWORD, kw0_AutoRelativeResize }, @@ -628,26 +627,25 @@ static int numkeywords = (sizeof(keytable)/sizeof(keytable[0])); -int parse_keyword (s, nump) - char *s; - int *nump; +int +parse_keyword (char *s, int *nump) { - register int lower = 0, upper = numkeywords - 1; + int lower = 0, upper = numkeywords - 1; XmuCopyISOLatin1Lowered (s, s); while (lower <= upper) { - int middle = (lower + upper) / 2; + int middle = (lower + upper) / 2; TwmKeyword *p = &keytable[middle]; - int res = strcmp (p->name, s); + int res = strcmp (p->name, s); - if (res < 0) { - lower = middle + 1; - } else if (res == 0) { + if (res < 0) { + lower = middle + 1; + } else if (res == 0) { *nump = p->subnum; - return p->value; - } else { - upper = middle - 1; - } + return p->value; + } else { + upper = middle - 1; + } } return ERRORTOKEN; } @@ -658,8 +656,8 @@ * action routines called by grammar */ -int do_single_keyword (keyword) - int keyword; +int +do_single_keyword (int keyword) { switch (keyword) { case kw0_NoDefaults: @@ -767,13 +765,12 @@ } -int do_string_keyword (keyword, s) - int keyword; - char *s; +int +do_string_keyword (int keyword, char *s) { switch (keyword) { case kws_UsePPosition: - { + { int ppos = ParseUsePPosition (s); if (ppos < 0) { twmrc_error_prefix(); @@ -815,7 +812,7 @@ case kws_MaxWindowSize: JunkMask = XParseGeometry (s, &JunkX, &JunkY, &JunkWidth, &JunkHeight); - if ((JunkMask & (WidthValue | HeightValue)) != + if ((JunkMask & (WidthValue | HeightValue)) != (WidthValue | HeightValue)) { twmrc_error_prefix(); fprintf (stderr, "bad MaxWindowSize \"%s\"\n", s); @@ -835,9 +832,8 @@ } -int do_number_keyword (keyword, num) - int keyword; - int num; +int +do_number_keyword (int keyword, int num) { switch (keyword) { case kwn_ConstrainedMoveTime: @@ -896,10 +892,8 @@ return 0; } -name_list **do_colorlist_keyword (keyword, colormode, s) - int keyword; - int colormode; - char *s; +name_list ** +do_colorlist_keyword (int keyword, int colormode, char *s) { switch (keyword) { case kwcl_BorderColor: @@ -949,10 +943,8 @@ return NULL; } -int do_color_keyword (keyword, colormode, s) - int keyword; - int colormode; - char *s; +int +do_color_keyword (int keyword, int colormode, char *s) { switch (keyword) { case kwc_DefaultForeground: @@ -1003,36 +995,33 @@ * put_pixel_on_root() Save a pixel value in twm root window color property. */ void -put_pixel_on_root(pixel) - Pixel pixel; -{ +put_pixel_on_root(Pixel pixel) +{ int i, addPixel = 1; - Atom pixelAtom, retAtom; + Atom pixelAtom, retAtom; int retFormat; - unsigned long nPixels, retAfter; + unsigned long nPixels, retAfter; Pixel *retProp; - pixelAtom = XInternAtom(dpy, "_MIT_PRIORITY_COLORS", TRUE); - XGetWindowProperty(dpy, Scr->Root, pixelAtom, 0, 8192, - FALSE, XA_CARDINAL, &retAtom, - &retFormat, &nPixels, &retAfter, + pixelAtom = XInternAtom(dpy, "_MIT_PRIORITY_COLORS", TRUE); + XGetWindowProperty(dpy, Scr->Root, pixelAtom, 0, 8192, + FALSE, XA_CARDINAL, &retAtom, + &retFormat, &nPixels, &retAfter, (unsigned char **)&retProp); - for (i=0; i< nPixels; i++) - if (pixel == retProp[i]) addPixel = 0; - - if (addPixel) + for (i=0; i< nPixels; i++) + if (pixel == retProp[i]) addPixel = 0; + + if (addPixel) XChangeProperty (dpy, Scr->Root, _XA_MIT_PRIORITY_COLORS, - XA_CARDINAL, 32, PropModeAppend, - (unsigned char *)&pixel, 1); -} + XA_CARDINAL, 32, PropModeAppend, + (unsigned char *)&pixel, 1); +} /* * do_string_savecolor() save a color from a string in the twmrc file. */ void -do_string_savecolor(colormode, s) - int colormode; - char *s; +do_string_savecolor(int colormode, char *s) { Pixel p; GetColor(colormode, &p, s); @@ -1042,12 +1031,14 @@ /* * do_var_savecolor() save a color from a var in the twmrc file. */ -typedef struct _cnode {int i; struct _cnode *next;} Cnode, *Cptr; +typedef struct _cnode { + int i; + struct _cnode *next; +} Cnode, *Cptr; Cptr chead = NULL; void -do_var_savecolor(key) -int key; +do_var_savecolor(int key) { Cptr cptrav, cpnew; if (!chead) { @@ -1066,8 +1057,8 @@ * assign_var_savecolor() traverse the var save color list placeing the pixels * in the root window property. */ -void -assign_var_savecolor() +void +assign_var_savecolor(void) { Cptr cp = chead; while (cp != NULL) { @@ -1114,9 +1105,8 @@ } } -static int -ParseUsePPosition (s) - register char *s; +static int +ParseUsePPosition (char *s) { XmuCopyISOLatin1Lowered (s, s); @@ -1134,12 +1124,8 @@ void -do_squeeze_entry (list, name, justify, num, denom) - name_list **list; /* squeeze or dont-squeeze list */ - char *name; /* window name */ - int justify; /* left, center, right */ - int num; /* signed num */ - int denom; /* 0 or indicates fraction denom */ +do_squeeze_entry (name_list **list, char *name, int justify, int num, + int denom) { int absnum = (num < 0 ? -num : num); Index: xc/programs/twm/parse.h diff -u xc/programs/twm/parse.h:1.13 xc/programs/twm/parse.h:1.14 --- xc/programs/twm/parse.h:1.13 Tue Jul 19 17:32:38 2005 +++ xc/programs/twm/parse.h Tue Oct 9 17:31:39 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/parse.h,v 1.13 2005/07/20 00:32:38 dawes Exp $ */ +/* $XFree86: xc/programs/twm/parse.h,v 1.14 2007/10/10 00:31:39 tsi Exp $ */ /*****************************************************************************/ /* @@ -68,7 +68,7 @@ extern int do_single_keyword ( int keyword ); extern int do_string_keyword ( int keyword, char *s ); extern int do_number_keyword ( int keyword, int num ); -extern name_list **do_colorlist_keyword ( int keyword, int colormode, +extern name_list **do_colorlist_keyword ( int keyword, int colormode, char *s ); extern int do_color_keyword ( int keyword, int colormode, char *s ); void put_pixel_on_root ( Pixel pixel ); @@ -79,7 +79,7 @@ extern int parse_keyword ( char *s, int *nump ); extern void TwmOutput ( int c ); extern void twmUnput ( int c ); -extern void do_squeeze_entry ( name_list **list, char *name, int justify, +extern void do_squeeze_entry ( name_list **list, char *name, int justify, int num, int denom ); @@ -135,7 +135,7 @@ #define F_SHOWLIST 44 #define F_HIDELIST 45 #define F_CHANGELABEL 46 -#define F_TOTALZOOM 47 +#define F_TOTALZOOM 47 #define F_MENU 101 /* string */ #define F_WARPNEXT 112 /* string */ Index: xc/programs/twm/resize.c diff -u xc/programs/twm/resize.c:1.10 xc/programs/twm/resize.c:1.11 --- xc/programs/twm/resize.c:1.10 Tue Jul 19 17:32:38 2005 +++ xc/programs/twm/resize.c Tue Oct 9 17:31:39 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/resize.c,v 1.11 2007/10/10 00:31:39 tsi Exp $ */ /*****************************************************************************/ /* @@ -58,7 +59,6 @@ * ***********************************************************************/ -/* $XFree86: xc/programs/twm/resize.c,v 1.10 2005/07/20 00:32:38 dawes Exp $ */ #include #include "twm.h" @@ -94,7 +94,7 @@ static int last_height; -static void +static void do_auto_clamp (TwmWindow *tmp_win, XEvent *evp) { Window junkRoot; @@ -117,9 +117,9 @@ } h = ((x - dragx) / (dragWidth < 3 ? 1 : (dragWidth / 3))); - v = ((y - dragy - tmp_win->title_height) / + v = ((y - dragy - tmp_win->title_height) / (dragHeight < 3 ? 1 : (dragHeight / 3))); - + if (h <= 0) { clampLeft = 1; clampDX = (x - dragx); @@ -152,10 +152,7 @@ */ void -StartResize(evp, tmp_win, fromtitlebar) -XEvent *evp; -TwmWindow *tmp_win; -Bool fromtitlebar; +StartResize(XEvent *evp, TwmWindow *tmp_win, Bool fromtitlebar) { Window junkRoot; unsigned int junkbw, junkDepth; @@ -163,14 +160,14 @@ ResizeWindow = tmp_win->frame; XGrabServer(dpy); XGrabPointer(dpy, Scr->Root, True, - ButtonPressMask | ButtonReleaseMask | + ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | PointerMotionHintMask, - GrabModeAsync, GrabModeAsync, - Scr->Root, Scr->ResizeCursor, CurrentTime); + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->ResizeCursor, CurrentTime); XGetGeometry(dpy, (Drawable) tmp_win->frame, &junkRoot, - &dragx, &dragy, (unsigned int *)&dragWidth, (unsigned int *)&dragHeight, &junkbw, - &junkDepth); + &dragx, &dragy, (unsigned int *)&dragWidth, (unsigned int *)&dragHeight, &junkbw, + &junkDepth); dragx += tmp_win->frame_bw; dragy += tmp_win->frame_bw; origx = dragx; @@ -184,7 +181,7 @@ Scr->SizeStringOffset = SIZE_HINDENT; XResizeWindow (dpy, Scr->SizeWindow, - Scr->SizeStringWidth + SIZE_HINDENT * 2, + Scr->SizeStringWidth + SIZE_HINDENT * 2, Scr->SizeFont.height + SIZE_VINDENT * 2); XMapRaised(dpy, Scr->SizeWindow); InstallRootColormap(); @@ -200,15 +197,13 @@ void -MenuStartResize(tmp_win, x, y, w, h) -TwmWindow *tmp_win; -int x, y, w, h; +MenuStartResize(TwmWindow *tmp_win, int x, int y, int w, int h) { XGrabServer(dpy); XGrabPointer(dpy, Scr->Root, True, - ButtonPressMask | ButtonMotionMask | PointerMotionMask, - GrabModeAsync, GrabModeAsync, - Scr->Root, Scr->ResizeCursor, CurrentTime); + ButtonPressMask | ButtonMotionMask | PointerMotionMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->ResizeCursor, CurrentTime); dragx = x + tmp_win->frame_bw; dragy = y + tmp_win->frame_bw; origx = dragx; @@ -220,12 +215,12 @@ last_height = 0; Scr->SizeStringOffset = SIZE_HINDENT; XResizeWindow (dpy, Scr->SizeWindow, - Scr->SizeStringWidth + SIZE_HINDENT * 2, + Scr->SizeStringWidth + SIZE_HINDENT * 2, Scr->SizeFont.height + SIZE_VINDENT * 2); XMapRaised(dpy, Scr->SizeWindow); DisplaySize(tmp_win, origWidth, origHeight); MoveOutline (Scr->Root, dragx - tmp_win->frame_bw, - dragy - tmp_win->frame_bw, + dragy - tmp_win->frame_bw, dragWidth + 2 * tmp_win->frame_bw, dragHeight + 2 * tmp_win->frame_bw, tmp_win->frame_bw, tmp_win->title_height); @@ -243,15 +238,13 @@ */ void -AddStartResize(tmp_win, x, y, w, h) -TwmWindow *tmp_win; -int x, y, w, h; +AddStartResize(TwmWindow *tmp_win, int x, int y, int w, int h) { XGrabServer(dpy); XGrabPointer(dpy, Scr->Root, True, - ButtonReleaseMask | ButtonMotionMask | PointerMotionHintMask, - GrabModeAsync, GrabModeAsync, - Scr->Root, Scr->ResizeCursor, CurrentTime); + ButtonReleaseMask | ButtonMotionMask | PointerMotionHintMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->ResizeCursor, CurrentTime); dragx = x + tmp_win->frame_bw; dragy = y + tmp_win->frame_bw; @@ -273,10 +266,7 @@ void -MenuDoResize(x_root, y_root, tmp_win) -int x_root; -int y_root; -TwmWindow *tmp_win; +MenuDoResize(int x_root, int y_root, TwmWindow *tmp_win) { int action; @@ -286,91 +276,91 @@ y_root -= clampDY; if (clampTop) { - int delta = y_root - dragy; - if (dragHeight - delta < MINHEIGHT) { - delta = dragHeight - MINHEIGHT; - clampTop = 0; - } - dragy += delta; - dragHeight -= delta; - action = 1; + int delta = y_root - dragy; + if (dragHeight - delta < MINHEIGHT) { + delta = dragHeight - MINHEIGHT; + clampTop = 0; + } + dragy += delta; + dragHeight -= delta; + action = 1; } else if (y_root <= dragy/* || - y_root == findRootInfo(root)->rooty*/) { - dragy = y_root; - dragHeight = origy + origHeight - - y_root; - clampBottom = 0; - clampTop = 1; + y_root == findRootInfo(root)->rooty*/) { + dragy = y_root; + dragHeight = origy + origHeight - + y_root; + clampBottom = 0; + clampTop = 1; clampDY = 0; - action = 1; + action = 1; } if (clampLeft) { - int delta = x_root - dragx; - if (dragWidth - delta < MINWIDTH) { - delta = dragWidth - MINWIDTH; - clampLeft = 0; - } - dragx += delta; - dragWidth -= delta; - action = 1; + int delta = x_root - dragx; + if (dragWidth - delta < MINWIDTH) { + delta = dragWidth - MINWIDTH; + clampLeft = 0; + } + dragx += delta; + dragWidth -= delta; + action = 1; } else if (x_root <= dragx/* || - x_root == findRootInfo(root)->rootx*/) { - dragx = x_root; - dragWidth = origx + origWidth - - x_root; - clampRight = 0; - clampLeft = 1; + x_root == findRootInfo(root)->rootx*/) { + dragx = x_root; + dragWidth = origx + origWidth - + x_root; + clampRight = 0; + clampLeft = 1; clampDX = 0; - action = 1; + action = 1; } if (clampBottom) { - int delta = y_root - dragy - dragHeight; - if (dragHeight + delta < MINHEIGHT) { - delta = MINHEIGHT - dragHeight; - clampBottom = 0; - } - dragHeight += delta; - action = 1; + int delta = y_root - dragy - dragHeight; + if (dragHeight + delta < MINHEIGHT) { + delta = MINHEIGHT - dragHeight; + clampBottom = 0; + } + dragHeight += delta; + action = 1; } else if (y_root >= dragy + dragHeight) { - dragy = origy; - dragHeight = 1 + y_root - dragy; - clampTop = 0; - clampBottom = 1; + dragy = origy; + dragHeight = 1 + y_root - dragy; + clampTop = 0; + clampBottom = 1; clampDY = 0; - action = 1; + action = 1; } if (clampRight) { - int delta = x_root - dragx - dragWidth; - if (dragWidth + delta < MINWIDTH) { - delta = MINWIDTH - dragWidth; - clampRight = 0; - } - dragWidth += delta; - action = 1; + int delta = x_root - dragx - dragWidth; + if (dragWidth + delta < MINWIDTH) { + delta = MINWIDTH - dragWidth; + clampRight = 0; + } + dragWidth += delta; + action = 1; } else if (x_root >= dragx + dragWidth) { - dragx = origx; - dragWidth = 1 + x_root - origx; - clampLeft = 0; - clampRight = 1; + dragx = origx; + dragWidth = 1 + x_root - origx; + clampLeft = 0; + clampRight = 1; clampDX = 0; - action = 1; + action = 1; } if (action) { - ConstrainSize (tmp_win, &dragWidth, &dragHeight); - if (clampLeft) - dragx = origx + origWidth - dragWidth; - if (clampTop) - dragy = origy + origHeight - dragHeight; - MoveOutline(Scr->Root, - dragx - tmp_win->frame_bw, - dragy - tmp_win->frame_bw, - dragWidth + 2 * tmp_win->frame_bw, - dragHeight + 2 * tmp_win->frame_bw, + ConstrainSize (tmp_win, &dragWidth, &dragHeight); + if (clampLeft) + dragx = origx + origWidth - dragWidth; + if (clampTop) + dragy = origy + origHeight - dragHeight; + MoveOutline(Scr->Root, + dragx - tmp_win->frame_bw, + dragy - tmp_win->frame_bw, + dragWidth + 2 * tmp_win->frame_bw, + dragHeight + 2 * tmp_win->frame_bw, tmp_win->frame_bw, tmp_win->title_height); } @@ -392,10 +382,7 @@ */ void -DoResize(x_root, y_root, tmp_win) -int x_root; -int y_root; -TwmWindow *tmp_win; +DoResize(int x_root, int y_root, TwmWindow *tmp_win) { int action; @@ -405,95 +392,95 @@ y_root -= clampDY; if (clampTop) { - int delta = y_root - dragy; - if (dragHeight - delta < MINHEIGHT) { - delta = dragHeight - MINHEIGHT; - clampTop = 0; - } - dragy += delta; - dragHeight -= delta; - action = 1; + int delta = y_root - dragy; + if (dragHeight - delta < MINHEIGHT) { + delta = dragHeight - MINHEIGHT; + clampTop = 0; + } + dragy += delta; + dragHeight -= delta; + action = 1; } else if (y_root <= dragy/* || - y_root == findRootInfo(root)->rooty*/) { - dragy = y_root; - dragHeight = origy + origHeight - - y_root; - clampBottom = 0; - clampTop = 1; + y_root == findRootInfo(root)->rooty*/) { + dragy = y_root; + dragHeight = origy + origHeight - + y_root; + clampBottom = 0; + clampTop = 1; clampDY = 0; - action = 1; + action = 1; } if (clampLeft) { - int delta = x_root - dragx; - if (dragWidth - delta < MINWIDTH) { - delta = dragWidth - MINWIDTH; - clampLeft = 0; - } - dragx += delta; - dragWidth -= delta; - action = 1; + int delta = x_root - dragx; + if (dragWidth - delta < MINWIDTH) { + delta = dragWidth - MINWIDTH; + clampLeft = 0; + } + dragx += delta; + dragWidth -= delta; + action = 1; } else if (x_root <= dragx/* || - x_root == findRootInfo(root)->rootx*/) { - dragx = x_root; - dragWidth = origx + origWidth - - x_root; - clampRight = 0; - clampLeft = 1; + x_root == findRootInfo(root)->rootx*/) { + dragx = x_root; + dragWidth = origx + origWidth - + x_root; + clampRight = 0; + clampLeft = 1; clampDX = 0; - action = 1; + action = 1; } if (clampBottom) { - int delta = y_root - dragy - dragHeight; - if (dragHeight + delta < MINHEIGHT) { - delta = MINHEIGHT - dragHeight; - clampBottom = 0; - } - dragHeight += delta; - action = 1; + int delta = y_root - dragy - dragHeight; + if (dragHeight + delta < MINHEIGHT) { + delta = MINHEIGHT - dragHeight; + clampBottom = 0; + } + dragHeight += delta; + action = 1; } else if (y_root >= dragy + dragHeight - 1/* || - y_root == findRootInfo(root)->rooty - + findRootInfo(root)->rootheight - 1*/) { - dragy = origy; - dragHeight = 1 + y_root - dragy; - clampTop = 0; - clampBottom = 1; + y_root == findRootInfo(root)->rooty + + findRootInfo(root)->rootheight - 1*/) { + dragy = origy; + dragHeight = 1 + y_root - dragy; + clampTop = 0; + clampBottom = 1; clampDY = 0; - action = 1; + action = 1; } if (clampRight) { - int delta = x_root - dragx - dragWidth; - if (dragWidth + delta < MINWIDTH) { - delta = MINWIDTH - dragWidth; - clampRight = 0; - } - dragWidth += delta; - action = 1; + int delta = x_root - dragx - dragWidth; + if (dragWidth + delta < MINWIDTH) { + delta = MINWIDTH - dragWidth; + clampRight = 0; + } + dragWidth += delta; + action = 1; } else if (x_root >= dragx + dragWidth - 1/* || - x_root == findRootInfo(root)->rootx + - findRootInfo(root)->rootwidth - 1*/) { - dragx = origx; - dragWidth = 1 + x_root - origx; - clampLeft = 0; - clampRight = 1; + x_root == findRootInfo(root)->rootx + + findRootInfo(root)->rootwidth - 1*/) { + dragx = origx; + dragWidth = 1 + x_root - origx; + clampLeft = 0; + clampRight = 1; clampDX = 0; - action = 1; + action = 1; } if (action) { - ConstrainSize (tmp_win, &dragWidth, &dragHeight); - if (clampLeft) - dragx = origx + origWidth - dragWidth; - if (clampTop) - dragy = origy + origHeight - dragHeight; - MoveOutline(Scr->Root, - dragx - tmp_win->frame_bw, - dragy - tmp_win->frame_bw, - dragWidth + 2 * tmp_win->frame_bw, - dragHeight + 2 * tmp_win->frame_bw, + ConstrainSize (tmp_win, &dragWidth, &dragHeight); + if (clampLeft) + dragx = origx + origWidth - dragWidth; + if (clampTop) + dragy = origy + origHeight - dragHeight; + MoveOutline(Scr->Root, + dragx - tmp_win->frame_bw, + dragy - tmp_win->frame_bw, + dragWidth + 2 * tmp_win->frame_bw, + dragHeight + 2 * tmp_win->frame_bw, tmp_win->frame_bw, tmp_win->title_height); } @@ -514,17 +501,14 @@ */ void -DisplaySize(tmp_win, width, height) -TwmWindow *tmp_win; -int width; -int height; +DisplaySize(TwmWindow *tmp_win, int width, int height) { char str[100]; int dwidth; int dheight; if (last_width == width && last_height == height) - return; + return; last_width = width; last_height = height; @@ -549,14 +533,14 @@ if (tmp_win->hints.flags & PResizeInc) { - dwidth /= tmp_win->hints.width_inc; - dheight /= tmp_win->hints.height_inc; + dwidth /= tmp_win->hints.width_inc; + dheight /= tmp_win->hints.height_inc; } (void) sprintf (str, " %4d x %-4d ", dwidth, dheight); XRaiseWindow(dpy, Scr->SizeWindow); MyFont_ChangeGC(Scr->DefaultC.fore, Scr->DefaultC.back, &Scr->SizeFont); - MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, + MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, Scr->NormalGC, Scr->SizeStringOffset, Scr->SizeFont.ascent + SIZE_VINDENT, str, 13); @@ -571,7 +555,7 @@ */ void -EndResize() +EndResize(void) { TwmWindow *tmp_win; @@ -587,8 +571,8 @@ ConstrainSize (tmp_win, &dragWidth, &dragHeight); if (dragWidth != tmp_win->frame_width || - dragHeight != tmp_win->frame_height) - tmp_win->zoomed = ZOOM_NONE; + dragHeight != tmp_win->frame_height) + tmp_win->zoomed = ZOOM_NONE; SetupWindow (tmp_win, dragx - tmp_win->frame_bw, dragy - tmp_win->frame_bw, dragWidth, dragHeight, -1); @@ -601,11 +585,11 @@ tmp_win->iconmgrp->width = (int) ((dragWidth * (long) tmp_win->iconmgrp->columns) / ncols); - PackIconManager(tmp_win->iconmgrp); + PackIconManager(tmp_win->iconmgrp); } if (!Scr->NoRaiseResize) - XRaiseWindow(dpy, tmp_win->frame); + XRaiseWindow(dpy, tmp_win->frame); UninstallRootColormap(); @@ -613,8 +597,7 @@ } void -MenuEndResize(tmp_win) -TwmWindow *tmp_win; +MenuEndResize(TwmWindow *tmp_win) { MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); XUnmapWindow(dpy, Scr->SizeWindow); @@ -637,8 +620,7 @@ */ void -AddEndResize(tmp_win) -TwmWindow *tmp_win; +AddEndResize(TwmWindow *tmp_win) { #ifdef DEBUG @@ -660,12 +642,10 @@ * * The general algorithm, especially the aspect ratio stuff, is * borrowed from uwm's CheckConsistency routine. - * + * ***********************************************************************/ void -ConstrainSize (tmp_win, widthp, heightp) - TwmWindow *tmp_win; - int *widthp, *heightp; +ConstrainSize (TwmWindow *tmp_win, int *widthp, int *heightp) { #define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) ) #define _min(a,b) (((a) < (b)) ? (a) : (b)) @@ -678,13 +658,13 @@ dheight -= tmp_win->title_height; if (tmp_win->hints.flags & PMinSize) { - minWidth = tmp_win->hints.min_width; - minHeight = tmp_win->hints.min_height; + minWidth = tmp_win->hints.min_width; + minHeight = tmp_win->hints.min_height; } else if (tmp_win->hints.flags & PBaseSize) { - minWidth = tmp_win->hints.base_width; - minHeight = tmp_win->hints.base_height; + minWidth = tmp_win->hints.base_width; + minHeight = tmp_win->hints.base_height; } else - minWidth = minHeight = 1; + minWidth = minHeight = 1; if (tmp_win->hints.flags & PBaseSize) { baseWidth = tmp_win->hints.base_width; @@ -697,18 +677,18 @@ if (tmp_win->hints.flags & PMaxSize) { - maxWidth = _min (Scr->MaxWindowWidth, tmp_win->hints.max_width); - maxHeight = _min (Scr->MaxWindowHeight, tmp_win->hints.max_height); + maxWidth = _min (Scr->MaxWindowWidth, tmp_win->hints.max_width); + maxHeight = _min (Scr->MaxWindowHeight, tmp_win->hints.max_height); } else { - maxWidth = Scr->MaxWindowWidth; + maxWidth = Scr->MaxWindowWidth; maxHeight = Scr->MaxWindowHeight; } if (tmp_win->hints.flags & PResizeInc) { - xinc = tmp_win->hints.width_inc; - yinc = tmp_win->hints.height_inc; + xinc = tmp_win->hints.width_inc; + yinc = tmp_win->hints.height_inc; } else - xinc = yinc = 1; + xinc = yinc = 1; /* * First, clamp to min and max values @@ -746,36 +726,36 @@ * * minAspectX * dheight > minAspectY * dwidth * maxAspectX * dheight < maxAspectY * dwidth - * + * */ - + if (tmp_win->hints.flags & PAspect) { - if (minAspectX * dheight > minAspectY * dwidth) - { - delta = makemult(minAspectX * dheight / minAspectY - dwidth, - xinc); - if (dwidth + delta <= maxWidth) dwidth += delta; - else - { - delta = makemult(dheight - dwidth*minAspectY/minAspectX, - yinc); - if (dheight - delta >= minHeight) dheight -= delta; - } - } - - if (maxAspectX * dheight < maxAspectY * dwidth) - { - delta = makemult(dwidth * maxAspectY / maxAspectX - dheight, - yinc); - if (dheight + delta <= maxHeight) dheight += delta; - else - { - delta = makemult(dwidth - maxAspectX*dheight/maxAspectY, - xinc); - if (dwidth - delta >= minWidth) dwidth -= delta; - } - } + if (minAspectX * dheight > minAspectY * dwidth) + { + delta = makemult(minAspectX * dheight / minAspectY - dwidth, + xinc); + if (dwidth + delta <= maxWidth) dwidth += delta; + else + { + delta = makemult(dheight - dwidth*minAspectY/minAspectX, + yinc); + if (dheight - delta >= minHeight) dheight -= delta; + } + } + + if (maxAspectX * dheight < maxAspectY * dwidth) + { + delta = makemult(dwidth * maxAspectY / maxAspectX - dheight, + yinc); + if (dheight + delta <= maxHeight) dheight += delta; + else + { + delta = makemult(dwidth - maxAspectX*dheight/maxAspectY, + xinc); + if (dwidth - delta >= minWidth) dwidth -= delta; + } + } } @@ -814,17 +794,15 @@ *********************************************************************** */ -void SetupWindow (tmp_win, x, y, w, h, bw) - TwmWindow *tmp_win; - int x, y, w, h, bw; +void +SetupWindow (TwmWindow *tmp_win, int x, int y, int w, int h, int bw) { SetupFrame (tmp_win, x, y, w, h, bw, False); } -void SetupFrame (tmp_win, x, y, w, h, bw, sendEvent) - TwmWindow *tmp_win; - int x, y, w, h, bw; - Bool sendEvent; /* whether or not to force a send */ +void +SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, + Bool sendEvent) { XEvent client_event; XWindowChanges frame_wc, xwc; @@ -846,7 +824,7 @@ if (tmp_win->iconmgr) { tmp_win->iconmgrp->width = w; - h = tmp_win->iconmgrp->height + tmp_win->title_height; + h = tmp_win->iconmgrp->height + tmp_win->title_height; } /* @@ -873,10 +851,10 @@ { xwc.width = title_width; if (tmp_win->frame_height != h || - tmp_win->frame_width != w || + tmp_win->frame_width != w || tmp_win->frame_bw != bw || - title_width != tmp_win->title_width) - reShape = TRUE; + title_width != tmp_win->title_width) + reShape = TRUE; } else { @@ -895,7 +873,7 @@ tmp_win->title_y = xwc.y = -bw; xwcm |= (CWX | CWY | CWBorderWidth); } - + XConfigureWindow(dpy, tmp_win->title_w, xwcm, &xwc); } @@ -911,7 +889,7 @@ XMoveResizeWindow (dpy, tmp_win->w, 0, tmp_win->title_height, w, h - tmp_win->title_height); - /* + /* * fix up frame and assign size/location values in tmp_win */ frame_mask = 0; @@ -933,15 +911,15 @@ { xwc.width = (tmp_win->rightx - tmp_win->highlightx); if (Scr->TBInfo.nright > 0) xwc.width -= Scr->TitlePadding; - if (xwc.width <= 0) { - xwc.x = Scr->MyDisplayWidth; /* move offscreen */ - xwc.width = 1; - } else { - xwc.x = tmp_win->highlightx; - } + if (xwc.width <= 0) { + xwc.x = Scr->MyDisplayWidth; /* move offscreen */ + xwc.width = 1; + } else { + xwc.x = tmp_win->highlightx; + } - xwcm = CWX | CWWidth; - XConfigureWindow(dpy, tmp_win->hilite_w, xwcm, &xwc); + xwcm = CWX | CWWidth; + XConfigureWindow(dpy, tmp_win->hilite_w, xwcm, &xwc); } if (HasShape && reShape) { @@ -950,22 +928,22 @@ if (sendEvent) { - client_event.type = ConfigureNotify; - client_event.xconfigure.display = dpy; - client_event.xconfigure.event = tmp_win->w; - client_event.xconfigure.window = tmp_win->w; - client_event.xconfigure.x = (x + tmp_win->frame_bw - tmp_win->old_bw); - client_event.xconfigure.y = (y + tmp_win->frame_bw + + client_event.type = ConfigureNotify; + client_event.xconfigure.display = dpy; + client_event.xconfigure.event = tmp_win->w; + client_event.xconfigure.window = tmp_win->w; + client_event.xconfigure.x = (x + tmp_win->frame_bw - tmp_win->old_bw); + client_event.xconfigure.y = (y + tmp_win->frame_bw + tmp_win->title_height - tmp_win->old_bw); - client_event.xconfigure.width = tmp_win->frame_width; - client_event.xconfigure.height = tmp_win->frame_height - - tmp_win->title_height; - client_event.xconfigure.border_width = tmp_win->old_bw; - /* Real ConfigureNotify events say we're above title window, so ... */ + client_event.xconfigure.width = tmp_win->frame_width; + client_event.xconfigure.height = tmp_win->frame_height - + tmp_win->title_height; + client_event.xconfigure.border_width = tmp_win->old_bw; + /* Real ConfigureNotify events say we're above title window, so ... */ /* what if we don't have a title ????? */ - client_event.xconfigure.above = tmp_win->frame; - client_event.xconfigure.override_redirect = False; - XSendEvent(dpy, tmp_win->w, False, StructureNotifyMask, &client_event); + client_event.xconfigure.above = tmp_win->frame; + client_event.xconfigure.override_redirect = False; + XSendEvent(dpy, tmp_win->w, False, StructureNotifyMask, &client_event); } } @@ -986,9 +964,7 @@ */ void -fullzoom(tmp_win,flag) -TwmWindow *tmp_win; -int flag; +fullzoom(TwmWindow *tmp_win, int flag) { Window junkRoot; unsigned int junkbw, junkDepth; @@ -1023,59 +999,59 @@ tmp_win->zoomed = flag; frame_bw_times_2 = 2*tmp_win->frame_bw; - switch (flag) - { - case ZOOM_NONE: - break; - case F_ZOOM: - dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; - dragy=basey; - break; - case F_HORIZOOM: - dragx = basex; - dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; - break; - case F_FULLZOOM: - dragx = basex; - dragy = basey; - dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; - dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; - break; - case F_LEFTZOOM: - dragx = basex; - dragy = basey; - dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; - dragWidth = Scr->MyDisplayWidth/2 - frame_bw_times_2; - break; - case F_RIGHTZOOM: - dragx = basex + Scr->MyDisplayWidth/2; - dragy = basey; - dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; - dragWidth = Scr->MyDisplayWidth/2 - frame_bw_times_2; - break; - case F_TOPZOOM: - dragx = basex; - dragy = basey; - dragHeight = Scr->MyDisplayHeight/2 - frame_bw_times_2; - dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; - break; - case F_BOTTOMZOOM: - dragx = basex; - dragy = basey + Scr->MyDisplayHeight/2; - dragHeight = Scr->MyDisplayHeight/2 - frame_bw_times_2; - dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; - break; + switch (flag) + { + case ZOOM_NONE: + break; + case F_ZOOM: + dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; + dragy=basey; + break; + case F_HORIZOOM: + dragx = basex; + dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; + break; + case F_FULLZOOM: + dragx = basex; + dragy = basey; + dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; + dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; + break; + case F_LEFTZOOM: + dragx = basex; + dragy = basey; + dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; + dragWidth = Scr->MyDisplayWidth/2 - frame_bw_times_2; + break; + case F_RIGHTZOOM: + dragx = basex + Scr->MyDisplayWidth/2; + dragy = basey; + dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; + dragWidth = Scr->MyDisplayWidth/2 - frame_bw_times_2; + break; + case F_TOPZOOM: + dragx = basex; + dragy = basey; + dragHeight = Scr->MyDisplayHeight/2 - frame_bw_times_2; + dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; + break; + case F_BOTTOMZOOM: + dragx = basex; + dragy = basey + Scr->MyDisplayHeight/2; + dragHeight = Scr->MyDisplayHeight/2 - frame_bw_times_2; + dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; + break; case F_TOTALZOOM: dragx = -tmp_win->frame_bw; dragy = -tmp_win->title_height - tmp_win->frame_bw; dragHeight = Scr->MyDisplayHeight + tmp_win->title_height; dragWidth = Scr->MyDisplayWidth; break; - } + } } if (!Scr->NoRaiseResize) - XRaiseWindow(dpy, tmp_win->frame); + XRaiseWindow(dpy, tmp_win->frame); if (flag != F_TOTALZOOM) ConstrainSize(tmp_win, &dragWidth, &dragHeight); @@ -1086,8 +1062,7 @@ } void -SetFrameShape (tmp) - TwmWindow *tmp; +SetFrameShape (TwmWindow *tmp) { /* * see if the titlebar needs to move @@ -1158,7 +1133,7 @@ newClip, 2, ShapeSet, YXBanded); } else { (void) XShapeCombineMask (dpy, tmp->frame, ShapeBounding, 0, 0, - None, ShapeSet); + None, ShapeSet); (void) XShapeCombineMask (dpy, tmp->frame, ShapeClip, 0, 0, None, ShapeSet); } @@ -1167,7 +1142,7 @@ /* * Squeezed Title: - * + * * tmp->title_x * 0 | * tmp->title_y ........+--------------+......... -+,- tmp->frame_bw @@ -1183,10 +1158,10 @@ * | | | | * | +---------------------------+ | * +-------------------------------+ - * - * + * + * * Unsqueezed Title: - * + * * tmp->title_x * | 0 * tmp->title_y +-------------------------------+ -+,tmp->frame_bw @@ -1202,11 +1177,11 @@ * | | | | * | +---------------------------+ | * +-------------------------------+ - * - * - * + * + * + * * Dimensions and Positions: - * + * * frame origin (0, 0) * frame upper left border (-tmp->frame_bw, -tmp->frame_bw) * frame size w/o border tmp->frame_width , tmp->frame_height @@ -1216,7 +1191,7 @@ * title origin w/o border (tmp->title_x, tmp->title_y) * client origin (0, Scr->TitleHeight + tmp->frame_bw) * client size tmp->attr.width , tmp->attr.height - * + * * When shaping, need to remember that the width and height of rectangles * are really deltax and deltay to lower right handle corner, so they need * to have -1 subtracted from would normally be the actual extents. Index: xc/programs/twm/screen.h diff -u xc/programs/twm/screen.h:1.8 xc/programs/twm/screen.h:1.9 --- xc/programs/twm/screen.h:1.8 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/screen.h Tue Oct 9 17:31:39 2007 @@ -1,5 +1,6 @@ +/* $XFree86: xc/programs/twm/screen.h,v 1.9 2007/10/10 00:31:39 tsi Exp $ */ /* - * + * Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -30,7 +31,6 @@ * 11-3-88 Dave Payne, Apple Computer File created * ***********************************************************************/ -/* $XFree86: xc/programs/twm/screen.h,v 1.8 2006/01/09 15:00:55 dawes Exp $ */ #ifndef _SCREEN_ #define _SCREEN_ @@ -98,7 +98,7 @@ MouseButton WindowFunction; struct { - Colormaps *cmaps; /* current list of colormap windows */ + Colormaps *cmaps; /* current list of colormap windows */ int maxCmaps; /* maximum number of installed colormaps */ unsigned long first_req; /* seq # for first XInstallColormap() req in pass thru loading a colortable list */ Index: xc/programs/twm/session.c diff -u xc/programs/twm/session.c:3.11 xc/programs/twm/session.c:3.14 --- xc/programs/twm/session.c:3.11 Mon Apr 9 08:37:20 2007 +++ xc/programs/twm/session.c Wed Oct 10 08:23:02 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/session.c,v 3.14 2007/10/10 15:23:02 tsi Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group @@ -24,7 +25,6 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ -/* $XFree86: xc/programs/twm/session.c,v 3.11 2007/04/09 15:37:20 tsi Exp $ */ #include @@ -76,10 +76,7 @@ char * -GetClientID (window) - -Window window; - +GetClientID (Window window) { char *client_id = NULL; Window client_leader; @@ -110,17 +107,14 @@ if (prop) XFree (prop); } - + return client_id; } char * -GetWindowRole (window) - -Window window; - +GetWindowRole (Window window) { XTextProperty tp; @@ -171,11 +165,7 @@ int -write_counted_string (file, string) - -FILE *file; -char *string; - +write_counted_string (FILE *file, char *string) { if (string) { @@ -198,11 +188,7 @@ int -read_byte (file, bp) - -FILE *file; -unsigned char *bp; - +read_byte (FILE *file, unsigned char *bp) { if (fread ((char *) bp, 1, 1, file) != 1) return 0; @@ -211,11 +197,7 @@ int -read_ushort (file, shortp) - -FILE *file; -unsigned short *shortp; - +read_ushort (FILE *file, unsigned short *shortp) { unsigned char file_short[2]; @@ -227,11 +209,7 @@ int -read_short (file, shortp) - -FILE *file; -short *shortp; - +read_short (FILE *file, short *shortp) { unsigned char file_short[2]; @@ -243,11 +221,7 @@ int -read_counted_string (file, stringp) - -FILE *file; -char **stringp; - +read_counted_string (FILE *file, char **stringp) { unsigned char len; char *data; @@ -257,13 +231,13 @@ if (len == 0) { data = 0; } else { - data = malloc ((unsigned) len + 1); - if (!data) + data = malloc ((unsigned) len + 1); + if (!data) return 0; - if (fread (data, (int) sizeof (char), (int) len, file) != len) { + if (fread (data, (int) sizeof (char), (int) len, file) != len) { free (data); return 0; - } + } data[len] = '\0'; } *stringp = data; @@ -291,7 +265,7 @@ * WM_CLASS "res class" LIST of bytes * WM_NAME length 1 (0 if name changed) * WM_NAME LIST of bytes - * WM_COMMAND arg count 1 (0 if no SM_CLIENT_ID) + * WM_COMMAND arg count 1 (0 if no SM_CLIENT_ID) * For each arg in WM_COMMAND * arg length 1 * arg LIST of bytes @@ -313,13 +287,8 @@ */ int -WriteWinConfigEntry (configFile, theWindow, clientId, windowRole) - -FILE *configFile; -TwmWindow *theWindow; -char *clientId; -char *windowRole; - +WriteWinConfigEntry (FILE *configFile, TwmWindow *theWindow, char *clientId, + char *windowRole) { char **wm_command; int wm_command_count, i; @@ -352,7 +321,7 @@ if (!write_counted_string (configFile, theWindow->name)) return 0; } - + wm_command = NULL; wm_command_count = 0; XGetCommand (dpy, theWindow->w, &wm_command, &wm_command_count); @@ -447,17 +416,17 @@ goto give_up; if (!read_counted_string (configFile, &entry->wm_name)) goto give_up; - + if (!read_byte (configFile, &byte)) goto give_up; entry->wm_command_count = byte; - + if (entry->wm_command_count == 0) entry->wm_command = NULL; else { entry->wm_command = (char **) malloc (entry->wm_command_count * - sizeof (char *)); + sizeof (char *)); if (!entry->wm_command) goto give_up; @@ -498,7 +467,6 @@ if (!read_byte (configFile, &byte)) goto give_up; entry->width_ever_changed_by_user = byte; - if (!read_byte (configFile, &byte)) goto give_up; entry->height_ever_changed_by_user = byte; @@ -531,7 +499,7 @@ } if (entry->wm_command) free ((char *) entry->wm_command); - + free ((char *) entry); *pentry = NULL; @@ -540,10 +508,7 @@ void -ReadWinConfigFile (filename) - -char *filename; - +ReadWinConfigFile (char *filename) { FILE *configFile; TWMWinConfigEntry *entry; @@ -577,19 +542,12 @@ int -GetWindowConfig (theWindow, x, y, width, height, - iconified, icon_info_present, icon_x, icon_y, - width_ever_changed_by_user, height_ever_changed_by_user) - -TwmWindow *theWindow; -short *x, *y; -unsigned short *width, *height; -Bool *iconified; -Bool *icon_info_present; -short *icon_x, *icon_y; -Bool *width_ever_changed_by_user; -Bool *height_ever_changed_by_user; - +GetWindowConfig (TwmWindow *theWindow, short *x, short *y, + unsigned short *width, unsigned short *height, + Bool *iconified, Bool *icon_info_present, + short *icon_x, short *icon_y, + Bool *width_ever_changed_by_user, + Bool *height_ever_changed_by_user) { char *clientId, *windowRole; TWMWinConfigEntry *ptr; @@ -635,10 +593,10 @@ */ if (strcmp (theWindow->class.res_name, - ptr->class.res_name) == 0 && + ptr->class.res_name) == 0 && strcmp (theWindow->class.res_class, ptr->class.res_class) == 0 && - (ptr->wm_name == NULL || + (ptr->wm_name == NULL || strcmp (theWindow->name, ptr->wm_name) == 0)) { if (clientId) @@ -661,7 +619,7 @@ int wm_command_count = 0, i; XGetCommand (dpy, theWindow->w, - &wm_command, &wm_command_count); + &wm_command, &wm_command_count); if (wm_command_count == ptr->wm_command_count) { @@ -716,17 +674,11 @@ #ifndef HAS_MKSTEMP static char * -unique_filename (path, prefix) -char *path; -char *prefix; +unique_filename (char *path, char *prefix) #else static char * -unique_filename (path, prefix, pFd) -char *path; -char *prefix; -int *pFd; +unique_filename (char *path, char *prefix, int *pFd) #endif - { #ifndef HAS_MKSTEMP #ifndef X_NOT_POSIX @@ -746,13 +698,13 @@ else return (NULL); #endif -#else +#else char tempFile[PATH_MAX]; char *ptr; sprintf (tempFile, "%s/%sXXXXXX", path, prefix); ptr = (char *)malloc(strlen(tempFile) + 1); - if (ptr != NULL) + if (ptr != NULL) { strcpy(ptr, tempFile); *pFd = mkstemp(ptr); @@ -764,11 +716,7 @@ void -SaveYourselfPhase2CB (smcConn, clientData) - -SmcConn smcConn; -SmPointer clientData; - +SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) { int scrnum; ScreenInfo *theScreen; @@ -806,14 +754,14 @@ prop2.vals = &prop2val; prop2val.value = (SmPointer) userId; prop2val.length = strlen (userId); - + prop3.name = SmRestartStyleHint; prop3.type = SmCARD8; prop3.num_vals = 1; prop3.vals = &prop3val; prop3val.value = (SmPointer) &hint; prop3val.length = 1; - + props[0] = &prop1; props[1] = &prop2; props[2] = &prop3; @@ -839,8 +787,8 @@ #else if ((filename = unique_filename (path, ".twm", &fd)) == NULL) goto bad; - - if (!(configFile = fdopen(fd, "wb"))) + + if (!(configFile = fdopen(fd, "wb"))) goto bad; #endif @@ -875,7 +823,7 @@ } } } - + prop1.name = SmRestartCommand; prop1.type = SmLISTofARRAY8; @@ -946,15 +894,8 @@ void -SaveYourselfCB (smcConn, clientData, saveType, shutdown, interactStyle, fast) - -SmcConn smcConn; -SmPointer clientData; -int saveType; -Bool shutdown; -int interactStyle; -Bool fast; - +SaveYourselfCB (SmcConn smcConn, SmPointer clientData, int saveType, + Bool shutdown, int interactStyle, Bool fast) { if (!SmcRequestSaveYourselfPhase2 (smcConn, SaveYourselfPhase2CB, NULL)) { @@ -968,11 +909,7 @@ void -DieCB (smcConn, clientData) - -SmcConn smcConn; -SmPointer clientData; - +DieCB (SmcConn smcConn, SmPointer clientData) { SmcCloseConnection (smcConn, 0, NULL); XtRemoveInput (iceInputId); @@ -982,11 +919,7 @@ void -SaveCompleteCB (smcConn, clientData) - -SmcConn smcConn; -SmPointer clientData; - +SaveCompleteCB (SmcConn smcConn, SmPointer clientData) { ; } @@ -994,11 +927,7 @@ void -ShutdownCancelledCB (smcConn, clientData) - -SmcConn smcConn; -SmPointer clientData; - +ShutdownCancelledCB (SmcConn smcConn, SmPointer clientData) { if (!sent_save_done) { @@ -1010,12 +939,7 @@ void -ProcessIceMsgProc (client_data, source, id) - -XtPointer client_data; -int *source; -XtInputId *id; - +ProcessIceMsgProc (XtPointer client_data, int *source, XtInputId *id) { IceConn ice_conn = (IceConn) client_data; @@ -1025,10 +949,7 @@ void -ConnectToSessionManager (previous_id) - -char *previous_id; - +ConnectToSessionManager (char *previous_id) { char errorMsg[256]; unsigned long mask; @@ -1051,7 +972,7 @@ callbacks.shutdown_cancelled.client_data = (SmPointer) NULL; smcConn = SmcOpenConnection ( - NULL, /* use SESSION_MANAGER env */ + NULL, /* use SESSION_MANAGER env */ (SmPointer) appContext, SmProtoMajor, SmProtoMinor, @@ -1069,10 +990,7 @@ iceInputId = XtAppAddInput ( appContext, IceConnectionNumber (iceConn), - (XtPointer) XtInputReadMask, + (XtPointer) XtInputReadMask, ProcessIceMsgProc, (XtPointer) iceConn); } - - - Index: xc/programs/twm/session.h diff -u xc/programs/twm/session.h:1.2 xc/programs/twm/session.h:1.3 --- xc/programs/twm/session.h:1.2 Fri Feb 13 15:58:53 2004 +++ xc/programs/twm/session.h Tue Oct 9 17:31:39 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/session.h,v 1.2 2004/02/13 23:58:53 dawes Exp $ */ +/* $XFree86: xc/programs/twm/session.h,v 1.3 2007/10/10 00:31:39 tsi Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. * All rights reserved. @@ -70,7 +70,7 @@ extern int write_counted_string ( FILE *file, char *string ); extern int write_short ( FILE *file, short s ); extern int write_ushort ( FILE *file, unsigned short s ); - + extern SmcConn smcConn; #endif Index: xc/programs/twm/twm.c diff -u xc/programs/twm/twm.c:3.17 xc/programs/twm/twm.c:3.18 --- xc/programs/twm/twm.c:3.17 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/twm.c Tue Oct 9 17:31:39 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/twm.c,v 3.18 2007/10/10 00:31:39 tsi Exp $ */ /*****************************************************************************/ /* @@ -57,7 +58,6 @@ * 27-Oct-87 Thomas E. LaStrange File created * 10-Oct-90 David M. Sternlicht Storing saved colors on root ***********************************************************************/ -/* $XFree86: xc/programs/twm/twm.c,v 3.17 2006/01/09 15:00:55 dawes Exp $ */ #include #include @@ -236,7 +236,7 @@ #define newhandler(sig) \ if (signal (sig, SIG_IGN) != SIG_IGN) (void) signal (sig, sigHandler) - + newhandler (SIGINT); newhandler (SIGHUP); newhandler (SIGQUIT); @@ -246,7 +246,7 @@ Home = getenv("HOME"); if (Home != NULL) { - char *temp_p; + char *temp_p; /* * Make a copy of Home because the string returned by getenv() can be @@ -270,7 +270,7 @@ appContext = XtCreateApplicationContext (); si = XtAppAddSignal(appContext, Done, NULL); - + if (!(dpy = XtOpenDisplay (appContext, display_name, "twm", "twm", NULL, 0, &zero, NULL))) { fprintf (stderr, "%s: unable to open display \"%s\"\n", @@ -279,7 +279,7 @@ } if (fcntl(ConnectionNumber(dpy), F_SETFD, 1) == -1) { - fprintf (stderr, + fprintf (stderr, "%s: unable to mark display connection as close-on-exec\n", ProgramName); exit (1); @@ -328,13 +328,13 @@ FirstScreen = TRUE; for (scrnum = firstscrn ; scrnum <= lastscrn; scrnum++) { - /* Make sure property priority colors is empty */ - XChangeProperty (dpy, RootWindow(dpy, scrnum), _XA_MIT_PRIORITY_COLORS, + /* Make sure property priority colors is empty */ + XChangeProperty (dpy, RootWindow(dpy, scrnum), _XA_MIT_PRIORITY_COLORS, XA_CARDINAL, 32, PropModeReplace, NULL, 0); RedirectError = FALSE; XSetErrorHandler(CatchRedirectError); XSelectInput(dpy, RootWindow (dpy, scrnum), - ColormapChangeMask | EnterWindowMask | PropertyChangeMask | + ColormapChangeMask | EnterWindowMask | PropertyChangeMask | SubstructureRedirectMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask); XSync(dpy, 0); @@ -354,14 +354,14 @@ numManaged ++; /* Note: ScreenInfo struct is calloc'ed to initialize to zero. */ - Scr = ScreenList[scrnum] = + Scr = ScreenList[scrnum] = (ScreenInfo *) calloc(1, sizeof(ScreenInfo)); - if (Scr == NULL) - { - fprintf (stderr, "%s: unable to allocate memory for ScreenInfo structure for screen %d.\n", - ProgramName, scrnum); - continue; - } + if (Scr == NULL) + { + fprintf (stderr, "%s: unable to allocate memory for ScreenInfo structure for screen %d.\n", + ProgramName, scrnum); + continue; + } /* initialize list pointers, remember to put an initialization * in InitVariables also @@ -415,7 +415,7 @@ Scr->cmapInfo.root_pushes = 0; InstallWindowColormaps(0, &Scr->TwmRoot); - Scr->StdCmapInfo.head = Scr->StdCmapInfo.tail = + Scr->StdCmapInfo.head = Scr->StdCmapInfo.tail = Scr->StdCmapInfo.mru = NULL; Scr->StdCmapInfo.mruindex = 0; LocateStandardColormaps(); @@ -436,8 +436,8 @@ if (DisplayCells(dpy, scrnum) < 3) Scr->Monochrome = MONOCHROME; - else if (DefaultVisual(dpy, scrnum)->class == GrayScale) - Scr->Monochrome = GRAYSCALE; + else if (DefaultVisual(dpy, scrnum)->class == GrayScale) + Scr->Monochrome = GRAYSCALE; else Scr->Monochrome = COLOR; @@ -560,16 +560,16 @@ } } - + attributes.border_pixel = Scr->DefaultC.fore; attributes.background_pixel = Scr->DefaultC.back; attributes.event_mask = (ExposureMask | ButtonPressMask | KeyPressMask | ButtonReleaseMask); attributes.backing_store = NotUseful; attributes.cursor = XCreateFontCursor (dpy, XC_hand2); - valuemask = (CWBorderPixel | CWBackPixel | CWEventMask | + valuemask = (CWBorderPixel | CWBackPixel | CWEventMask | CWBackingStore | CWCursor); - Scr->InfoWindow = XCreateWindow (dpy, Scr->Root, 0, 0, + Scr->InfoWindow = XCreateWindow (dpy, Scr->Root, 0, 0, (unsigned int) 5, (unsigned int) 5, (unsigned int) BW, 0, (unsigned int) CopyFromParent, @@ -580,7 +580,7 @@ " 8888 x 8888 ", 13); valuemask = (CWBorderPixel | CWBackPixel | CWBitGravity); attributes.bit_gravity = NorthWestGravity; - Scr->SizeWindow = XCreateWindow (dpy, Scr->Root, 0, 0, + Scr->SizeWindow = XCreateWindow (dpy, Scr->Root, 0, 0, (unsigned int) Scr->SizeStringWidth, (unsigned int) (Scr->SizeFont.height + SIZE_VINDENT*2), @@ -592,7 +592,7 @@ XUngrabServer(dpy); FirstScreen = FALSE; - Scr->FirstTime = FALSE; + Scr->FirstTime = FALSE; } /* for */ if (numManaged == 0) { @@ -620,7 +620,7 @@ */ void -InitVariables() +InitVariables(void) { FreeList(&Scr->BorderColorL); FreeList(&Scr->IconBorderColorL); @@ -771,7 +771,7 @@ } void -CreateFonts () +CreateFonts (void) { GetFont(&Scr->TitleBarFont); GetFont(&Scr->MenuFont); @@ -783,14 +783,13 @@ } void -RestoreWithdrawnLocation (tmp) - TwmWindow *tmp; +RestoreWithdrawnLocation (TwmWindow *tmp) { int gravx, gravy; unsigned int bw, mask; XWindowChanges xwc; - if (XGetGeometry (dpy, tmp->w, &JunkRoot, &xwc.x, &xwc.y, + if (XGetGeometry (dpy, tmp->w, &JunkRoot, &xwc.x, &xwc.y, &JunkWidth, &JunkHeight, &bw, &JunkDepth)) { GetGravityOffsets (tmp, &gravx, &gravy); @@ -831,9 +830,8 @@ } -void -Reborder (time) -Time time; +void +Reborder (Time time) { TwmWindow *tmp; /* temp twm window structure */ int scrnum; @@ -858,7 +856,7 @@ SetFocus ((TwmWindow*)NULL, time); } -static SIGNAL_T +static SIGNAL_T sigHandler(int sig) { XtNoticeSignal(si); @@ -887,7 +885,7 @@ void Done(XtPointer client_data, XtSignalId *si) { - if (dpy) + if (dpy) { Reborder(CurrentTime); XCloseDisplay(dpy); @@ -904,15 +902,13 @@ Bool ErrorOccurred = False; XErrorEvent LastErrorEvent; -static int -TwmErrorHandler(dpy, event) - Display *dpy; - XErrorEvent *event; +static int +TwmErrorHandler(Display *dpy, XErrorEvent *event) { LastErrorEvent = *event; ErrorOccurred = True; - if (PrintErrorMessages && /* don't be too obnoxious */ + if (PrintErrorMessages && /* don't be too obnoxious */ event->error_code != BadWindow && /* watch for dead puppies */ (event->request_code != X_GetGeometry && /* of all styles */ event->error_code != BadDrawable)) @@ -922,10 +918,8 @@ /* ARGSUSED*/ -static int -CatchRedirectError(dpy, event) - Display *dpy; - XErrorEvent *event; +static int +CatchRedirectError(Display *dpy, XErrorEvent *event) { RedirectError = TRUE; LastErrorEvent = *event; Index: xc/programs/twm/twm.h diff -u xc/programs/twm/twm.h:3.15 xc/programs/twm/twm.h:3.16 --- xc/programs/twm/twm.h:3.15 Sat Feb 25 18:41:02 2006 +++ xc/programs/twm/twm.h Tue Oct 9 17:31:39 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/twm.h,v 3.16 2007/10/10 00:31:39 tsi Exp $ */ /*****************************************************************************/ /** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ /** Salt Lake City, Utah **/ @@ -57,7 +58,6 @@ * 28-Oct-87 Thomas E. LaStrange File created * 10-Oct-90 David M. Sternlicht Storeing saved colors on root ***********************************************************************/ -/* $XFree86: xc/programs/twm/twm.h,v 3.15 2006/02/26 02:41:02 dawes Exp $ */ #ifndef _TWM_ #define _TWM_ @@ -189,7 +189,7 @@ * ICCCM property. */ typedef struct TwmColormap -{ +{ Colormap c; /* Colormap id */ int state; /* install(ability) state */ unsigned long install_req; /* request number which installed it */ @@ -220,7 +220,7 @@ ((cm)->number_cwins - 1) / 2) /* for each window that is on the display, one of these structures - * is allocated and linked into a list + * is allocated and linked into a list */ typedef struct TwmWindow { @@ -408,7 +408,7 @@ #if !defined(YYBISON) && !(defined(YYBYACC) && defined(__NetBSD__)) extern int yyparse ( void ); #endif -extern int yylex ( void ); +extern int yylex ( void ); extern void yyerror ( char *s ); extern int doinput ( char *buf, int size ); extern void RemoveDQuote ( char *str ); Index: xc/programs/twm/twm.man diff -u xc/programs/twm/twm.man:1.15 xc/programs/twm/twm.man:1.16 --- xc/programs/twm/twm.man:1.15 Tue Jul 19 17:32:38 2005 +++ xc/programs/twm/twm.man Tue Oct 9 17:31:39 2007 @@ -1,16 +1,18 @@ +.\" $XFree86: xc/programs/twm/twm.man,v 1.16 2007/10/10 00:31:39 tsi Exp $ +.\" .\" Copyright 1993, 1994, 1998 The Open Group .\" Portions copyright 1988 Evans & Sutherland Computer Corporation. .\" Portions copyright 1989 Hewlett-Packard Company -.\" +.\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. -.\" +.\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. -.\" +.\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -18,14 +20,12 @@ .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. -.\" +.\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/twm/twm.man,v 1.15 2005/07/20 00:32:38 dawes Exp $ -.\" .de EX \"Begin example .ne 5 .if n .sp 1 @@ -47,26 +47,26 @@ \fBtwm \fP[ \fB\-display\fP \fIdpy\fP ] [ \fB\-s\fP ] [ \fB\-f\fP \fIinitfile\fP ] [ \fB\-v\fP ] .SH DESCRIPTION -\fITwm\fP is a window manager for the X Window System. It provides +\fITwm\fP is a window manager for the X Window System. It provides titlebars, shaped windows, -several forms of icon management, user-defined macro functions, -click-to-type and pointer-driven keyboard focus, and user-specified +several forms of icon management, user-defined macro functions, +click-to-type and pointer-driven keyboard focus, and user-specified key and pointer button bindings. .PP This program is usually started by the user's session manager or startup script. When used from \fIxdm(1)\fP or \fIxinit(1)\fP without a session manager, \fItwm\fP is frequently executed in the foreground -as the last client. When run this way, exiting \fItwm\fP causes the +as the last client. When run this way, exiting \fItwm\fP causes the session to be terminated (i.e., logged out). .PP -By default, application windows are surrounded by a ``frame'' with a -titlebar at the top and a special border around the window. The titlebar +By default, application windows are surrounded by a ``frame'' with a +titlebar at the top and a special border around the window. The titlebar contains the window's name, a rectangle that is lit when the window is receiving keyboard input, and function boxes known as ``titlebuttons'' at the left and right edges of the titlebar. .PP Pressing pointer Button1 (usually the left-most -button unless it has been changed with \fIxmodmap\fP) on a +button unless it has been changed with \fIxmodmap\fP) on a titlebutton will invoke the function associated with the button. In the default interface, windows are iconified by clicking (pressing and then immediately releasing) the left titlebutton (which looks @@ -85,13 +85,13 @@ .PP When new windows are created, \fItwm\fP will honor any size and location information requested by the user (usually through \fI-geometry\fP -command line argument or resources for the individual applications). -Otherwise, an outline of the window's default size, its titlebar, and lines -dividing the +command line argument or resources for the individual applications). +Otherwise, an outline of the window's default size, its titlebar, and lines +dividing the window into a 3x3 grid that track the pointer are displayed. Clicking pointer Button1 will position the window at the current position and give it the default -size. Pressing pointer Button2 (usually the middle pointer button) +size. Pressing pointer Button2 (usually the middle pointer button) and dragging the outline will give the window its current position but allow the sides to be resized as described above. Clicking pointer Button3 (usually the right pointer button) @@ -105,14 +105,14 @@ This option specifies the X server to use. .TP 8 .B \-s -This option indicates that only the default screen (as specified by +This option indicates that only the default screen (as specified by \fB\-display\fP or by the \fBDISPLAY\fP environment variable) should be managed. By default, \fItwm\fP will attempt to manage all screens on the display. .TP 8 .B \-f \fIfilename\fP This option specifies the name of the startup file to use. By default, -\fItwm\fP will look in the user's home directory for files +\fItwm\fP will look in the user's home directory for files named \fI.twmrc.num\fP (where \fInum\fP is a screen number) or \fI.twmrc\fP. .TP 8 .B \-v @@ -128,8 +128,8 @@ .B "$HOME/.twmrc.\fIscreennumber\fP" The \fIscreennumber\fP is a small positive number (e.g. 0, 1, etc.) representing the screen number (e.g. the last number in the DISPLAY environment -variable \fIhost:displaynum.screennum\fP) that would be used to contact that -screen of the display. This is intended for displays with multiple screens of +variable \fIhost:displaynum.screennum\fP) that would be used to contact that +screen of the display. This is intended for displays with multiple screens of differing visual types. .TP 8 .B "$HOME/.twmrc" @@ -137,25 +137,25 @@ .TP 8 .B __projectroot__/lib/X11/twm/system.twmrc If neither of the preceding files are found, \fItwm\fP will look in this -file for a +file for a default configuration. This is often tailored by the site administrator to provide convenient menus or familiar bindings for novice users. .PP If no startup files are found, \fItwm\fP will use the built-in defaults -described above. The only resource used by \fItwm\fP is +described above. The only resource used by \fItwm\fP is \fIbitmapFilePath\fP for a colon-separated list of directories to search when looking for bitmap files (for more information, see the \fIAthena Widgets\fP manual and \fIxrdb(1)\fP). .PP -\fITwm\fP startup files are logically broken up into three types of -specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. The +\fITwm\fP startup files are logically broken up into three types of +specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. The \fIVariables\fP section must come first and is used to describe the fonts, colors, cursors, border widths, icon and window placement, highlighting, autoraising, layout of titles, warping, use of the icon manager. The \fIBindings\fP section usually comes second and is used to specify the functions that should be to be invoked when keyboard and pointer buttons are pressed in -windows, icons, titles, and frames. The \fIMenus\fP section gives any +windows, icons, titles, and frames. The \fIMenus\fP section gives any user-defined menus (containing functions to be invoked or commands to be executed). .PP @@ -185,22 +185,22 @@ "Xmh" } .EE -When a variable containing a list of strings representing windows is searched +When a variable containing a list of strings representing windows is searched (e.g. to determine whether or not to enable autoraise as shown above), a string must be an exact, case-sensitive match to -the window's name (given by the WM_NAME window property), resource name +the window's name (given by the WM_NAME window property), resource name or class name (both given by the WM_CLASS window property). The preceding example would enable autoraise on windows named ``emacs'' as well as any -\fIxterm\fP (since they are of class ``XTerm'') or xmh windows +\fIxterm\fP (since they are of class ``XTerm'') or xmh windows (which are of class ``Xmh''). .PP String arguments that are interpreted as filenames (see the \fBPixmaps\fP, -\fBCursors\fP, and \fBIconDirectory\fP below) will +\fBCursors\fP, and \fBIconDirectory\fP below) will prepend the user's directory (specified by the \fBHOME\fP environment variable) if the first character is a tilde (~). If, instead, the first character is a colon (:), the name is assumed to refer to one of the internal bitmaps that are used to -create the default titlebars symbols: \fB:xlogo\fP +create the default titlebars symbols: \fB:xlogo\fP or \fB:delete\fP (both refer to the X logo), \fB:dot\fP or \fB:iconify\fP (both refer to the dot), \fB:resize\fP (the nested squares used by the resize button), @@ -218,21 +218,21 @@ 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 -initially sizing the window with pointer Button2 or when resizing it) +initially sizing the window with pointer Button2 or when resizing it) should not wait until the pointer has crossed the window edges. Instead, moving the pointer automatically causes the nearest edge or edges to move by the -same amount. This allows the resizing of windows that extend off +same amount. This allows the resizing of windows that extend off the edge of the screen. If the pointer is -in the center of the window, or if the resize is begun by pressing a +in the center of the window, or if the resize is begun by pressing a titlebutton, \fItwm\fP will still wait for the pointer to cross a window edge (to prevent accidents). This option is particularly useful for people who like the press-drag-release method of sweeping out window sizes. .IP "\fBBorderColor\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 -This variable specifies the default color of the border to be placed around -all +This variable specifies the default color of the border to be placed around +all non-iconified windows, and may only be given within a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwincolorlist\fP specifies a list @@ -247,7 +247,7 @@ .EE The default is "black". .IP "\fBBorderTileBackground\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 -This variable specifies the default background color in the gray pattern +This variable specifies the default background color in the gray pattern used in unhighlighted borders (only if \fBNoHighlight\fP hasn't been set), and may only be given within a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwincolorlist\fP allows per-window colors to be specified. @@ -255,7 +255,7 @@ .IP "\fBBorderTileForeground\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 This variable specifies the default foreground color in the gray pattern used in unhighlighted borders (only -if \fBNoHighlight\fP hasn't been set), and may only be given within a +if \fBNoHighlight\fP hasn't been set), and may only be given within a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwincolorlist\fP allows per-window colors to be specified. The default is "black". .IP "\fBBorderWidth\fP \fIpixels\fP" 8 @@ -264,7 +264,7 @@ This value is also used to set the border size of windows created by \fItwm\fP (such as the icon manager). The default is 2. .IP "\fBButtonIndent\fP \fIpixels\fP" 8 -This variable specifies the amount by which titlebuttons should be +This variable specifies the amount by which titlebuttons should be indented on all sides. Positive values cause the buttons to be smaller than the window text and highlight area so that they stand out. Setting this and the \fBTitleButtonBorderWidth\fP variables to 0 makes titlebuttons be as @@ -312,7 +312,7 @@ TitleBackground "blue" } .EE -All of these color variables may also be specified for the \fBMonochrome\fP +All of these color variables may also be specified for the \fBMonochrome\fP variable, allowing the same initialization file to be used on both color and monochrome displays. .IP "\fBConstrainedMoveTime\fP \fImilliseconds\fP" 8 @@ -360,8 +360,8 @@ } .EE .IP "\fBDecorateTransients\fP" 8 -This variable indicates that transient windows (those containing a -WM_TRANSIENT_FOR property) should have titlebars. By default, transients +This variable indicates that transient windows (those containing a +WM_TRANSIENT_FOR property) should have titlebars. By default, transients are not reparented. .IP "\fBDefaultBackground\fP \fIstring\fP" 8 This variable specifies the background color to be used for sizing and @@ -378,7 +378,7 @@ This variable indicates that windows should not be allowed to be moved off the screen. It can be overridden by the \fBf.forcemove\fP function. .IP "\fBDontSqueezeTitle\fP [{ \fIwin-list\fP }] " 8 -This variable indicates that titlebars should not be squeezed to their +This variable indicates that titlebars should not be squeezed to their minimum size as described under \fBSqueezeTitle\fP below. If the optional window list is supplied, only those windows will be prevented from being squeezed. @@ -403,7 +403,7 @@ may only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that per-window colors may be specified. See the \fBBorderColor\fP -variable for a complete description of the \fIwin-list\fP. +variable for a complete description of the \fIwin-list\fP. The default is "black". .IP "\fBIconBorderWidth\fP \fIpixels\fP" 8 This variable specifies the width in pixels of the border surrounding @@ -412,7 +412,7 @@ This variable specifies the maximum width in pixels of the icon window. The default is 1024. .IP "\fBIconDirectory\fP \fIstring\fP" 8 -This variable specifies the directory that should be searched if +This variable specifies the directory that should be searched if if a bitmap file cannot be found in any of the directories in the \fBbitmapFilePath\fP resource. .IP "\fBIconFont\fP \fIstring\fP" 8 @@ -420,7 +420,7 @@ icons. The default is "variable". .IP "\fBIconForeground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the foreground color to be used when displaying icons, -and may only be specified inside of a +and may only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that per-window colors may be specified. See the \fBBorderColor\fP @@ -428,7 +428,7 @@ The default is "black". .IP "\fBIconifyByUnmapping [{ \fIwin-list\fP }]\fP" 8 This variable indicates that windows should be iconified by being unmapped -without trying to map any icons. This assumes that the user will +without trying to map any icons. This assumes that the user will remap the window through the icon manager, the \fBf.warpto\fP function, or the \fITwmWindows\fP menu. If the optional \fIwin-list\fP is provided, only those windows will be @@ -437,7 +437,7 @@ to the \fITwmWindows\fP menu is set in the user's startup file. .IP "\fBIconManagerBackground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the background color to use for icon manager entries, -and may only be specified inside of a +and may only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that per-window colors may be specified. See the \fBBorderColor\fP @@ -454,15 +454,15 @@ entries. The default is "variable". .IP "\fBIconManagerForeground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the foreground color to be used when displaying -icon manager entries, and may only be specified inside of a +icon manager entries, and may only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that per-window colors may be specified. See the \fBBorderColor\fP variable for a complete description of the \fIwin-list\fP. The default is "black". .IP "\fBIconManagerGeometry\fP \fIstring\fP [ \fIcolumns\fP ]" 8 -This variable specifies the geometry of the icon manager window. The -\fIstring\fP argument is standard geometry specification that indicates +This variable specifies the geometry of the icon manager window. The +\fIstring\fP argument is standard geometry specification that indicates the initial full size of the icon manager. The icon manager window is then broken into \fIcolumns\fP pieces and scaled according to the number of entries in the icon manager. Extra entries are wrapped to form @@ -470,7 +470,7 @@ .IP "\fBIconManagerHighlight\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the border color to be used when highlighting the icon manager entry that currently has the focus, -and can only be specified inside of a +and can only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that per-window colors may be specified. See the \fBBorderColor\fP @@ -483,7 +483,7 @@ "\fIwinname\fP" ["\fIiconname\fP"] "\fIgeometry\fP" \fIcolumns\fP .EE where \fIwinname\fP is the name of the windows that should be put into this -icon manager, \fIiconname\fP is the name of that icon manager window's icon, +icon manager, \fIiconname\fP is the name of that icon manager window's icon, \fIgeometry\fP is a standard geometry specification, and \fIcolumns\fP is the number of columns in this icon manager as described in \fBIconManagerGeometry\fP. For example: @@ -513,7 +513,7 @@ top or bottom of the icon region. Similarly, the \fIhgrav\fP argument should be either \fBEast\fP or \fBWest\fP and is used to control whether icons should be filled in from left from the right. Icons are laid out within the region -in a grid with cells \fIgridwidth\fP pixels wide and \fIgridheight\fP pixels +in a grid with cells \fIgridwidth\fP pixels wide and \fIgridheight\fP pixels high. .IP "\fBIcons\fP { \fIwin-list\fP }" 8 This variable specifies a list of window names and the bitmap filenames that @@ -525,8 +525,8 @@ "xfd" "xfd_icon" } .EE -Windows that match ``XTerm'' and would not be iconified by unmapping, and -would try to use +Windows that match ``XTerm'' and would not be iconified by unmapping, and +would try to use the icon bitmap in the file ``xterm.icon''. If \fBForceIcons\fP is specified, this bitmap will be used even if the client has requested its own icon pixmap. @@ -554,16 +554,16 @@ set. .IP "\fBMaxWindowSize\fP \fIstring\fP" 8 This variable specifies a geometry in which the width and height -give the maximum size for a given window. This is typically used to +give the maximum size for a given window. This is typically used to restrict windows to the size of the screen. The default width is 32767 - -screen width. The default height is 32767 - screen height. +screen width. The default height is 32767 - screen height. .IP "\fBMenuBackground\fP \fIstring\fP" 8 This variable specifies the background color used for menus, -and can only be specified inside of a +and can only be specified inside of a \fBColor\fP or \fBMonochrome\fP list. The default is "white". .IP "\fBMenuBorderColor\fP \fIstring\fP" 8 This variable specifies the color of the menu border and can only be specified -inside of a +inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The default is "black". .IP "\fBMenuBorderWidth\fP \fIpixels\fP" 8 This variable specifies the width in pixels of the border surrounding @@ -573,21 +573,21 @@ is "variable". .IP "\fBMenuForeground\fP \fIstring\fP" 8 This variable specifies the foreground color used for menus, -and can only be specified inside of a +and can only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The default is "black". .IP "\fBMenuShadowColor\fP \fIstring\fP" 8 This variable specifies the color of the shadow behind pull-down menus -and can only be specified inside of a +and can only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The default is "black". .IP "\fBMenuTitleBackground\fP \fIstring\fP" 8 This variable specifies the background color for \fBf.title\fP entries in menus, and -can only be specified inside of a +can only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The default is "white". .IP "\fBMenuTitleForeground\fP \fIstring\fP" 8 This variable specifies the foreground color for \fBf.title\fP entries in menus and -can only be specified inside of a +can only be specified inside of a \fBColor\fP or \fBMonochrome\fP list. The default is "black". .IP "\fBMonochrome\fP { \fIcolors\fP }" 8 This variable specifies a list of color assignments that should be made if @@ -602,10 +602,10 @@ used with servers that can repaint faster than they can handle backing store. .IP "\fBNoCaseSensitive\fP" 8 This variable indicates that case should be ignored when sorting icon names -in an icon manager. This option is typically used with applications that +in an icon manager. This option is typically used with applications that capitalize the first letter of their icon name. .IP "\fBNoDefaults\fP" 8 -This variable indicates that \fItwm\fP should not supply the default +This variable indicates that \fItwm\fP should not supply the default titlebuttons and bindings. This option should only be used if the startup file contains a completely new set of bindings and definitions. .IP "\fBNoGrabServer\fP" 8 @@ -626,7 +626,7 @@ them. This is typically used with slower servers since it speeds up menu drawing at the expense of making the menu slightly harder to read. .IP "\fBNoRaiseOnDeiconify\fP" 8 -This variable indicates that windows that are deiconified should not be +This variable indicates that windows that are deiconified should not be raised. .IP "\fBNoRaiseOnMove\fP" 8 This variable indicates that windows should not be raised when moved. This @@ -639,18 +639,18 @@ is warped into them with the \fBf.warpto\fP function. If this option is set, warping to an occluded window may result in the pointer ending up in the occluding window instead the desired window (which causes unexpected behavior -with \fBf.warpring\fP). +with \fBf.warpring\fP). .IP "\fBNoSaveUnders\fP" 8 This variable indicates that menus should not request save-unders to minimize window repainting following menu selection. It is typically used with displays that can repaint faster than they can handle save-unders. .IP "\fBNoStackMode\fP [{ \fIwin-list\fP }]" 8 -This variable indicates that client window requests to change stacking order -should be ignored. If the optional \fIwin-list\fP is given, only requests on +This variable indicates that client window requests to change stacking order +should be ignored. If the optional \fIwin-list\fP is given, only requests on those windows will be ignored. This is typically used to prevent applications from relentlessly popping themselves to the front of the window stack. .IP "\fBNoTitle\fP [{ \fIwin-list\fP }] " 8 -This variable indicates that windows should not have titlebars. If the +This variable indicates that windows should not have titlebars. If the optional \fIwin-list\fP is given, only those windows will not have titlebars. \fBMakeTitle\fP may be used with this option to force titlebars to be put on specific windows. @@ -661,7 +661,7 @@ icon managers are delivered to the application. If the pointer is moved quickly and \fItwm\fP is slow to respond, input can be directed to the old window instead of the new. This option is typically -used to prevent this ``input lag'' and to +used to prevent this ``input lag'' and to work around bugs in older applications that have problems with focus events. .IP "\fBNoTitleHighlight\fP [{ \fIwin-list\fP }]" 8 This variable indicates that the highlight area of the titlebar, which is @@ -677,8 +677,8 @@ used on fast displays (particularly if \fBNoGrabServer\fP is set). .IP "\fBPixmaps\fP { \fIpixmaps\fP }" 8 This variable specifies a list of pixmaps that define the appearance of various -images. Each entry is a keyword indicating the pixmap to set, followed by a -string giving the name of the bitmap file. The following pixmaps +images. Each entry is a keyword indicating the pixmap to set, followed by a +string giving the name of the bitmap file. The following pixmaps may be specified: .EX 0 \fBPixmaps\fP @@ -689,17 +689,17 @@ The default for \fITitleHighlight\fP is to use an even stipple pattern. .IP "\fBPriority\fP \fIpriority\fP" 8 This variable sets \fItwm\fP's priority. \fIpriority\fP should be an -unquoted, signed number (e.g. 999). This variable has an effect only +unquoted, signed number (e.g. 999). This variable has an effect only if the server supports the SYNC extension. .IP "\fBRandomPlacement\fP" 8 -This variable indicates that windows with no specified geometry should +This variable indicates that windows with no specified geometry should be placed in a pseudo-random location instead of having the user drag out an outline. .IP "\fBResizeFont\fP \fIstring\fP" 8 This variable specifies the font to be used for in the dimensions window when resizing windows. The default is "fixed". .IP "\fBRestartPreviousState\fP" 8 -This variable indicates that +This variable indicates that \fItwm\fP should attempt to use the WM_STATE property on client windows to tell which windows should be iconified and which should be left visible. This is typically used to try to regenerate the state that the screen @@ -708,7 +708,7 @@ This variable indicates a list of color assignments to be stored as pixel values in the root window property _MIT_PRIORITY_COLORS. Clients may elect to preserve these values when installing their own colormap. Note that -use of this mechanism is a way an for application to avoid the "technicolor" +use of this mechanism is a way an for application to avoid the "technicolor" problem, whereby useful screen objects such as window borders and titlebars disappear when a programs custom colors are installed by the window manager. @@ -716,12 +716,12 @@ .EX 0 \fBSaveColor\fP { - BorderColor - TitleBackground - TitleForeground - "red" - "green" - "blue" + BorderColor + TitleBackground + TitleForeground + "red" + "green" + "blue" } .EE This would place on the root window 3 pixel values for borders and titlebars, @@ -731,8 +731,8 @@ \fItwm\fP is started. It can always be brought up using the \fBf.showiconmgr\fP function. .IP "\fBSortIconManager\fP" 8 -This variable indicates that entries in the icon manager should be -sorted alphabetically rather than by simply appending new windows to +This variable indicates that entries in the icon manager should be +sorted alphabetically rather than by simply appending new windows to the end. .IP "\fBSqueezeTitle\fP [{ \fIsqueeze-list\fP }] " 8 This variable indicates that \fItwm\fP should attempt to use the SHAPE @@ -749,7 +749,7 @@ are numbers specifying a ratio giving the relative position about which the titlebar is justified. The ratio is measured from left to right if the numerator is positive, and right to left if negative. A denominator -of 0 indicates that the numerator should be measured in pixels. For +of 0 indicates that the numerator should be measured in pixels. For convenience, the ratio 0/0 is the same as 1/2 for \fBcenter\fP and -1/1 for \fBright\fP. For example: .EX 0 @@ -762,7 +762,7 @@ "emacs" right 0 0 } .EE -The \fBDontSqueezeTitle\fP list can be used to turn off squeezing on +The \fBDontSqueezeTitle\fP list can be used to turn off squeezing on certain titles. .IP "\fBStartIconified\fP [{ \fIwin-list\fP }] " 8 This variable indicates that client windows should initially be left as @@ -772,7 +772,7 @@ resource. .IP "\fBTitleBackground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the background color used in titlebars, -and may only be specified inside of a +and may only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that per-window colors may be specified. @@ -787,13 +787,13 @@ titlebars. The default is "variable". .IP "\fBTitleForeground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the foreground color used in titlebars, and -may only be specified inside of a +may only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that per-window colors may be specified. The default is "black". .IP "\fBTitleIndent\fP \fIpixels\fP" 8 -This variable specifies the amount by which window name should be +This variable specifies the amount by which window name should be indented on the left. The default is 0. .IP "\fBTitlePadding\fP \fIpixels\fP" 8 This variable specifies the distance between the various buttons, text, and @@ -804,24 +804,24 @@ clients which do not provide an icon bitmap and are not listed in the \fBIcons\fP list. .IP "\fBUsePPosition\fP \fIstring\fP" 8 -This variable specifies whether or not \fItwm\fP should honor +This variable specifies whether or not \fItwm\fP should honor program-requested locations (given by the \fBPPosition\fP flag in the WM_NORMAL_HINTS property) in the absence of a user-specified position. The argument \fIstring\fP may have one of three values: \fB"off"\fP -(the default) +(the default) indicating that \fItwm\fP -should ignore the program-supplied position, +should ignore the program-supplied position, \fB"on"\fP indicating that the position -should be used, and +should be used, and \fB"non-zero"\fP indicating that the position should used if -it is other than (0,0). The latter option is for working around a bug in +it is other than (0,0). The latter option is for working around a bug in older toolkits. .IP "\fBWarpCursor\fP [{ \fIwin-list\fP }]" 8 This variable indicates that the pointer should be warped into windows when they are deiconified. If the optional \fIwin-list\fP is given, the pointer will only be warped when those windows are deiconified. .IP "\fBWindowRing\fP { \fIwin-list\fP }" 8 -This variable specifies a list of windows along which the \fBf.warpring\fP +This variable specifies a list of windows along which the \fBf.warpring\fP function cycles. .IP "\fBWarpUnmapped\fP" 8 This variable indicates that the \fBf.warpto\fP function should deiconify @@ -830,12 +830,12 @@ where it is. The default is for \fBf.warpto\fP to ignore iconified windows. .IP "\fBXorValue\fP \fInumber\fP" 8 This variable specifies the value to use when drawing window outlines for -moving and resizing. This should be set to a value that will result in a +moving and resizing. This should be set to a value that will result in a variety of of distinguishable colors when exclusive-or'ed with the contents of the user's typical screen. Setting this variable to 1 often gives nice results -if adjacent colors in the default colormap are distinct. By default, -\fItwm\fP will attempt to cause temporary lines to appear at the opposite +if adjacent colors in the default colormap are distinct. By default, +\fItwm\fP will attempt to cause temporary lines to appear at the opposite end of the colormap from the graphics. .IP "\fBZoom\fP [ \fIcount\fP ]" 8 This variable indicates that outlines suggesting movement of a window @@ -851,20 +851,20 @@ event is received for which no binding is provided. This is typically bound to \fBf.nop\fP, \fBf.beep\fP, or a menu containing window operations. .IP "\fBWindowFunction\fP \fIfunction\fP" 8 -This variable specifies the function to execute when a window is selected +This variable specifies the function to execute when a window is selected from the \fBTwmWindows\fP menu. If this variable is not set, the window will be deiconified and raised. .SH BINDINGS .PP -After the desired variables have been set, functions may be attached +After the desired variables have been set, functions may be attached titlebuttons and key and pointer buttons. Titlebuttons may be added -from the left or right side and appear in the titlebar from left-to-right +from the left or right side and appear in the titlebar from left-to-right according to the order in which they are specified. Key and pointer button bindings may be given in any order. .PP Titlebuttons specifications must include the name of the pixmap to use in -the button box and the function to be invoked when a pointer button is +the button box and the function to be invoked when a pointer button is pressed within them: .EX 0 \fBLeftTitleButton\fP "\fIbitmapname\fP" = \fIfunction\fP @@ -879,7 +879,7 @@ .PP Key and pointer button specifications must give the modifiers that must be pressed, over which parts of the screen the pointer must be, and what -function is to be invoked. Keys are given as strings containing the +function is to be invoked. Keys are given as strings containing the appropriate keysym name; buttons are given as the keywords \fBButton1\fP-\fBButton5\fP: .EX 0 @@ -888,10 +888,10 @@ .EE The \fImodlist\fP is any combination of the modifier names \fBshift\fP, \fBcontrol\fP, \fBlock\fP, \fBmeta\fP, \fBmod1\fP, \fBmod2\fP, \fBmod3\fP, -\fBmod4\fP, or \fBmod5\fP (which may be abbreviated as -\fBs\fP, \fBc\fP, \fBl\fP, \fBm\fP, \fBm1\fP, \fBm2\fP, \fBm3\fP, \fBm4\fP, +\fBmod4\fP, or \fBmod5\fP (which may be abbreviated as +\fBs\fP, \fBc\fP, \fBl\fP, \fBm\fP, \fBm1\fP, \fBm2\fP, \fBm3\fP, \fBm4\fP, \fBm5\fP, respectively) separated by a vertical bar (\(or). -Similarly, the \fIcontext\fP is any combination of +Similarly, the \fIcontext\fP is any combination of \fBwindow\fP, \fBtitle\fP, \fBicon\fP, @@ -899,7 +899,7 @@ \fBframe\fP, \fBiconmgr\fP, their first letters (\fBiconmgr\fP abbreviation is \fBm\fP), or \fBall\fP, -separated by a vertical bar. The \fIfunction\fP is any of the \fBf.\fP +separated by a vertical bar. The \fIfunction\fP is any of the \fBf.\fP keywords described below. For example, the default startup file contains the following bindings: .EX 0 @@ -932,12 +932,12 @@ .EE \fITwm\fP provides many more window manipulation primitives than can be conveniently stored in a titlebar, menu, or set of key bindings. Although -a small set of defaults are supplied (unless the \fBNoDefaults\fP is +a small set of defaults are supplied (unless the \fBNoDefaults\fP is specified), most users will want to have their most common operations bound to key and button strokes. To do this, \fItwm\fP associates names with each of the primitives and provides \fIuser-defined functions\fP for -building higher level primitives and \fImenus\fP for interactively selecting -among groups of functions. +building higher level primitives and \fImenus\fP for interactively selecting +among groups of functions. .PP User-defined functions contain the name by which they are referenced in calls to \fBf.function\fP and a list of other functions to execute. For @@ -948,7 +948,7 @@ Function "move-or-iconify" { f.move f.deltastop f.iconify } Function "restore-colormap" { f.colormap "default" f.lower } .EE -The function name must be used in \fBf.function\fP exactly as it appears in +The function name must be used in \fBf.function\fP exactly as it appears in the function specification. .PP In the descriptions below, if the function is said to operate on the selected @@ -964,7 +964,7 @@ This function toggles whether or not the selected window is raised whenever entered by the pointer. See the description of the variable \fBAutoRaise\fP. .IP "\fBf.backiconmgr\fI" 8 -This function warps the pointer to the previous column in the +This function warps the pointer to the previous column in the current icon manager, wrapping back to the previous row if necessary. .IP "\fBf.beep\fP" 8 This function sounds the keyboard bell. @@ -983,7 +983,7 @@ .IP "\fBf.colormap\fP \fIstring\fP" 8 This function rotates the colormaps (obtained from the WM_COLORMAP_WINDOWS property on the window) that \fItwm\fP will display when the pointer -is in this window. The argument \fIstring\fP may have one of the following +is in this window. The argument \fIstring\fP may have one of the following values: \fB"next"\fP, \fB"prev"\fP, and \fB"default"\fP. It should be noted here that in general, the installed colormap is determined by keyboard focus. A pointer driven keyboard focus will install a private colormap upon entry @@ -993,29 +993,29 @@ .\"OBSOLETE - should go away and use a clipboard. .\".IP "\fBf.cut\fP \fIstring\fP" 8 .\"This function places the specified \fIstring\fP (followed by a newline -.\"character) into the root window property CUT_BUFFER0. +.\"character) into the root window property CUT_BUFFER0. .\".IP "\fBf.cutfile\fP" 8 .\"This function reads the file indicated by the contents of the CUT_BUFFER0 .\"window property and replaces the cut buffer. .IP "\fBf.deiconify\fP" 8 -This function deiconifies the selected window. If the window is not an icon, +This function deiconifies the selected window. If the window is not an icon, this function does nothing. .IP "\fBf.delete\fP" 8 This function sends the WM_DELETE_WINDOW message to the selected window if the client application has requested it through the WM_PROTOCOLS window property. The application is supposed to respond to the message by removing the indicated window. If the window has not requested -WM_DELETE_WINDOW messages, the keyboard bell will be rung indicating that +WM_DELETE_WINDOW messages, the keyboard bell will be rung indicating that the user should choose an alternative method. Note this is very different -from f.destroy. The intent here is to delete a single window, not +from f.destroy. The intent here is to delete a single window, not necessarily the entire application. .IP "\fBf.deltastop\fP" 8 -This function allows a user-defined function to be aborted if the pointer has +This function allows a user-defined function to be aborted if the pointer has been moved more than \fIMoveDelta\fP pixels. See the example definition given for \fBFunction "move-or-raise"\fP at the beginning of the section. .IP "\fBf.destroy\fP" 8 This function instructs the X server to close the display connection of the -client that created the selected window. This should only be used as a last +client that created the selected window. This should only be used as a last resort for shutting down runaway clients. See also f.delete. .IP "\fBf.downiconmgr\fI" 8 This function warps the pointer to the next row in the current icon manger, @@ -1032,7 +1032,7 @@ This function toggles the keyboard focus of the server to the selected window, changing the focus rule from pointer-driven if necessary. If the selected window already was focused, this function executes an -\fBf.unfocus\fP. +\fBf.unfocus\fP. .IP "\fBf.forcemove\fP" 8 This function is like \fBf.move\fP except that it ignores the \fBDontMoveOff\fP variable. @@ -1044,20 +1044,20 @@ else restores the original size if the window was already zoomed. .IP "\fBf.function\fP \fIstring\fP" 8 This function executes the user-defined function whose name is specified -by the argument \fIstring\fP. +by the argument \fIstring\fP. .IP "\fBf.hbzoom\fP" 8 This function is a synonym for \fBf.bottomzoom\fP. .IP "\fBf.hideiconmgr\fP" 8 This function unmaps the current icon manager. .IP "\fBf.horizoom\fP" 8 -This variable is similar to the \fBf.zoom\fP function except that the +This variable is similar to the \fBf.zoom\fP function except that the selected window is resized to the full width of the display. .IP "\fBf.htzoom\fP" 8 This function is a synonym for \fBf.topzoom\fP. .IP "\fBf.hzoom\fP" 8 This function is a synonym for \fBf.horizoom\fP. .IP "\fBf.iconify\fP" 8 -This function iconifies or deiconifies the selected window or icon, +This function iconifies or deiconifies the selected window or icon, respectively. .IP "\fBf.identify\fP" 8 This function displays a summary of the name and geometry of the @@ -1098,8 +1098,8 @@ windows on the current or preceding screens. .IP "\fBf.priority\fP \fIstring\fP" 8 This function sets the priority of the client owning the selected window to -the numeric value of the argument \fIstring\fP, which should be a signed -integer in double quotes (e.g. "999" ). This function has an effect only +the numeric value of the argument \fIstring\fP, which should be a signed +integer in double quotes (e.g. "999" ). This function has an effect only if the server supports the SYNC extension. .IP "\fBf.quit\fP" 8 This function causes \fItwm\fP to restore the window's borders and exit. If @@ -1114,7 +1114,7 @@ This function causes all windows to be refreshed. .IP "\fBf.resize\fP" 8 This function displays an outline of the selected window. Crossing a border -(or setting \fBAutoRelativeResize\fP) will cause the outline to begin to +(or setting \fBAutoRelativeResize\fP) will cause the outline to begin to rubber band until the invoking button is released. To abort a resize, press another button before releasing the first button. .IP "\fBf.restart\fP" 8 @@ -1141,7 +1141,7 @@ This function sorts the entries in the current icon manager alphabetically. See the variable \fBSortIconManager\fP. .\".IP "\fBf.source\fP \fIstring\fP" 8 -.\"This function assumes \fIstring\fP is a file name. The file is read +.\"This function assumes \fIstring\fP is a file name. The file is read .\"and parsed as a \fItwm\fP startup file. .\"This .\"function is intended to be used only to re-build pull-down menus. None @@ -1150,7 +1150,7 @@ This function provides a centered, unselectable item in a menu definition. It should not be used in any other context. .IP "\fBf.topzoom\fP" 8 -This variable is similar to the \fBf.bottomzoom\fP function except that +This variable is similar to the \fBf.bottomzoom\fP function except that the selected window is only resized to the top half of the display. .\".IP "\fBf.twmrc\fP" 8 .\"This function causes the startup customization file to be re-read. This @@ -1177,14 +1177,14 @@ window manager decoration. .IP "\fBf.warpring\fP \fIstring\fP" 8 This function warps the pointer to the next or previous window (as indicated -by the argument \fIstring\fP, which may be \fB"next"\fP or \fB"prev"\fP) +by the argument \fIstring\fP, which may be \fB"next"\fP or \fB"prev"\fP) specified in the \fBWindowRing\fP variable. .IP "\fBf.warpto\fP \fIstring\fP" 8 -This function warps the pointer to the window which has a name or class +This function warps the pointer to the window which has a name or class that matches \fIstring\fP. If the window is iconified, it will be deiconified if the variable \fBWarpUnmapped\fP is set or else ignored. .IP "\fBf.warptoiconmgr\fP \fIstring\fP" 8 -This function warps the pointer to the icon manager entry +This function warps the pointer to the icon manager entry associated with the window containing the pointer in the icon manager specified by the argument \fIstring\fP. If \fIstring\fP is empty (i.e. ""), the current icon manager is chosen. @@ -1192,7 +1192,7 @@ This function warps the pointer to the screen specified by the argument \fIstring\fP. \fIString\fP may be a number (e.g. \fB"0"\fP or \fB"1"\fP), the word \fB"next"\fP (indicating the current screen plus 1, -skipping over any unmanaged screens), +skipping over any unmanaged screens), the word \fB"back"\fP (indicating the current screen minus 1, skipping over any unmanaged screens), or the word \fB"prev"\fP (indicating the last screen visited. @@ -1206,10 +1206,10 @@ .PP Functions may be grouped and interactively selected using pop-up (when bound to a pointer button) or pull-down (when associated -with a titlebutton) menus. Each menu specification contains the name of the -menu as it will be referred to by \fBf.menu\fP, optional default +with a titlebutton) menus. Each menu specification contains the name of the +menu as it will be referred to by \fBf.menu\fP, optional default foreground and background colors, the list of item names and the functions -they should invoke, and optional foreground and background colors for +they should invoke, and optional foreground and background colors for individual items: .EX 0 \fBMenu\fP "\fImenuname\fP" [ ("\fIdeffore\fP":"\fIdefback\fP") ] @@ -1225,14 +1225,14 @@ .PP The \fImenuname\fP is case-sensitive. The optional \fIdeffore\fP and \fIdefback\fP arguments specify the foreground -and background colors used on a color display +and background colors used on a color display to highlight menu entries. The \fIstring\fP portion of each menu entry will be the text which will appear in the menu. The optional \fIfore\fP and \fIback\fP arguments specify the foreground and background colors of the menu entry when the pointer is not in the entry. These colors will only be used on a color display. The -default is to use the colors specified by the +default is to use the colors specified by the \fBMenuForeground\fP and \fBMenuBackground\fP variables. The \fIfunction\fP portion of the menu entry is one of the functions, including any user-defined functions, or additional menus. @@ -1252,10 +1252,10 @@ .PP An icon manager is a window that contains names of selected or all windows currently on the display. In addition to the window name, -a small button using the default iconify symbol will be displayed to the -left of the name when the window is iconified. By default, clicking on an +a small button using the default iconify symbol will be displayed to the +left of the name when the window is iconified. By default, clicking on an entry in the icon manager performs \fBf.iconify\fP. -To change the actions taken in the icon manager, use the +To change the actions taken in the icon manager, use the the \fBiconmgr\fP context when specifying button and keyboard bindings. .PP Moving the pointer into the icon manager also directs keyboard focus to @@ -1274,9 +1274,9 @@ Double clicking very fast to get the constrained move function will sometimes cause the window to move, even though the pointer is not moved. .PP -If \fBIconifyByUnmapping\fP is on and windows are listed in -\fBIconManagerDontShow\fP but not in \fBDontIconifyByUnmapping\fP, -they may be lost if they are iconified and no bindings to +If \fBIconifyByUnmapping\fP is on and windows are listed in +\fBIconManagerDontShow\fP but not in \fBDontIconifyByUnmapping\fP, +they may be lost if they are iconified and no bindings to \fBf.menu "TwmWindows"\fP or \fBf.warpto\fP are setup. .SH FILES .PP Index: xc/programs/twm/util.c diff -u xc/programs/twm/util.c:1.15 xc/programs/twm/util.c:1.17 --- xc/programs/twm/util.c:1.15 Mon Jan 9 07:00:55 2006 +++ xc/programs/twm/util.c Wed Oct 10 08:23:02 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/util.c,v 1.17 2007/10/10 15:23:02 tsi Exp $ */ /*****************************************************************************/ /* @@ -48,7 +49,6 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/util.c,v 1.15 2006/01/09 15:00:55 dawes Exp $ */ /*********************************************************************** @@ -70,15 +70,15 @@ #include #include -static Pixmap CreateXLogoPixmap ( unsigned int *widthp, +static Pixmap CreateXLogoPixmap ( unsigned int *widthp, unsigned int *heightp ); -static Pixmap CreateResizePixmap ( unsigned int *widthp, +static Pixmap CreateResizePixmap ( unsigned int *widthp, unsigned int *heightp ); -static Pixmap CreateDotPixmap ( unsigned int *widthp, +static Pixmap CreateDotPixmap ( unsigned int *widthp, unsigned int *heightp ); -static Pixmap CreateQuestionPixmap ( unsigned int *widthp, +static Pixmap CreateQuestionPixmap ( unsigned int *widthp, unsigned int *heightp ); -static Pixmap CreateMenuPixmap ( unsigned int *widthp, +static Pixmap CreateMenuPixmap ( unsigned int *widthp, unsigned int *heightp ); int HotX, HotY; @@ -101,9 +101,8 @@ */ /* ARGSUSED */ -void MoveOutline(root, x, y, width, height, bw, th) - Window root; - int x, y, width, height, bw, th; +void +MoveOutline(Window root, int x, int y, int width, int height, int bw, int th) { static int lastx = 0; static int lasty = 0; @@ -114,12 +113,12 @@ int xl, xr, yt, yb, xinnerl, xinnerr, yinnert, yinnerb; int xthird, ythird; XSegment outline[18]; - register XSegment *r; + XSegment *r; if (x == lastx && y == lasty && width == lastWidth && height == lastHeight && lastBW == bw && th == lastTH) return; - + r = outline; #define DRAWIT() \ @@ -228,8 +227,7 @@ */ void -Zoom(wf, wt) - Window wf, wt; +Zoom(Window wf, Window wt) { int fx, fy, tx, ty; /* from, to */ unsigned int fw, fh, tw, th; /* from, to */ @@ -259,7 +257,7 @@ int y = fy + (int) ((dy * i) / z); unsigned width = (unsigned) (((long) fw) + (dw * i) / z); unsigned height = (unsigned) (((long) fh) + (dh * i) / z); - + XDrawRectangle (dpy, Scr->Root, Scr->DrawGC, x, y, width, height); } @@ -284,8 +282,7 @@ */ char * -ExpandFilename(name) -char *name; +ExpandFilename(char *name) { char *newname; @@ -293,7 +290,7 @@ newname = (char *) malloc (HomeLen + strlen(name) + 2); if (!newname) { - fprintf (stderr, + fprintf (stderr, "%s: unable to allocate %ld bytes to expand filename %s/%s\n", ProgramName, HomeLen + (unsigned long)strlen(name) + 2, Home, &name[1]); @@ -316,8 +313,7 @@ */ void -GetUnknownIcon(name) -char *name; +GetUnknownIcon(char *name) { if ((Scr->UnknownPm = GetBitmap(name)) != None) { @@ -342,10 +338,8 @@ *********************************************************************** */ -Pixmap -FindBitmap (name, widthp, heightp) - char *name; - unsigned int *widthp, *heightp; +Pixmap +FindBitmap (char *name, unsigned int *widthp, unsigned int *heightp) { char *bigname; Pixmap pm; @@ -371,7 +365,7 @@ { TBPM_MENU, CreateMenuPixmap }, { TBPM_QUESTION, CreateQuestionPixmap }, }; - + for (i = 0; i < (sizeof pmtab)/(sizeof pmtab[0]); i++) { if (XmuCompareISOLatin1 (pmtab[i].name, name) == 0) return (*pmtab[i].proc) (widthp, heightp); @@ -446,26 +440,21 @@ } if (bigname != name) free (bigname); if (pm == None) { - fprintf (stderr, "%s: unable to find bitmap \"%s\"\n", + fprintf (stderr, "%s: unable to find bitmap \"%s\"\n", ProgramName, name); } return pm; } -Pixmap -GetBitmap (name) - char *name; +Pixmap +GetBitmap (char *name) { return FindBitmap (name, &JunkWidth, &JunkHeight); } void -InsertRGBColormap (a, maps, nmaps, replace) - Atom a; - XStandardColormap *maps; - int nmaps; - Bool replace; +InsertRGBColormap (Atom a, XStandardColormap *maps, int nmaps, Bool replace) { StdCmap *sc = NULL; @@ -499,18 +488,15 @@ } sc->nmaps = nmaps; sc->maps = maps; - - return; } void -RemoveRGBColormap (a) - Atom a; +RemoveRGBColormap (Atom a) { StdCmap *sc, *prev; prev = NULL; - for (sc = Scr->StdCmapInfo.head; sc; sc = sc->next) { + for (sc = Scr->StdCmapInfo.head; sc; sc = sc->next) { if (sc->atom == a) break; prev = sc; } @@ -521,11 +507,10 @@ if (Scr->StdCmapInfo.tail == sc) Scr->StdCmapInfo.tail = prev; if (Scr->StdCmapInfo.mru == sc) Scr->StdCmapInfo.mru = NULL; } - return; } void -LocateStandardColormaps() +LocateStandardColormaps(void) { Atom *atoms; int natoms; @@ -542,14 +527,10 @@ } } if (atoms) XFree ((char *) atoms); - return; } void -GetColor(kind, what, name) -int kind; -Pixel *what; -char *name; +GetColor(int kind, Pixel *what, char *name) { XColor color, junkcolor; Status stat = 0; @@ -575,7 +556,7 @@ stat = XParseColor (dpy, cmap, name, &color); if (!stat) { - fprintf (stderr, "%s: invalid color name \"%s\"\n", + fprintf (stderr, "%s: invalid color name \"%s\"\n", ProgramName, name); return; } @@ -606,7 +587,7 @@ gotit: if (stdcmap) { - color.pixel = (stdcmap->base_pixel + + color.pixel = (stdcmap->base_pixel + ((Pixel)(((float)color.red / 65535.0) * stdcmap->red_max + 0.5) * stdcmap->red_mult) + @@ -616,8 +597,8 @@ ((Pixel)(((float)color.blue / 65535.0) * stdcmap->blue_max + 0.5) * stdcmap->blue_mult)); - } else { - fprintf (stderr, "%s: unable to allocate color \"%s\"\n", + } else { + fprintf (stderr, "%s: unable to allocate color \"%s\"\n", ProgramName, name); return; } @@ -627,10 +608,7 @@ } void -GetColorValue(kind, what, name) -int kind; -XColor *what; -char *name; +GetColorValue(int kind, XColor *what, char *name) { XColor junkcolor; Colormap cmap = Scr->TwmRoot.cmaps.cwins[0]->colormap->c; @@ -645,7 +623,7 @@ if (!XLookupColor (dpy, cmap, name, what, &junkcolor)) { - fprintf (stderr, "%s: invalid color name \"%s\"\n", + fprintf (stderr, "%s: invalid color name \"%s\"\n", ProgramName, name); } else @@ -654,7 +632,7 @@ } } -/* +/* * The following functions are sensible to 'use_fontset'. * When 'use_fontset' is True, * - XFontSet-related internationalized functions are used @@ -665,8 +643,7 @@ * locale is not set properly. */ void -GetFont(font) -MyFont *font; +GetFont(MyFont *font) { char *deffontname = "fixed"; char **missing_charset_list_return; @@ -675,7 +652,7 @@ XFontSetExtents *font_extents; XFontStruct **xfonts; char **font_names; - register int i; + int i; int ascent; int descent; int fnum; @@ -740,10 +717,7 @@ } int -MyFont_TextWidth(font, string, len) - MyFont *font; - char *string; - int len; +MyFont_TextWidth(MyFont *font, char *string, int len) { XRectangle ink_rect; XRectangle logical_rect; @@ -757,14 +731,8 @@ } void -MyFont_DrawImageString(dpy, d, font, gc, x, y, string, len) - Display *dpy; - Drawable d; - MyFont *font; - GC gc; - int x,y; - char *string; - int len; +MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc, + int x, int y, char *string, int len) { if (use_fontset) { XmbDrawImageString(dpy, d, font->fontset, gc, x, y, string, len); @@ -774,14 +742,8 @@ } void -MyFont_DrawString(dpy, d, font, gc, x, y, string, len) - Display *dpy; - Drawable d; - MyFont *font; - GC gc; - int x,y; - char *string; - int len; +MyFont_DrawString(Display *dpy, Drawable d, MyFont *font, GC gc, int x, int y, + char *string, int len) { if (use_fontset) { XmbDrawString(dpy, d, font->fontset, gc, x, y, string, len); @@ -791,9 +753,8 @@ } void -MyFont_ChangeGC(fix_fore, fix_back, fix_font) - unsigned long fix_fore, fix_back; - MyFont *fix_font; +MyFont_ChangeGC(unsigned long fix_fore, unsigned long fix_back, + MyFont *fix_font) { Gcv.foreground = fix_fore; Gcv.background = fix_back; @@ -808,22 +769,19 @@ /* * The following functions are internationalized substitutions * for XFetchName and XGetIconName using XGetWMName and - * XGetWMIconName. + * XGetWMIconName. * - * Please note that the third arguments have to be freed using free(), + * Please note that the third arguments have to be freed using free(), * not XFree(). */ Status -I18N_FetchName(dpy, w, winname) - Display *dpy; - Window w; - char ** winname; +I18N_FetchName(Display *dpy, Window w, char ** winname) { int status; XTextProperty text_prop; char **list; int num; - + status = XGetWMName(dpy, w, &text_prop); if (!status || !text_prop.value || !text_prop.nitems) { *winname = NULL; @@ -831,7 +789,7 @@ } status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); if (status < Success || !num || !*list) { - *winname = NULL; + *winname = NULL; return 0; } XFree(text_prop.value); @@ -841,16 +799,13 @@ } Status -I18N_GetIconName(dpy, w, iconname) - Display *dpy; - Window w; - char ** iconname; +I18N_GetIconName(Display *dpy, Window w, char ** iconname) { int status; XTextProperty text_prop; char **list; int num; - + status = XGetWMIconName(dpy, w, &text_prop); if (!status || !text_prop.value || !text_prop.nitems) return 0; status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); @@ -866,9 +821,7 @@ * and easier to debug */ void -SetFocus (tmp_win, time) - TwmWindow *tmp_win; - Time time; +SetFocus (TwmWindow *tmp_win, Time time) { Window w = (tmp_win ? tmp_win->w : PointerRoot); @@ -895,8 +848,7 @@ * called NAME. */ int -putenv(s) - char *s; +putenv(char *s) { char *v; int varlen, idx; @@ -922,12 +874,12 @@ } } } - + /* add to environment (unless no value; then just return) */ if(v[1] == 0) return 0; if(virgin) { - register i; + int i; newenv = (char **) malloc((unsigned) ((idx + 2) * sizeof(char*))); if(newenv == 0) @@ -945,15 +897,14 @@ environ = newenv; environ[idx] = s; environ[idx+1] = 0; - + return 0; } #endif /* NOPUTENV */ -static Pixmap -CreateXLogoPixmap (widthp, heightp) - unsigned int *widthp, *heightp; +static Pixmap +CreateXLogoPixmap (unsigned int *widthp, unsigned int *heightp) { int h = Scr->TBInfo.width - Scr->TBInfo.border * 2; if (h < 0) h = 0; @@ -987,9 +938,8 @@ } -static Pixmap -CreateResizePixmap (widthp, heightp) - unsigned int *widthp, *heightp; +static Pixmap +CreateResizePixmap (unsigned int *widthp, unsigned int *heightp) { int h = Scr->TBInfo.width - Scr->TBInfo.border * 2; if (h < 1) h = 1; @@ -1015,7 +965,7 @@ XSetLineAttributes (dpy, gc, lw, LineSolid, CapButt, JoinMiter); /* - * draw the resize button, + * draw the resize button, */ w = (h * 2) / 3; points[0].x = w; @@ -1043,9 +993,8 @@ } -static Pixmap -CreateDotPixmap (widthp, heightp) - unsigned int *widthp, *heightp; +static Pixmap +CreateDotPixmap (unsigned int *widthp, unsigned int *heightp) { int h = Scr->TBInfo.width - Scr->TBInfo.border * 2; @@ -1075,9 +1024,8 @@ static char questionmark_bits[] = { 0x38, 0x7c, 0x64, 0x30, 0x18, 0x00, 0x18, 0x18}; -static Pixmap -CreateQuestionPixmap (widthp, heightp) - unsigned int *widthp, *heightp; +static Pixmap +CreateQuestionPixmap (unsigned int *widthp, unsigned int *heightp) { *widthp = questionmark_width; *heightp = questionmark_height; @@ -1094,18 +1042,15 @@ } -static Pixmap -CreateMenuPixmap (widthp, heightp) - unsigned int *widthp, *heightp; +static Pixmap +CreateMenuPixmap (unsigned int *widthp, unsigned int *heightp) { return CreateMenuIcon (Scr->TBInfo.width - Scr->TBInfo.border * 2, widthp,heightp); } -Pixmap -CreateMenuIcon (height, widthp, heightp) - int height; - unsigned int *widthp, *heightp; +Pixmap +CreateMenuIcon (int height, unsigned int *widthp, unsigned int *heightp) { int h, w; int ih, iw; @@ -1179,15 +1124,11 @@ } void -Bell(type,percent,win) - int type; - int percent; - Window win; +Bell(int type, int percent, Window win) { #ifdef XKB XkbStdBell(dpy, win, percent, type); #else XBell(dpy, percent); #endif - return; } Index: xc/programs/twm/util.h diff -u xc/programs/twm/util.h:1.8 xc/programs/twm/util.h:1.9 --- xc/programs/twm/util.h:1.8 Mon Jan 9 07:00:56 2006 +++ xc/programs/twm/util.h Tue Oct 9 17:31:39 2007 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/twm/util.h,v 1.9 2007/10/10 00:31:39 tsi Exp $ */ /*****************************************************************************/ /* @@ -48,7 +49,6 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/util.h,v 1.8 2006/01/09 15:00:56 dawes Exp $ */ /*********************************************************************** @@ -62,15 +62,15 @@ #ifndef _UTIL_ #define _UTIL_ -extern void MoveOutline ( Window root, int x, int y, int width, int height, +extern void MoveOutline ( Window root, int x, int y, int width, int height, int bw, int th ); extern void Zoom ( Window wf, Window wt ); extern char * ExpandFilename ( char *name ); extern void GetUnknownIcon ( char *name ); -extern Pixmap FindBitmap ( char *name, unsigned int *widthp, +extern Pixmap FindBitmap ( char *name, unsigned int *widthp, unsigned int *heightp ); extern Pixmap GetBitmap ( char *name ); -extern void InsertRGBColormap ( Atom a, XStandardColormap *maps, int nmaps, +extern void InsertRGBColormap ( Atom a, XStandardColormap *maps, int nmaps, Bool replace ); extern void RemoveRGBColormap ( Atom a ); extern void LocateStandardColormaps ( void ); @@ -78,12 +78,12 @@ extern void GetColorValue ( int kind, XColor *what, char *name ); extern void GetFont ( MyFont *font ); extern int MyFont_TextWidth( MyFont *font, char *string, int len); -extern void MyFont_DrawImageString( Display *dpy, Drawable d, MyFont *font, - GC gc, int x, int y, char * string, +extern void MyFont_DrawImageString( Display *dpy, Drawable d, MyFont *font, + GC gc, int x, int y, char * string, int len); -extern void MyFont_DrawString( Display *dpy, Drawable d, MyFont *font, +extern void MyFont_DrawString( Display *dpy, Drawable d, MyFont *font, GC gc, int x, int y, char * string, int len); -extern void MyFont_ChangeGC( unsigned long fix_fore, unsigned long fix_back, +extern void MyFont_ChangeGC( unsigned long fix_fore, unsigned long fix_back, MyFont *fix_font); extern Status I18N_FetchName( Display *dpy, Window win, char **winname); extern Status I18N_GetIconName( Display *dpy, Window win, char **iconname); Index: xc/programs/twm/sample-twmrc/keith.twmrc diff -u xc/programs/twm/sample-twmrc/keith.twmrc:1.1.1.1 xc/programs/twm/sample-twmrc/keith.twmrc:1.2 --- xc/programs/twm/sample-twmrc/keith.twmrc:1.1.1.1 Wed Apr 27 00:20:18 1994 +++ xc/programs/twm/sample-twmrc/keith.twmrc Tue Oct 9 17:31:40 2007 @@ -104,7 +104,7 @@ DefaultFunction f.nop -Button1 = : title : f.function "move-or-raiselower" +Button1 = : title : f.function "move-or-raiselower" Button2 = : title : f.menu "Title Menu" Button3 = : title : f.resize Button1 = m : window|icon : f.iconify Index: xc/programs/twm/sample-twmrc/lemke.twmrc diff -u xc/programs/twm/sample-twmrc/lemke.twmrc:1.1.1.1 xc/programs/twm/sample-twmrc/lemke.twmrc:1.2 --- xc/programs/twm/sample-twmrc/lemke.twmrc:1.1.1.1 Wed Apr 27 00:20:18 1994 +++ xc/programs/twm/sample-twmrc/lemke.twmrc Tue Oct 9 17:31:40 2007 @@ -36,7 +36,7 @@ SqueezeTitle { - "XTerm" center 0 0 + "XTerm" center 0 0 "Xsol" center 0 0 "Spider" center 0 0 } @@ -119,16 +119,16 @@ # buttons # -Button1 = : root : f.menu "button1" -Button2 = : root : f.menu "Util_menu" -Button3 = : root : f.menu "Hosts_menu" -Button1 = : m : f.iconify -Button2 = : m : f.lower -Button1 = : t : f.function "move-or-raise" -Button2 = : t : f.lower -Button3 = : t : f.menu "window-ops" -Button1 = : i : f.iconify -Button2 = : i : f.function "move-or-raise" +Button1 = : root : f.menu "button1" +Button2 = : root : f.menu "Util_menu" +Button3 = : root : f.menu "Hosts_menu" +Button1 = : m : f.iconify +Button2 = : m : f.lower +Button1 = : t : f.function "move-or-raise" +Button2 = : t : f.lower +Button3 = : t : f.menu "window-ops" +Button1 = : i : f.iconify +Button2 = : i : f.function "move-or-raise" "F1" = : w|t|i : f.iconify "F2" = : all : f.refresh @@ -147,7 +147,7 @@ #"Notepad" !"/usr/bin/dxnotepad -display $DISPLAY&" #"Calculator" !"xcalc -display $DISPLAY&" "Mail Box" !"/usr/bin/X11/xbiff -display $DISPLAY&" -"Clock" !"oclock -display $DISPLAY &" +"Clock" !"oclock -display $DISPLAY &" "Xterm" !"/usr/bin/X11/xterm -ls -display $DISPLAY &" "Big Xterm" !"/usr/bin/X11/xterm -ls -fn 9x15 -display $DISPLAY &" "xsol" !"$HOME/games/bin/`arch`/xsol &" @@ -183,9 +183,9 @@ #"FrameMaker" !"rsh indian -n /usr/local/xframemaker $DISPLAY& " #"Calendar" !"/usr/bin/dxcalendar -display $DISPLAY &" "Clock" !"/usr/bin/X11/xclock -display $DISPLAY &" -#"Rolodex" !"/usr/bin/dxcardfiler -display $DISPLAY &" -#"Paint" !"/usr/bin/dxpaint -display $DISPLAY &" -"Lock Screen" !"/usr/bin/X11/xlock & " +#"Rolodex" !"/usr/bin/dxcardfiler -display $DISPLAY &" +#"Paint" !"/usr/bin/dxpaint -display $DISPLAY &" +"Lock Screen" !"/usr/bin/X11/xlock & " "Preferences" !"/usr/bin/X11/xpref -display $DISPLAY&" "Xterm" !"/usr/bin/X11/xterm -ls -display $DISPLAY &" } Index: xc/programs/x11perf/Imakefile diff -u xc/programs/x11perf/Imakefile:3.14 xc/programs/x11perf/Imakefile:3.15 --- xc/programs/x11perf/Imakefile:3.14 Fri May 18 11:02:00 2007 +++ xc/programs/x11perf/Imakefile Tue Sep 25 08:24:10 2007 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/x11perf/Imakefile,v 3.14 2007/05/18 18:02:00 tsi Exp $ +XCOMM $XFree86: xc/programs/x11perf/Imakefile,v 3.15 2007/09/25 15:24:10 tsi Exp $ #ifndef X11perfcompLib #define X11perfcompLib $(LIBDIR)/x11perfcomp @@ -9,14 +9,16 @@ #endif #if BuildRenderLibrary XRENDERDEFS = -DXRENDER + XRENDERINCS = $(XRENDERINCLUDES) +#if !BuildXftLibrary XRENDERDEPS = $(DEPXRENDERLIB) XRENDERLIBS = $(XRENDERLIB) - XRENDERINCS = $(XRENDERINCLUDES) +#endif #endif #if BuildXftLibrary XFTDEFS = -DXFT - XFTDEPS = XftClientDepLibs - XFTLIBS = XftClientLibs + XFTDEPS = XftClientDepLibs $(DEPXRENDERLIB) + XFTLIBS = XftClientLibs $(XRENDERLIB) XFTINCS = $(XFTINCLUDES) #endif DEFINES = $(SIGNAL_DEFINES) $(SHMDEFS) $(XFTDEFS) $(XRENDERDEFS) Index: xc/programs/xdm/greeter/verify.c diff -u xc/programs/xdm/greeter/verify.c:3.29 xc/programs/xdm/greeter/verify.c:3.30 --- xc/programs/xdm/greeter/verify.c:3.29 Mon Jan 9 07:01:06 2006 +++ xc/programs/xdm/greeter/verify.c Wed Oct 15 13:59:14 2008 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.30 2008/10/15 20:59:14 tsi Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -25,7 +26,6 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.29 2006/01/09 15:01:06 dawes Exp $ */ /* * xdm - display manager daemon @@ -160,7 +160,7 @@ /* PAM frees resp */ break; case PAM_TEXT_INFO: - /* ignore the informational mesage */ + /* ignore the informational message */ break; default: /* unknown or PAM_ERROR_MSG */ @@ -189,7 +189,7 @@ auth_session_t *as; char *style, *shell, *home, *s, **argv; char path[MAXPATHLEN]; - int authok; + int authok, password_length; /* User may have specified an authentication style. */ if ((style = strchr(greet->name, ':')) != NULL) @@ -230,10 +230,20 @@ return 0; } + password_length = strlen(greet->password); + /* Set up state for no challenge, just check a response. */ auth_setstate(as, 0); auth_setdata(as, "", 1); - auth_setdata(as, greet->password, strlen(greet->password) + 1); + auth_setdata(as, greet->password, password_length + 1); + + /* + * Zap password now, unless still needed by StartClient(). Otherwise, + * unzapped copies will end up in our forked children. + */ +#if !defined(SECURE_RPC) && !defined(K5AUTH) + bzero(greet->password, password_length); +#endif /* Build path of the auth script and call it */ snprintf(path, sizeof(path), _PATH_AUTHPROG "%s", style); @@ -243,7 +253,9 @@ if ((authok & AUTH_ALLOW) == 0) { Debug("password verify failed\n"); - bzero(greet->password, strlen(greet->password)); +#if defined(SECURE_RPC) || defined(K5AUTH) + bzero(greet->password, password_length); +#endif auth_close(as); login_close(lc); return 0; @@ -251,7 +263,9 @@ /* Run the approval script */ if (!auth_approval(as, lc, greet->name, "auth-xdm")) { Debug("login not approved\n"); - bzero(greet->password, strlen(greet->password)); +#if defined(SECURE_RPC) || defined(K5AUTH) + bzero(greet->password, password_length); +#endif auth_close(as); login_close(lc); return 0; @@ -259,14 +273,16 @@ auth_close(as); login_close(lc); /* Check empty passwords against allowNullPasswd */ - if (!greet->allow_null_passwd && strlen(greet->password) == 0) { + if (!greet->allow_null_passwd && password_length == 0) { Debug("empty password not allowed\n"); return 0; } /* Only accept root logins if allowRootLogin resource is set */ if (p->pw_uid == 0 && !greet->allow_root_login) { Debug("root logins not allowed\n"); - bzero(greet->password, strlen(greet->password)); +#if defined(SECURE_RPC) || defined(K5AUTH) + bzero(greet->password, password_length); +#endif return 0; } @@ -279,7 +295,9 @@ /* did not found the shell in /etc/shells -> failure */ Debug("shell not in /etc/shells\n"); - bzero(greet->password, strlen(greet->password)); +#if defined(SECURE_RPC) || defined(K5AUTH) + bzero(greet->password, password_length); +#endif endusershell(); return 0; } Index: xc/programs/xfs/Imakefile diff -u xc/programs/xfs/Imakefile:3.27 xc/programs/xfs/Imakefile:3.28 --- xc/programs/xfs/Imakefile:3.27 Mon Jan 9 07:01:10 2006 +++ xc/programs/xfs/Imakefile Wed Mar 26 10:47:27 2008 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/xfs/Imakefile,v 3.27 2006/01/09 15:01:10 dawes Exp $ +XCOMM $XFree86: xc/programs/xfs/Imakefile,v 3.28 2008/03/26 17:47:27 tsi Exp $ #undef ServerDefines #include @@ -34,10 +34,6 @@ DEFAULTFONTPATH = DefaultFSFontPath SITE_CONFIG = -DDEFAULTFONTPATH=$(DEFAULTFONTPATH) -DFSERRORS=$(FSERRORS) -$(OSLIB): $(OSDIR) - -$(DIFSLIB): $(DIFSDIR) - all:: config #if !defined(LynxOSArchitecture) && !defined(QNX4Architecture) Index: xc/programs/xterm/Imakefile diff -u xc/programs/xterm/Imakefile:3.79 xc/programs/xterm/Imakefile:3.80 --- xc/programs/xterm/Imakefile:3.79 Tue Jul 3 08:19:53 2007 +++ xc/programs/xterm/Imakefile Fri Oct 31 20:20:29 2008 @@ -7,7 +7,7 @@ XCOMM bcopy (or memcpy) cannot, write a routine called bcopy and link it in XCOMM or add -Dbcopy=mybcopy to the DEFINES list below. XCOMM -XCOMM $XFree86: xc/programs/xterm/Imakefile,v 3.79 2007/07/03 15:19:53 tsi Exp $ +XCOMM $XFree86: xc/programs/xterm/Imakefile,v 3.80 2008/11/01 03:20:29 dawes Exp $ XCOMM /* Uncomment SCROLLBAR_RIGHT if you want the scroll bar to be on the right */ @@ -195,6 +195,10 @@ OBSOLETE_INCLUDES = -I. #endif +#ifdef XtermFeatureOptions +XTERM_FEATURE_OPTIONS = XtermFeatureOptions +#endif + MAIN_DEFINES = $(UTMPDEF) $(TTYGROUPDEF) $(PUCCPTYDDEF) $(CSGIDFLAGS) \ -DOSMAJORVERSION=$(OSMAJORVERSION) \ -DOSMINORVERSION=$(OSMINORVERSION) @@ -203,7 +207,8 @@ PATH_DEFINES = -DPROJECTROOT=$(PROJECTROOT) DEFINES = $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) \ $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF) $(PATH_DEFINES) \ - $(PUTENVDEF) $(IMAKEDEFINES) $(TRACEDEF) + $(XTERM_FEATURE_OPTIONS) $(PUTENVDEF) \ + $(IMAKEDEFINES) $(TRACEDEF) INCLUDES = $(OBSOLETE_INCLUDES) $(XRFINCLUDES) #ifdef OS2Architecture Index: xc/programs/xtrap/xtrapin.c diff -u xc/programs/xtrap/xtrapin.c:1.4 xc/programs/xtrap/xtrapin.c:1.5 --- xc/programs/xtrap/xtrapin.c:1.4 Mon Apr 9 08:37:21 2007 +++ xc/programs/xtrap/xtrapin.c Sat Sep 15 20:44:18 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/xtrapin.c,v 1.4 2007/04/09 15:37:21 tsi Exp $ */ +/* $XFree86: xc/programs/xtrap/xtrapin.c,v 1.5 2007/09/16 03:44:18 tsi Exp $ */ /* * @DEC_COPYRIGHT@ */ @@ -169,7 +169,7 @@ appW = XtAppInitialize(&app,"XTrap",optionTable,(Cardinal)1L, (int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp, - (Cardinal)NULL); + (Cardinal)0); dpy = XtDisplay(appW); #ifdef DEBUG Index: xc/programs/xtrap/xtrapinfo.c diff -u xc/programs/xtrap/xtrapinfo.c:1.2 xc/programs/xtrap/xtrapinfo.c:1.3 --- xc/programs/xtrap/xtrapinfo.c:1.2 Wed Sep 18 10:11:57 2002 +++ xc/programs/xtrap/xtrapinfo.c Sat Sep 15 20:44:18 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/xtrapinfo.c,v 1.2 2002/09/18 17:11:57 tsi Exp $ */ +/* $XFree86: xc/programs/xtrap/xtrapinfo.c,v 1.3 2007/09/16 03:44:18 tsi Exp $ */ /* * @DEC_COPYRIGHT@ */ @@ -68,7 +68,7 @@ /* Connect to Server */ appW = XtAppInitialize(&app,"XTrap",NULL,(Cardinal)0L, (int *)&argc, (String *)argv, (String *)NULL, (ArgList)&tmp, - (Cardinal)NULL); + (Cardinal)0); dpy = XtDisplay(appW); #ifdef DEBUG XSynchronize(dpy, True); Index: xc/programs/xtrap/xtrapout.c diff -u xc/programs/xtrap/xtrapout.c:1.4 xc/programs/xtrap/xtrapout.c:1.5 --- xc/programs/xtrap/xtrapout.c:1.4 Tue Mar 29 10:17:02 2005 +++ xc/programs/xtrap/xtrapout.c Sat Sep 15 20:44:18 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/xtrapout.c,v 1.4 2005/03/29 18:17:02 tsi Exp $ */ +/* $XFree86: xc/programs/xtrap/xtrapout.c,v 1.5 2007/09/16 03:44:18 tsi Exp $ */ /* * @DEC_COPYRIGHT@ */ @@ -228,7 +228,7 @@ appW = XtAppInitialize(&app,"XTrap",optionTable,(Cardinal)2L, (int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp, - (Cardinal)NULL); + (Cardinal)0); dpy = XtDisplay(appW); #ifdef DEBUG Index: xc/programs/xtrap/xtrapproto.c diff -u xc/programs/xtrap/xtrapproto.c:1.5 xc/programs/xtrap/xtrapproto.c:1.6 --- xc/programs/xtrap/xtrapproto.c:1.5 Mon Jan 9 07:01:55 2006 +++ xc/programs/xtrap/xtrapproto.c Sat Sep 15 20:44:18 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/xtrapproto.c,v 1.5 2006/01/09 15:01:55 dawes Exp $ */ +/* $XFree86: xc/programs/xtrap/xtrapproto.c,v 1.6 2007/09/16 03:44:18 tsi Exp $ */ /* * @DEC_COPYRIGHT@ */ @@ -67,7 +67,7 @@ /* Connect to Server */ appW = XtAppInitialize(&app,"XTrap",NULL,(Cardinal)0L, (int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp, - (Cardinal)NULL); + (Cardinal)0); dpy = XtDisplay(appW); printf("Display: %s \n", DisplayString(dpy)); if ((tc = XECreateTC(dpy,0L, NULL)) == False) Index: xc/programs/xtrap/xtrapreset.c diff -u xc/programs/xtrap/xtrapreset.c:1.2 xc/programs/xtrap/xtrapreset.c:1.3 --- xc/programs/xtrap/xtrapreset.c:1.2 Wed Sep 18 10:11:57 2002 +++ xc/programs/xtrap/xtrapreset.c Sat Sep 15 20:44:18 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/xtrapreset.c,v 1.2 2002/09/18 17:11:57 tsi Exp $ */ +/* $XFree86: xc/programs/xtrap/xtrapreset.c,v 1.3 2007/09/16 03:44:18 tsi Exp $ */ /* * @DEC_COPYRIGHT@ */ @@ -67,7 +67,7 @@ /* Connect to Server */ appW = XtAppInitialize(&app,"XTrap",NULL,(Cardinal)0L, (int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp, - (Cardinal)NULL); + (Cardinal)0); dpy = XtDisplay(appW); #ifdef DEBUG XSynchronize(dpy, True); Index: xc/programs/xtrap/xtrapstats.c diff -u xc/programs/xtrap/xtrapstats.c:1.2 xc/programs/xtrap/xtrapstats.c:1.3 --- xc/programs/xtrap/xtrapstats.c:1.2 Wed Sep 18 10:11:57 2002 +++ xc/programs/xtrap/xtrapstats.c Sat Sep 15 20:44:18 2007 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xtrap/xtrapstats.c,v 1.2 2002/09/18 17:11:57 tsi Exp $ */ +/* $XFree86: xc/programs/xtrap/xtrapstats.c,v 1.3 2007/09/16 03:44:18 tsi Exp $ */ /* * @DEC_COPYRIGHT@ */ @@ -75,7 +75,7 @@ /* Connect to Server */ appW = XtAppInitialize(&app,"XTrap",NULL,(Cardinal)0L, (int *)&argc, (String *)argv, (String *)NULL,(ArgList)&tmp, - (Cardinal)NULL); + (Cardinal)0); dpy = XtDisplay(appW); #ifdef DEBUG XSynchronize(dpy, True);