Input events started to arrive before ns_term_init() was finished.
Solved by blocking input. This also seems to correct the "You
can't open the application "Emacs" because it may be damaged or
incomplete" error issued when double-clicking on the Emacs
application.
* nsterm.m (ns_constrain_all_frames, ns_init_term): Block input.
* nsterm.m (ns_send_appdefined, EmacsApp): Trace output.
NSTRACE ("ns_constrain_all_frames");
NSTRACE ("ns_constrain_all_frames");
FOR_EACH_FRAME (tail, frame)
{
struct frame *f = XFRAME (frame);
FOR_EACH_FRAME (tail, frame)
{
struct frame *f = XFRAME (frame);
recognize and take as a command to halt the event loop.
-------------------------------------------------------------------------- */
{
recognize and take as a command to halt the event loop.
-------------------------------------------------------------------------- */
{
- /*NSTRACE ("ns_send_appdefined"); */
+ NSTRACE ("ns_send_appdefined");
#ifdef NS_IMPL_GNUSTEP
// GNUstep needs postEvent to happen on the main thread.
#ifdef NS_IMPL_GNUSTEP
// GNUstep needs postEvent to happen on the main thread.
if (ns_initialized) return x_display_list;
ns_initialized = 1;
if (ns_initialized) return x_display_list;
ns_initialized = 1;
NSTRACE ("ns_term_init");
[outerpool release];
NSTRACE ("ns_term_init");
[outerpool release];
NSTRACE_MSG ("ns_term_init done");
NSTRACE_MSG ("ns_term_init done");
+ NSTRACE ("[EmacsApp init]");
+
if ((self = [super init]))
{
#ifdef NS_IMPL_COCOA
if ((self = [super init]))
{
#ifdef NS_IMPL_COCOA
#ifdef NS_IMPL_COCOA
- (void)run
{
#ifdef NS_IMPL_COCOA
- (void)run
{
+ NSTRACE ("[EmacsApp run]");
+
#ifndef NSAppKitVersionNumber10_9
#define NSAppKitVersionNumber10_9 1265
#endif
#ifndef NSAppKitVersionNumber10_9
#define NSAppKitVersionNumber10_9 1265
#endif
- (void)stop: (id)sender
{
- (void)stop: (id)sender
{
+ NSTRACE ("[EmacsApp stop]");
+
shouldKeepRunning = NO;
// Stop possible dialog also. Noop if no dialog present.
// The file dialog still leaks 7k - 10k on 10.9 though.
shouldKeepRunning = NO;
// Stop possible dialog also. Noop if no dialog present.
// The file dialog still leaks 7k - 10k on 10.9 though.
- (void)logNotification: (NSNotification *)notification
{
- (void)logNotification: (NSNotification *)notification
{
+ NSTRACE ("[EmacsApp logNotification]");
+
const char *name = [[notification name] UTF8String];
if (!strstr (name, "Update") && !strstr (name, "NSMenu")
&& !strstr (name, "WindowNumber"))
const char *name = [[notification name] UTF8String];
if (!strstr (name, "Update") && !strstr (name, "NSMenu")
&& !strstr (name, "WindowNumber"))
int type = [theEvent type];
NSWindow *window = [theEvent window];
int type = [theEvent type];
NSWindow *window = [theEvent window];
-/* NSTRACE ("sendEvent"); */
+ NSTRACE ("[EmacsApp sendEvent]");
/*fprintf (stderr, "received event of type %d\t%d\n", type);*/
#ifdef NS_IMPL_GNUSTEP
/*fprintf (stderr, "received event of type %d\t%d\n", type);*/
#ifdef NS_IMPL_GNUSTEP
- (void)newFrame: (id)sender
{
- (void)newFrame: (id)sender
{
+ NSTRACE ("[EmacsApp newFrame]");
+
struct frame *emacsframe = SELECTED_FRAME ();
NSEvent *theEvent = [NSApp currentEvent];
struct frame *emacsframe = SELECTED_FRAME ();
NSEvent *theEvent = [NSApp currentEvent];
/* Open a file (used by below, after going into queue read by ns_read_socket) */
- (BOOL) openFile: (NSString *)fileName
{
/* Open a file (used by below, after going into queue read by ns_read_socket) */
- (BOOL) openFile: (NSString *)fileName
{
+ NSTRACE ("[EmacsApp openFile]");
+
struct frame *emacsframe = SELECTED_FRAME ();
NSEvent *theEvent = [NSApp currentEvent];
struct frame *emacsframe = SELECTED_FRAME ();
NSEvent *theEvent = [NSApp currentEvent];
When application is loaded, terminate event loop in ns_term_init
-------------------------------------------------------------------------- */
{
When application is loaded, terminate event loop in ns_term_init
-------------------------------------------------------------------------- */
{
- NSTRACE ("applicationDidFinishLaunching");
+ NSTRACE ("[EmacsApp applicationDidFinishLaunching]");
+
#ifdef NS_IMPL_GNUSTEP
((EmacsApp *)self)->applicationDidFinishLaunchingCalled = YES;
#endif
#ifdef NS_IMPL_GNUSTEP
((EmacsApp *)self)->applicationDidFinishLaunchingCalled = YES;
#endif
- (void) terminate: (id)sender
{
- (void) terminate: (id)sender
{
+ NSTRACE ("[EmacsApp terminate]");
+
struct frame *emacsframe = SELECTED_FRAME ();
if (!emacs_event)
struct frame *emacsframe = SELECTED_FRAME ();
if (!emacs_event)
- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender
{
- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender
{
+ NSTRACE ("[EmacsApp applicationShouldTerminate]");
+
bool ret;
if (NILP (ns_confirm_quit)) // || ns_shutdown_properly --> TO DO
bool ret;
if (NILP (ns_confirm_quit)) // || ns_shutdown_properly --> TO DO
/* TODO: these may help w/IO switching btwn terminal and NSApp */
- (void)applicationWillBecomeActive: (NSNotification *)notification
{
/* TODO: these may help w/IO switching btwn terminal and NSApp */
- (void)applicationWillBecomeActive: (NSNotification *)notification
{
+ NSTRACE ("[EmacsApp applicationWillBecomeActive]");
- (void)applicationDidBecomeActive: (NSNotification *)notification
{
- (void)applicationDidBecomeActive: (NSNotification *)notification
{
- NSTRACE ("applicationDidBecomeActive");
+ NSTRACE ("[EmacsApp applicationDidBecomeActive]");
#ifdef NS_IMPL_GNUSTEP
if (! applicationDidFinishLaunchingCalled)
#ifdef NS_IMPL_GNUSTEP
if (! applicationDidFinishLaunchingCalled)
}
- (void)applicationDidResignActive: (NSNotification *)notification
{
}
- (void)applicationDidResignActive: (NSNotification *)notification
{
+ NSTRACE ("[EmacsApp applicationDidResignActive]");
+
//ns_app_active=NO;
ns_send_appdefined (-1);
}
//ns_app_active=NO;
ns_send_appdefined (-1);
}