Subject: Flickering titlebars

From: Ben Mansell <[email-masked]>
Date: Tue, 25 May 1999 01:44:15 +0100 (BST)

(Note: apologies in advance if this has been covered before; I couldn't
find anything relevant by searching the mailing list archives, however) 

FVWM seems to be over-enthusiastic about redrawing titlebars of windows.
If I drag one window over another, the lower window's titlebar flickers
madly, even if it is never obscured or uncovered. FVWM appears to redraw
the whole titlebar of a window whenever any part of the window frame gets
an expose event. IMHO, the flickery titlebar text looks really poor.

Anyway, I've been looking through the source code (since its clearly a
better thing to do than revise for my exams :) and found the following:

fvwm/events.c : HandleExpose()
This handler for X expose events _does_ seem to check to see if the
exposed window frame should be redrawn, or just the title bar. It calls
SetBorder() or SetTitleBar(), as appropriate.

fvwm/borders.c : SetBorder()
Inside this function there's a SetTitleBar() call (about line 390) which
is always invoked - so title bars are _always_ redrawn when window frames
are, regardless of whether or not they have to be.

I tried just commenting out this SetTitleBar() call, but this causes more
problems - sometimes titlebars aren't drawn at all. I guess other parts of
the program rely on SetBorder also redrawing the title bar.

So, I added lots of extra SetTitleBar() calls to everywhere in the code
that calls SetBorder(). (Except of course in the HandleExpose() code) 
The result - well, everything seems to work fine, and titlebars no longer
flicker when I drag windows round the screen. 

However, this all seems to be a hideous way of going about solving the
problem. Is there a better way of fixing it that doesn't involve adding
loads of SetTitleBar() calls everywhere? Is the problem worth fixing
anyway? Maybe I'm just being too picky about FVWM's behaviour. Any
suggestions?

Ben

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Bob Woodside <[email-masked]>
Date: Mon, 24 May 1999 23:58:01 -0400

> an expose event. IMHO, the flickery titlebar text looks really poor.

	Hmm...I've been tacitly assuming it was the price I had to pay for
using those fancy gradient title styles on my slow machine, and trying
to ignore it. (It's much more obvious with a gradient; but now that you
mention it, I can see it even with plain solid color titlebars.) Thanks
for questioning it.

> Anyway, I've been looking through the source code...

	It is a far, far better thing I do....

> loads of SetTitleBar() calls everywhere? 

	Caveat: I'm completely ignorant of this area of the code. I just looked
at it for the first time this evening. There are others in the group who
can comment much more knowledgeably than I, but here goes.

	If this really looks like a good fix, I'd change SetBorder by adding
another Bool calling argument, like settitlebar or ignoretitlebar,
according to your taste, and have it bypass the SetTitleBar when the arg
is set appropriately. Then change all those SetBorder calls to request
the SetTitleBar, except for the one in HandleExpose, which does the
opposite. Oh, yeah, and lose all those extra SetTitleBar calls. (And try
to pretend that that Bool arg that takes more than two states doesn't
really exist!)

	If this seems to be working, and you'd be good enough to send us a
patch (I personally prefer diff -u), I think we'd like to give it a try.
I would, anyway.

	Now, that's the tricky part. You don't say which version you're using,
but I presume it's a reasonably stable one. For a patch, however, you
should grab a recent development snapshot, so we might have some hope of
actually applying the thing. Please *do not* overlay your stable system
with one of these snapshots. I find the current ones to be somewhat, er,
quirky.

> Is the problem worth fixing anyway? 

	I think so.

- Bob

---

From: Tim Phipps <[email-masked]>
Date: Tue, 25 May 1999 15:36:10 +0100

> mention it, I can see it even with plain solid color titlebars.) Thanks

I think it's a problem with using SetBorder() to change the window frame
when focus changes and using it again for expose events.  It might be
better to cut the border drawing stuff out of SetBorder() and put it in
a new function (RedrawBorder()) and have SetBorder() and HandleExpose()
call RedrawBorder().  The call to SetTitleBar() should be left in
SetBorder() along with the style changing stuff.

Cheers,
Tim.

---

From: Matthias Clasen <[email-masked]>
Date: Tue, 25 May 1999 17:46:45 +0200

> SetBorder() along with the style changing stuff.

I think there is already an "enh. todo" entry for exactly this.

Matthias

-- 
Matthias Clasen, 
Tel. 0761/203-5606
Email: [email-masked]
Mathematisches Institut, Albert-Ludwigs-Universitaet Freiburg
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Ben Mansell <[email-masked]>
Date: Tue, 25 May 1999 23:08:43 +0100 (BST)

On Tue, 25 May 1999, Tim Phipps wrote:

[snip]
> SetBorder() along with the style changing stuff.

I've implemented this approach, since it seems the simplest way to fix the
problem. However, I haven't tried separating the border drawing code from
the style changing stuff in SetBorder, since the code is all intermixed.
There'd be a whole lot to change and I'm sure I'd break something :)

Instead, all I've taken out is the SetTitleBar(). SetBorder() becomes
RedrawBorder(), and I've created a new SetBorder function that merely
calls both RedrawBorder() and SetTitleBar(). Its not as convoluted as it
sounds, honest!

The patch (from: cvs diff -u) is available at:
http://brm20.quns.cam.ac.uk/patchfile

Ben.

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 26 May 1999 12:23:04 -0600

> There'd be a whole lot to change and I'm sure I'd break something :)

All of us will break something when touching that code :-) 
I'm desperately looking for someone who does this for me (I need it for
tear-off menus anyway). There's even more to it: I'd like to be able to
draw borders independently of title bars. 

> http://brm20.quns.cam.ac.uk/patchfile

Can you mail that patch to me?

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]