diff options
| author | Steven Tamm | 2004-10-10 16:56:21 +0000 |
|---|---|---|
| committer | Steven Tamm | 2004-10-10 16:56:21 +0000 |
| commit | c3f4c690b66558c159f98b9ab5d9164c2fa0bfb7 (patch) | |
| tree | 6fabdcde0d06bb3a2638ea46102c1b4925464a4d /src/mac.c | |
| parent | af8c54774fa9b48755d28bee1d095e4a7eb83c2f (diff) | |
| download | emacs-c3f4c690b66558c159f98b9ab5d9164c2fa0bfb7.tar.gz emacs-c3f4c690b66558c159f98b9ab5d9164c2fa0bfb7.zip | |
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
Diffstat (limited to 'src/mac.c')
| -rw-r--r-- | src/mac.c | 47 |
1 files changed, 29 insertions, 18 deletions
| @@ -47,6 +47,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 47 | #undef realloc | 47 | #undef realloc |
| 48 | #undef init_process | 48 | #undef init_process |
| 49 | #include <Carbon/Carbon.h> | 49 | #include <Carbon/Carbon.h> |
| 50 | #undef mktime | ||
| 51 | #define mktime emacs_mktime | ||
| 50 | #undef free | 52 | #undef free |
| 51 | #define free unexec_free | 53 | #define free unexec_free |
| 52 | #undef malloc | 54 | #undef malloc |
| @@ -73,6 +75,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 73 | #include "process.h" | 75 | #include "process.h" |
| 74 | #include "sysselect.h" | 76 | #include "sysselect.h" |
| 75 | #include "systime.h" | 77 | #include "systime.h" |
| 78 | #include "blockinput.h" | ||
| 76 | 79 | ||
| 77 | Lisp_Object QCLIPBOARD; | 80 | Lisp_Object QCLIPBOARD; |
| 78 | 81 | ||
| @@ -2548,7 +2551,9 @@ component. */) | |||
| 2548 | 2551 | ||
| 2549 | CHECK_STRING (script); | 2552 | CHECK_STRING (script); |
| 2550 | 2553 | ||
| 2554 | BLOCK_INPUT; | ||
| 2551 | status = do_applescript (SDATA (script), &result); | 2555 | status = do_applescript (SDATA (script), &result); |
| 2556 | UNBLOCK_INPUT; | ||
| 2552 | if (status) | 2557 | if (status) |
| 2553 | { | 2558 | { |
| 2554 | if (!result) | 2559 | if (!result) |
| @@ -2618,26 +2623,23 @@ DEFUN ("mac-paste-function", Fmac_paste_function, Smac_paste_function, 0, 0, 0, | |||
| 2618 | () | 2623 | () |
| 2619 | { | 2624 | { |
| 2620 | #if TARGET_API_MAC_CARBON | 2625 | #if TARGET_API_MAC_CARBON |
| 2626 | OSStatus err; | ||
| 2621 | ScrapRef scrap; | 2627 | ScrapRef scrap; |
| 2622 | ScrapFlavorFlags sff; | 2628 | ScrapFlavorFlags sff; |
| 2623 | Size s; | 2629 | Size s; |
| 2624 | int i; | 2630 | int i; |
| 2625 | char *data; | 2631 | char *data; |
| 2626 | 2632 | ||
| 2627 | if (GetCurrentScrap (&scrap) != noErr) | 2633 | BLOCK_INPUT; |
| 2628 | return Qnil; | 2634 | err = GetCurrentScrap (&scrap); |
| 2629 | 2635 | if (err == noErr) | |
| 2630 | if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) != noErr) | 2636 | err = GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff); |
| 2631 | return Qnil; | 2637 | if (err == noErr) |
| 2632 | 2638 | err = GetScrapFlavorSize (scrap, kScrapFlavorTypeText, &s); | |
| 2633 | if (GetScrapFlavorSize (scrap, kScrapFlavorTypeText, &s) != noErr) | 2639 | if (err == noErr && (data = (char*) alloca (s))) |
| 2634 | return Qnil; | 2640 | err = GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data); |
| 2635 | 2641 | UNBLOCK_INPUT; | |
| 2636 | if ((data = (char*) alloca (s)) == NULL) | 2642 | if (err != noErr || s == 0) |
| 2637 | return Qnil; | ||
| 2638 | |||
| 2639 | if (GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data) != noErr | ||
| 2640 | || s == 0) | ||
| 2641 | return Qnil; | 2643 | return Qnil; |
| 2642 | 2644 | ||
| 2643 | /* Emacs expects clipboard contents have Unix-style eol's */ | 2645 | /* 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, | |||
| 2702 | #if TARGET_API_MAC_CARBON | 2704 | #if TARGET_API_MAC_CARBON |
| 2703 | { | 2705 | { |
| 2704 | ScrapRef scrap; | 2706 | ScrapRef scrap; |
| 2707 | |||
| 2708 | BLOCK_INPUT; | ||
| 2705 | ClearCurrentScrap (); | 2709 | ClearCurrentScrap (); |
| 2706 | if (GetCurrentScrap (&scrap) != noErr) | 2710 | if (GetCurrentScrap (&scrap) != noErr) |
| 2707 | error ("cannot get current scrap"); | 2711 | { |
| 2712 | UNBLOCK_INPUT; | ||
| 2713 | error ("cannot get current scrap"); | ||
| 2714 | } | ||
| 2708 | 2715 | ||
| 2709 | if (PutScrapFlavor (scrap, kScrapFlavorTypeText, kScrapFlavorMaskNone, len, | 2716 | if (PutScrapFlavor (scrap, kScrapFlavorTypeText, kScrapFlavorMaskNone, len, |
| 2710 | buf) != noErr) | 2717 | buf) != noErr) |
| 2711 | error ("cannot put to scrap"); | 2718 | { |
| 2719 | UNBLOCK_INPUT; | ||
| 2720 | error ("cannot put to scrap"); | ||
| 2721 | } | ||
| 2722 | UNBLOCK_INPUT; | ||
| 2712 | } | 2723 | } |
| 2713 | #else /* not TARGET_API_MAC_CARBON */ | 2724 | #else /* not TARGET_API_MAC_CARBON */ |
| 2714 | ZeroScrap (); | 2725 | ZeroScrap (); |
| @@ -2743,9 +2754,11 @@ and t is the same as `SECONDARY'. */) | |||
| 2743 | ScrapRef scrap; | 2754 | ScrapRef scrap; |
| 2744 | ScrapFlavorFlags sff; | 2755 | ScrapFlavorFlags sff; |
| 2745 | 2756 | ||
| 2757 | BLOCK_INPUT; | ||
| 2746 | if (GetCurrentScrap (&scrap) == noErr) | 2758 | if (GetCurrentScrap (&scrap) == noErr) |
| 2747 | if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) == noErr) | 2759 | if (GetScrapFlavorFlags (scrap, kScrapFlavorTypeText, &sff) == noErr) |
| 2748 | val = Qt; | 2760 | val = Qt; |
| 2761 | UNBLOCK_INPUT; | ||
| 2749 | #else /* not TARGET_API_MAC_CARBON */ | 2762 | #else /* not TARGET_API_MAC_CARBON */ |
| 2750 | Handle my_handle; | 2763 | Handle my_handle; |
| 2751 | long rc, scrap_offset; | 2764 | long rc, scrap_offset; |
| @@ -2770,8 +2783,6 @@ and t is the same as `SECONDARY'. */) | |||
| 2770 | extern int inhibit_window_system; | 2783 | extern int inhibit_window_system; |
| 2771 | extern int noninteractive; | 2784 | extern int noninteractive; |
| 2772 | 2785 | ||
| 2773 | #include "blockinput.h" | ||
| 2774 | |||
| 2775 | /* When Emacs is started from the Finder, SELECT always immediately | 2786 | /* When Emacs is started from the Finder, SELECT always immediately |
| 2776 | returns as if input is present when file descriptor 0 is polled for | 2787 | returns as if input is present when file descriptor 0 is polled for |
| 2777 | input. Strangely, when Emacs is run as a GUI application from the | 2788 | input. Strangely, when Emacs is run as a GUI application from the |