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: Thu, 06 Oct 2005 13:00:56 +0000

On 2005-10-06 12:42:13 +0000 Roman Belenov <rbelenov@yandex.ru> wrote:

> Richard Frith-Macdonald <richard@brainstorm.co.uk> writes:
> 
>> My reading of it is that it's your responsibility as a developer to have 
>> your
>> code listen for the notification and call [NSApp -terminate] when you 
>> receive
>> it.  I don't think the gui/AppKit does that for you.  Did you try this on
>> MacOS-X?  It would be interesting to know how it actually behaves.
> 
> Mac OS X documentation (follow the link posted by Sašo) doesn't even mention
> the notification - it says that applicationShouldTerminate: is invoked in any
> case (so that e.g. applications that use NSDocumentController have support for
> graceful termination for free withoput additional coding).
> Processing of NSWorkspaceWillPowerOffNotification seems to be required only
> for apps that should do some specific processing in case of poweroff
> (vs. normal termination).

That's the case we are talking about here ... session management.
The NSWorkspaceWillPowerOffNotification is sent both for session termination 
(logoff) and for machine shutdown.

The 'normal' termination occurs when the user selects 'Quit' on the 
application's menu ... it's internal to the application.

What the documentation you are referring to is talking about is, how 
applications should manage their shutdown. Basically, the app delegate should 
do any work it needs to do in the -applicationShouldTerminate: method, which is 
called by NSApplication's -terminate method.  The link does not address the 
issue of how an application is informed that it should shut down by the session 
manager.  I believe NSDocumentController observes 
NSWorkspaceWillPowerOffNotification itsself in GNUstep.

I have never seen anything in the MacOS-X documentation describing how the 
session manager tells the application to shut down other than the 
NSWorkspaceWillPowerOffNotification.  It is clear that the session manager 
sends thay notification to each application to tell it to shut down, but it is 
not clear what happens then.
Does NSApp observe the notification and call its own -terminate method when it 
receives it, or does it depend on the applicaton programmer to write code to 
observe the notification and call -terminate?
Does the session manager use a fallback mechanism to terminate the application 
in the event that the app does not terminate upn receiving the notification?   
If so, what is it?  Connecting to the app and sending a -terminate message to 
it?  Using the kill() system call? AFAIK this is not documented anywhere?





reply via email to

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