aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2005-01-16 09:17:02 +0000
committerJan Djärv2005-01-16 09:17:02 +0000
commita2d5fca0444b5e1a83d8c84f21674f2ba48d0a26 (patch)
treec5f712f5f50816d26220722ae20797f2b7d983d6 /src
parent42187e99f8adc31d93d027b9017160731aab8972 (diff)
downloademacs-a2d5fca0444b5e1a83d8c84f21674f2ba48d0a26.tar.gz
emacs-a2d5fca0444b5e1a83d8c84f21674f2ba48d0a26.zip
* keyboard.c (READABLE_EVENTS_DO_TIMERS_NOW)
(READABLE_EVENTS_FILTER_EVENTS) (READABLE_EVENTS_IGNORE_SQUEEZABLES): New flags for readable_events. get_filtered_input_pending, readable_filtered_events): Removed. (tracking_off): Call readable_events and get_input_pending with flag READABLE_EVENTS_DO_TIMERS_NOW. (readable_events): Move code from old readable_filtered_events here, but check new READABLE_EVENTS_* in argument flags instead of previous two boolean arguments do_timers_now and filter_events. If we are doing mouse tracking and the mouse moved, return only if READABLE_EVENTS_IGNORE_SQUEEZABLES is not set in flags. (swallow_events): Call get_input_pending with flag READABLE_EVENTS_DO_TIMERS_NOW. (get_input_pending): Move code from old get_filtered_input_pending here. Replace boolean arguments do_timers_now, filter_events with flags, and pass flags to readable_events. Document new READABLE_EVENTS_* flags. (detect_input_pending_ignore_squeezables): New function. (detect_input_pending_run_timers): Call get_input_pending with flag READABLE_EVENTS_DO_TIMERS_NOW. (Finput_pending_p): Call get_input_pending with flags READABLE_EVENTS_DO_TIMERS_NOW and READABLE_EVENTS_FILTER_EVENTS. * dispnew.c (update_window, update_frame_1): Replace calls to detect_input_pending with detect_input_pending_ignore_squeezables so that redisplay is not paused if the event queue contains only mouse movements. * lisp.h: Declare detect_input_pending_ignore_squeezables.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog32
-rw-r--r--src/dispnew.c8
-rw-r--r--src/keyboard.c93
-rw-r--r--src/lisp.h1
4 files changed, 81 insertions, 53 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index eb87729133d..57be0b86123 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,35 @@
12005-01-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * keyboard.c (READABLE_EVENTS_DO_TIMERS_NOW)
4 (READABLE_EVENTS_FILTER_EVENTS)
5 (READABLE_EVENTS_IGNORE_SQUEEZABLES): New flags for readable_events.
6 get_filtered_input_pending, readable_filtered_events): Removed.
7 (tracking_off): Call readable_events and get_input_pending with
8 flag READABLE_EVENTS_DO_TIMERS_NOW.
9 (readable_events): Move code from old readable_filtered_events here,
10 but check new READABLE_EVENTS_* in argument flags instead of previous
11 two boolean arguments do_timers_now and filter_events.
12 If we are doing mouse tracking and the mouse moved, return only if
13 READABLE_EVENTS_IGNORE_SQUEEZABLES is not set in flags.
14 (swallow_events): Call get_input_pending with flag
15 READABLE_EVENTS_DO_TIMERS_NOW.
16 (get_input_pending): Move code from old get_filtered_input_pending
17 here. Replace boolean arguments do_timers_now, filter_events with
18 flags, and pass flags to readable_events. Document new
19 READABLE_EVENTS_* flags.
20 (detect_input_pending_ignore_squeezables): New function.
21 (detect_input_pending_run_timers): Call get_input_pending with flag
22 READABLE_EVENTS_DO_TIMERS_NOW.
23 (Finput_pending_p): Call get_input_pending with flags
24 READABLE_EVENTS_DO_TIMERS_NOW and READABLE_EVENTS_FILTER_EVENTS.
25
26 * dispnew.c (update_window, update_frame_1): Replace calls to
27 detect_input_pending with detect_input_pending_ignore_squeezables
28 so that redisplay is not paused if the event queue contains only
29 mouse movements.
30
31 * lisp.h: Declare detect_input_pending_ignore_squeezables.
32
12005-01-15 Steven Tamm <steventamm@mac.com> 332005-01-15 Steven Tamm <steventamm@mac.com>
2 34
3 * macterm.c (Vmac_use_core_graphics): defined for 35 * macterm.c (Vmac_use_core_graphics): defined for
diff --git a/src/dispnew.c b/src/dispnew.c
index 78ca0e39109..ff26a4dc66c 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4075,7 +4075,7 @@ update_window (w, force_p)
4075 if (redisplay_dont_pause) 4075 if (redisplay_dont_pause)
4076 force_p = 1; 4076 force_p = 1;
4077 else 4077 else
4078 detect_input_pending (); 4078 detect_input_pending_ignore_squeezables ();
4079 4079
4080 /* If forced to complete the update, or if no input is pending, do 4080 /* If forced to complete the update, or if no input is pending, do
4081 the update. */ 4081 the update. */
@@ -4149,7 +4149,7 @@ update_window (w, force_p)
4149 scrolling large windows with repeated scroll-up 4149 scrolling large windows with repeated scroll-up
4150 commands will too quickly pause redisplay. */ 4150 commands will too quickly pause redisplay. */
4151 if (!force_p && ++n_updated % preempt_count == 0) 4151 if (!force_p && ++n_updated % preempt_count == 0)
4152 detect_input_pending (); 4152 detect_input_pending_ignore_squeezables ();
4153 4153
4154 changed_p |= update_window_line (w, vpos, 4154 changed_p |= update_window_line (w, vpos,
4155 &mouse_face_overwritten_p); 4155 &mouse_face_overwritten_p);
@@ -5093,7 +5093,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
5093 5093
5094 if (redisplay_dont_pause) 5094 if (redisplay_dont_pause)
5095 force_p = 1; 5095 force_p = 1;
5096 else if (!force_p && detect_input_pending ()) 5096 else if (!force_p && detect_input_pending_ignore_squeezables ())
5097 { 5097 {
5098 pause = 1; 5098 pause = 1;
5099 goto do_pause; 5099 goto do_pause;
@@ -5149,7 +5149,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
5149 } 5149 }
5150 5150
5151 if ((i - 1) % preempt_count == 0) 5151 if ((i - 1) % preempt_count == 0)
5152 detect_input_pending (); 5152 detect_input_pending_ignore_squeezables ();
5153 5153
5154 update_frame_line (f, i); 5154 update_frame_line (f, i);
5155 } 5155 }
diff --git a/src/keyboard.c b/src/keyboard.c
index fb52c7e9f61..3b7d2aac981 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -646,14 +646,17 @@ static EMACS_TIME timer_last_idleness_start_time;
646 646
647/* Global variable declarations. */ 647/* Global variable declarations. */
648 648
649/* Flags for readable_events. */
650#define READABLE_EVENTS_DO_TIMERS_NOW (1 << 0)
651#define READABLE_EVENTS_FILTER_EVENTS (1 << 1)
652#define READABLE_EVENTS_IGNORE_SQUEEZABLES (1 << 2)
653
649/* Function for init_keyboard to call with no args (if nonzero). */ 654/* Function for init_keyboard to call with no args (if nonzero). */
650void (*keyboard_init_hook) (); 655void (*keyboard_init_hook) ();
651 656
652static int read_avail_input P_ ((int)); 657static int read_avail_input P_ ((int));
653static void get_input_pending P_ ((int *, int)); 658static void get_input_pending P_ ((int *, int));
654static void get_filtered_input_pending P_ ((int *, int, int));
655static int readable_events P_ ((int)); 659static int readable_events P_ ((int));
656static int readable_filtered_events P_ ((int, int));
657static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *, 660static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *,
658 Lisp_Object, int *)); 661 Lisp_Object, int *));
659static Lisp_Object read_char_x_menu_prompt (); 662static Lisp_Object read_char_x_menu_prompt ();
@@ -3441,10 +3444,11 @@ tracking_off (old_value)
3441 input has been processed. If the only input available was 3444 input has been processed. If the only input available was
3442 the sort that we have just disabled, then we need to call 3445 the sort that we have just disabled, then we need to call
3443 redisplay. */ 3446 redisplay. */
3444 if (!readable_events (1)) 3447 if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW))
3445 { 3448 {
3446 redisplay_preserve_echo_area (6); 3449 redisplay_preserve_echo_area (6);
3447 get_input_pending (&input_pending, 1); 3450 get_input_pending (&input_pending,
3451 READABLE_EVENTS_DO_TIMERS_NOW);
3448 } 3452 }
3449 } 3453 }
3450 return Qnil; 3454 return Qnil;
@@ -3496,20 +3500,19 @@ some_mouse_moved ()
3496/* Return true iff there are any events in the queue that read-char 3500/* Return true iff there are any events in the queue that read-char
3497 would return. If this returns false, a read-char would block. */ 3501 would return. If this returns false, a read-char would block. */
3498static int 3502static int
3499readable_filtered_events (do_timers_now, filter_events) 3503readable_events (flags)
3500 int do_timers_now; 3504 int flags;
3501 int filter_events;
3502{ 3505{
3503 if (do_timers_now) 3506 if (flags & READABLE_EVENTS_DO_TIMERS_NOW)
3504 timer_check (do_timers_now); 3507 timer_check (1);
3505 3508
3506 /* If the buffer contains only FOCUS_IN_EVENT events, 3509 /* If the buffer contains only FOCUS_IN_EVENT events, and
3507 and FILTER_EVENTS is nonzero, report it as empty. */ 3510 READABLE_EVENTS_FILTER_EVENTS is set, report it as empty. */
3508 if (kbd_fetch_ptr != kbd_store_ptr) 3511 if (kbd_fetch_ptr != kbd_store_ptr)
3509 { 3512 {
3510 int have_live_event = 1; 3513 int have_live_event = 1;
3511 3514
3512 if (filter_events) 3515 if (flags & READABLE_EVENTS_FILTER_EVENTS)
3513 { 3516 {
3514 struct input_event *event; 3517 struct input_event *event;
3515 3518
@@ -3530,7 +3533,8 @@ readable_filtered_events (do_timers_now, filter_events)
3530 } 3533 }
3531 3534
3532#ifdef HAVE_MOUSE 3535#ifdef HAVE_MOUSE
3533 if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 3536 if (!(flags & READABLE_EVENTS_IGNORE_SQUEEZABLES)
3537 && !NILP (do_mouse_tracking) && some_mouse_moved ())
3534 return 1; 3538 return 1;
3535#endif 3539#endif
3536 if (single_kboard) 3540 if (single_kboard)
@@ -3548,15 +3552,6 @@ readable_filtered_events (do_timers_now, filter_events)
3548 return 0; 3552 return 0;
3549} 3553}
3550 3554
3551/* Return true iff there are any events in the queue that read-char
3552 would return. If this returns false, a read-char would block. */
3553static int
3554readable_events (do_timers_now)
3555 int do_timers_now;
3556{
3557 return readable_filtered_events (do_timers_now, 0);
3558}
3559
3560/* Set this for debugging, to have a way to get out */ 3555/* Set this for debugging, to have a way to get out */
3561int stop_character; 3556int stop_character;
3562 3557
@@ -4227,7 +4222,7 @@ swallow_events (do_display)
4227 } 4222 }
4228 4223
4229 old_timers_run = timers_run; 4224 old_timers_run = timers_run;
4230 get_input_pending (&input_pending, 1); 4225 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
4231 4226
4232 if (timers_run != old_timers_run && do_display) 4227 if (timers_run != old_timers_run && do_display)
4233 redisplay_preserve_echo_area (7); 4228 redisplay_preserve_echo_area (7);
@@ -6519,18 +6514,20 @@ lucid_event_type_list_p (object)
6519 but works even if FIONREAD does not exist. 6514 but works even if FIONREAD does not exist.
6520 (In fact, this may actually read some input.) 6515 (In fact, this may actually read some input.)
6521 6516
6522 If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe. 6517 If READABLE_EVENTS_DO_TIMERS_NOW is set in FLAGS, actually run
6523 If FILTER_EVENTS is nonzero, ignore internal events (FOCUS_IN_EVENT). */ 6518 timer events that are ripe.
6519 If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal
6520 events (FOCUS_IN_EVENT).
6521 If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse
6522 movements. */
6524 6523
6525static void 6524static void
6526get_filtered_input_pending (addr, do_timers_now, filter_events) 6525get_input_pending (addr, flags)
6527 int *addr; 6526 int *addr;
6528 int do_timers_now; 6527 int flags;
6529 int filter_events;
6530{ 6528{
6531 /* First of all, have we already counted some input? */ 6529 /* First of all, have we already counted some input? */
6532 *addr = (!NILP (Vquit_flag) 6530 *addr = (!NILP (Vquit_flag) || readable_events (flags));
6533 || readable_filtered_events (do_timers_now, filter_events));
6534 6531
6535 /* If input is being read as it arrives, and we have none, there is none. */ 6532 /* If input is being read as it arrives, and we have none, there is none. */
6536 if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) 6533 if (*addr > 0 || (interrupt_input && ! interrupts_deferred))
@@ -6538,23 +6535,7 @@ get_filtered_input_pending (addr, do_timers_now, filter_events)
6538 6535
6539 /* Try to read some input and see how much we get. */ 6536 /* Try to read some input and see how much we get. */
6540 gobble_input (0); 6537 gobble_input (0);
6541 *addr = (!NILP (Vquit_flag) 6538 *addr = (!NILP (Vquit_flag) || readable_events (flags));
6542 || readable_filtered_events (do_timers_now, filter_events));
6543}
6544
6545/* Store into *addr a value nonzero if terminal input chars are available.
6546 Serves the purpose of ioctl (0, FIONREAD, addr)
6547 but works even if FIONREAD does not exist.
6548 (In fact, this may actually read some input.)
6549
6550 If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe. */
6551
6552static void
6553get_input_pending (addr, do_timers_now)
6554 int *addr;
6555 int do_timers_now;
6556{
6557 get_filtered_input_pending (addr, do_timers_now, 0);
6558} 6539}
6559 6540
6560/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ 6541/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */
@@ -9871,6 +9852,18 @@ detect_input_pending ()
9871 return input_pending; 9852 return input_pending;
9872} 9853}
9873 9854
9855/* Return nonzero if input events other than mouse movements are
9856 pending. */
9857
9858int
9859detect_input_pending_ignore_squeezables ()
9860{
9861 if (!input_pending)
9862 get_input_pending (&input_pending, READABLE_EVENTS_IGNORE_SQUEEZABLES);
9863
9864 return input_pending;
9865}
9866
9874/* Return nonzero if input events are pending, and run any pending timers. */ 9867/* Return nonzero if input events are pending, and run any pending timers. */
9875 9868
9876int 9869int
@@ -9880,7 +9873,7 @@ detect_input_pending_run_timers (do_display)
9880 int old_timers_run = timers_run; 9873 int old_timers_run = timers_run;
9881 9874
9882 if (!input_pending) 9875 if (!input_pending)
9883 get_input_pending (&input_pending, 1); 9876 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
9884 9877
9885 if (old_timers_run != timers_run && do_display) 9878 if (old_timers_run != timers_run && do_display)
9886 { 9879 {
@@ -9929,7 +9922,9 @@ if there is a doubt, the value is t. */)
9929 if (!NILP (Vunread_command_events) || unread_command_char != -1) 9922 if (!NILP (Vunread_command_events) || unread_command_char != -1)
9930 return (Qt); 9923 return (Qt);
9931 9924
9932 get_filtered_input_pending (&input_pending, 1, 1); 9925 get_input_pending (&input_pending,
9926 READABLE_EVENTS_DO_TIMERS_NOW
9927 | READABLE_EVENTS_FILTER_EVENTS);
9933 return input_pending > 0 ? Qt : Qnil; 9928 return input_pending > 0 ? Qt : Qnil;
9934} 9929}
9935 9930
diff --git a/src/lisp.h b/src/lisp.h
index f6db53f2ff8..49acb225e1e 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2906,6 +2906,7 @@ EXFUN (Fevent_convert_list, 1);
2906EXFUN (Fread_key_sequence, 5); 2906EXFUN (Fread_key_sequence, 5);
2907EXFUN (Fset_input_mode, 4); 2907EXFUN (Fset_input_mode, 4);
2908extern int detect_input_pending P_ ((void)); 2908extern int detect_input_pending P_ ((void));
2909extern int detect_input_pending_ignore_squeezables P_ ((void));
2909extern int detect_input_pending_run_timers P_ ((int)); 2910extern int detect_input_pending_run_timers P_ ((int));
2910extern void safe_run_hooks P_ ((Lisp_Object)); 2911extern void safe_run_hooks P_ ((Lisp_Object));
2911extern void cmd_error_internal P_ ((Lisp_Object, char *)); 2912extern void cmd_error_internal P_ ((Lisp_Object, char *));