diff options
| author | Richard M. Stallman | 1997-05-08 05:51:48 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-05-08 05:51:48 +0000 |
| commit | d925fb392a8b4f0f902fb41a02637660d2e726ce (patch) | |
| tree | 838b3efaeb84731c2cf9f75f211e046dc9e540d5 /src | |
| parent | 293a54ce2cc9fd90d6a5d37d358014fc7e1ee071 (diff) | |
| download | emacs-d925fb392a8b4f0f902fb41a02637660d2e726ce.tar.gz emacs-d925fb392a8b4f0f902fb41a02637660d2e726ce.zip | |
(Qtimer_event): Variable deleted.
(Qtimer_event_handler): New variable.
(syms_of_keyboard): Don't initialize Qtimer_event.
Do initialize Qtimer_event_handler.
(read_char): Don't check for timer event.
(swallow_events): Don't handle timer events.
(timer_check): Likewise.
(make_lispy_event): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 107 |
1 files changed, 19 insertions, 88 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index b16cb1a1f4a..958bd3a007c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Keyboard and mouse input; editor command loop. | 1 | /* Keyboard and mouse input; editor command loop. |
| 2 | Copyright (C) 1985,86,87,88,89,93,94,95,96 Free Software Foundation, Inc. | 2 | Copyright (C) 1985,86,87,88,89,93,94,95,96,97 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -314,6 +314,7 @@ Lisp_Object Qself_insert_command; | |||
| 314 | Lisp_Object Qforward_char; | 314 | Lisp_Object Qforward_char; |
| 315 | Lisp_Object Qbackward_char; | 315 | Lisp_Object Qbackward_char; |
| 316 | Lisp_Object Qundefined; | 316 | Lisp_Object Qundefined; |
| 317 | Lisp_Object Qtimer_event_handler; | ||
| 317 | 318 | ||
| 318 | /* read_key_sequence stores here the command definition of the | 319 | /* read_key_sequence stores here the command definition of the |
| 319 | key sequence that it reads. */ | 320 | key sequence that it reads. */ |
| @@ -440,7 +441,6 @@ Lisp_Object Qmake_frame_visible; | |||
| 440 | /* Symbols to denote kinds of events. */ | 441 | /* Symbols to denote kinds of events. */ |
| 441 | Lisp_Object Qfunction_key; | 442 | Lisp_Object Qfunction_key; |
| 442 | Lisp_Object Qmouse_click; | 443 | Lisp_Object Qmouse_click; |
| 443 | Lisp_Object Qtimer_event; | ||
| 444 | /* Lisp_Object Qmouse_movement; - also an event header */ | 444 | /* Lisp_Object Qmouse_movement; - also an event header */ |
| 445 | 445 | ||
| 446 | /* Properties of event headers. */ | 446 | /* Properties of event headers. */ |
| @@ -2069,7 +2069,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2069 | 2069 | ||
| 2070 | /* Now that we have read an event, Emacs is not idle-- | 2070 | /* Now that we have read an event, Emacs is not idle-- |
| 2071 | unless the event was a timer event (not used now). */ | 2071 | unless the event was a timer event (not used now). */ |
| 2072 | if (! (CONSP (c) && EQ (XCONS (c)->car, Qtimer_event))) | 2072 | if (! CONSP (c)) |
| 2073 | timer_stop_idle (); | 2073 | timer_stop_idle (); |
| 2074 | 2074 | ||
| 2075 | start_polling (); | 2075 | start_polling (); |
| @@ -2932,29 +2932,6 @@ swallow_events (do_display) | |||
| 2932 | abort (); | 2932 | abort (); |
| 2933 | #endif | 2933 | #endif |
| 2934 | } | 2934 | } |
| 2935 | /* Note that timer_event is currently never used. */ | ||
| 2936 | else if (event->kind == timer_event) | ||
| 2937 | { | ||
| 2938 | Lisp_Object tem, lisp_event; | ||
| 2939 | int was_locked = single_kboard; | ||
| 2940 | |||
| 2941 | tem = get_keymap_1 (Vspecial_event_map, 0, 0); | ||
| 2942 | tem = get_keyelt (access_keymap (tem, Qtimer_event, 0, 0), | ||
| 2943 | 1); | ||
| 2944 | lisp_event = Fcons (Qtimer_event, | ||
| 2945 | Fcons (Fcdr (event->frame_or_window), Qnil)); | ||
| 2946 | kbd_fetch_ptr = event + 1; | ||
| 2947 | if (kbd_fetch_ptr == kbd_store_ptr) | ||
| 2948 | input_pending = 0; | ||
| 2949 | Fcommand_execute (tem, Qnil, Fvector (1, &lisp_event), Qt); | ||
| 2950 | timers_run++; | ||
| 2951 | if (do_display) | ||
| 2952 | redisplay_preserve_echo_area (); | ||
| 2953 | |||
| 2954 | /* Resume allowing input from any kboard, if that was true before. */ | ||
| 2955 | if (!was_locked) | ||
| 2956 | any_kboard_state (); | ||
| 2957 | } | ||
| 2958 | else | 2935 | else |
| 2959 | break; | 2936 | break; |
| 2960 | } | 2937 | } |
| @@ -3025,8 +3002,6 @@ timer_check (do_it_now) | |||
| 3025 | EMACS_TIME nexttime; | 3002 | EMACS_TIME nexttime; |
| 3026 | EMACS_TIME now, idleness_now; | 3003 | EMACS_TIME now, idleness_now; |
| 3027 | Lisp_Object timers, idle_timers, chosen_timer; | 3004 | Lisp_Object timers, idle_timers, chosen_timer; |
| 3028 | /* Nonzero if we generate some events. */ | ||
| 3029 | int events_generated = 0; | ||
| 3030 | struct gcpro gcpro1, gcpro2, gcpro3; | 3005 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 3031 | 3006 | ||
| 3032 | EMACS_SET_SECS (nexttime, -1); | 3007 | EMACS_SET_SECS (nexttime, -1); |
| @@ -3163,64 +3138,27 @@ timer_check (do_it_now) | |||
| 3163 | { | 3138 | { |
| 3164 | if (NILP (vector[0])) | 3139 | if (NILP (vector[0])) |
| 3165 | { | 3140 | { |
| 3141 | Lisp_Object tem; | ||
| 3142 | int was_locked = single_kboard; | ||
| 3143 | int count = specpdl_ptr - specpdl; | ||
| 3144 | |||
| 3166 | /* Mark the timer as triggered to prevent problems if the lisp | 3145 | /* Mark the timer as triggered to prevent problems if the lisp |
| 3167 | code fails to reschedule it right. */ | 3146 | code fails to reschedule it right. */ |
| 3168 | vector[0] = Qt; | 3147 | vector[0] = Qt; |
| 3169 | 3148 | ||
| 3170 | /* Run the timer or queue a timer event. */ | 3149 | specbind (Qinhibit_quit, Qt); |
| 3171 | if (1) | ||
| 3172 | { | ||
| 3173 | Lisp_Object tem, event; | ||
| 3174 | int was_locked = single_kboard; | ||
| 3175 | int count = specpdl_ptr - specpdl; | ||
| 3176 | |||
| 3177 | specbind (Qinhibit_quit, Qt); | ||
| 3178 | 3150 | ||
| 3179 | tem = get_keymap_1 (Vspecial_event_map, 0, 0); | 3151 | call1 (Qtimer_event_handler, chosen_timer); |
| 3180 | tem = get_keyelt (access_keymap (tem, Qtimer_event, 0, 0), | 3152 | timers_run++; |
| 3181 | 1); | ||
| 3182 | event = Fcons (Qtimer_event, Fcons (chosen_timer, Qnil)); | ||
| 3183 | Fcommand_execute (tem, Qnil, Fvector (1, &event), Qt); | ||
| 3184 | timers_run++; | ||
| 3185 | 3153 | ||
| 3186 | unbind_to (count, Qnil); | 3154 | unbind_to (count, Qnil); |
| 3187 | 3155 | ||
| 3188 | /* Resume allowing input from any kboard, if that was true before. */ | 3156 | /* Resume allowing input from any kboard, if that was true before. */ |
| 3189 | if (!was_locked) | 3157 | if (!was_locked) |
| 3190 | any_kboard_state (); | 3158 | any_kboard_state (); |
| 3191 | 3159 | ||
| 3192 | /* Since we have handled the event, | 3160 | /* Since we have handled the event, |
| 3193 | we don't need to tell the caller to wake up and do it. */ | 3161 | we don't need to tell the caller to wake up and do it. */ |
| 3194 | } | ||
| 3195 | #if 0 | ||
| 3196 | else | ||
| 3197 | { | ||
| 3198 | /* Generate a timer event so the caller will handle it. */ | ||
| 3199 | struct input_event event; | ||
| 3200 | |||
| 3201 | event.kind = timer_event; | ||
| 3202 | event.modifiers = 0; | ||
| 3203 | event.x = event.y = Qnil; | ||
| 3204 | event.timestamp = triggertime; | ||
| 3205 | /* Store the timer in the frame slot. */ | ||
| 3206 | event.frame_or_window | ||
| 3207 | = Fcons (Fselected_frame (), chosen_timer); | ||
| 3208 | kbd_buffer_store_event (&event); | ||
| 3209 | |||
| 3210 | last_timer_event = event; | ||
| 3211 | |||
| 3212 | /* Tell caller to handle this event right away. */ | ||
| 3213 | events_generated = 1; | ||
| 3214 | EMACS_SET_SECS (nexttime, 0); | ||
| 3215 | EMACS_SET_USECS (nexttime, 0); | ||
| 3216 | |||
| 3217 | /* Don't queue more than one event at once. | ||
| 3218 | When Emacs is ready for another, it will | ||
| 3219 | queue the next one. */ | ||
| 3220 | UNGCPRO; | ||
| 3221 | return nexttime; | ||
| 3222 | } | ||
| 3223 | #endif /* 0 */ | ||
| 3224 | } | 3162 | } |
| 3225 | } | 3163 | } |
| 3226 | else | 3164 | else |
| @@ -3228,10 +3166,6 @@ timer_check (do_it_now) | |||
| 3228 | return the amount of time to wait before it is ripe. */ | 3166 | return the amount of time to wait before it is ripe. */ |
| 3229 | { | 3167 | { |
| 3230 | UNGCPRO; | 3168 | UNGCPRO; |
| 3231 | /* But if we generated an event, | ||
| 3232 | tell the caller to handle it now. */ | ||
| 3233 | if (events_generated) | ||
| 3234 | return nexttime; | ||
| 3235 | return difference; | 3169 | return difference; |
| 3236 | } | 3170 | } |
| 3237 | } | 3171 | } |
| @@ -3798,10 +3732,6 @@ make_lispy_event (event) | |||
| 3798 | (sizeof (lispy_function_keys) | 3732 | (sizeof (lispy_function_keys) |
| 3799 | / sizeof (lispy_function_keys[0]))); | 3733 | / sizeof (lispy_function_keys[0]))); |
| 3800 | 3734 | ||
| 3801 | /* Note that timer_event is currently never used. */ | ||
| 3802 | case timer_event: | ||
| 3803 | return Fcons (Qtimer_event, Fcons (Fcdr (event->frame_or_window), Qnil)); | ||
| 3804 | |||
| 3805 | #ifdef HAVE_MOUSE | 3735 | #ifdef HAVE_MOUSE |
| 3806 | /* A mouse click. Figure out where it is, decide whether it's | 3736 | /* A mouse click. Figure out where it is, decide whether it's |
| 3807 | a press, click or drag, and build the appropriate structure. */ | 3737 | a press, click or drag, and build the appropriate structure. */ |
| @@ -7945,6 +7875,9 @@ struct event_head head_table[] = { | |||
| 7945 | 7875 | ||
| 7946 | syms_of_keyboard () | 7876 | syms_of_keyboard () |
| 7947 | { | 7877 | { |
| 7878 | Qtimer_event_handler = intern ("timer-event-handler"); | ||
| 7879 | staticpro (&Qtimer_event_handler); | ||
| 7880 | |||
| 7948 | Qdisabled_command_hook = intern ("disabled-command-hook"); | 7881 | Qdisabled_command_hook = intern ("disabled-command-hook"); |
| 7949 | staticpro (&Qdisabled_command_hook); | 7882 | staticpro (&Qdisabled_command_hook); |
| 7950 | 7883 | ||
| @@ -7982,8 +7915,6 @@ syms_of_keyboard () | |||
| 7982 | staticpro (&Qfunction_key); | 7915 | staticpro (&Qfunction_key); |
| 7983 | Qmouse_click = intern ("mouse-click"); | 7916 | Qmouse_click = intern ("mouse-click"); |
| 7984 | staticpro (&Qmouse_click); | 7917 | staticpro (&Qmouse_click); |
| 7985 | Qtimer_event = intern ("timer-event"); | ||
| 7986 | staticpro (&Qtimer_event); | ||
| 7987 | 7918 | ||
| 7988 | Qmenu_enable = intern ("menu-enable"); | 7919 | Qmenu_enable = intern ("menu-enable"); |
| 7989 | staticpro (&Qmenu_enable); | 7920 | staticpro (&Qmenu_enable); |