Subject: FVWM: Multi-screen patch redux

From: "Barry A. Warsaw" <[email-masked]>
Date: Thu, 20 Feb 1997 17:14:38 -0500

On 26 Sep 1996, I posted a patch to fix a problem with handling focus
on multiple screen systems.  The problem manifested itself when moving
the pointer from a window on e.g. screen 0 to the root window of
screen 1.  In these situations, screen 0 would still get focus.  See
my message of that date for details.

The fix was simple, I thought.  But then on 30 Sep 1996, Mark Boyns
followed up with a note that under SloppyFocus there were focus
problems with my patch.  Chuck subsequently did not install my patch
in 2.0.45.

I've just spent some time tracking all this down, and I now think that
Mark's problem has nothing to do with my patch (sorry Mark ;).  I
think the SloppyFocus problem exists in 2.0.45 with or without my
patch.  I'd like Mark (or any other multi-screener) to verify, but I
have been able to reproduce the problem from Mark's description with a
vanilla 2.0.45.  My patch does nothing to fix or hurt this, AFAICT.

I've also come to the conclusion that really good multi-screen support
is hopeless with the way FVWM currently handles multiple screens.  I
don't think there's any way for the screen 0 process to know what's
happening on screen 1 and vice versa.  And if you wanted SloppyFocus
to work correctly, it would have to do this:

    - when moving the pointer from a window in screen 0 to the root
      window in screen 1, the original window keeps focus

    - when subsequently moving the pointer to a window in screen 1, it
      gets focus and the original window loses focus.

    - when moving the pointer from a window in screen 0 to a window in
      screen 1, the new window gets focus and the original window
      loses it.

I don't think there's any way to do this because the screen 0 process
never gets EnterNotify events on screen 1, so it will never know
exactly when to de-focus the original screen.  It could be that there
are dark corners of X (or the FVWM sources :) that contain the answer,
but I can't find it, and can't really spend any more time on the
problem.  The ultimate fix is to do what ctwm does and *not* fork a
separate FVWM process for every screen.  That'll take a major effort I
think.

So, I'm reposting my patch (actually a little cleaner this time), and
hope Chuck will put it in the next version.  If not, I'll resign
myself to patching subsequent versions myself...

-Barry

*** events.c	1997/02/20 16:09:23	1.1
--- events.c	1997/02/20 21:34:48
***************
*** 1100,1105 ****
    if(Event.xany.window == Scr.Root)
      {
!       if((Scr.Focus)&&(!(Scr.Focus->flags&ClickToFocus))&&
! 	 (!(Scr.Focus->flags&SloppyFocus)))
  	{
  	  SetFocus(Scr.NoFocusWin,NULL,1);
--- 1100,1105 ----
    if(Event.xany.window == Scr.Root)
      {
!       if(!Scr.Focus || (!(Scr.Focus->flags&ClickToFocus)&&
!                         !(Scr.Focus->flags&SloppyFocus)))
  	{
  	  SetFocus(Scr.NoFocusWin,NULL,1);

---

From: Mark Boyns <[email-masked]>
Date: 20 Feb 1997 15:41:45 -0800

> vanilla 2.0.45.  My patch does nothing to fix or hurt this, AFAICT.

Here's what I said on 30 Sept 1996:

    I just tried the patch and it only works a little better for me.  It
    seems to only do the right thing when there are no windows that accept
    focus on the second screen.  For example:

	screen0: nothing
	screen1: xterm
	screen2: nothing

    If I move the mouse out of the xterm on screen1 and onto screen2, the
    xterm cursor is no longer solid and focus appears to really be on
    screen2.  (I use sloppyfocus)

    But, if the screens are like this:

	screen0: nothing
	screen1: xterm
	screen2: xterm

    When I move the mouse out of the xterm on screen1 and onto the blank
    screen on screen2 (not touching the xterm on screen2), focus is still
    in the xterm on screen1.

I didn't mean to say that your patch introduced new problems, it only
slightly fixes the existing problem.

I say go ahead and include the patch.
--
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: "Barry A. Warsaw" <[email-masked]>
Date: Thu, 20 Feb 1997 18:50:06 -0500

>>>>> "MB" == Mark Boyns <[email-masked]> writes:

    MB> I didn't mean to say that your patch introduced new problems,
    MB> it only slightly fixes the existing problem.

    MB> I say go ahead and include the patch.

Cool.  Yes, we should spend some effort getting FVWM to work better on
multiple screens.  Unfortunately the only multi-headed system I have
is here at work, and finding free time at work to hack on this isn't
easy. :-(

-Barry

---

From: "Eddy J. Gurney" <[email-masked]>
Date: Fri, 21 Feb 1997 09:02:50 -0500

On Feb 20 at 18:50, Barry A. Warsaw wrote:
,--
| > "MB" == Mark Boyns <[email-masked]> writes:
|
| MB> I didn't mean to say that your patch introduced new problems,
| MB> it only slightly fixes the existing problem.
|
| MB> I say go ahead and include the patch.
|
| Cool.  Yes, we should spend some effort getting FVWM to work better on
| multiple screens.  Unfortunately the only multi-headed system I have
| is here at work, and finding free time at work to hack on this isn't
| easy. :-(
`--
I definitely agree that we need better multi-screen support... preferably
in a fashion that doesn't require spawning a copy of fvwm2, FvwmAuto,
FvwmIconMan, FvwmButtons, FvwmPager, etc. FOR EACH SCREEN like it does
now. The ctwm window manager handles this very elegantly, and if we are
going to look anywhere for a "model" that is the place to do it. I'd be
happy to help test for sure, and even write code. I'm no eX11pert, but I
can hold my own when it comes to regular C programming...

Eddy

---

From: "Barry A. Warsaw" <[email-masked]>
Date: Fri, 21 Feb 1997 12:48:35 -0500

>>>>> "EJG" == Eddy J Gurney <[email-masked]> writes:

    EJG> The ctwm window manager handles this very elegantly, and
    EJG> if we are going to look anywhere for a "model" that is the
    EJG> place to do it.

I enthusiastically agree!

---

From: Grant McDorman <[email-masked]>
Date: Tue, 25 Feb 1997 11:39:50 -0500 (EST)

-----BEGIN PGP SIGNED MESSAGE-----

On 20-Feb-97 23:41:45 Mark Boyns wrote:
>     focus on the second screen.

[cut]

The problem here is in focus.c; the attached patch fixes it to have
the desired behaviour. 

Grant McDorman <[email-masked]>
ISG Technologies, Inc.  http://www.isgtec.com
Mississauga, Ontario, Canada

---

From: Grant McDorman <[email-masked]>
Date: Tue, 25 Feb 1997 11:39:50 -0500 (EST)

-----BEGIN PGP SIGNED MESSAGE-----

[cut]

---

From: Grant McDorman <[email-masked]>
Date: Tue, 25 Feb 1997 11:39:50 -0500 (EST)

-----BEGIN PGP SIGNED MESSAGE-----

[cut]