FVWM: Placement bug finally found.

From: Anthony Martin <amartin_at_engr.csulb.edu>
Date: Tue, 29 Oct 1996 00:00:54 -0800 (PST)

I finally found the bug in the fvwm placement code that results in windows
being placed one pixel higher and to the left of where they should be if
RandomPlacement is used (even in combination with SmartPlacement or
CleverPlacement). Most people probably didn't notice this but it bugged
me for a long time (years) and actually resulted in me writing
CleverPlacement. The funny thing is that a bug in the old SmartPlacement
counteracted this bug and resulted in the windows being placed correctly
if you used RandomPlacement as the fallback and incorrectly if you used
ActivePlacement. The change is in the function PlaceWindow() where the
lines
          else
            {
              tmp_win->attr.x = xl - tmp_win->old_bw;
              tmp_win->attr.y = yt - tmp_win->old_bw;
            }
should be changed to:
          else
            {
              tmp_win->attr.x = xl - tmp_win->old_bw + tmp_win->bw;
              tmp_win->attr.y = yt - tmp_win->old_bw + tmp_win->bw;
            }
like they are later in the function in the code for the interactive
placement. It looks like there is a lot of historical baggage in this
code and it is messier than it should be. Fortunately I could see the
difference from the interactive placement code. For fvwm95, the above
change doesn't make any difference because win->bw seems to always be 0.
However in fvwm2, win->bw is usually 0. For both, win->old_bw is 1.

If anyone knows what win->bw and win->bw_old represent and why they are
sometimes 0, and sometimes 1, I would be interested in hearing. It looks
like the rest of placement.c could use some serious rewriting as well and
could get smaller and simpler in the process, but I don't want to get too
carried away.

You can get the patched placement.c from:
http://www.engr.csulb.edu/~amartin/placement.c

This also includes CleverPlacement (which hasn't changed this time) which
does intelligent placing of windows.

Tony.

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Tue Oct 29 1996 - 02:01:09 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:59 BST