emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/src ChangeLog keyboard.c nsmenu.m nsterm....


From: Adrian Robert
Subject: [Emacs-diffs] emacs/src ChangeLog keyboard.c nsmenu.m nsterm....
Date: Wed, 04 Feb 2009 11:31:30 +0000

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

Modified files:
        src            : ChangeLog keyboard.c nsmenu.m nsterm.m 
        src/s          : darwin.h 

Log message:
        * nsmenu.m (pop_down_menu): New function.
        (ns_popup_dialog): Call it on unwind.
        (EmacsDialogPanel-runDialogAt:): Check popup_activated_flag and
        call timer_check() (Bug#2154).
        (EmacsMenu-menuNeedsUpdate:): Don't call ns_update_menu if
        handling_signal is set.
        (EmacsMenu-fillWithWidgetValue:): Set submenu title.
        
        * s/darwin.h: Same and NO_SOCK_SIGIO as well.
        
        * nsterm.m (ns_read_socket): Same and don't set handling_signal.
        
        * keyboard.c (poll_for_input_1, handle_async_input): Set
        handling_signal under HAVE_NS.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7337&r2=1.7338
http://cvs.savannah.gnu.org/viewcvs/emacs/src/keyboard.c?cvsroot=emacs&r1=1.994&r2=1.995
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsmenu.m?cvsroot=emacs&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsterm.m?cvsroot=emacs&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/emacs/src/s/darwin.h?cvsroot=emacs&r1=1.52&r2=1.53

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7337
retrieving revision 1.7338
diff -u -b -r1.7337 -r1.7338
--- ChangeLog   4 Feb 2009 03:51:27 -0000       1.7337
+++ ChangeLog   4 Feb 2009 11:31:28 -0000       1.7338
@@ -1,3 +1,22 @@
+2009-02-04  Adrian Robert  <address@hidden>
+
+       * nsmenu.m (pop_down_menu): New function.
+       (ns_popup_dialog): Call it on unwind.
+       (EmacsDialogPanel-runDialogAt:): Check popup_activated_flag and
+       call timer_check() (Bug#2154).
+       (EmacsMenu-menuNeedsUpdate:): Don't call ns_update_menu if
+       handling_signal is set.
+       (EmacsMenu-fillWithWidgetValue:): Set submenu title.
+
+       * config.in: Get rid of COCOA_EXPERIMENTAL_CTRL_G
+
+       * s/darwin.h: Same and NO_SOCK_SIGIO as well.
+
+       * nsterm.m (ns_read_socket): Same and don't set handling_signal.
+
+       * keyboard.c (poll_for_input_1, handle_async_input): Set
+       handling_signal under HAVE_NS.
+
 2009-02-04  Glenn Morris  <address@hidden>
 
        * fileio.c (Fwrite_region): Doc fix (mention annotate-functions).

Index: keyboard.c
===================================================================
RCS file: /sources/emacs/emacs/src/keyboard.c,v
retrieving revision 1.994
retrieving revision 1.995
diff -u -b -r1.994 -r1.995
--- keyboard.c  1 Feb 2009 16:32:26 -0000       1.994
+++ keyboard.c  4 Feb 2009 11:31:29 -0000       1.995
@@ -2182,16 +2182,24 @@
 
 #ifdef POLL_FOR_INPUT
 
-/* Poll for input, so what we catch a C-g if it comes in.  This
+/* Poll for input, so that we catch a C-g if it comes in.  This
    function is called from x_make_frame_visible, see comment
    there.  */
 
 void
 poll_for_input_1 ()
 {
+/* Tell ns_read_socket() it is being called asynchronously so it can avoid
+   doing anything dangerous. */
+#ifdef HAVE_NS
+  ++handling_signal;
+#endif
   if (interrupt_input_blocked == 0
       && !waiting_for_input)
     read_avail_input (0);
+#ifdef HAVE_NS
+  --handling_signal;
+#endif
 }
 
 /* Timer callback function for poll_timer.  TIMER is equal to
@@ -7276,7 +7284,11 @@
 #ifdef SYNC_INPUT
   pending_signals = pending_atimers;
 #endif
-
+/* Tell ns_read_socket() it is being called asynchronously so it can avoid
+   doing anything dangerous. */
+#ifdef HAVE_NS
+  ++handling_signal;
+#endif
   while (1)
     {
       int nread;
@@ -7287,6 +7299,9 @@
       if (nread <= 0)
        break;
     }
+#ifdef HAVE_NS
+  --handling_signal;
+#endif
 }
 
 void

Index: nsmenu.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsmenu.m,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- nsmenu.m    25 Jan 2009 19:43:34 -0000      1.17
+++ nsmenu.m    4 Feb 2009 11:31:29 -0000       1.18
@@ -573,7 +573,10 @@
      since key equivalents are handled through emacs.
      On Leopard, even keystroke events generate SystemDefined events, but
      their subtype is 8. */
-  if ([event type] != NSSystemDefined || [event subtype] == 8)
+  if ([event type] != NSSystemDefined || [event subtype] == 8
+      /* Also, don't try this if from an event picked up asynchronously,
+         as lots of lisp evaluation happens in ns_update_menubar. */
+      || handling_signal != 0)
     return;
 /*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog 
(@"address@hidden", event); */
   ns_update_menubar (frame, 1, self);
@@ -688,7 +691,7 @@
 
       if (wv->contents)
         {
-          EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: @"Submenu"];
+          EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: [item title]];
 
           [self setSubmenu: submenu forItem: item];
           [submenu fillWithWidgetValue: wv->contents];
@@ -1485,6 +1488,20 @@
 
    ========================================================================== 
*/
 
