]> git.eshelyaron.com Git - emacs.git/commitdiff
macterm.c (x_raise_frame): Add BLOCK_INPUT around SelectWindow
authorSteven Tamm <steventamm@mac.com>
Sun, 10 Oct 2004 16:56:21 +0000 (16:56 +0000)
committerSteven Tamm <steventamm@mac.com>
Sun, 10 Oct 2004 16:56:21 +0000 (16:56 +0000)
  (x_lower_frame): Add BLOCK_INPUT around SendBehind
  (make_mac_frame): Add BLOCK_INPUT around the making of a
  terminal frame
  (mac_initialize): Add BLOCK_INPUT around carbon initialization
macgui.h (mktime): Use emacs_mktime
macfns.c (Fx_file_dialog): Add BLOCK_INPUT around more code.
  Make a cancel file-open dialog be like C-g.
mac.c (mktime): Use emacs_mktime
  (Fdo_applescript): Add BLOCK_INPUT around do_applescript
  (Fmac_paste_function): Add better error handling for carbon
  cut/paste

src/ChangeLog
src/mac.c
src/macfns.c
src/macgui.h
src/macterm.c

index f77876b007aef332e8f253c86cf97be66a3458ef..16cf5a216e154111ba33a8d62fd1fd2da8ebd6e8 100644 (file)
@@ -1,3 +1,18 @@
+2004-10-10  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+       * macterm.c (x_raise_frame): Add BLOCK_INPUT around SelectWindow
+       (x_lower_frame): Add BLOCK_INPUT around SendBehind
+       (make_mac_frame): Add BLOCK_INPUT around the making of a
+       terminal frame
+       (mac_initialize): Add BLOCK_INPUT around carbon initialization
+       * macgui.h (mktime): Use emacs_mktime
+       * macfns.c (Fx_file_dialog): Add BLOCK_INPUT around more code.
+       Make a cancel file-open dialog be like C-g.
+       * mac.c (mktime): Use emacs_mktime
+       (Fdo_applescript): Add BLOCK_INPUT around do_applescript
+       (Fmac_paste_function): Add better error handling for carbon
+       cut/paste 
+
 2004-10-10  Kim F. Storm  <storm@cua.dk>
 
        * keyboard.c (timer_resume_idle): New function to resume idle
index f7e96b9c1460c4cbb9b7989d32d3e29d6c0d7430..91d073725780ba906330a30fc35c32237cb6bd68 100644 (file)
--- a/src/mac.c
+++ b/src/mac.c
@@ -47,6 +47,8 @@ Boston, MA 02111-1307, USA.  */
 #undef realloc
 #undef init_process
 #include <Carbon/Carbon.h>
+#undef mktime
+#define mktime emacs_mktime
 #undef free
 #define free unexec_free
 #undef malloc
@@ -73,6 +75,7 @@ Boston, MA 02111-1307, USA.  */
 #include "process.h"
 #include "sysselect.h"
 #include "systime.h"
+#include "blockinput.h"
 
 Lisp_Object QCLIPBOARD;
 
@@ -2548,7 +2551,9 @@ component.  */)
 
   CHECK_STRING (script);
 
+  BLOCK_INPUT;
   status = do_applescript (SDATA (script), &result);
+  UNBLOCK_INPUT;
   if (status)
     {
       if (!result)
@@ -2618,26 +2623,23 @@ DEFUN ("mac-paste-function", Fmac_paste_function, Smac_paste_function, 0, 0, 0,
      ()
 {
 #if TARGET_API_MAC_CARBON
+  OSStatus err;
   ScrapRef scrap;
   ScrapFlavorFlags sff;
   Size s;
   int i;
   char *data;
 
-  if (GetCurrentScrap (&scrap) != noErr)
-    return Qnil;
-
-  if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) != noErr)
-    return Qnil;
-
-  if (GetScrapFlavorSize (scrap, kScrapFlavorTypeText, &s) != noErr)
-    return Qnil;
-
-  if ((data = (char*) alloca (s)) == NULL)
-    return Qnil;
-
-  if (GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data) != noErr
-      || s == 0)
+  BLOCK_INPUT;
+  err = GetCurrentScrap (&scrap);
+  if (err == noErr)
+    err = GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff);
+  if (err == noErr)
+    err = GetScrapFlavorSize (scrap, kScrapFlavorTypeText, &s);
+  if (err == noErr && (data = (char*) alloca (s)))
+    err = GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data);
+  UNBLOCK_INPUT;
+  if (err != noErr || s == 0)
     return Qnil;
 
   /* Emacs expects clipboard contents have Unix-style eol's */
