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 | |
| 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')
| -rw-r--r-- | src/ChangeLog | 15 | ||||
| -rw-r--r-- | src/mac.c | 47 | ||||
| -rw-r--r-- | src/macfns.c | 8 | ||||
| -rw-r--r-- | src/macgui.h | 2 | ||||
| -rw-r--r-- | src/macterm.c | 18 |
5 files changed, 63 insertions, 27 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f77876b007a..16cf5a216e1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2004-10-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * macterm.c (x_raise_frame): Add BLOCK_INPUT around SelectWindow | ||
| 4 | (x_lower_frame): Add BLOCK_INPUT around SendBehind | ||
| 5 | (make_mac_frame): Add BLOCK_INPUT around the making of a | ||
| 6 | terminal frame | ||
| 7 | (mac_initialize): Add BLOCK_INPUT around carbon initialization | ||
| 8 | * macgui.h (mktime): Use emacs_mktime | ||
| 9 | * macfns.c (Fx_file_dialog): Add BLOCK_INPUT around more code. | ||
| 10 | Make a cancel file-open dialog be like C-g. | ||
| 11 | * mac.c (mktime): Use emacs_mktime | ||
| 12 | (Fdo_applescript): Add BLOCK_INPUT around do_applescript | ||
| 13 | (Fmac_paste_function): Add better error handling for carbon | ||
| 14 | cut/paste | ||
| 15 | |||
| 1 | 2004-10-10 Kim F. Storm <storm@cua.dk> | 16 | 2004-10-10 Kim F. Storm <storm@cua.dk> |
| 2 | 17 | ||
| 3 | * keyboard.c (timer_resume_idle): New function to resume idle | 18 | * keyboard.c (timer_resume_idle): New function to resume idle |
| @@ -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 |
diff --git a/src/macfns.c b/src/macfns.c index f7594e9c6c2..88f975a65c8 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -4247,6 +4247,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) | |||
| 4247 | NavUserAction userAction; | 4247 | NavUserAction userAction; |
| 4248 | CFStringRef message=NULL, client=NULL, saveName = NULL; | 4248 | CFStringRef message=NULL, client=NULL, saveName = NULL; |
| 4249 | 4249 | ||
| 4250 | BLOCK_INPUT; | ||
| 4250 | /* No need for a callback function because we are modal */ | 4251 | /* No need for a callback function because we are modal */ |
| 4251 | NavGetDefaultDialogCreationOptions(&options); | 4252 | NavGetDefaultDialogCreationOptions(&options); |
| 4252 | options.modality = kWindowModalityAppModal; | 4253 | options.modality = kWindowModalityAppModal; |
| @@ -4317,9 +4318,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) | |||
| 4317 | AEDisposeDesc(&defLocAed); | 4318 | AEDisposeDesc(&defLocAed); |
| 4318 | } | 4319 | } |
| 4319 | 4320 | ||
| 4320 | BLOCK_INPUT; | ||
| 4321 | status = NavDialogRun(dialogRef); | 4321 | status = NavDialogRun(dialogRef); |
| 4322 | UNBLOCK_INPUT; | ||
| 4323 | } | 4322 | } |
| 4324 | 4323 | ||
| 4325 | if (saveName) CFRelease(saveName); | 4324 | if (saveName) CFRelease(saveName); |
| @@ -4332,9 +4331,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) | |||
| 4332 | { | 4331 | { |
| 4333 | case kNavUserActionNone: | 4332 | case kNavUserActionNone: |
| 4334 | case kNavUserActionCancel: | 4333 | case kNavUserActionCancel: |
| 4335 | NavDialogDispose(dialogRef); | 4334 | break; /* Treat cancel like C-g */ |
| 4336 | Fsignal (Qquit, Qnil); /* Treat cancel like C-g */ | ||
| 4337 | return; | ||
| 4338 | case kNavUserActionOpen: | 4335 | case kNavUserActionOpen: |
| 4339 | case kNavUserActionChoose: | 4336 | case kNavUserActionChoose: |
| 4340 | case kNavUserActionSaveAs: | 4337 | case kNavUserActionSaveAs: |
| @@ -4369,6 +4366,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) | |||
| 4369 | dir, mustmatch, dir, Qfile_name_history, | 4366 | dir, mustmatch, dir, Qfile_name_history, |
| 4370 | default_filename, Qnil); | 4367 | default_filename, Qnil); |
| 4371 | } | 4368 | } |
| 4369 | UNBLOCK_INPUT; | ||
| 4372 | } | 4370 | } |
| 4373 | 4371 | ||
| 4374 | UNGCPRO; | 4372 | UNGCPRO; |
diff --git a/src/macgui.h b/src/macgui.h index 58081df52b4..e5ea665ac15 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -42,6 +42,8 @@ typedef unsigned long Time; | |||
| 42 | #undef min | 42 | #undef min |
| 43 | #undef init_process | 43 | #undef init_process |
| 44 | #include <Carbon/Carbon.h> | 44 | #include <Carbon/Carbon.h> |
| 45 | #undef mktime | ||
| 46 | #define mktime emacs_mktime | ||
| 45 | #undef Z | 47 | #undef Z |
| 46 | #define Z (current_buffer->text->z) | 48 | #define Z (current_buffer->text->z) |
| 47 | #undef free | 49 | #undef free |
diff --git a/src/macterm.c b/src/macterm.c index a5e1de9be08..3616ac95672 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -5317,7 +5317,11 @@ x_raise_frame (f) | |||
| 5317 | struct frame *f; | 5317 | struct frame *f; |
| 5318 | { | 5318 | { |
| 5319 | if (f->async_visible) | 5319 | if (f->async_visible) |
| 5320 | SelectWindow (FRAME_MAC_WINDOW (f)); | 5320 | { |
| 5321 | BLOCK_INPUT; | ||
| 5322 | SelectWindow (FRAME_MAC_WINDOW (f)); | ||
| 5323 | UNBLOCK_INPUT; | ||
| 5324 | } | ||
| 5321 | } | 5325 | } |
| 5322 | 5326 | ||
| 5323 | /* Lower frame F. */ | 5327 | /* Lower frame F. */ |
| @@ -5326,7 +5330,11 @@ x_lower_frame (f) | |||
| 5326 | struct frame *f; | 5330 | struct frame *f; |
| 5327 | { | 5331 | { |
| 5328 | if (f->async_visible) | 5332 | if (f->async_visible) |
| 5329 | SendBehind (FRAME_MAC_WINDOW (f), nil); | 5333 | { |
| 5334 | BLOCK_INPUT; | ||
| 5335 | SendBehind (FRAME_MAC_WINDOW (f), nil); | ||
| 5336 | UNBLOCK_INPUT; | ||
| 5337 | } | ||
| 5330 | } | 5338 | } |
| 5331 | 5339 | ||
| 5332 | static void | 5340 | static void |
| @@ -8757,6 +8765,7 @@ make_mac_frame (FRAME_PTR fp) | |||
| 8757 | 8765 | ||
| 8758 | mwp = fp->output_data.mac; | 8766 | mwp = fp->output_data.mac; |
| 8759 | 8767 | ||
| 8768 | BLOCK_INPUT; | ||
| 8760 | if (making_terminal_window) | 8769 | if (making_terminal_window) |
| 8761 | { | 8770 | { |
| 8762 | if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL, | 8771 | if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL, |
| @@ -8784,9 +8793,8 @@ make_mac_frame (FRAME_PTR fp) | |||
| 8784 | /* so that update events can find this mac_output struct */ | 8793 | /* so that update events can find this mac_output struct */ |
| 8785 | mwp->mFP = fp; /* point back to emacs frame */ | 8794 | mwp->mFP = fp; /* point back to emacs frame */ |
| 8786 | 8795 | ||
| 8787 | SetPortWindowPort (mwp->mWP); | ||
| 8788 | |||
| 8789 | SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false); | 8796 | SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false); |
| 8797 | UNBLOCK_INPUT; | ||
| 8790 | } | 8798 | } |
| 8791 | 8799 | ||
| 8792 | 8800 | ||
| @@ -9209,6 +9217,7 @@ mac_initialize () | |||
| 9209 | signal (SIGPIPE, x_connection_signal); | 9217 | signal (SIGPIPE, x_connection_signal); |
| 9210 | #endif | 9218 | #endif |
| 9211 | 9219 | ||
| 9220 | BLOCK_INPUT; | ||
| 9212 | mac_initialize_display_info (); | 9221 | mac_initialize_display_info (); |
| 9213 | 9222 | ||
| 9214 | #if TARGET_API_MAC_CARBON | 9223 | #if TARGET_API_MAC_CARBON |
| @@ -9227,6 +9236,7 @@ mac_initialize () | |||
| 9227 | if (!inhibit_window_system) | 9236 | if (!inhibit_window_system) |
| 9228 | MakeMeTheFrontProcess (); | 9237 | MakeMeTheFrontProcess (); |
| 9229 | #endif | 9238 | #endif |
| 9239 | UNBLOCK_INPUT; | ||
| 9230 | } | 9240 | } |
| 9231 | 9241 | ||
| 9232 | 9242 | ||