Commit 6cf4e5d6 authored by Jan Djärv's avatar Jan Djärv

* nsfns.m (ns_do_applescript): Surround executeAndReturnError

with calls to ns_init_events, ns_finish_events.

* nsterm.h (ns_init_events, ns_finish_events): Declare.

* nsterm.m (ns_init_events, ns_finish_events): New functions.
(ns_read_socket, ns_select): Call ns_init_events, ns_finish_events.

Fixes: debbugs:17424
parent cae9b33d
2014-05-26 Jan Djärv <jan.h.d@swipnet.se>
* nsterm.h (ns_init_events, ns_finish_events): Declare.
* nsterm.m (ns_init_events, ns_finish_events): New functions.
(ns_read_socket, ns_select): Call ns_init_events, ns_finish_events.
* nsfns.m (ns_do_applescript): Surround executeAndReturnError
with calls to ns_init_events, ns_finish_events (Bug#17424).
2014-05-26 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (move_it_in_display_line_to): Don't record wrap position
......
......@@ -2094,9 +2094,10 @@ and GNUstep implementations ("distributor-specific release
[[NSAppleScript alloc] initWithSource:
[NSString stringWithUTF8String: SSDATA (script)]];
ns_init_events ();
returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
[scriptObject release];
ns_finish_events ();
*result = Qnil;
if (returnDescriptor != NULL)
......
......@@ -896,6 +896,9 @@ extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds,
extern unsigned long ns_get_rgb_color (struct frame *f,
float r, float g, float b, float a);
extern void ns_init_events ();
extern void ns_finish_events ();
/* From nsterm.m, needed in nsfont.m. */
#ifdef __OBJC__
extern void
......
......@@ -396,6 +396,19 @@ - (NSColor *)colorUsingDefaultColorSpace
========================================================================== */
void
ns_init_events (struct input_event* ev)
{
EVENT_INIT (*ev);
emacs_event = ev;
}
void
ns_finish_events ()
{
emacs_event = NULL;
}
static void
hold_event (struct input_event *event)
{
......@@ -3606,8 +3619,7 @@ overwriting cursor (usually when cursor on a tab) */
block_input ();
n_emacs_events_pending = 0;
EVENT_INIT (ev);
emacs_event = &ev;
ns_init_events (&ev);
q_event_ptr = hold_quit;
/* we manage autorelease pools by allocate/reallocate each time around
......@@ -3648,7 +3660,8 @@ overwriting cursor (usually when cursor on a tab) */
nevents = n_emacs_events_pending;
n_emacs_events_pending = 0;
emacs_event = q_event_ptr = NULL;
ns_finish_events ();
q_event_ptr = NULL;
unblock_input ();
return nevents;
......@@ -3743,16 +3756,15 @@ overwriting cursor (usually when cursor on a tab) */
ns_send_appdefined (-1);
}
EVENT_INIT (event);
block_input ();
emacs_event = &event;
ns_init_events (&event);
if (++apploopnr != 1)
{
emacs_abort ();
}
[NSApp run];
--apploopnr;
emacs_event = NULL;
ns_finish_events ();
if (nr > 0 && readfds)
{
c = 's';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment