Subject: FVWM: bug in CleverPlacement

From: Trent Piepho <[email-masked]>
Date: Wed, 30 Dec 1998 09:10:28 -0800 (PST)

There seems to be some kind of bug in the Smart placement code.  The placement
of windows gets messed up if there is an iconized window with no icon.  To
demonstrate, try this.  Add this to the end of your .fvwm2rc or via FvwmTalk:

Style "*" NoIcon 
GlobalOpts SmartPlacementIsReallySmart

Now make your desktop mostly empty.  Start some program and iconize it, then
start a second copy.  It should appear right where the first one did, but
instead it will appear at some other odd place.

The fvwm2 code is really a mess to me, but the problem looks like the function
test_fit in placement.c

There is some code that does this:

    if((testw->flags & ICONIFIED)&&
       (testw->icon_w)) {
       if(testw->flags & ICON_UNMAPPED)
         continue;
      ... stuff with icon position ...
    } else {
      ... stuff with window position ...
    }

It looks like iconified windows with no icon will take the branch that uses
the window position for calculations.  Here is a patch that seems to have
fixed it for me.

diff fvwm-2.1.5/fvwm/placement.c fvwm-2.1.5.new/fvwm/placement.c
320,321c320
<     if((testw->flags & ICONIFIED)&&
<        (testw->icon_w))
---
>     if(testw->flags & ICONIFIED)
323c322
<        if(testw->flags & ICON_UNMAPPED)
---
>        if((testw->flags & ICON_UNMAPPED) || !(testw->icon_w))

--
Visit the official FVWM web page at <URL: http://fvwm.math.uh.edu/>.
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: Dominik Vogt <[email-masked]>
Date: Wed, 30 Dec 1998 19:58:49 +0100

On Wed, Dec 30, 1998 at 09:10:28AM -0800, Trent Piepho wrote:
> The fvwm2 code is really a mess to me,

Well, perhaps it comforts you that I've see *much* worse code.

> but the problem looks like the function
> test_fit in placement.c
> 

Looks right to me. I'll apply the patch soon.

BTW, when you create a patch next time, please use the
-c or -u options to diff (contextual/unified diff). Simple
diffs cannot be applied automatically by the patch program
and I tend to make a typo even with cut-and-paste.

Thanks

Dominik

-- 
Dominik Vogt, [email-masked]
Reply-To: [email-masked]