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> 2014-05-26 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (move_it_in_display_line_to): Don't record wrap position * xdisp.c (move_it_in_display_line_to): Don't record wrap position
......
...@@ -2094,9 +2094,10 @@ and GNUstep implementations ("distributor-specific release ...@@ -2094,9 +2094,10 @@ and GNUstep implementations ("distributor-specific release
[[NSAppleScript alloc] initWithSource: [[NSAppleScript alloc] initWithSource:
[NSString stringWithUTF8String: SSDATA (script)]]; [NSString stringWithUTF8String: SSDATA (script)]];
ns_init_events ();
returnDescriptor = [scriptObject executeAndReturnError: &errorDict]; returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
[scriptObject release]; [scriptObject release];
ns_finish_events ();
*result = Qnil; *result = Qnil;
if (returnDescriptor != NULL) if (returnDescriptor != NULL)
......
...@@ -896,6 +896,9 @@ extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds, ...@@ -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, extern unsigned long ns_get_rgb_color (struct frame *f,
float r, float g, float b, float a); 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. */ /* From nsterm.m, needed in nsfont.m. */
#ifdef __OBJC__ #ifdef __OBJC__
extern void extern void
......
...@@ -396,6 +396,19 @@ - (NSColor *)colorUsingDefaultColorSpace ...@@ -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 static void
hold_event (struct input_event *event) hold_event (struct input_event *event)
{ {
...@@ -3606,8 +3619,7 @@ overwriting cursor (usually when cursor on a tab) */ ...@@ -3606,8 +3619,7 @@ overwriting cursor (usually when cursor on a tab) */
block_input (); block_input ();
n_emacs_events_pending = 0; n_emacs_events_pending = 0;
EVENT_INIT (ev); ns_init_events (&ev);
emacs_event = &ev;
q_event_ptr = hold_quit; q_event_ptr = hold_quit;
/* we manage autorelease pools by allocate/reallocate each time around /* we manage autorelease pools by allocate/reallocate each time around
...@@ -3648,7 +3660,8 @@ overwriting cursor (usually when cursor on a tab) */ ...@@ -3648,7 +3660,8 @@ overwriting cursor (usually when cursor on a tab) */
nevents = n_emacs_events_pending; nevents = n_emacs_events_pending;
n_emacs_events_pending = 0; n_emacs_events_pending = 0;
emacs_event = q_event_ptr = NULL; ns_finish_events ();
q_event_ptr = NULL;
unblock_input (); unblock_input ();
return nevents; return nevents;
...@@ -3743,16 +3756,15 @@ overwriting cursor (usually when cursor on a tab) */ ...@@ -3743,16 +3756,15 @@ overwriting cursor (usually when cursor on a tab) */
ns_send_appdefined (-1); ns_send_appdefined (-1);
} }
EVENT_INIT (event);
block_input (); block_input ();
emacs_event = &event; ns_init_events (&event);
if (++apploopnr != 1) if (++apploopnr != 1)
{ {
emacs_abort (); emacs_abort ();
} }
[NSApp run]; [NSApp run];
--apploopnr; --apploopnr;
emacs_event = NULL; ns_finish_events ();
if (nr > 0 && readfds) if (nr > 0 && readfds)
{ {
c = 's'; 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