Subject: Restarting bit is not set when needed

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 5 Jun 1999 12:55:04 +0300 (IDT)

When starting fvwm from xterm, it must invoke RestartFunction, not
InitFunction as it is in 2.3. I see that all code with _XA_WM_DESKTOP was
removed comparing to stable versions (including this additional Restarting     
setting). Please comment on this (Mathias?).

Regards,
Mikhael.

--
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: Matthias Clasen <[email-masked]>
Date: Sat, 5 Jun 1999 21:51:44 +0200

> setting). Please comment on this (Mathias?).

I removed the _XA_WM_DESKTOP stuff, since it seemed stupid to have two
mechanisms for the same goal: saving some window state over wm restarts.

What exactly do you mean by "starting fvwm from an xterm" ? RestartFunction
should be used if and only if fvwm was exec'ed from a running fvwm via
"Restart". Am I missing anything here ?

-- 
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: Mikhael Goikhman <[email-masked]>
Date: Sun, 6 Jun 1999 00:16:08 +0300 (IDT)

> "Restart". Am I missing anything here ?

Try to "Restart xterm" and then start fvwm from the xterm.
In 2.2 and prior versions this is equivalent to just Restart with nice
side effect - redirecting fvwm output to an xterm. (With my pending patch
you can even combine these 2 things into one "Restart xterm -e fvwm -s")
With the current CVS version you get duplicate windows because of
duplicate InitFunction call. I would like fvwm to call RestartFunction
and not InitFunction in this case. Another solution is a "-restart" option
to fvwm to do the same only on request. What do you prefer?

Regards,
Mikhael.

---

From: Matthias Clasen <[email-masked]>
Date: Sun, 6 Jun 1999 02:04:37 +0200

> In 2.2 and prior versions this is equivalent to just Restart with nice

I'd call this an unintended side effect of the way the old restart code
worked. 

> to fvwm to do the same only on request. What do you prefer?
If you really need this, then -restart might be a good way to achieve it
...but in what way is  -restart different from 
-cmd 'DestroyFunc InitFunc' -n' -cmd 'AhnToFunc InitFuncion "I"
RestartFunction' ?

Matthias

---

From: Mikhael Goikhman <[email-masked]>
Date: Sun, 6 Jun 1999 15:26:54 +0300 (IDT)

> I'd call this an unintended side effect of the way the old restart code

I just think it worked consistently and I prefer 2.3 to be somehow
compatible with 2.2 in that aspect.

> If you really need this, then -restart might be a good way to achieve it

Ok, here are other examples. Restarting to other window manager and back,
or restarting to another fvwm version and back. In the last case with 2.2
InitFunction and two RestartFunction`s are called (which is correct), with
2.3 versions three InitFunction`s are called which is very annoying.

What I am asking is determining that it is not the first fvwm (see the
subject), just like 2.2.2 did. "-restart" option is ok for me, but it
is sometimes not functional, since there are no fvwm versions (or clones)
accepting parameters in "Restart fvwm2 -restart". I can implement both
solutions, but prefer you to do this.

Regards,
Mikhael.

---

From: Bob Woodside <[email-masked]>
Date: Sun, 06 Jun 1999 09:16:05 -0400

> I'd call this an unintended side effect of the way the old restart code

	You may be underestimating Rob's cleverness here. In any case, it was a
very nice feature whose implications go beyond the xterm example, and
I'm finding it increasingly bothersome to lose it.

	One of the things that historically made FVWM friendlier than most
other window managers is its willingness to "restart" other things -
things like other window managers, not just an xterm. Because of the way
many of them work, using their "restart" function would cause FVWM to
restart instead (although they don't natively provide a command to
"restart" another window manager). So, you could, for whatever reason,
start up another window manager, do whatever you wanted to do under it,
then easily and gracefully return to FVWM, and FVWM would understand
that it was restarting. You can no longer do this, because of the
changes in argument passing and the elimination of the _XA_WM_DESKTOP
stuff.

