diff options
| author | Jan Djärv | 2002-06-28 19:47:49 +0000 |
|---|---|---|
| committer | Jan Djärv | 2002-06-28 19:47:49 +0000 |
| commit | 20057d5215674d9c83b79fafedf37bf36b2fd0ae (patch) | |
| tree | 004d92c76a84b15012c7451b728a4297da709831 /src | |
| parent | cab34f502151e68c823be6242044d77c4f2e5f8b (diff) | |
| download | emacs-20057d5215674d9c83b79fafedf37bf36b2fd0ae.tar.gz emacs-20057d5215674d9c83b79fafedf37bf36b2fd0ae.zip | |
(readable_filtered_events): New function.
(readable_events): Call readable_filtered_events.
(get_filtered_input_pending): New function.
(get_input_pending): Call get_filtered_input_pending.
(Finput_pending_p): Call get_filtered_input_pending.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/keyboard.c | 78 |
2 files changed, 77 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d3898130d7c..b7a6e0f9111 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2002-06-28 Jan D. <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * keyboard.c (readable_filtered_events): New function that filters | ||
| 4 | FOCUS_IN_EVENT depending on parameter. | ||
| 5 | (readable_events): Calls readable_filtered_events, not filtering | ||
| 6 | FOCUS_IN_EVENT. | ||
| 7 | (get_filtered_input_pending): New function, filtering parameter passed | ||
| 8 | to readable_filtered_events. | ||
| 9 | (get_input_pending): Calls get_filtered_input_pending, not filtering | ||
| 10 | FOCUS_IN_EVENT. | ||
| 11 | (Finput_pending_p): Calls get_filtered_input_pending, DO filter | ||
| 12 | FOCUS_IN_EVENT. | ||
| 13 | |||
| 14 | * xterm.h (struct x_output): Add focus_state. | ||
| 15 | |||
| 16 | * xterm.c (x_focus_changed): New function. | ||
| 17 | (x_detect_focus_change): New function. | ||
| 18 | (XTread_socket): Call x_detect_focus_change for FocusIn/FocusOut | ||
| 19 | EnterNotify and LeaveNotify to track X focus changes. | ||
| 20 | |||
| 1 | 2002-06-28 Andreas Schwab <schwab@suse.de> | 21 | 2002-06-28 Andreas Schwab <schwab@suse.de> |
| 2 | 22 | ||
| 3 | * lisp.h: Remove duplicate declaration of | 23 | * lisp.h: Remove duplicate declaration of |
diff --git a/src/keyboard.c b/src/keyboard.c index ef4a5028ae3..99f060533ea 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -672,7 +672,9 @@ void (*keyboard_init_hook) (); | |||
| 672 | 672 | ||
| 673 | static int read_avail_input P_ ((int)); | 673 | static int read_avail_input P_ ((int)); |
| 674 | static void get_input_pending P_ ((int *, int)); | 674 | static void get_input_pending P_ ((int *, int)); |
| 675 | static void get_filtered_input_pending P_ ((int *, int, int)); | ||
| 675 | static int readable_events P_ ((int)); | 676 | static int readable_events P_ ((int)); |
| 677 | static int readable_filtered_events P_ ((int, int)); | ||
| 676 | static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *, | 678 | static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *, |
| 677 | Lisp_Object, int *)); | 679 | Lisp_Object, int *)); |
| 678 | static Lisp_Object read_char_x_menu_prompt (); | 680 | static Lisp_Object read_char_x_menu_prompt (); |
| @@ -3253,31 +3255,37 @@ some_mouse_moved () | |||
| 3253 | /* Return true iff there are any events in the queue that read-char | 3255 | /* Return true iff there are any events in the queue that read-char |
| 3254 | would return. If this returns false, a read-char would block. */ | 3256 | would return. If this returns false, a read-char would block. */ |
| 3255 | static int | 3257 | static int |
| 3256 | readable_events (do_timers_now) | 3258 | readable_filtered_events (do_timers_now, filter_events) |
| 3257 | int do_timers_now; | 3259 | int do_timers_now; |
| 3260 | int filter_events; | ||
| 3258 | { | 3261 | { |
| 3259 | if (do_timers_now) | 3262 | if (do_timers_now) |
| 3260 | timer_check (do_timers_now); | 3263 | timer_check (do_timers_now); |
| 3261 | 3264 | ||
| 3262 | /* If the buffer contains only FOCUS_IN_EVENT events, | 3265 | /* If the buffer contains only FOCUS_IN_EVENT events, |
| 3263 | report it as empty. */ | 3266 | and FILTER_EVENTS is nonzero, report it as empty. */ |
| 3264 | if (kbd_fetch_ptr != kbd_store_ptr) | 3267 | if (kbd_fetch_ptr != kbd_store_ptr) |
| 3265 | { | 3268 | { |
| 3266 | struct input_event *event; | 3269 | int have_live_event = 1; |
| 3267 | |||
| 3268 | event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE) | ||
| 3269 | ? kbd_fetch_ptr | ||
| 3270 | : kbd_buffer); | ||
| 3271 | 3270 | ||
| 3272 | while (event->kind == FOCUS_IN_EVENT) | 3271 | if (filter_events) |
| 3273 | { | 3272 | { |
| 3274 | event++; | 3273 | struct input_event *event; |
| 3275 | if (event == kbd_buffer + KBD_BUFFER_SIZE) | 3274 | |
| 3276 | event = kbd_buffer; | 3275 | event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE) |
| 3277 | if (event == kbd_store_ptr) | 3276 | ? kbd_fetch_ptr |
| 3278 | return 0; | 3277 | : kbd_buffer); |
| 3279 | } | 3278 | |
| 3280 | return 1; | 3279 | while (have_live_event && event->kind == FOCUS_IN_EVENT) |
| 3280 | { | ||
| 3281 | event++; | ||
| 3282 | if (event == kbd_buffer + KBD_BUFFER_SIZE) | ||
| 3283 | event = kbd_buffer; | ||
| 3284 | if (event == kbd_store_ptr) | ||
| 3285 | have_live_event = 0; | ||
| 3286 | } | ||
| 3287 | } | ||
| 3288 | if (have_live_event) return 1; | ||
| 3281 | } | 3289 | } |
| 3282 | 3290 | ||
| 3283 | #ifdef HAVE_MOUSE | 3291 | #ifdef HAVE_MOUSE |
| @@ -3299,6 +3307,15 @@ readable_events (do_timers_now) | |||
| 3299 | return 0; | 3307 | return 0; |
| 3300 | } | 3308 | } |
| 3301 | 3309 | ||
| 3310 | /* Return true iff there are any events in the queue that read-char | ||
| 3311 | would return. If this returns false, a read-char would block. */ | ||
| 3312 | static int | ||
| 3313 | readable_events (do_timers_now) | ||
| 3314 | int do_timers_now; | ||
| 3315 | { | ||
| 3316 | return readable_filtered_events (do_timers_now, 0); | ||
| 3317 | } | ||
| 3318 | |||
| 3302 | /* Set this for debugging, to have a way to get out */ | 3319 | /* Set this for debugging, to have a way to get out */ |
| 3303 | int stop_character; | 3320 | int stop_character; |
| 3304 | 3321 | ||
| @@ -6144,15 +6161,18 @@ lucid_event_type_list_p (object) | |||
| 6144 | but works even if FIONREAD does not exist. | 6161 | but works even if FIONREAD does not exist. |
| 6145 | (In fact, this may actually read some input.) | 6162 | (In fact, this may actually read some input.) |
| 6146 | 6163 | ||
| 6147 | If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe. */ | 6164 | If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe. |
| 6165 | If FILTER_EVENTS is nonzero, ignore internal events (FOCUS_IN_EVENT). */ | ||
| 6148 | 6166 | ||
| 6149 | static void | 6167 | static void |
| 6150 | get_input_pending (addr, do_timers_now) | 6168 | get_filtered_input_pending (addr, do_timers_now, filter_events) |
| 6151 | int *addr; | 6169 | int *addr; |
| 6152 | int do_timers_now; | 6170 | int do_timers_now; |
| 6171 | int filter_events; | ||
| 6153 | { | 6172 | { |
| 6154 | /* First of all, have we already counted some input? */ | 6173 | /* First of all, have we already counted some input? */ |
| 6155 | *addr = !NILP (Vquit_flag) || readable_events (do_timers_now); | 6174 | *addr = (!NILP (Vquit_flag) |
| 6175 | || readable_filtered_events (do_timers_now, filter_events)); | ||
| 6156 | 6176 | ||
| 6157 | /* If input is being read as it arrives, and we have none, there is none. */ | 6177 | /* If input is being read as it arrives, and we have none, there is none. */ |
| 6158 | if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) | 6178 | if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) |
| @@ -6160,7 +6180,23 @@ get_input_pending (addr, do_timers_now) | |||
| 6160 | 6180 | ||
| 6161 | /* Try to read some input and see how much we get. */ | 6181 | /* Try to read some input and see how much we get. */ |
| 6162 | gobble_input (0); | 6182 | gobble_input (0); |
| 6163 | *addr = !NILP (Vquit_flag) || readable_events (do_timers_now); | 6183 | *addr = (!NILP (Vquit_flag) |
| 6184 | || readable_filtered_events (do_timers_now, filter_events)); | ||
| 6185 | } | ||
| 6186 | |||
| 6187 | /* Store into *addr a value nonzero if terminal input chars are available. | ||
| 6188 | Serves the purpose of ioctl (0, FIONREAD, addr) | ||
| 6189 | but works even if FIONREAD does not exist. | ||
| 6190 | (In fact, this may actually read some input.) | ||
| 6191 | |||
| 6192 | If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe. */ | ||
| 6193 | |||
| 6194 | static void | ||
| 6195 | get_input_pending (addr, do_timers_now) | ||
| 6196 | int *addr; | ||
| 6197 | int do_timers_now; | ||
| 6198 | { | ||
| 6199 | get_filtered_input_pending (addr, do_timers_now, 0); | ||
| 6164 | } | 6200 | } |
| 6165 | 6201 | ||
| 6166 | /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ | 6202 | /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ |
| @@ -9563,7 +9599,7 @@ if there is a doubt, the value is t. */) | |||
| 9563 | if (!NILP (Vunread_command_events) || unread_command_char != -1) | 9599 | if (!NILP (Vunread_command_events) || unread_command_char != -1) |
| 9564 | return (Qt); | 9600 | return (Qt); |
| 9565 | 9601 | ||
| 9566 | get_input_pending (&input_pending, 1); | 9602 | get_filtered_input_pending (&input_pending, 1, 1); |
| 9567 | return input_pending > 0 ? Qt : Qnil; | 9603 | return input_pending > 0 ? Qt : Qnil; |
| 9568 | } | 9604 | } |
| 9569 | 9605 | ||