Re: How doess Cocoa handle SIGINT?
Re: How doess Cocoa handle SIGINT?
- Subject: Re: How doess Cocoa handle SIGINT?
- From: Thierry Faucounau <email@hidden>
- Date: Wed, 27 Jun 2001 13:20:59 -0600
On Wednesday, June 27, 2001, at 11:36 AM, cocoa-dev-
email@hidden wrote:
Date: Wed, 27 Jun 2001 16:18:29 +0200
From: Philippe Mougin <email@hidden>
To: email@hidden
Subject: Re: How doess Cocoa handle SIGINT?
Thierry Faucounau wrote :
It seems then that my situation gets a lot easier, as I mentioned, in
the UNIX code, the signal handler just sets a global instructing the
engine to abort whatever it is doing.
In my Cocoa version, I'll just trap the abort key sequence (I'll
probably change it to Command-. and hook it up as a menu command) from
the main AppKity thread, set the global and be done with it.
In NEXTSTEP's AppKit, this functionality was built-in. The
NXUserAborted() function was used to know if the user had typed
"Command-." The super nice thing: it was not using multi-threading
(IIRC). This was super handy to use in programs and helped a lot to
provide a good user experience.
It would be great to bring back this feature into Cocoa.
Phil
I agree that a standard way to interrupt a program would be great. I had
sort of expected this (Cocoa seems to have everything else covered)
This way, the user would never have to guess at what the keystroke
should be (Control-C, Command-., Esc to name a few)
Speaking of Keystrokes, how do I trap a keystroke (like Control-C) in a
global application way? I would have thought that my app delegate could
somehow handle it but it seems from a quick glance at the docs that I
may need to subclass NSApplication to intercept the NSEvents. This seems
very un-Cocoa like? What am I missing?
--
Thierry Faucounau
Research Systems, Inc.