> RestartFunction should be used if and only if fvwm was exec'ed from a
> running fvwm via "Restart". Am I missing anything here ?

	I think you are. A Restart should be recognized if FVWM is starting up
again in the same session as the previous instance, no matter how many
other programs may have been executed in the meantime.

	Now, I've tried to figure a way to save the "restarting" state across
an intervening invocation of another program, but I haven't come up with
anything fool-proof. 

	Clearly, the "-restart" option won't work with a "foreign" program:
that's the same problem as the passing of "-restore", which got Mikhael
started re-working the argument passing logic in the first place.

	I thought about storing a "restarting" or "how last terminated" flag in
the restart file, but this is not proof against the user's invoking
another window manager and then terminating the X session rather than
returning to FVWM.

	It seems to me that the only way you can reliably determine that you're
starting up under the same instance of the X server is to have the X
server communicate this information with you - which is done by setting
a property on the root window.

	Also, I believe there was a question some time back about how a program
determines whether FVWM is running. (I know, a well-written program
shouldn't be trying to do such things - but in the real world, people do
write such programs, and users often expect them to work.) We've removed
the ability to determine this.

> -cmd 'DestroyFunc InitFunc' -n' -cmd 'AhnToFunc InitFuncion "I"

	Huh? The purpose of a Restart (as implemented in FVWM) is to invoke a
completely clean instance of the window manager - insuring, for example,
that no global variables are left in a suspect state.

	I think we need to think long and hard about 1) whether the "-restart"
command flag is really workable, and 2) whether we should reinstate
setting a wm property on the root window.

- Bob

---

From: Matthias Clasen <[email-masked]>
Date: Sun, 6 Jun 1999 21:36:01 +0200

> solutions, but prefer you to do this.

I decided to take a break from hacking fvwm for a while, so if you do it,
it might arrive earlier.

Btw. my final position on this whole restart business is that it would
be best to rip off Restart, InitFunction/RestartFunction (at least for the 
purpose of starting initial clients) completely. This is all
session manager functionality and should be provided by a session manager.

Matthias

---

From: Matthias Clasen <[email-masked]>
Date: Sun, 6 Jun 1999 21:50:40 +0200

> a property on the root window.

OK OK, it is obvious by now that removing XA_WM_DESKTOP caused a lot of
trouble and only a little code cleanup. So let's just bring back a property
for checking that fvwm is restarting. We can then set the Restarting flag
based on the presence of the property. using -restore ~/.fvwm_restart should
no longer be necessary then. Instead fvwm should look for this file
automatically if it is restarting.

> the ability to determine this.

But I have already added a better way to do this. Check out ICCCM 2
on "manager selections". 
 
> that no global variables are left in a suspect state.

Well, the complaint was about RestartFunction not being run. I just wanted
to point out that you can force this on the command line simply by making
the two functions the same.

> setting a wm property on the root window.

I vote for 2).

Matthias

---

From: Bob Woodside <[email-masked]>
Date: Sun, 06 Jun 1999 18:59:45 -0400

Matthias Clasen wrote:
BW> > ...how a program determines whether FVWM is running....
MC> But I have already added a better way to do this. Check out ICCCM 2
MC> on "manager selections".

	Ah, good. I'd missed this.

BW> > ...and 2) whether we should reinstate setting a wm property on the
BW> > root window.
MC> I vote for 2).

	Ok, if everyone's comfortable with this.

- Bob

---

From: Mikhael Goikhman <[email-masked]>
Date: Mon, 7 Jun 1999 03:16:17 +0300 (IDT)

> 	Ok, if everyone's comfortable with this.

I hope it is the best solution. I can restore this sometimes soon.

Also, as Matthias said, we can do not add "-restore" on a native Restart.
And the same goes to "-s". In this way "Restart command args" is always
parsed and there are no special cases of it (except of empty "Restart").
On empty "Restart" the original fvwm with the initial arguments is called.
Any complains?

Regards,
Mikhael.