[5800] daemon@ATHENA.MIT.EDU  Athena Bugs  08/23/90 12:04 (108 lines)
Subject: twm patch from comp.windows.x 
Date: Thu, 23 Aug 90 12:04:29 -0400
From: "Barr3y Jaspan" <bjaspan@ATHENA.MIT.EDU>
To: bugs@ATHENA.MIT.EDU


This came from comp.windows.x and has already been sent to the X
Consortium, but we probably shouldn't wait for the X Consortium to get
around to releasing it.  

---- snip snip ----

Article 26691 of comp.windows.x:
Path: bloom-beacon!snorkelwacker!usc!samsung!munnari.oz.au!sirius.ucs.adelaide.edu.au!augean!flinders!lennon!vega!rwhitby
From: rwhitby@austek.oz.au (Rod Whitby)
Newsgroups: comp.windows.x
Subject: TWM patch to include new windows in DontMoveOff functionality
Keywords: TWM DontMoveOff
Message-ID: <RWHITBY.90Aug15150459@vega.austek.oz.au>
Date: 15 Aug 90 05:34:59 GMT
Sender: rwhitby@vega.austek.oz
Distribution: comp
Organization: Austek Microsystems Pty Ltd
Lines: 82

Here is a patch to twm (and also vtwm) to ensure that user-positioned
windows cannot be placed off the screen when DontMoveOff is set.

When the user interactively positions a new window it is possible to
place the window off the screen even though the DontMoveOff option is
set.  This patch confines the placement of new windows to the screen
boundaries in the same way that f.move does.

I have submitted this patch to xbugs for possible inclusion in a
future version of TWM, and to Dave Edmonson <dme@doc.ic.ac.uk> for
possible inclusion in a future version of VTWM.

Whether the current behaviour is a bug or a feature is uncertain.
IMHO, if I enable DontMoveOff, then my windows should never be allowed
to cross the screen boundaries (unless I use f.forcemove).

*** add_window.c~	Sun Aug 12 14:31:05 1990
--- add_window.c	Mon Aug 13 19:10:25 1990
***************
*** 417,422 ****
--- 417,440 ----
  		XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild,
  		    &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask);
  
+ 		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;
+ 		}
+ 
  		MoveOutline(Scr->Root, AddingX, AddingY, AddingW, AddingH,
  			    tmp_win->frame_bw, tmp_win->title_height);
  
***************
*** 424,429 ****
--- 442,465 ----
  		{
  		    AddingX = event.xbutton.x_root;
  		    AddingY = event.xbutton.y_root;
+ 
+ 		    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;
  		}
  	    }
--
Rod Whitby                                               _--_|\
Austek Microsystems                                     /      \
Technology Park         ACSnet: rwhitby@austek.oz       \_.--*_/
Adelaide, SA 5095       ARPA:   rwhitby@austek.oz.au          v
Australia               UUCP:   uunet.uu.net!munnari!austek.oz.au!rwhitby
X-Face: %}1klhj1q/qgLe;Nz<&;'7TsMEx5A-`,l|;;\.s5TiG99*0QR{~hNesXoQWp|I*"@r)U1\u
 Dvj|b#m5uV.2QkJ.<Yu?X^pn+^W_UQyG5/iZ!AA`3<JJMe3z{*?p!yarBuJ+!RY"&knZ]eDImi,u5,
 4(+M`ECv"q}58Oe11%e[g36]D_PaQY]K3@)6d5n:I8Q!&o&Y~kRth?QHJUmg%O[BQ4+w}1g"ElFFS2
 *gAn)$TfYp0ji!6t[oXdfYBM+]=V[c7_\$8M|rp(2=i@


--[5800]--

