From 64ccff5f0ed8f0347b30e8fb4bd9b18a6cbaf1c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Sun, 28 Oct 2012 17:10:06 +0100 Subject: [PATCH] * nsterm.m (NO_APPDEFINED_DATA): New define. (last_appdefined_event_data): New variable (last_appdefined_event): Remove. (ns_select): Initialize t from last_appdefined_event_data instead of [last_appdefined_event data1]. (sendEvent:): Save [theEvent data1] to last_appdefined_event_data, remove last_appdefined_event. Fixes: debbugs:12698 --- src/ChangeLog | 10 ++++++++++ src/nsterm.m | 19 +++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 41909a7a663..d2c16fa8310 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2012-10-28 Jan Djärv + + * nsterm.m (NO_APPDEFINED_DATA): New define. + (last_appdefined_event_data): New variable + (last_appdefined_event): Remove. + (ns_select): Initialize t from last_appdefined_event_data instead + of [last_appdefined_event data1]. + (sendEvent:): Save [theEvent data1] to last_appdefined_event_data, + remove last_appdefined_event (Bug#12698). + 2012-10-28 Stefan Monnier * frame.c (x_set_font): Catch internal error. diff --git a/src/nsterm.m b/src/nsterm.m index a4eaad47ac1..9b2e544c75b 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -190,7 +190,8 @@ static BOOL ns_menu_bar_is_hidden = NO; /* event loop */ static BOOL send_appdefined = YES; -static NSEvent *last_appdefined_event = 0; +#define NO_APPDEFINED_DATA (-8) +static int last_appdefined_event_data = NO_APPDEFINED_DATA; static NSTimer *timed_entry = 0; static NSTimer *scroll_repeat_entry = nil; static fd_set select_readfds, select_writefds; @@ -3436,8 +3437,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, -------------------------------------------------------------------------- */ { int result; - NSEvent *ev; - int k, nr = 0; + int t, k, nr = 0; struct input_event event; char c; @@ -3521,16 +3521,11 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, } unblock_input (); - ev = last_appdefined_event; + t = last_appdefined_event_data; - if (ev) + if (t != NO_APPDEFINED_DATA) { - int t; - if ([ev type] != NSApplicationDefined) - emacs_abort (); - - t = [ev data1]; - last_appdefined_event = 0; + last_appdefined_event_data = NO_APPDEFINED_DATA; if (t == -2) { @@ -4307,7 +4302,7 @@ ns_term_shutdown (int sig) modal loop. Just defer it until later. */ if ([NSApp modalWindow] == nil) { - last_appdefined_event = theEvent; + last_appdefined_event_data = [theEvent data1]; [self stop: self]; } else -- 2.39.2