emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src nsterm.m


From: Adrian Robert
Subject: [Emacs-diffs] emacs/src nsterm.m
Date: Sat, 07 Feb 2009 11:04:07 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Adrian Robert <arobert> 09/02/07 11:04:07

Modified files:
        src            : nsterm.m 

Log message:
                * nsterm.m (EmacsApp-sendEvent:): Defer NSApplicationDefined 
event
                when modal window is active. (Bug #2152)
                (applicationShouldTerminate:): Remove now-unneeded while loop
                around NSRunAlertPanel.
        
                * nsmenu.m (popupSession): New file-global variable.
                (pop_down_menu): End the popupSession before closing dialog.
                (ns_popup_dialog): BLOCK_INPUT around dialog presentation.
                (EmacsDialogPanel-runDialogAt:): Don't place window 
(superfluous),
                don't query NSApp for events (just sleep instead).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsterm.m?cvsroot=emacs&r1=1.57&r2=1.58

Patches:
Index: nsterm.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsterm.m,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- nsterm.m    4 Feb 2009 11:31:30 -0000       1.57
+++ nsterm.m    7 Feb 2009 11:04:07 -0000       1.58
@@ -4037,7 +4037,8 @@
 
 - (void)sendEvent: (NSEvent *)theEvent
 /* --------------------------------------------------------------------------
-     Events posted by ns_send_appdefined interrupt the run loop here
+     Called when NSApp is running for each event received.  Used to stop
+     the loop when we choose, since there's no way to just run one iteration.
    -------------------------------------------------------------------------- 
*/
 {
   int type = [theEvent type];
@@ -4081,9 +4082,20 @@
 
   if (type == NSApplicationDefined)
     {
+      /* Events posted by ns_send_appdefined interrupt the run loop here.
+         But, if a modal window is up, an appdefined can still come through,
+         (e.g., from a makeKeyWindow event) but stopping self also stops the
+         modal loop. Just defer it until later. */
+      if ([NSApp modalWindow] == nil)
+        {
       last_appdefined_event = theEvent;
       [self stop: self];
     }
+      else
+        {
+          send_appdefined = YES;
+        }
+    }
 
   [super sendEvent: theEvent];
 }
@@ -4199,28 +4211,15 @@
   if (ns_shutdown_properly || NILP (ns_confirm_quit))
     return NSTerminateNow;
 
-  /* XXX: This while() loop is needed because if the user switches to another
-          application while the panel is up, it is taken down w/a return value
-          of NSRunStoppedResponse, and the event queue gets messed up.
-          In this case resend the appdefined and put up the window again. */
-  while (1) {
     ret = NSRunAlertPanel([[NSProcessInfo processInfo] processName],
                           [NSString stringWithUTF8String:"Exit requested.  
Would you like to Save Buffers and Exit, or Cancel the request?"],
                           @"Save Buffers and Exit", @"Cancel", nil);
 
     if (ret == NSAlertDefaultReturn)
-      {
-        send_appdefined = YES;
-        ns_send_appdefined(-1);
         return NSTerminateNow;
-      }
     else if (ret == NSAlertAlternateReturn)
-      {
-        send_appdefined = YES;
-        ns_send_appdefined(-1);
         return NSTerminateCancel;
-      }
-  }
+    return NSTerminateNow;  /* just in case */
 }
 
 




reply via email to

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