+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
#undef realloc
#undef init_process
#include <Carbon/Carbon.h>
+#undef mktime
+#define mktime emacs_mktime
#undef free
#define free unexec_free
#undef malloc
#include "process.h"
#include "sysselect.h"
#include "systime.h"
+#include "blockinput.h"
Lisp_Object QCLIPBOARD;
CHECK_STRING (script);
+ BLOCK_INPUT;
status = do_applescript (SDATA (script), &result);
+ UNBLOCK_INPUT;
if (status)
{
if (!result)
()
{
#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 */
#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 ();
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;
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
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;
AEDisposeDesc(&defLocAed);
}
- BLOCK_INPUT;
status = NavDialogRun(dialogRef);
- UNBLOCK_INPUT;
}
if (saveName) CFRelease(saveName);
{
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:
dir, mustmatch, dir, Qfile_name_history,
default_filename, Qnil);
}
+ UNBLOCK_INPUT;
}
UNGCPRO;
#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
struct frame *f;
{
if (f->async_visible)
- SelectWindow (FRAME_MAC_WINDOW (f));
+ {
+ BLOCK_INPUT;
+ SelectWindow (FRAME_MAC_WINDOW (f));
+ UNBLOCK_INPUT;
+ }
}
/* 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
mwp = fp->output_data.mac;
+ BLOCK_INPUT;
if (making_terminal_window)
{
if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL,
/* 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;
}
signal (SIGPIPE, x_connection_signal);
#endif
+ BLOCK_INPUT;
mac_initialize_display_info ();
#if TARGET_API_MAC_CARBON
if (!inhibit_window_system)
MakeMeTheFrontProcess ();
#endif
+ UNBLOCK_INPUT;
}