Mercurial > emacs
diff src/mac.c @ 57425:0867872551d9
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
author | Steven Tamm <steventamm@mac.com> |
---|---|
date | Sun, 10 Oct 2004 16:56:21 +0000 |
parents | 8434603cae5b |
children | 4ad0594e1ac4 ff0e824afa37 |
line wrap: on
line diff
--- a/src/mac.c Sun Oct 10 14:29:43 2004 +0000 +++ b/src/mac.c Sun Oct 10 16:56:21 2004 +0000 @@ -47,6 +47,8 @@ #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 @@ #include "process.h" #include "sysselect.h" #include "systime.h" +#include "blockinput.h" Lisp_Object QCLIPBOARD; @@ -2548,7 +2551,9 @@ CHECK_STRING (script); + BLOCK_INPUT; status = do_applescript (SDATA (script), &result); + UNBLOCK_INPUT; if (status) { if (!result) @@ -2618,26 +2623,23 @@ () { #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 @@ #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 @@ 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 @@ 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