git: 9front

Download patch

ref: 0621758bc4c71f1db36b42ae26435d72d992fb5e
parent: cfc5900e16dde3f3158df3afa73927717cfa43a5
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Mon Sep 16 21:30:35 EDT 2013

rio: translate window when scaling results in bad window rect on screen resize

when the screen is resized, we scale the windows to
match the new screen size. when the screen is too
small tho, the scaled down window rect might result
in a bad window rect. before, we kept the window
in its original position and size making it possible
to move a window out of the screen by resizing its
outer rio.

now, if we get a bad rectangle after scaling, we
just tralslate position to the new scaled r.min
point but preserve its orginal size. this keeps
the window always accessible.

--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -643,7 +643,7 @@
 		r.max.x = (r.max.x*n.x)/o.x;
 		r.max.y = (r.max.y*n.y)/o.y;
 		if(!goodrect(r))
-			r = rectsubpt(w->i->r, viewr.min);
+			r = rectsubpt(w->i->r, subpt(w->i->r.min, r.min));
 		r = rectaddpt(r, screen->clipr.min);
 		for(j=0; j<nhidden; j++)
 			if(w == hidden[j])
--