aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2012-10-12 19:50:39 +0200
committerJan Djärv2012-10-12 19:50:39 +0200
commit167e3640f16a3825f6189111caf86a743e5282e5 (patch)
treebb181f0246ce672d9e8b3c552349011feede653c /src
parentc40239dff913de4a404f97568a755deb2086db76 (diff)
downloademacs-167e3640f16a3825f6189111caf86a743e5282e5.tar.gz
emacs-167e3640f16a3825f6189111caf86a743e5282e5.zip
* nsterm.m (hold_event_q): New static variable.
(EV_TRAILER, sendScrollEventAtLoc:fromEvent:): Call hold_event if ! q_event_ptr. (hold_event): New function. (ns_read_socket): If hold_event_q have events, store them and return. (setPosition:portion:whole:): Send SIGIO to ourselves if apploopnr is zero (Bug#12384).
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/nsterm.m39
2 files changed, 48 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 42f96587ccc..d6429501059 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12012-10-12 Jan Djärv <jan.h.d@swipnet.se>
2
3 * nsterm.m (hold_event_q): New static variable.
4 (EV_TRAILER, sendScrollEventAtLoc:fromEvent:): Call hold_event if
5 ! q_event_ptr.
6 (hold_event): New function.
7 (ns_read_socket): If hold_event_q have events, store them and
8 return (Bug#12384).
9 (setPosition:portion:whole:): Send SIGIO to ourselves if apploopnr
10 is zero (Bug#12384).
11
12012-10-12 Juanma Barranquero <lekktu@gmail.com> 122012-10-12 Juanma Barranquero <lekktu@gmail.com>
2 13
3 * makefile.w32-in ($(BLD)/w32select.$(O)): Update dependencies. 14 * makefile.w32-in ($(BLD)/w32select.$(O)): Update dependencies.
diff --git a/src/nsterm.m b/src/nsterm.m
index 1d935fc76de..98dd0a8aab1 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -208,6 +208,13 @@ static NSMutableArray *ns_pending_files, *ns_pending_service_names,
208 *ns_pending_service_args; 208 *ns_pending_service_args;
209static BOOL ns_do_open_file = NO; 209static BOOL ns_do_open_file = NO;
210 210
211static struct {
212 struct input_event *q;
213 int nr, cap;
214} hold_event_q = {
215 NULL, 0, 0
216};
217
211/* Convert modifiers in a NeXTstep event to emacs style modifiers. */ 218/* Convert modifiers in a NeXTstep event to emacs style modifiers. */
212#define NS_FUNCTION_KEY_MASK 0x800000 219#define NS_FUNCTION_KEY_MASK 0x800000
213#define NSLeftControlKeyMask (0x000001 | NSControlKeyMask) 220#define NSLeftControlKeyMask (0x000001 | NSControlKeyMask)
@@ -273,7 +280,7 @@ static BOOL ns_do_open_file = NO;
273 kbd_buffer_store_event_hold (emacs_event, q_event_ptr); \ 280 kbd_buffer_store_event_hold (emacs_event, q_event_ptr); \
274 } \ 281 } \
275 else \ 282 else \
276 kbd_buffer_store_event (emacs_event); \ 283 hold_event (emacs_event); \
277 EVENT_INIT (*emacs_event); \ 284 EVENT_INIT (*emacs_event); \
278 ns_send_appdefined (-1); \ 285 ns_send_appdefined (-1); \
279 } 286 }
@@ -292,6 +299,19 @@ void x_set_frame_alpha (struct frame *f);
292 299
293 ========================================================================== */ 300 ========================================================================== */
294 301
302static void
303hold_event (struct input_event *event)
304{
305 if (hold_event_q.nr == hold_event_q.cap)
306 {
307 if (hold_event_q.cap == 0) hold_event_q.cap = 10;
308 else hold_event_q.cap *= 2;
309 hold_event_q.q = (struct input_event *)
310 xrealloc (hold_event_q.q, hold_event_q.cap * sizeof (*hold_event_q.q));
311 }
312
313 hold_event_q.q[hold_event_q.nr++] = *event;
314}
295 315
296static Lisp_Object 316static Lisp_Object
297append2 (Lisp_Object list, Lisp_Object item) 317append2 (Lisp_Object list, Lisp_Object item)
@@ -3348,6 +3368,15 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3348 if ([NSApp modalWindow] != nil) 3368 if ([NSApp modalWindow] != nil)
3349 return -1; 3369 return -1;
3350 3370
3371 if (hold_event_q.nr > 0)
3372 {
3373 int i;
3374 for (i = 0; i < hold_event_q.nr; ++i)
3375 kbd_buffer_store_event_hold (&hold_event_q.q[i], hold_quit);
3376 hold_event_q.nr = 0;
3377 return i;
3378 }
3379
3351 block_input (); 3380 block_input ();
3352 n_emacs_events_pending = 0; 3381 n_emacs_events_pending = 0;
3353 EVENT_INIT (ev); 3382 EVENT_INIT (ev);
@@ -6645,6 +6674,12 @@ not_in_argv (NSString *arg)
6645 [self setFloatValue: pos knobProportion: por]; 6674 [self setFloatValue: pos knobProportion: por];
6646#endif 6675#endif
6647 } 6676 }
6677
6678 /* Events may come here even if the event loop is not running.
6679 If we don't enter the event loop, the scroll bar will not update.
6680 So send SIGIO to ourselves. */
6681 if (apploopnr == 0) kill (0, SIGIO);
6682
6648 return self; 6683 return self;
6649} 6684}
6650 6685
@@ -6685,7 +6720,7 @@ not_in_argv (NSString *arg)
6685 kbd_buffer_store_event_hold (emacs_event, q_event_ptr); 6720 kbd_buffer_store_event_hold (emacs_event, q_event_ptr);
6686 } 6721 }
6687 else 6722 else
6688 kbd_buffer_store_event (emacs_event); 6723 hold_event (emacs_event);
6689 EVENT_INIT (*emacs_event); 6724 EVENT_INIT (*emacs_event);
6690 ns_send_appdefined (-1); 6725 ns_send_appdefined (-1);
6691} 6726}