Subject: fvwm/focus.c: restore_focus_after_unmap()

From: Tim Phipps <[email-masked]>
Date: Thu, 31 May 2001 18:08:44 +0100

Hi All,
	Not a bug so no bug report

This function sets a variable set_focus_to that is the window that focus
is going to get moved to due to a window with focus going away. The
process loks like this:

1) if the window going away is a transient set set_focus_to to the
transient_for window

2) if set_focus_to not set and the window going away is a click_focus or
sloppy_focus got to set set_focus_to to the next window on the window
list on the same desk as the window going away.

3) if set_focus_to is set to a window on the same desk as the window
going away transfer focus to set_focus_to.

I think this has a couple of defect:

A) transient windows with parents on a different desk cause the focus to
get set to none. A fix is to either transfer focus to the parent and
switch desks or not look on other desks for the parent so 2) becomes
operative.

B) in 2) I think CirculateSkip should be honoured (and
CirculateSkipIcon) like the Prev command. I would prefer to skip iconic
windows too but I can work around that with a function.

Cheers,
Tim.
--
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, 31 May 2001 19:16:29 +0100

> windows too but I can work around that with a function.

Patch attached to ignore transient parent on other desks and
CirculateSkip windows

Cheers,
Tim.

Index: fvwm/focus.c
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/fvwm/focus.c,v
retrieving revision 1.8
diff -u -r1.8 focus.c
--- fvwm/focus.c	2001/05/29 09:21:00	1.8
+++ fvwm/focus.c	2001/05/31 17:29:58
@@ -306,6 +306,7 @@
       for (t = Scr.FvwmRoot.next; t != NULL; t = t->next)
       {
 	if (t->w == tmp_win->transientfor &&
+	    t->Desk == tmp_win->Desk &&
 	    (!do_skip_marked_transients || !IS_IN_TRANSIENT_SUBTREE(tmp_win)))
 	{
 	  set_focus_to = t;
@@ -319,6 +320,8 @@
       for (t = tmp_win->next; t != NULL; t = t->next)
       {
 	if (t->Desk == tmp_win->Desk &&
+	    !DO_SKIP_CIRCULATE(t) &&
+	    !(DO_SKIP_ICON_CIRCULATE(t) && IS_ICONIFIED(t)) &&
 	    (!do_skip_marked_transients || !IS_IN_TRANSIENT_SUBTREE(tmp_win)))
 	{
 	  /* If it is on a different desk we have to look for another window */