aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2014-05-26 13:16:47 +0200
committerJan Djärv2014-05-26 13:16:47 +0200
commit6cf4e5d6f677c1a03076b16d6c265c7b0d9711d6 (patch)
tree5a8c874b4b65c22b39c2127e65de69a0037b605a /src
parentcae9b33defcdd3700f787bd94d5f47f69a3377f6 (diff)
downloademacs-6cf4e5d6f677c1a03076b16d6c265c7b0d9711d6.tar.gz
emacs-6cf4e5d6f677c1a03076b16d6c265c7b0d9711d6.zip
* 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
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/nsfns.m3
-rw-r--r--src/nsterm.h3
-rw-r--r--src/nsterm.m24
4 files changed, 33 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 76117451b16..06f3a9403e3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12014-05-26 Jan Djärv <jan.h.d@swipnet.se>
2
3 * nsterm.h (ns_init_events, ns_finish_events): Declare.
4
5 * nsterm.m (ns_init_events, ns_finish_events): New functions.
6 (ns_read_socket, ns_select): Call ns_init_events, ns_finish_events.
7
8 * nsfns.m (ns_do_applescript): Surround executeAndReturnError
9 with calls to ns_init_events, ns_finish_events (Bug#17424).
10
12014-05-26 Eli Zaretskii <eliz@gnu.org> 112014-05-26 Eli Zaretskii <eliz@gnu.org>
2 12
3 * xdisp.c (move_it_in_display_line_to): Don't record wrap position 13 * xdisp.c (move_it_in_display_line_to): Don't record wrap position
diff --git a/src/nsfns.m b/src/nsfns.m
index 4c3f7f34c07..0f2c2e693f7 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2094,9 +2094,10 @@ ns_do_applescript (Lisp_Object script, Lisp_Object *result)
2094 [[NSAppleScript alloc] initWithSource: 2094 [[NSAppleScript alloc] initWithSource:
2095 [NSString stringWithUTF8String: SSDATA (script)]]; 2095 [NSString stringWithUTF8String: SSDATA (script)]];
2096 2096
2097 ns_init_events ();
2097 returnDescriptor = [scriptObject executeAndReturnError: &errorDict]; 2098 returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
2098 [scriptObject release]; 2099 [scriptObject release];
2099 2100 ns_finish_events ();
2100 *result = Qnil; 2101 *result = Qnil;
2101 2102
2102 if (returnDescriptor != NULL) 2103 if (returnDescriptor != NULL)
diff --git a/src/nsterm.h b/src/nsterm.h
index 74789634a90..49dd9d79008 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -896,6 +896,9 @@ extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds,
896extern unsigned long ns_get_rgb_color (struct frame *f, 896extern unsigned long ns_get_rgb_color (struct frame *f,
897 float r, float g, float b, float a); 897 float r, float g, float b, float a);
898 898
899extern void ns_init_events ();
900extern void ns_finish_events ();
901
899/* From nsterm.m, needed in nsfont.m. */ 902/* From nsterm.m, needed in nsfont.m. */
900#ifdef __OBJC__ 903#ifdef __OBJC__
901extern void 904extern void
diff --git a/src/nsterm.m b/src/nsterm.m
index 059ae6d0cd6..ba94d28b797 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -396,6 +396,19 @@ void x_set_frame_alpha (struct frame *f);
396 396
397 ========================================================================== */ 397 ========================================================================== */
398 398
399void
400ns_init_events (struct input_event* ev)
401{
402 EVENT_INIT (*ev);
403 emacs_event = ev;
404}
405
406void
407ns_finish_events ()
408{
409 emacs_event = NULL;
410}
411
399static void 412static void
400hold_event (struct input_event *event) 413hold_event (struct input_event *event)
401{ 414{
@@ -3606,8 +3619,7 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3606 3619
3607 block_input (); 3620 block_input ();
3608 n_emacs_events_pending = 0; 3621 n_emacs_events_pending = 0;
3609 EVENT_INIT (ev); 3622 ns_init_events (&ev);
3610 emacs_event = &ev;
3611 q_event_ptr = hold_quit; 3623 q_event_ptr = hold_quit;
3612 3624
3613 /* we manage autorelease pools by allocate/reallocate each time around 3625 /* we manage autorelease pools by allocate/reallocate each time around
@@ -3648,7 +3660,8 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3648 3660
3649 nevents = n_emacs_events_pending; 3661 nevents = n_emacs_events_pending;
3650 n_emacs_events_pending = 0; 3662 n_emacs_events_pending = 0;
3651 emacs_event = q_event_ptr = NULL; 3663 ns_finish_events ();
3664 q_event_ptr = NULL;
3652 unblock_input (); 3665 unblock_input ();
3653 3666
3654 return nevents; 3667 return nevents;
@@ -3743,16 +3756,15 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
3743 ns_send_appdefined (-1); 3756 ns_send_appdefined (-1);
3744 } 3757 }
3745 3758
3746 EVENT_INIT (event);
3747 block_input (); 3759 block_input ();
3748 emacs_event = &event; 3760 ns_init_events (&event);
3749 if (++apploopnr != 1) 3761 if (++apploopnr != 1)
3750 { 3762 {
3751 emacs_abort (); 3763 emacs_abort ();
3752 } 3764 }
3753 [NSApp run]; 3765 [NSApp run];
3754 --apploopnr; 3766 --apploopnr;
3755 emacs_event = NULL; 3767 ns_finish_events ();
3756 if (nr > 0 && readfds) 3768 if (nr > 0 && readfds)
3757 { 3769 {
3758 c = 's'; 3770 c = 's';