stux2000 / plan9front

Automatically exported from code.google.com/p/plan9front
0 stars 0 forks source link

rio wctl move command ignores maxx maxy information. #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The documentation for rio says that move and resize accepts -r minx miny maxx 
maxy 
while resize correctly moves the window to the specified location with 
specified size, move only moves the window to the location. It silently ignores 
the maxx maxy provided.

Original issue reported on code.google.com by 9...@vrtra.net on 9 May 2012 at 12:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Better report:
Take a term resize it to be a rectangle, and execute the following commands
  echo (move -r 0 0 200 200) > /dev/wsys/1/wctl
Move it back to the original location and do this  
  echo (resize -r 0 0 200 200) > /dev/wsys/1/wctl

Notice that the resize command makes the window to a perfect square while move 
ignores the maxx maxy information

A possible fix is below. It changes the command to Resize if '-r' is detected 
during move. The reason for such a fix is that both Move and Resize are 
implemented in the same place in wctl.c where move is simply a special case of 
resize. (See below)
So we don't gain any thing by looking for '-r' at this point (That information 
is already lost at writectl function). So the simplest fix is as given below. 
(I could not find rio under /sys/src/cmd so this is diffed against plan9 
sources. I hope the line numbers are correct.)

-----------------
   switch(cmd){
  case New:
    return wctlnew(rect, arg, pid, hideit, scrollit, dir, err);
  case Set:
    if(pid > 0)
      wsetpid(w, pid, 0);
    return 1;
  case Move:
    rect = Rect(rect.min.x, rect.min.y, rect.min.x+Dx(w->screenr), rect.min.y+Dy(w->screenr));
    rect = rectonscreen(rect);
    /* fall through */
  case Resize:
    if(!goodrect(rect)){
      strcpy(err, Ebadwr);
      return -1;
    }
-----------------

--- a/sys/src/cmd/rio/wctl.c
+++ b/sys/src/cmd/rio/wctl.c
@@ -236,6 +236,8 @@ parsewctl(char **argp, Rectangle r, Rectangle *rp, int 
*pidp, int *idp, int *hid
                        if(t == s)
                                return -1;
                        s = t;
+                       if (cmd == Move)
+                               cmd = Resize;
                        continue;
                }
                while(isspace(*s))

Original comment by 9...@vrtra.net on 14 May 2012 at 1:47

GoogleCodeExporter commented 9 years ago
theres no bug there. move MOVES the window without
chainging its size. this lets rio do some optimizations.
if you want to change the window size as well, use 
resize wctl command.

Original comment by cinap_le...@felloff.net on 16 May 2012 at 3:13

GoogleCodeExporter commented 9 years ago
In which case, why is move command accepting a '-r' option? From the man page, 
it seems to say that "They also accept an option -r minx miny maxx maxy to set 
all four at once." So at least the man page needs to be reworded then?

Original comment by 9...@vrtra.net on 16 May 2012 at 3:25