+
+static Lisp_Object
+pop_down_menu (Lisp_Object arg)
+{
+  struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
+  popup_activated_flag = 0;
+  BLOCK_INPUT;
+  [((EmacsDialogPanel *) (p->pointer)) close];
+  [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
+  UNBLOCK_INPUT;
+  return Qnil;
+}
+
+
 Lisp_Object
 ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object 
header)
 {
@@ -1539,13 +1556,18 @@
   p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2;
   dialog = [[EmacsDialogPanel alloc] initFromContents: contents
                                            isQuestion: isQ];
+  {
+    int specpdl_count = SPECPDL_INDEX ();
+    record_unwind_protect (pop_down_menu, make_save_value (dialog, 0));
   popup_activated_flag = 1;
   tem = [dialog runDialogAt: p];
   popup_activated_flag = 0;
+    unbind_to (specpdl_count, Qnil);
+  }
 
   [dialog close];
-
   [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
+
   return tem;
 }
 
@@ -1858,12 +1880,14 @@
   [self orderFront: NSApp];
 
   session = [NSApp beginModalSessionForWindow: self];
-  while ((ret = [NSApp runModalSession: session]) == NSRunContinuesResponse)
+  while (popup_activated_flag
+         && (ret = [NSApp runModalSession: session]) == NSRunContinuesResponse)
     {
-    (e = [NSApp nextEventMatchingMask: NSAnyEventMask
-                            untilDate: [NSDate distantFuture]
+      timer_check (1);  // for timers.el, indep of atimers; might not return
+      e = [NSApp nextEventMatchingMask: NSAnyEventMask
+                             untilDate: [NSDate dateWithTimeIntervalSinceNow: 
1]
                                inMode: NSModalPanelRunLoopMode
-                              dequeue: NO]);
+                               dequeue: NO];
 /*fprintf (stderr, "ret = %d\te = %p\n", ret, e);*/
     }
   [NSApp endModalSession: session];
@@ -1878,7 +1902,6 @@
 @end
 
 
-
 /* ==========================================================================
 
     Lisp definitions

Index: nsterm.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsterm.m,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- nsterm.m    2 Feb 2009 12:33:09 -0000       1.56
+++ nsterm.m    4 Feb 2009 11:31:30 -0000       1.57
@@ -3147,15 +3147,8 @@
 #ifdef SYNC_INPUT
   pending_signals = pending_atimers;
 #endif
-  BLOCK_INPUT;
-
-#ifdef COCOA_EXPERIMENTAL_CTRL_G
-  /* causes Feval to abort; should probably set this in calling code when
-     it IS actually called from signal handler, in which case we need to
-     defer ns_update_menubar() calls */
-  ++handling_signal;
-#endif
 
+  BLOCK_INPUT;
   n_emacs_events_pending = 0;
   EVENT_INIT (ev);
   emacs_event = &ev;
@@ -3210,10 +3203,6 @@
   nevents = n_emacs_events_pending;
   n_emacs_events_pending = 0;
   emacs_event = q_event_ptr = NULL;
-
-#ifdef COCOA_EXPERIMENTAL_CTRL_G
-  --handling_signal;
-#endif
   UNBLOCK_INPUT;
 
   return nevents;
@@ -4164,24 +4153,24 @@
     Cmd-Q:
     MenuBar | File | Exit:
         ns_term_shutdown: 0
-        received -terminate: 1
-        received -appShouldTerminate: 1
+        -terminate: 1
+        -appShouldTerminate: 1
 
     Select Quit from App menubar:
         received -terminate: 0
         ns_term_shutdown: 0
-        received -terminate: 1
-        received -appShouldTerminate: 1
+        -terminate: 1
+        -appShouldTerminate: 1
 
     Select Quit from Dock menu:
     Logout attempt:
-        received -appShouldTerminate: 0
+        -appShouldTerminate: 0
           Cancel -> Nothing else
           Accept ->
-            received -terminate: 0
+            -terminate: 0
             ns_term_shutdown: 0
-            received -terminate: 1
-            received -appShouldTerminate: 1
+            -terminate: 1
+            -appShouldTerminate: 1
 */
 
 - (void) terminate: (id)sender
@@ -4212,8 +4201,8 @@
 
   /* 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 -1000, and the event queue gets messed up.  In this case resend
-          the appdefined and put up the window again. */
+          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?"],
@@ -5112,13 +5101,6 @@
     x_set_window_size (emacsframe, 0, cols, rows);
 
   ns_send_appdefined (-1);
-
-  /* The following line causes a crash on GNUstep.  Adrian Robert
-     says he doesn't remember why he added this line, but removing it
-     doesn't seem to cause problems on OSX, either.  */
-#if 0
-  [NSApp stopModal];
-#endif
 }
 
 

Index: s/darwin.h
===================================================================
RCS file: /sources/emacs/emacs/src/s/darwin.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- s/darwin.h  8 Jan 2009 03:16:19 -0000       1.52
+++ s/darwin.h  4 Feb 2009 11:31:30 -0000       1.53
@@ -133,15 +133,6 @@
 /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
 #define HAVE_SOCKETS
 
-/* This seems to help in Ctrl-G detection under Cocoa, however at the cost
-   of some quirks that may or may not bother a given user.
-   It was earlier commented that "In Carbon, asynchronous I/O (using SIGIO)
-   can't be used for window events because they don't come from sockets,
-   even though it works fine on tty's.  Uncertain about situation in Cocoa. */
-#ifdef COCOA_EXPERIMENTAL_CTRL_G
-#define NO_SOCK_SIGIO
-#endif
-
 /* Definitions for how to dump.  Copied from nextstep.h.  */
 
 #define UNEXEC unexmacosx.o




reply via email to

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