Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2005/1109/2

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Snap mouse to border when grabbing to resize.
 [rsc] --rw-rw-r-- M 4315 glenda sys 22788 Nov  9 16:18 sys/src/cmd/rio/rio.c
	/n/sourcesdump/2005/1109/plan9/sys/src/cmd/rio/rio.c:887,892 - 
	/n/sourcesdump/2005/1110/plan9/sys/src/cmd/rio/rio.c:887,924
	  	return ni;
	  }
	  
	+ Point
	+ cornerpt(Rectangle r, Point p, int which)
	+ {
	+ 	switch(which){
	+ 	case 0:	/* top left */
	+ 		p = Pt(r.min.x, r.min.y);
	+ 		break;
	+ 	case 2:	/* top right */
	+ 		p = Pt(r.max.x,r.min.y);
	+ 		break;
	+ 	case 6:	/* bottom left */
	+ 		p = Pt(r.min.x, r.max.y);
	+ 		break;
	+ 	case 8:	/* bottom right */
	+ 		p = Pt(r.max.x, r.max.y);
	+ 		break;
	+ 	case 1:	/* top edge */
	+ 		p = Pt(p.x,r.min.y);
	+ 		break;
	+ 	case 5:	/* right edge */
	+ 		p = Pt(r.max.x, p.y);
	+ 		break;
	+ 	case 7:	/* bottom edge */
	+ 		p = Pt(p.x, r.max.y);
	+ 		break;
	+ 	case 3:		/* left edge */
	+ 		p = Pt(r.min.x, p.y);
	+ 		break;
	+ 	}
	+ 	return p;
	+ }
	+ 
	  Rectangle
	  whichrect(Rectangle r, Point p, int which)
	  {
	/n/sourcesdump/2005/1109/plan9/sys/src/cmd/rio/rio.c:928,935 - 
	/n/sourcesdump/2005/1110/plan9/sys/src/cmd/rio/rio.c:960,970
	  	int which, but;
	  
	  	p = mouse->xy;
	- 	startp = p;
	+ 	
	  	which = whichcorner(w, p);
	+ 	startp = cornerpt(w->screenr, p, which);
	+ 	wmovemouse(w, startp);
	+ 	readmouse(mousectl);
	  	r = whichrect(w->screenr, p, which);
	  	drawborder(r, 1);
	  	or = r;


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.