@@ -2702,13 +2704,22 @@ DEFUN ("mac-cut-function", Fmac_cut_function, Smac_cut_function, 1, 2, 0,
 #if TARGET_API_MAC_CARBON
   {
     ScrapRef scrap;
+
+    BLOCK_INPUT;
     ClearCurrentScrap ();
     if (GetCurrentScrap (&scrap) != noErr)
-      error ("cannot get current scrap");
+      {
+       UNBLOCK_INPUT;
+       error ("cannot get current scrap");
+      }
 
     if (PutScrapFlavor (scrap, kScrapFlavorTypeText, kScrapFlavorMaskNone, len,
                        buf) != noErr)
-      error ("cannot put to scrap");
+      {
+       UNBLOCK_INPUT;
+       error ("cannot put to scrap");
+      }
+    UNBLOCK_INPUT;
   }
 #else /* not TARGET_API_MAC_CARBON */
   ZeroScrap ();
@@ -2743,9 +2754,11 @@ and t is the same as `SECONDARY'.  */)
       ScrapRef scrap;
       ScrapFlavorFlags sff;
 
+      BLOCK_INPUT;
       if (GetCurrentScrap (&scrap) == noErr)
         if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) == noErr)
           val = Qt;
+      UNBLOCK_INPUT;
 #else /* not TARGET_API_MAC_CARBON */
       Handle my_handle;
       long rc, scrap_offset;
@@ -2770,8 +2783,6 @@ and t is the same as `SECONDARY'.  */)
 extern int inhibit_window_system;
 extern int noninteractive;
 
-#include "blockinput.h"
-
 /* When Emacs is started from the Finder, SELECT always immediately
    returns as if input is present when file descriptor 0 is polled for
    input.  Strangely, when Emacs is run as a GUI application from the
index f7594e9c6c215b5e5f509762d6016c2634d44a9c..88f975a65c88f6cf9ab972a3302b3c34acd0edec 100644 (file)
@@ -4247,6 +4247,7 @@ specified.  Ensure that file exists if MUSTMATCH is non-nil.  */)
     NavUserAction userAction;
     CFStringRef message=NULL, client=NULL, saveName = NULL;
     
+    BLOCK_INPUT;
     /* No need for a callback function because we are modal */
     NavGetDefaultDialogCreationOptions(&options);
     options.modality = kWindowModalityAppModal;
@@ -4317,9 +4318,7 @@ specified.  Ensure that file exists if MUSTMATCH is non-nil.  */)
        AEDisposeDesc(&defLocAed);
       }
 
-      BLOCK_INPUT;
       status = NavDialogRun(dialogRef);
-      UNBLOCK_INPUT;
     }
 
     if (saveName) CFRelease(saveName);
@@ -4332,9 +4331,7 @@ specified.  Ensure that file exists if MUSTMATCH is non-nil.  */)
        {
        case kNavUserActionNone:
        case kNavUserActionCancel:
-         NavDialogDispose(dialogRef);
-         Fsignal (Qquit, Qnil);  /* Treat cancel like C-g */
-         return;
+         break;                /* Treat cancel like C-g */
        case kNavUserActionOpen:
        case kNavUserActionChoose:
        case kNavUserActionSaveAs:
@@ -4369,6 +4366,7 @@ specified.  Ensure that file exists if MUSTMATCH is non-nil.  */)
                               dir, mustmatch, dir, Qfile_name_history,
                               default_filename, Qnil);
     }
+    UNBLOCK_INPUT;
   }
 
   UNGCPRO;
index 58081df52b4816f4ba7d483d321103baaebba986..e5ea665ac158fd0ddebcb0083f1c417f4edc404a 100644 (file)
@@ -42,6 +42,8 @@ typedef unsigned long Time;
 #undef min
 #undef init_process
 #include <Carbon/Carbon.h>
+#undef mktime
+#define mktime emacs_mktime
 #undef Z
 #define Z (current_buffer->text->z)
 #undef free
index a5e1de9be0812e4ad81cb81a36295be26b2432c7..3616ac9567287510ce27ee16e95a4bcf0811d809 100644 (file)
@@ -5317,7 +5317,11 @@ x_raise_frame (f)
      struct frame *f;
 {
   if (f->async_visible)
-    SelectWindow (FRAME_MAC_WINDOW (f));
+    {
+      BLOCK_INPUT;
+      SelectWindow (FRAME_MAC_WINDOW (f));
+      UNBLOCK_INPUT;
+    }
 }
 
 /* Lower frame F.  */
@@ -5326,7 +5330,11 @@ x_lower_frame (f)
      struct frame *f;
 {
   if (f->async_visible)
-    SendBehind (FRAME_MAC_WINDOW (f), nil);
+    {
+      BLOCK_INPUT;
+      SendBehind (FRAME_MAC_WINDOW (f), nil);
+      UNBLOCK_INPUT;
+    }
 }
 
 static void
@@ -8757,6 +8765,7 @@ make_mac_frame (FRAME_PTR fp)
 
   mwp = fp->output_data.mac;
 
+  BLOCK_INPUT;
   if (making_terminal_window)
     {
       if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL,
@@ -8784,9 +8793,8 @@ make_mac_frame (FRAME_PTR fp)
     /* so that update events can find this mac_output struct */
   mwp->mFP = fp;  /* point back to emacs frame */
 
-  SetPortWindowPort (mwp->mWP);
-
   SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false);
+  UNBLOCK_INPUT;
 }
 
 
@@ -9209,6 +9217,7 @@ mac_initialize ()
   signal (SIGPIPE, x_connection_signal);
 #endif
 
+  BLOCK_INPUT;
   mac_initialize_display_info ();
 
 #if TARGET_API_MAC_CARBON
@@ -9227,6 +9236,7 @@ mac_initialize ()
   if (!inhibit_window_system)
     MakeMeTheFrontProcess ();
 #endif
+  UNBLOCK_INPUT;
 }