There was no mention of this new feature in ActiveState's 8.4.13
announcement and no discussion in the Activestate 8.4.13 help file.
So, answers to the following would be appreciated, assuming that
wm protocol . WM_QUERYENDSESSION {confirmSessionTermination}
is now supported ( . is any Tk address, confirmSessionTermination any Tcl
proc).
Is this the correct syntax?
What are the requirements for confirmSessionTermination?
If confirmSessionTermination returns a Tcl Boolean, what happens next?
What if it doesn't?
Is there a time out?
What is the effect on the Tcl process if WM_QUERYENDSESSION is not
specified?
What is the effect on the Tcl process if a Tcl event loop isn't running?
Is the Tcl behavior the same in tclsh, wish, etc?
Is this event propagated to threads, or is it only visible in the main
thread?
Any change in the Tcl event loop behavior after this event occurs? Is it
like a modal dialog?
What happens if Tcl exit is called before confirmSessionTermination returns?
The WM_ENDSESSION event is closely related. It can arrive with or without a
prior WM_QUERYENDSESSION. So, assuming something like
wm protocol . WM_ENDSESSION {terminateSession}
Is this event supported in 8.4.13?
If yes:
What are the requirements for terminateSession?
What is the effect of its return value?
Is there a time out?
What is the effect on the Tcl interp if not specified?
Any change in the Tcl event loop behavior after this Windows event occurs?
Is this like a modal dialog?
What happens if Tcl exit is called before terminateSession returns?
What is the effect on the Tcl process if WM_ENDSESSION is not specified?
What is the effect on the Tcl process if a Tcl event loop isn't running?
Is the Tcl behavior the same in tclsh, wish, etc?
Is this event propagated to threads, or is it only visible in the main
thread?
Any change in the Tcl event loop behavior after this event occurs? Is it
like a modal dialog?
What happens if Tcl exit is called before terminateSession returns?
For reference, here is the MSDN doc for these events
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shutdown/base/exitwindows.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shutdown/base/wm_queryendsession.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shutdown/base/wm_endsession.asp
Tia
Bob
In the scheme of changes, this was a minor one, and as such was not
deemed important enough to warrant major recognition.
> So, answers to the following would be appreciated, assuming that
>
> wm protocol . WM_QUERYENDSESSION {confirmSessionTermination}
>
> is now supported ( . is any Tk address, confirmSessionTermination any Tcl
> proc).
>
> Is this the correct syntax?
No, what was precisely added is Windows support of this message in the
form of the existing and known X11 wm protocol WM_SAVE_YOURSELF. Thus,
the correct syntax is:
wm protocol . WM_SAVE_YOURSELF doSomethingOnLogout
> What are the requirements for confirmSessionTermination?
> If confirmSessionTermination returns a Tcl Boolean, what happens next?
> What if it doesn't?
> Is there a time out?
The callback can do what it wants - it is basically an exit handler of a
special form. It doesn't matter what is returned, as this form does not
support aborting logout. Such is possible, but would not fit into the
existing WM_SAVE_YOURSELF handling.
> What is the effect on the Tcl process if WM_QUERYENDSESSION is not
> specified?
As before - no effect, the process will be killed as before.
> What is the effect on the Tcl process if a Tcl event loop isn't running?
> Is the Tcl behavior the same in tclsh, wish, etc?
> Is this event propagated to threads, or is it only visible in the main
> thread?
> Any change in the Tcl event loop behavior after this event occurs? Is it
> like a modal dialog?
This is a Tk event callback, so an event loop will always exist. It is
not recommended to run Tk in multiple threads, but you should receive it
in each thread that Tk runs in.
> What happens if Tcl exit is called before confirmSessionTermination returns?
No adverse effect, as the OS will handle processes disappearing.
> The WM_ENDSESSION event is closely related. It can arrive with or without a
> prior WM_QUERYENDSESSION. So, assuming something like
No, this is not supported. This was all mapped to the existing
WM_SAVE_YOURSELF, so no differentiation is made between logout versus
shutdown, or QUERY versus actual ENDSESSION.
If such nuances need to be managed, then something like twapi could be
used, possibly even from Tcl (no Tk).
Jeff
>No, what was precisely added is Windows support of this message in the
>form of the existing and known X11 wm protocol WM_SAVE_YOURSELF. Thus,
>the correct syntax is:
>
> wm protocol . WM_SAVE_YOURSELF doSomethingOnLogout
>
>> What are the requirements for confirmSessionTermination?
>> If confirmSessionTermination returns a Tcl Boolean, what happens next?
>> What if it doesn't?
>> Is there a time out?
>
>The callback can do what it wants - it is basically an exit handler of a
>special form. It doesn't matter what is returned, as this form does not
>support aborting logout. [...]
On X11, a WM_SAVE_YOURSELF protocol handler *must* update
the WM_COMMAND property of the toplevel window that received
the message, to notify the session manager that the message
has been handled.
Failure to do so can prevent the user from logging out.
--Joe English