Subject: FVWM: Placement bug finally found.

From: Anthony Martin <[email-masked]>
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 [email-masked].
To report problems, send mail to [email-masked].

---

From: Trent Piepho <[email-masked]>
Date: Tue, 29 Oct 1996 00:53:19 -0800 (PST)

> sometimes 0, and sometimes 1, I would be interested in hearing.  It looks

I'm not sure, but I think it has to do with the borders X can place on a
window.  If you have no window manager you will notice that most windows have
a 1 pixel wide back border around them.  I think that fvwm removes this border
by setting it to 0, because it is just going to draw over it with the fvwm
borders.

|Gazing up to the breeze of the heavens \ on a quest, meaning, reason  |
|came to be, how it begun \ all alone in the family of the sun         |
|curiosity teasing everyone \ on our home, third stone from the sun.   |
|Trent Piepho ([email-masked])                   -- Metallica  |
--
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 [email-masked].
To report problems, send mail to [email-masked].