discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNUstep and session management


From: Richard Frith-Macdonald
Subject: Re: GNUstep and session management
Date: Fri, 07 Oct 2005 08:31:49 +0000

On 2005-10-07 07:53:06 +0000 Chris Vetter <cbv@gmx.net> wrote:


On Fri, 07 Oct 2005 06:58:51 +0000, Richard wrote:
[...]
I think we should provide a (documented) mechanism to shut down an application for GNUstep. This should probably be some message that the application will respond to like -powerOff, which will send a local NSWorkspaceWillPowerOffNotification within the receiving application and then call [NSApp terminate].

Might be a good idea. However what if you (you in general) explicitly *want*
your application to *ignore* NSWorkspaceWillPowerOffNotification (for
whatever reason)?

Well, I was simplifying a bit for clarity ... the whole standard termination procedure is actually a bit more complex than that, and the value that the delegate returns is used by -terminate to determine whether to actually terminate, to abandon termination, or to defer termination. That is to say, the ability to ignore termination is already present in MacOS-X, and we should aim for compatible behavior.

OTOH, why not just have (sort of a forced) observer for
NSWorkspaceWillPowerOffNotification in NSApplication that just calls
-terminate: on it's respective delegate? No need to add another
GNUstep-specific method (-powerOff). Just create the observer in
NSApplication-setDelegate: and you're good to go.

The only problem with this is, as Roman pointed out, the order of delivery of the notification to different observers is undefined. This means that any built-in observer which calls -terminate could be executed before other observers which should be doing some particular power-off cleanup before the app terminates. We need to make sure that all observers receive NSWorkspaceWillPowerOffNotification *before* -terminate is called (unless one of the observers explicitly calls -terminate itsself ... in which case this is presumably what the developer who wrote that particular app wanted).

The only simple way I can see to do that is have a new method which sends the notification and then calls -terminate.

I don't see it as a problem that this would be a new GNUstep method ... since MacOS-X probably has something similar (used by the 'force quit' panel in the finder), but doesn't document it. Apple can get away with that ... as they have their own session manager application which is able to use private undocumented APIs. We need to make our API public, and try to keep it really simple so that, if apple make their mechanism public, we chan change to be compatible with minimal work.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]