[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Terminate NSApp gracefully when receiving SIGNIT. )Fwd: [Etoile-discuss]
From: |
Yen-Ju Chen |
Subject: |
Terminate NSApp gracefully when receiving SIGNIT. )Fwd: [Etoile-discuss] Etoile 0.2 on Solaris) |
Date: |
Tue, 31 Jul 2007 17:30:56 -0700 |
Hi,
Here is a patch from David to terminate NSApp gracefully
when an application receive a SIGINT signal.
It is what NSApp on Cocoa behaves.
So it is nice to have it in GNUstep.
Thanx.
Yen-Ju
---------- Forwarded message ----------
From: David Chisnall <theraven@sucs.org>
Date: Jul 31, 2007 5:12 PM
Subject: Re: [Etoile-discuss] Etoile 0.2 on Solaris
To: Discussion list for Étoilé desktop environment <etoile-discuss@gna.org>
On 1 Aug 2007, at 00:37, Yen-Ju Chen wrote:
> Maybe we should file a feature request to GNUstep ?
Or I could just implement it. Here's the diff, let me know if you
have any problems (if there aren't any, can someone push it upstream;
the FSF now have my copyright assignment form):
*** NSApplication.m.original Tue Jul 3 19:21:11 2007
--- NSApplication.m Wed Aug 1 01:09:50 2007
***************
*** 31,36 ****
--- 31,39 ----
#include "config.h"
#include <stdio.h>
+ #ifdef HAVE_UNISTD_H
+ #include <signal.h>
+ #endif //HAVE_UNISTD_H
#include <Foundation/NSArray.h>
#include <Foundation/NSAutoreleasePool.h>
***************
*** 95,100 ****
--- 98,113 ----
static NSUncaughtExceptionHandler *defaultUncaughtExceptionHandler;
/*
+ * Terminate cleanly if instructed.
+ */
+ #ifdef HAVE_UNISTD_H
+ void terminateApp(int sig)
+ {
+ [NSApp terminate:nil];
+ }
+ #endif //HAVE_UNISTD_H
+
+ /*
* Gui library user friendly exception handler
*/
static void
***************
*** 455,460 ****
--- 468,476 ----
tileCell = [[NSCell alloc] initImageCell: tileImage];
RELEASE(tileImage);
[tileCell setBordered: NO];
+ #ifdef HAVE_UNISTD_H
+ signal(SIGINT, terminateApp);
+ #endif //HAVE_UNISTD_H
}
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
_______________________________________________
Etoile-discuss mailing list
Etoile-discuss@gna.org
https://mail.gna.org/listinfo/etoile-discuss
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Terminate NSApp gracefully when receiving SIGNIT. )Fwd: [Etoile-discuss] Etoile 0.2 on Solaris),
Yen-Ju Chen <=