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 <[EMAIL PROTECTED]>
Date: Jul 31, 2007 5:12 PM
Subject: Re: [Etoile-discuss] Etoile 0.2 on Solaris
To: Discussion list for Étoilé desktop environment <[EMAIL PROTECTED]>


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
[EMAIL PROTECTED]
https://mail.gna.org/listinfo/etoile-discuss


_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to