Re: FVWM: Flickering of buttons and mouse focus

From: Dominik Vogt <fvwm_at_fvwm.org>
Date: Tue, 16 Apr 2002 15:42:12 +0200

On Tue, Apr 16, 2002 at 01:50:14PM +0300, Tom Alsberg wrote:
> On Tue, Apr 16, 2002 at 12:17:59PM +0200, Dominik Vogt wrote:
> > <snip />
> > > <snip />
> > >
> > > No, it doesn't happen without a config file...
> > > I checked a bit further, and found that the problem is related to the
> > > following in my .fvwm2rc - if I remove them then the problem goes
> > > away:
> > >
> > > # For auto-raise:
> > > *FvwmEvent: enter_window "Silent SelectiveRaise"
> > > *FvwmEvent: leave_window "Silent SelectiveLower"
> > >...
> >
> > Um, yes. It's very easy to create a race condition with the
> > enter and leave events in FvwmEvent. THere isn't much we can do
> > about it, though.
>
> Why can't it be fixed somehow? I mean, what is exactly the cause for
> that condition?

This can't be fixed in general inside fvwm and/or FvwmEvent
because *your* code causes the race condition. FvwmEvent can't
know how and when fvwm will react to the enter and leave packets.
Let's assume you have two windows:

         *
 +--------------+
 |A |
 | +---------------+
 | |B : |
 | | : |
 | | : |
 +--|............ |
    | |
    +---------------+
 
The * marks the pointer position. Now you drag the pointer
down into window B, passing over window A. X generates an enter
event on window A first, then an enter event on window B and a
leave event on window A. FvwmEvent is informed of these events
and replies with

  Silent SelectiveRaise (A)
  Silent SelectiveLower (A)
  Silent SelectiveRaise (B)

When this actually happens is unpredictable. Under some
circumstances, fvwm now raises window A while the pointer is
already over B. this causes an enter event on A and a leave event
on B. Next it raises B, generating enter on B and leave on A.
FvwmEvent replies with "Silent Selective..." and the loop begins
again. To fix that one would have to synchronize communication
between X, fvwm and FvwmEvent. On one hand, this is not possible
because fvwm takes input from FvwmEvent and X at the same time and
can not determine which was generated first. But even if that
were possible, this would slow down FvwmEvent to fvwm
communication so much that the enter and leave events would become
pointless.

All you can do is to very carefully program the functions that do
the raising/lowering. With the new 'Schedule' and 'Deschedule'
commands it is possible to avoid the race condition.

Bye

Dominik ^_^ ^_^

-- 
Dominik Vogt, email: d.vogt_at_lifebits.de
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Tue Apr 16 2002 - 10:22:28 BST

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