[comp.sources.x] v09i011: tvtwm , Patch1, Part01/01

toml@Solbourne.COM (08/30/90)

Submitted-by: toml@Solbourne.COM
Posting-number: Volume 9, Issue 11
Archive-name: tvtwm/patch1
Patch-To: tvtwm: Volume 9, Issue 2-10

#! /bin/sh
# This is a shell archive, meaning:
# 1.  Remove everything above the #! /bin/sh line.
# 2.  Save the resulting test in a file
# 3.  Execute the file with /bin/sh (not csh) to create the files:
#
#patch.1
#
# Created by toml () on Thu Aug 30 07:36:53 MDT 1990
#
if test -f 'patch.1'
then
    echo shar: will not over-write existing file "patch.1"
else
echo extracting "patch.1"
sed 's/^X//' >patch.1 <<'SHAR_EOF'
Xdiff -c ../old/README.tvtwm ./README.tvtwm
X*** ../old/README.tvtwm	Wed Aug 29 08:34:46 1990
X--- ./README.tvtwm	Thu Aug 30 07:17:58 1990
X***************
X*** 72,83 ****
X     didn't touch any code related to window moves in events.c.
X     The new window move code is in a new file called move.c.
X  
X! 3. Because of the new window move code, I have not looked at 
X!    or implemented the MoveOpaque feature.  With the Virtual Desktop
X!    enabled, users typically won't want to use MoveOpaque anyway 
X!    because it's not as clean to move into and out of the panner.
X!    The constrained move and DontMoveOff functionality is also
X!    missing.
X  
X  4. Rather than the f.nail and "NailedDown" features of vtwm, tvtwm
X     uses the same terminology as swm.  In tvtwm, windows that do
X--- 72,80 ----
X     didn't touch any code related to window moves in events.c.
X     The new window move code is in a new file called move.c.
X  
X! 3. Opaque moves look kind of strange when dragging windows in
X!    and out of the panner, but they do the right thing.  DontMoveOff
X!    has not been fixed to work properly with the desktop.
X  
X  4. Rather than the f.nail and "NailedDown" features of vtwm, tvtwm
X     uses the same terminology as swm.  In tvtwm, windows that do
Xdiff -c ../old/add_window.c ./add_window.c
X*** ../old/add_window.c	Wed Aug 29 08:34:47 1990
X--- ./add_window.c	Thu Aug 30 07:17:58 1990
X***************
X*** 157,162 ****
X--- 157,163 ----
X      int cancel;				/* cancel flag for window move */
X      int tmpX;				/* temp variable */
X      int saveDelta;			/* save the Scr->MoveDelta */
X+     int saveOpaque;			/* save the Scr->OpaqueMove */
X  
X  #ifdef DEBUG
X      fprintf(stderr, "AddWindow: w = 0x%x\n", w);
X***************
X*** 659,668 ****
X--- 660,672 ----
X  		XMoveWindow(dpy, tmp_win->frame, AddingX, AddingY);
X  
X  	    saveDelta = Scr->MoveDelta;
X+ 	    saveOpaque = Scr->OpaqueMove;
X  	    Scr->MoveDelta = 0;
X+ 	    Scr->OpaqueMove = False;
X  	    StartMove(tmp_win, tmp_win->frame, tmp_win->title_height,
X  		&AddingX, &AddingY, &cancel, OUT_PANNER, 1, 0, 0, True, False);
X  	    Scr->MoveDelta = saveDelta;
X+ 	    Scr->OpaqueMove = saveOpaque;
X  
X  	    if (cancel == Button2) {
X  		int lastx, lasty;
Xdiff -c ../old/menus.c ./menus.c
X*** ../old/menus.c	Wed Aug 29 08:34:54 1990
X--- ./menus.c	Thu Aug 30 07:18:02 1990
X***************
X*** 1241,1246 ****
X--- 1241,1251 ----
X  		XReparentWindow(dpy, tmp_win->frame, Scr->VirtualDesktop,
X  		    tmp_win->frame_x + Scr->vdtPositionX,
X  		    tmp_win->frame_y + Scr->vdtPositionY);
X+ 		tmp_win->frame_x += Scr->vdtPositionX;
X+ 		tmp_win->frame_y += Scr->vdtPositionY;
X+ 		XMoveWindow(dpy, tmp_win->virtualWindow,
X+ 		    tmp_win->frame_x / Scr->PannerScale,
X+ 		    tmp_win->frame_y / Scr->PannerScale);
X  		if (tmp_win->icon_w) {
X  		    XReparentWindow(dpy, tmp_win->icon_w, Scr->VirtualDesktop,
X  			tmp_win->icon_loc_x + Scr->vdtPositionX,
X***************
X*** 1247,1252 ****
X--- 1252,1260 ----
X  			tmp_win->icon_loc_y + Scr->vdtPositionY);
X  		    tmp_win->icon_loc_x += Scr->vdtPositionX;
X  		    tmp_win->icon_loc_y += Scr->vdtPositionY;
X+ 		    XMoveWindow(dpy, tmp_win->virtualIcon,
X+ 			tmp_win->icon_loc_x / Scr->PannerScale,
X+ 			tmp_win->icon_loc_y / Scr->PannerScale);
X  		}
X  		if (!tmp_win->icon)
X  		    XMapRaised(dpy, tmp_win->virtualWindow);
X***************
X*** 1253,1260 ****
X  		else if (tmp_win->virtualIcon)
X  		    XMapRaised(dpy, tmp_win->virtualIcon);
X  		tmp_win->root = Scr->VirtualDesktop;
X- 		tmp_win->frame_x += Scr->vdtPositionX;
X- 		tmp_win->frame_y += Scr->vdtPositionY;
X  		tmp_win->sticky = False;
X  		SetSWM_ROOT(tmp_win);
X  		SetTWM_FLAGS(tmp_win);
X--- 1261,1266 ----
X***************
X*** 1263,1268 ****
X--- 1269,1276 ----
X  		XReparentWindow(dpy, tmp_win->frame, Scr->Root,
X  		    tmp_win->frame_x - Scr->vdtPositionX,
X  		    tmp_win->frame_y - Scr->vdtPositionY);
X+ 		tmp_win->frame_x -= Scr->vdtPositionX;
X+ 		tmp_win->frame_y -= Scr->vdtPositionY;
X  		if (tmp_win->icon_w) {
X  		    XReparentWindow(dpy, tmp_win->icon_w, Scr->Root,
X  			tmp_win->icon_loc_x - Scr->vdtPositionX,
X***************
X*** 1274,1281 ****
X  		if (tmp_win->virtualIcon)
X  		    XUnmapWindow(dpy, tmp_win->virtualIcon);
X  		tmp_win->root = Scr->Root;
X- 		tmp_win->frame_x -= Scr->vdtPositionX;
X- 		tmp_win->frame_y -= Scr->vdtPositionY;
X  		tmp_win->sticky = True;
X  		SetSWM_ROOT(tmp_win);
X  		SetTWM_FLAGS(tmp_win);
X--- 1282,1287 ----
X***************
X*** 1803,1813 ****
X  	break;
X  
X      case F_CIRCLEUP:
X! 	XCirculateSubwindowsUp(dpy, Scr->Root);
X  	break;
X  
X      case F_CIRCLEDOWN:
X! 	XCirculateSubwindowsDown(dpy, Scr->Root);
X  	break;
X  
X      case F_EXEC:
X--- 1809,1825 ----
X  	break;
X  
X      case F_CIRCLEUP:
X! 	if (Scr->VirtualDesktop)
X! 	    XCirculateSubwindowsUp(dpy, Scr->VirtualDesktop);
X! 	else
X! 	    XCirculateSubwindowsUp(dpy, Scr->Root);
X  	break;
X  
X      case F_CIRCLEDOWN:
X! 	if (Scr->VirtualDesktop)
X! 	    XCirculateSubwindowsDown(dpy, Scr->VirtualDesktop);
X! 	else
X! 	    XCirculateSubwindowsDown(dpy, Scr->Root);
X  	break;
X  
X      case F_EXEC:
Xdiff -c ../old/move.c ./move.c
X*** ../old/move.c	Wed Aug 29 08:34:55 1990
X--- ./move.c	Thu Aug 30 07:18:02 1990
X***************
X*** 58,63 ****
X--- 58,67 ----
X  static int dragBW2;
X  static int diffX;
X  static int diffY;
X+ static int offsetX;
X+ static int offsetY;
X+ static int rootX;
X+ static int rootY;
X  static Window outlineWindow;
X  static int scale;
X  static int titleHeight;
X***************
X*** 172,177 ****
X--- 176,184 ----
X  	    Scr->Root, Scr->MoveCursor, CurrentTime);
X      }
X  
X+     rootX = *x_root;
X+     rootY = *y_root;
X+ 
X      /* how big is this thing we are moving? */
X      XGetGeometry(dpy, window, &junkRoot, &junkX, &junkY, &dragWidth, &dragHeight, &dragBW, &junkDepth);
X      origX = junkX;
X***************
X*** 191,197 ****
X  	XTranslateCoordinates(dpy, Scr->Root, tmp_win->root, dragX, dragY, x_root, y_root, &junkChild);
X      }
X  
X!     if (tmp_win->root != Scr->Root && !Scr->OpaqueMove)
X  	doingMove = True;
X      outlineWindow = tmp_win->root;
X      scale = move_scale;
X--- 198,204 ----
X  	XTranslateCoordinates(dpy, Scr->Root, tmp_win->root, dragX, dragY, x_root, y_root, &junkChild);
X      }
X  
X!     if (tmp_win->root != Scr->Root /*  && !Scr->OpaqueMove */)
X  	doingMove = True;
X      outlineWindow = tmp_win->root;
X      scale = move_scale;
X***************
X*** 211,220 ****
X--- 218,235 ----
X      while (True)
X      {
X  	*cancel = False;
X+ 
X+ 	XTranslateCoordinates(dpy, Scr->Root, outlineWindow,
X+ 	    0, 0, &offsetX, &offsetY, &junkChild);
X+ 
X  	reallyStartMove(tmp_win, window, x_root, y_root, cancel, outlineWindow, &first, adding, pulldown);
X  
X  	if (*cancel == IN_PANNER)
X  	{
X+ 	    if (window == tmp_win->frame)
X+ 		window = tmp_win->virtualWindow;
X+ 	    else
X+ 		window = tmp_win->virtualIcon;
X  	    panner = IN_PANNER;
X  	    dragWidth /= Scr->PannerScale;
X  	    dragHeight /= Scr->PannerScale;
X***************
X*** 226,231 ****
X--- 241,250 ----
X  	}
X  	else if (*cancel == OUT_PANNER)
X  	{
X+ 	    if (window == tmp_win->virtualWindow)
X+ 		window = tmp_win->frame;
X+ 	    else
X+ 		window = tmp_win->icon_w;
X  	    panner = OUT_PANNER;
X  	    dragWidth = objWidth;
X  	    dragHeight = objHeight;
X***************
X*** 250,255 ****
X--- 269,280 ----
X  	XUngrabPointer(dpy, CurrentTime);
X  	XUngrabServer(dpy);
X      }
X+     /* can't cancel an opaque move */
X+     if (Scr->OpaqueMove)
X+ 	*cancel = False;
X+ 
X+     if (*cancel)
X+ 	WindowMoved = False;
X  }
X  
X  /***********************************************************************
X***************
X*** 295,303 ****
X  	    doMove(tmp_win, window, *x_root, *y_root, &xdest, &ydest);
X      }
X  
X-     if (*cancel)
X- 	WindowMoved = False;
X- 
X      *x_root = xdest;
X      *y_root = ydest;
X  }
X--- 320,325 ----
X***************
X*** 324,379 ****
X      deltax = xl - origX/scale;
X      deltay = yt - origY/scale;
X  
X- #ifdef NOT_YET
X-     if (wp->constrain())
X-     {
X- 	if (xl < 0)
X- 	    xl = 0;
X- 	else if ((xl + dragWidth) > wp->root()->size_x())
X- 	    xl = wp->root()->size_x() - dragWidth;
X  
X! 	if (yt < 0)
X! 	    yt = 0;
X! 	else if ((yt + dragHeight) > wp->root()->size_y())
X! 	    yt = wp->root()->size_y() - dragHeight;
X!     }
X  
X-     if (wmMoveOpaque)
X- 	oi->set_loc(xl, yt);
X-     else 
X-     {
X- 	rectcount = 0;
X- 	if (numRectangles == 1)
X- 	{
X- 	    rects[0].x = xl;
X- 	    rects[0].y = yt;
X- 	    rects[0].width = dragWidth;
X- 	    rects[0].height = dragHeight;
X- 	    rectcount = 1;
X- 	}
X- 	else
X- 	{
X- 	    for (i = 1; i < wmSweptCount; i++)
X- 	    {
X- 		if (wmSwept[i] && wmSwept[i]->state() == OI_ACTIVE)
X- 		{
X- 		    rects[rectcount].x = wmSwept[i]->loc_x()/xRatio + deltax;
X- 		    rects[rectcount].y = wmSwept[i]->loc_y()/yRatio + deltay;
X- 		    rects[rectcount].width = wmSwept[i]->space_x()/xRatio;
X- 		    rects[rectcount].height = wmSwept[i]->space_y()/yRatio;
X- 		    rectcount++;
X- 		}
X- 	    }
X- 	}
X- 	wmMoveOutline(outlineWindow, rectcount, rects);
X-     }
X-     sprintf(str, " %5d, %-5d  ", xl*xRatio, yt*yRatio);
X-     XRaiseWindow(DPY, wmScr->sizeOI->outside_X_window());
X-     wmScr->sizeOI->set_text(str);
X- #endif NOT_YET
X- 
X-     MoveOutline(outlineWindow, xl, yt, dragWidth, dragHeight, 0, titleHeight);
X- 
X      *x_dest = xl;
X      *y_dest = yt;
X  }
X--- 346,357 ----
X      deltax = xl - origX/scale;
X      deltay = yt - origY/scale;
X  
X  
X!     if (Scr->OpaqueMove)
X! 	XMoveWindow(dpy, window, xl, yt);
X!     else
X! 	MoveOutline(outlineWindow, xl, yt, dragWidth, dragHeight, 0, titleHeight);
X  
X      *x_dest = xl;
X      *y_dest = yt;
X  }
X***************
X*** 393,405 ****
X      XEvent event;
X      int xdest, ydest;
X      unsigned mask;
X-     static int firstX, firstY;
X      static int buttons;
X  
X      if (*first) {
X  	*first = False;
X- 	firstX = *x_root;
X- 	firstY = *y_root;
X  	buttons = 0;
X      }
X  
X--- 371,380 ----
X***************
X*** 470,490 ****
X  		break;
X  	    case MotionNotify:
X  		if (!WindowMoved &&
X! 		    abs(event.xmotion.x_root - firstX) >= Scr->MoveDelta &&
X! 		    abs(event.xmotion.y_root - firstY) >= Scr->MoveDelta)
X  		{
X  		    WindowMoved = True;
X  		}
X  		if (WindowMoved) {
X! 		    *x_root = event.xmotion.x_root;
X! 		    *y_root = event.xmotion.y_root;
X! 		    if (window != Scr->Root) {
X! 			if (window != Scr->VirtualDesktop || (Scr->vdtPositionX != 0 || Scr->vdtPositionY != 0)) {
X! 			    XTranslateCoordinates(dpy, Scr->Root, window,
X! 				event.xbutton.x_root, event.xbutton.y_root,
X! 				x_root, y_root, &junkChild);
X! 			}
X! 		    }
X  		    doingFine = False;
X  		}
X  		break;
X--- 445,458 ----
X  		break;
X  	    case MotionNotify:
X  		if (!WindowMoved &&
X! 		    (abs(event.xmotion.x_root - rootX) >= Scr->MoveDelta ||
X! 		     abs(event.xmotion.y_root - rootY) >= Scr->MoveDelta))
X  		{
X  		    WindowMoved = True;
X  		}
X  		if (WindowMoved) {
X! 		    *x_root = event.xmotion.x_root + offsetX;
X! 		    *y_root = event.xmotion.y_root + offsetY;
X  		    doingFine = False;
X  		}
X  		break;
Xdiff -c ../old/patchlevel.h ./patchlevel.h
X*** ../old/patchlevel.h	Wed Aug 29 08:34:57 1990
X--- ./patchlevel.h	Thu Aug 30 07:18:03 1990
X***************
X*** 1 ****
X! #define PATCHLEVEL 0
X--- 1 ----
X! #define PATCHLEVEL 1
Xdiff -c ../old/resize.c ./resize.c
X*** ../old/resize.c	Wed Aug 29 08:34:57 1990
X--- ./resize.c	Thu Aug 30 07:18:03 1990
X***************
X*** 395,407 ****
X  	dwidth *= Scr->PannerScale;
X  	dheight *= Scr->PannerScale;
X      }
X!     (void) sprintf (str, " %4d x %-4d ", dwidth, dheight);
X      XRaiseWindow(dpy, Scr->SizeWindow);
X      FBF(Scr->DefaultC.fore, Scr->DefaultC.back, Scr->SizeFont.font->fid);
X      XDrawImageString (dpy, Scr->SizeWindow, Scr->NormalGC,
X  		      Scr->SizeStringOffset,
X  		      Scr->SizeFont.font->ascent + SIZE_VINDENT,
X! 		      str, 13);
X  }
X  
X  /***********************************************************************
X--- 395,407 ----
X  	dwidth *= Scr->PannerScale;
X  	dheight *= Scr->PannerScale;
X      }
X!     (void) sprintf (str, " %5d x %-5d ", dwidth, dheight);
X      XRaiseWindow(dpy, Scr->SizeWindow);
X      FBF(Scr->DefaultC.fore, Scr->DefaultC.back, Scr->SizeFont.font->fid);
X      XDrawImageString (dpy, Scr->SizeWindow, Scr->NormalGC,
X  		      Scr->SizeStringOffset,
X  		      Scr->SizeFont.font->ascent + SIZE_VINDENT,
X! 		      str, 15);
X  }
X  
X  /***********************************************************************
Xdiff -c ../old/twm.c ./twm.c
X*** ../old/twm.c	Wed Aug 29 08:35:01 1990
X--- ./twm.c	Thu Aug 30 07:18:04 1990
X***************
X*** 497,503 ****
X  					 valuemask, &attributes);
X  
X  	Scr->SizeStringWidth = XTextWidth (Scr->SizeFont.font,
X! 					   " 8888 x 8888 ", 13);
X  	valuemask = (CWBorderPixel | CWBackPixel | CWBitGravity);
X  	attributes.bit_gravity = NorthWestGravity;
X  	Scr->SizeWindow = XCreateWindow (dpy, Scr->Root, 0, 0, 
X--- 497,503 ----
X  					 valuemask, &attributes);
X  
X  	Scr->SizeStringWidth = XTextWidth (Scr->SizeFont.font,
X! 					   " 88888 x 88888 ", 15);
X  	valuemask = (CWBorderPixel | CWBackPixel | CWBitGravity);
X  	attributes.bit_gravity = NorthWestGravity;
X  	Scr->SizeWindow = XCreateWindow (dpy, Scr->Root, 0, 0, 
Xdiff -c ../old/vdt.c ./vdt.c
X*** ../old/vdt.c	Wed Aug 29 08:35:03 1990
X--- ./vdt.c	Thu Aug 30 07:18:05 1990
X***************
X*** 47,52 ****
X--- 47,55 ----
X  #include "parse.h"
X  #include "move.h"
X  
X+ #define MAX_VDT_WIDTH	32000
X+ #define MAX_VDT_HEIGHT	32000
X+ 
X  static int pointerX;
X  static int pointerY;
X  
X***************
X*** 179,184 ****
X--- 182,189 ----
X      height /= Scr->PannerScale;
X      if (width <= 0) width = 1;
X      if (height <= 0) height = 1;
X+     if (width > MAX_VDT_WIDTH) width = MAX_VDT_WIDTH;
X+     if (height > MAX_VDT_HEIGHT) height = MAX_VDT_HEIGHT;
X      virtual = XCreateSimpleWindow(dpy, Scr->Panner, x, y,
X  	width, height, 1, border, background);
X      XGrabButton(dpy, Button2, AnyModifier, virtual,
X***************
X*** 523,531 ****
X      sizeHints->base_height = height;
X      sizeHints->min_width = Scr->MyDisplayWidth/Scr->PannerScale;
X      sizeHints->min_height = Scr->MyDisplayHeight/Scr->PannerScale;
X      XWMGeometry(dpy, Scr->screen, Scr->PannerGeometry, NULL,
X  	1, sizeHints, &x, &y, &width, &height, &sizeHints->win_gravity);
X!     sizeHints->flags = USPosition|PWinGravity|PMinSize;
X  
X      wmHints = XAllocWMHints();
X      wmHints->initial_state = Scr->PannerState;
X--- 528,538 ----
X      sizeHints->base_height = height;
X      sizeHints->min_width = Scr->MyDisplayWidth/Scr->PannerScale;
X      sizeHints->min_height = Scr->MyDisplayHeight/Scr->PannerScale;
X+     sizeHints->max_width = MAX_VDT_WIDTH/Scr->PannerScale;
X+     sizeHints->max_height = MAX_VDT_HEIGHT/Scr->PannerScale;
X      XWMGeometry(dpy, Scr->screen, Scr->PannerGeometry, NULL,
X  	1, sizeHints, &x, &y, &width, &height, &sizeHints->win_gravity);
X!     sizeHints->flags = USPosition|PWinGravity|PMinSize|PMaxSize;
X  
X      wmHints = XAllocWMHints();
X      wmHints->initial_state = Scr->PannerState;
Xdiff -c ../old/version.c ./version.c
X*** ../old/version.c	Wed Aug 29 08:35:04 1990
X--- ./version.c	Thu Aug 30 07:18:05 1990
X***************
X*** 26,30 ****
X  /*****************************************************************************/
X  
X  /* char *Version = "MIT X Consortium, R4"; */
X! char *Version = "$Revision: 4.0 $";
X  
X--- 26,30 ----
X  /*****************************************************************************/
X  
X  /* char *Version = "MIT X Consortium, R4"; */
X! char *Version = "$Revision: 5.0 $";
X  
SHAR_EOF
if test 15376 -ne "`wc -c < patch.1`"
then
    echo shar: error transmitting "patch.1" '(should have been 15376 characters)'
fi
fi
# end of shell archive
exit 0

dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.