Subject: Recent focus changes have broken Next/Prev from keys

From: Tim Phipps <[email-masked]>
Date: Thu, 05 Apr 2001 10:26:50 +0100

Configuration Information [Automatically generated, do not change]:
uname output: SunOS silver 5.5.1 Generic_103640-35 sun4u sparc SUNW,Ultra-5_10
Compiler: gcc
Compilation CFLAGS: -g -O2
prefix: /u/phippst/sunos

FVWM Version:	2.3.31
FVWM_MODULEDIR:	/u/phippst/sunos/libexec/fvwm/2.3.31
FVWM_DATADIR:	/u/phippst/sunos/share/fvwm
FVWM_USERDIR:	/u/phippst/.fvwm

Description:

This doesn't work after the fix for focus on windows that change pages
==
Style * SloppyFocus

DestroyFunc forward
AddToFunc forward I Echo forward
+ I Next (!Iconic CurrentDesk) Focus
+ I WarpToWindow 50 50

DestroyFunc backward
AddToFunc backward I Echo backward
+ I Prev (!Iconic CurrentDesk) Focus
+ I WarpToWindow 50 50

Key KP_Add A N forward
Key KP_Subtract A N backward
==
What happens is that the focus remains in the current window. I think I
see the borders flicker so something may be happening and the the focus
goes back to the current.

Style * ClickToFocus

causes the KP_Add key to move the focus correctly but the pointer is
warped to the old window. The KP_Subtract behaviour remains broken.
--
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: Dominik Vogt <[email-masked]>
Date: Thu, 5 Apr 2001 12:36:53 +0200

> warped to the old window. The KP_Subtract behaviour remains broken.

There are two problems.  First, the functions are incorrect.  It
is not guaranteed that
 
  Next (!Iconic CurrentDesk) Focus

and

  WarpToWindow 50 50

operate on the same window.  This depends on timing.  Instead you
should use something like this:

  AddToFunc MyFocus
  + I Focus
  + I WarpToWindow 50 50

  AddToFunc forward
  + I Next (!Iconic CurrentDesk) MyFocus

Second, the focus window is set to NULL when the pointer is
grabbed.  I'll elaborate on this in a separate mail.

Bye

Dominik ^_^  ^_^

--
Dominik Vogt, email: [email-masked]
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-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Tim Phipps <[email-masked]>
Date: Thu, 05 Apr 2001 16:27:14 +0100

> There are two problems.  First, the functions are incorrect.  It

Ooops, I had tried to simplify my functions to show the bug I am seeing,
I think I simplified things wrong.

Is this correct syntax?
==
Style * SloppyFocus

DestroyFunc my_focus
AddToFunc my_focus 
+ I Focus
+ I Raise
+ I WarpToWindow 50 50

DestroyFunc my_next
AddToFunc my_next 
+ I Next (!Iconic CurrentDesk) my_focus

DestroyFunc my_prev
AddToFunc my_prev 
+ I Prev (!Iconic CurrentDesk) my_focus

Key KP_Add	A	N	my_next
Key KP_Subtract	A	N	my_prev
==
If it is then there is still a bug with KP_Subtract but not with KP_Add.
Interestingly, if you remove the WarpToWindow line KP_Add is broken too.
It may be that the bug you have fixed will fix this, I'll try it on
Friday's snapshot.

Cheers,
Tim.

P.S. I've stumbled across httptunnel, it looks like it will enable me to
get CVS to get through the company firewall. I've asked Jason if he
would consider running an httptunnel server.
--
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: Tim Phipps <[email-masked]>
Date: Fri, 06 Apr 2001 15:45:37 +0100

> It may be that the bug you have fixed will fix this, I'll try it on

Bad news: Friday's snapshot make this fail, nothing happens at all if
you take the WarpToWindow out, if WarpToWindow is included KP_Add works
but KP_Subtract behaves like FlipFocus.

Cheers,
Tim.

---

From: Dominik Vogt <[email-masked]>
Date: Sat, 7 Apr 2001 15:17:02 +0200

> but KP_Subtract behaves like FlipFocus.

The code had this bug since at least 2.0.38.  But it did not show
up for 'I' functions until recently.  It was always there for the
other specifiers C, H, D and M.  There was some code to prevent
that the window under the pointer gets an EnterNotify event after
an XUngrabPointer, but that never worked.  This additional event
took away to focus from the just focused window again.  I fixed
it by ignoring EnterNotify and LeaveNotify events that are
generated by grabbing or ungrabbing the pointer.  But that does
not prevent the application from handling them and possibly doing
something wrong.

Bye

Dominik ^_^  ^_^

--
Dominik Vogt, [email-masked]
Reply-To: [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]

---

From: Tim Phipps <[email-masked]>
Date: Mon, 09 Apr 2001 09:33:46 +0100

[email-masked] wrote:
> I fixed

Thanks Dominik, the Prev and Next functions are working again.
Unfortunately, I think the bug you fixed that caused the Prev function
to break is back.  If I run the following on an rxvt terminal the focus
remains on the rxvt but the text cursor goes hollow. This seems to
indicate that rxvt doesn't think it has the focus.

DestroyFunc my_unfocus
AddToFunc my_unfocus
+ I MoveToDesk 0 -1
+ I Move 0 0
+ I MoveToDesk 0
+ I WarpToWindow 50 50

Key KP_5        WTSFI   N       my_unfocus

It might only be rxvt that has this problem, xterm works OK but I
occasionally get problems with Synopsys design_analyzer not recognizing
key strokes. I also get problems when de-iconifying from an FvwmIconMan
- the window border highlights but the keyboard focus stays on some
other window (usually a window focussed by the pointer moving over an
FvwmIconMan button)

DestroyFunc my_flipfocus
AddToFunc my_flipfocus I Echo my_flipfocus
+ I Iconify Off
+ I WindowShade Off
+ I Raise
+ I FlipFocus
+ I WarpToWindow 50 50

*FvwmIconMan*Action Select SendCommand FlipFocus
*FvwmIconMan*Action Mouse 1 N SendCommand my_flipfocus

When Prev was broken this worked fine, After the Prev fix the focus is
often on the wrong window even though the border hilight indicates the
de-iconified window should have the focus. SloppyFocus as usual.

Hope this helps,
Tim.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 9 Apr 2001 14:14:34 +0200

> de-iconified window should have the focus. SloppyFocus as usual.

The longer I look into the code the more bugs do I find.  It's
almost a miracle that all this has worked before.  When a window
was moved to another desk or iconified, the window was unfocused
only for some focus models.  Sometimes, the window still had the
focus, for example when unmapped because it was moved to a
different desk.  rxvt notices that it is iconified and assumes
it does not have focus anymore while its main window still has
the focus *although it is unmapped*.  When it's mapped again,
rxvt never gets a new FocusIn event and thus still thinks I does
not have focus.  I fixed this by explicitly taking and giving
focus upon a desk switch or (de)iconify.

Furthermore the iconify code did not handle iconifying trees of
transient windows.  For example, if the main window of an
application was iconified and with it its transients, one of the
now unmapped transients may well have received focus.

This is hopefulle all fixed, but expect new problems showing up.

Bye

Dominik ^_^  ^_^