comparison src/event-stream.c @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children 1ccc32a20af4
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
49 * 49 *
50 */ 50 */
51 51
52 /* TODO: 52 /* TODO:
53 This stuff is way too hard to maintain - needs rework. 53 This stuff is way too hard to maintain - needs rework.
54
55 C-x @ h <scrollbar-drag> x causes a crash.
56 54
57 The command builder should deal only with key and button events. 55 The command builder should deal only with key and button events.
58 Other command events should be able to come in the MIDDLE of a key 56 Other command events should be able to come in the MIDDLE of a key
59 sequence, without disturbing the key sequence composition, or the 57 sequence, without disturbing the key sequence composition, or the
60 command builder structure representing it. 58 command builder structure representing it.
119 Lisp_Object Qpre_idle_hook, Vpre_idle_hook; 117 Lisp_Object Qpre_idle_hook, Vpre_idle_hook;
120 118
121 /* Control gratuitous keyboard focus throwing. */ 119 /* Control gratuitous keyboard focus throwing. */
122 int focus_follows_mouse; 120 int focus_follows_mouse;
123 121
122 /* When true, modifier keys are sticky. */
124 int modifier_keys_are_sticky; 123 int modifier_keys_are_sticky;
125 124 /* Modifier keys are sticky for this many milliseconds. */
126 #if 0 /* FSF Emacs crap */ 125 Lisp_Object Vmodifier_keys_sticky_time;
127 /* Hook run after a command if there's no more input soon. */ 126
128 Lisp_Object Qpost_command_idle_hook, Vpost_command_idle_hook; 127 /* Here FSF Emacs 20.7 defines Vpost_command_idle_hook,
129 128 post_command_idle_delay, Vdeferred_action_list, and
130 /* Delay time in microseconds before running post-command-idle-hook. */ 129 Vdeferred_action_function, but we don't because that stuff is crap,
131 int post_command_idle_delay; 130 and we're smarter than them, and their momas are fat. */
132 131
133 /* List of deferred actions to be performed at a later time. 132 /* FSF Emacs 20.7 also defines Vinput_method_function,
134 The precise format isn't relevant here; we just check whether it is nil. */ 133 Qinput_method_exit_on_first_char and Qinput_method_use_echo_area.
135 Lisp_Object Vdeferred_action_list; 134 I don't know this should be imported or not. */
136
137 /* Function to call to handle deferred actions, when there are any. */
138 Lisp_Object Vdeferred_action_function;
139 Lisp_Object Qdeferred_action_function;
140 #endif /* FSF Emacs crap */
141 135
142 /* Non-nil disable property on a command means 136 /* Non-nil disable property on a command means
143 do not execute it; call disabled-command-hook's value instead. */ 137 do not execute it; call disabled-command-hook's value instead. */
144 Lisp_Object Qdisabled, Vdisabled_command_hook; 138 Lisp_Object Qdisabled, Vdisabled_command_hook;
145 139
500 494
501 /* If a longjmp() happens in the callback, we're screwed. 495 /* If a longjmp() happens in the callback, we're screwed.
502 Let's hope it doesn't. I think the code here is fairly 496 Let's hope it doesn't. I think the code here is fairly
503 clean and doesn't do this. */ 497 clean and doesn't do this. */
504 emacs_is_blocking = 1; 498 emacs_is_blocking = 1;
505 #if 0
506 /* Do this if the poll-for-quit timer seems to be taking too
507 much CPU time when idle ... */
508 reset_poll_for_quit ();
509 #endif
510 event_stream->next_event_cb (event); 499 event_stream->next_event_cb (event);
511 #if 0
512 init_poll_for_quit ();
513 #endif
514 emacs_is_blocking = 0; 500 emacs_is_blocking = 0;
515 501
516 #ifdef DEBUG_XEMACS 502 #ifdef DEBUG_XEMACS
517 /* timeout events have more info set later, so 503 /* timeout events have more info set later, so
518 print the event out in next_event_internal(). */ 504 print the event out in next_event_internal(). */
796 782
797 /* NB: The following auto-save stuff is in keyboard.c in FSFmacs, and 783 /* NB: The following auto-save stuff is in keyboard.c in FSFmacs, and
798 keystrokes_since_auto_save is equivalent to the difference between 784 keystrokes_since_auto_save is equivalent to the difference between
799 num_nonmacro_input_chars and last_auto_save. */ 785 num_nonmacro_input_chars and last_auto_save. */
800 786
801 /* When an auto-save happens, record the "time", and don't do again soon. */ 787 /* When an auto-save happens, record the number of keystrokes, and
788 don't do again soon. */
802 789
803 void 790 void
804 record_auto_save (void) 791 record_auto_save (void)
805 { 792 {
806 keystrokes_since_auto_save = 0; 793 keystrokes_since_auto_save = 0;
810 797
811 void 798 void
812 force_auto_save_soon (void) 799 force_auto_save_soon (void)
813 { 800 {
814 keystrokes_since_auto_save = 1 + max (auto_save_interval, 20); 801 keystrokes_since_auto_save = 1 + max (auto_save_interval, 20);
815
816 #if 0 /* FSFmacs */
817 record_asynch_buffer_change ();
818 #endif
819 } 802 }
820 803
821 static void 804 static void
822 maybe_do_auto_save (void) 805 maybe_do_auto_save (void)
823 { 806 {
1693 } 1676 }
1694 1677
1695 static void 1678 static void
1696 run_deselect_frame_hook (void) 1679 run_deselect_frame_hook (void)
1697 { 1680 {
1698 #if 0 /* unclean! FSF calls this at all sorts of random places,
1699 including a bunch of places in their mouse.el. If this
1700 is implemented, it has to be done cleanly. */
1701 run_hook (Qmouse_leave_buffer_hook); /* #### Correct? It's also
1702 called in `call-interactively'.
1703 Does this mean it will be
1704 called twice? Oh well, FSF
1705 bug -- FSF calls it in
1706 `handle-switch-frame',
1707 which is approximately the
1708 same as the caller of this
1709 function. */
1710 #endif
1711 run_hook (Qdeselect_frame_hook); 1681 run_hook (Qdeselect_frame_hook);
1712 } 1682 }
1713 1683
1714 /* When select-frame is called and focus_follows_mouse is false, we want 1684 /* When select-frame is called and focus_follows_mouse is false, we want
1715 to tell the window system that the focus should be changed to point to 1685 to tell the window system that the focus should be changed to point to
2682 current_buffer = old_buffer; 2652 current_buffer = old_buffer;
2683 return result; 2653 return result;
2684 } 2654 }
2685 2655
2686 DEFUN ("sleep-for", Fsleep_for, 1, 1, 0, /* 2656 DEFUN ("sleep-for", Fsleep_for, 1, 1, 0, /*
2687 Pause, without updating display, for ARG seconds. 2657 Pause, without updating display, for SECONDS seconds.
2688 ARG may be a float, meaning pause for some fractional part of a second. 2658 SECONDS may be a float, allowing pauses for fractional parts of a second.
2689 2659
2690 It is recommended that you never call sleep-for from inside of a process 2660 It is recommended that you never call sleep-for from inside of a process
2691 filter function or timer event (either synchronous or asynchronous). 2661 filter function or timer event (either synchronous or asynchronous).
2692 */ 2662 */
2693 (seconds)) 2663 (seconds))
2694 { 2664 {
2695 /* This function can GC */ 2665 /* This function can GC */
2696 unsigned long msecs = lisp_number_to_milliseconds (seconds, 1); 2666 unsigned long msecs = lisp_number_to_milliseconds (seconds, 1);
2749 UNGCPRO; 2719 UNGCPRO;
2750 return Qnil; 2720 return Qnil;
2751 } 2721 }
2752 2722
2753 DEFUN ("sit-for", Fsit_for, 1, 2, 0, /* 2723 DEFUN ("sit-for", Fsit_for, 1, 2, 0, /*
2754 Perform redisplay, then wait ARG seconds or until user input is available. 2724 Perform redisplay, then wait SECONDS seconds or until user input is available.
2755 ARG may be a float, meaning a fractional part of a second. 2725 SECONDS may be a float, meaning a fractional part of a second.
2756 Optional second arg non-nil means don't redisplay, just wait for input. 2726 Optional second arg NODISPLAY non-nil means don't redisplay; just wait.
2757 Redisplay is preempted as always if user input arrives, and does not 2727 Redisplay is preempted as always if user input arrives, and does not
2758 happen if input is available before it starts. 2728 happen if input is available before it starts.
2759 Value is t if waited the full time with no input arriving. 2729 Value is t if waited the full time with no input arriving.
2760 2730
2761 If sit-for is called from within a process filter function or timer 2731 If sit-for is called from within a process filter function or timer
3793 /* This function can GC */ 3763 /* This function can GC */
3794 struct console *con = XCONSOLE (command_builder->console); 3764 struct console *con = XCONSOLE (command_builder->console);
3795 struct gcpro gcpro1; 3765 struct gcpro gcpro1;
3796 3766
3797 GCPRO1 (event); /* event may be freshly created */ 3767 GCPRO1 (event); /* event may be freshly created */
3798 reset_current_events (command_builder); 3768
3769 /* To fix C-x @ h <scrollbar-drag> x crash. */
3770 if (XEVENT (event)->event_type != misc_user_event)
3771 reset_current_events (command_builder);
3799 3772
3800 switch (XEVENT (event)->event_type) 3773 switch (XEVENT (event)->event_type)
3801 { 3774 {
3802 case key_press_event: 3775 case key_press_event:
3803 Vcurrent_mouse_event = Qnil; 3776 Vcurrent_mouse_event = Qnil;
3860 Fcommand_execute (Vthis_command, Qnil, Qnil); 3833 Fcommand_execute (Vthis_command, Qnil, Qnil);
3861 } 3834 }
3862 3835
3863 post_command_hook (); 3836 post_command_hook ();
3864 3837
3865 #if 0 /* #### here was an attempted fix that didn't work */
3866 if (XEVENT (event)->event_type == misc_user_event)
3867 ;
3868 else
3869 #endif
3870 if (!NILP (con->prefix_arg)) 3838 if (!NILP (con->prefix_arg))
3871 { 3839 {
3872 /* Commands that set the prefix arg don't update last-command, don't 3840 /* Commands that set the prefix arg don't update last-command, don't
3873 reset the echoing state, and don't go into keyboard macros unless 3841 reset the echoing state, and don't go into keyboard macros unless
3874 followed by another command. */ 3842 followed by another command. Also don't quit here. */
3843 int speccount = specpdl_depth ();
3844 specbind (Qinhibit_quit, Qt);
3875 maybe_echo_keys (command_builder, 0); 3845 maybe_echo_keys (command_builder, 0);
3846 unbind_to (speccount, Qnil);
3876 3847
3877 /* If we're recording a keyboard macro, and the last command 3848 /* If we're recording a keyboard macro, and the last command
3878 executed set a prefix argument, then decrement the pointer to 3849 executed set a prefix argument, then decrement the pointer to
3879 the "last character really in the macro" to be just before this 3850 the "last character really in the macro" to be just before this
3880 command. This is so that the ^U in "^U ^X )" doesn't go onto 3851 command. This is so that the ^U in "^U ^X )" doesn't go onto
3889 Vlast_command_properties = Vthis_command_properties; 3860 Vlast_command_properties = Vthis_command_properties;
3890 Vthis_command_properties = Qnil; 3861 Vthis_command_properties = Qnil;
3891 3862
3892 /* Emacs 18 doesn't unconditionally clear the echoed keystrokes, 3863 /* Emacs 18 doesn't unconditionally clear the echoed keystrokes,
3893 so we don't either */ 3864 so we don't either */
3894 reset_this_command_keys (make_console (con), 0); 3865 if (XEVENT (event)->event_type != misc_user_event)
3866 reset_this_command_keys (make_console (con), 0);
3895 } 3867 }
3896 } 3868 }
3897 3869
3898 UNGCPRO; 3870 UNGCPRO;
3899 } 3871 }
3953 3925
3954 safe_run_hook_trapping_errors 3926 safe_run_hook_trapping_errors
3955 ("Error in `post-command-hook' (setting hook to nil)", 3927 ("Error in `post-command-hook' (setting hook to nil)",
3956 Qpost_command_hook, 1); 3928 Qpost_command_hook, 1);
3957 3929
3958 #if 0 /* FSF Emacs crap */
3959 if (!NILP (Vdeferred_action_list))
3960 call0 (Vdeferred_action_function);
3961
3962 if (NILP (Vunread_command_events)
3963 && NILP (Vexecuting_macro)
3964 && !NILP (Vpost_command_idle_hook)
3965 && !NILP (Fsit_for (make_float ((double) post_command_idle_delay
3966 / 1000000), Qnil)))
3967 safe_run_hook_trapping_errors
3968 ("Error in `post-command-idle-hook' (setting hook to nil)",
3969 Qpost_command_idle_hook, 1);
3970 #endif /* FSF Emacs crap */
3971
3972 #if 0 /* FSF Emacs */
3973 if (!NILP (current_buffer->mark_active))
3974 {
3975 if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode))
3976 {
3977 current_buffer->mark_active = Qnil;
3978 run_hook (intern ("deactivate-mark-hook"));
3979 }
3980 else if (current_buffer != prev_buffer ||
3981 BUF_MODIFF (current_buffer) != prev_modiff)
3982 run_hook (intern ("activate-mark-hook"));
3983 }
3984 #endif /* FSF Emacs */
3985
3986 /* #### Kludge!!! This is necessary to make sure that things 3930 /* #### Kludge!!! This is necessary to make sure that things
3987 are properly positioned even if post-command-hook moves point. 3931 are properly positioned even if post-command-hook moves point.
3988 #### There should be a cleaner way of handling this. */ 3932 #### There should be a cleaner way of handling this. */
3989 call0 (Qauto_show_make_point_visible); 3933 call0 (Qauto_show_make_point_visible);
3990 } 3934 }
3991 3935
3992 3936
3993 DEFUN ("dispatch-event", Fdispatch_event, 1, 1, 0, /* 3937 DEFUN ("dispatch-event", Fdispatch_event, 1, 1, 0, /*
3994 Given an event object as returned by `next-event', execute it. 3938 Given an event object EVENT as returned by `next-event', execute it.
3995 3939
3996 Key-press, button-press, and button-release events get accumulated 3940 Key-press, button-press, and button-release events get accumulated
3997 until a complete key sequence (see `read-key-sequence') is reached, 3941 until a complete key sequence (see `read-key-sequence') is reached,
3998 at which point the sequence is looked up in the current keymaps and 3942 at which point the sequence is looked up in the current keymaps and
3999 acted upon. 3943 acted upon.
4159 4103
4160 if (!magic_undo) 4104 if (!magic_undo)
4161 command_builder->self_insert_countdown = 0; 4105 command_builder->self_insert_countdown = 0;
4162 if (NILP (XCONSOLE (console)->prefix_arg) 4106 if (NILP (XCONSOLE (console)->prefix_arg)
4163 && NILP (Vexecuting_macro) 4107 && NILP (Vexecuting_macro)
4164 #if 0
4165 /* This was done in the days when there was no undo
4166 in the minibuffer. If we don't disable this code,
4167 then each instance of "undo" undoes everything in
4168 the minibuffer. */
4169 && !EQ (minibuf_window, Fselected_window (Qnil))
4170 #endif
4171 && command_builder->self_insert_countdown == 0) 4108 && command_builder->self_insert_countdown == 0)
4172 Fundo_boundary (); 4109 Fundo_boundary ();
4173 4110
4174 if (magic_undo) 4111 if (magic_undo)
4175 { 4112 {
4176 if (--command_builder->self_insert_countdown < 0) 4113 if (--command_builder->self_insert_countdown < 0)
4177 command_builder->self_insert_countdown = magic_undo_count; 4114 command_builder->self_insert_countdown = magic_undo_count;
4178 } 4115 }
4179 execute_command_event 4116 execute_command_event
4180 (command_builder, 4117 (command_builder,
4181 internal_equal (event, command_builder-> most_current_event, 0) 4118 internal_equal (event, command_builder->most_current_event, 0)
4182 ? event 4119 ? event
4183 /* Use the translated event that was most recently seen. 4120 /* Use the translated event that was most recently seen.
4184 This way, last-command-event becomes f1 instead of 4121 This way, last-command-event becomes f1 instead of
4185 the P from ESC O P. But we must copy it, else we'll 4122 the P from ESC O P. But we must copy it, else we'll
4186 lose when the command-builder events are deallocated. */ 4123 lose when the command-builder events are deallocated. */
4187 : Fcopy_event (command_builder-> most_current_event, Qnil)); 4124 : Fcopy_event (command_builder->most_current_event, Qnil));
4188 } 4125 }
4189 break; 4126 break;
4190 } 4127 }
4191 case misc_user_event: 4128 case misc_user_event:
4192 { 4129 {
4237 } 4174 }
4238 4175
4239 DEFUN ("read-key-sequence", Fread_key_sequence, 1, 3, 0, /* 4176 DEFUN ("read-key-sequence", Fread_key_sequence, 1, 3, 0, /*
4240 Read a sequence of keystrokes or mouse clicks. 4177 Read a sequence of keystrokes or mouse clicks.
4241 Returns a vector of the event objects read. The vector and the event 4178 Returns a vector of the event objects read. The vector and the event
4242 objects it contains are freshly created (and will not be side-effected 4179 objects it contains are freshly created (and so will not be side-effected
4243 by subsequent calls to this function). 4180 by subsequent calls to this function).
4244 4181
4245 The sequence read is sufficient to specify a non-prefix command starting 4182 The sequence read is sufficient to specify a non-prefix command starting
4246 from the current local and global keymaps. A C-g typed while in this 4183 from the current local and global keymaps. A C-g typed while in this
4247 function is treated like any other character, and `quit-flag' is not set. 4184 function is treated like any other character, and `quit-flag' is not set.
4248 4185
4249 First arg PROMPT is a prompt string. If nil, do not prompt specially. 4186 First arg PROMPT is a prompt string. If nil, do not prompt specially.
4250 Second (optional) arg CONTINUE-ECHO, if non-nil, means this key echoes 4187
4251 as a continuation of the previous key. 4188 Second optional arg CONTINUE-ECHO non-nil means this key echoes as a
4252 4189 continuation of the previous key.
4253 The third (optional) arg DONT-DOWNCASE-LAST, if non-nil, means do not 4190
4254 convert the last event to lower case. (Normally any upper case event 4191 Third optional arg DONT-DOWNCASE-LAST non-nil means do not convert the
4255 is converted to lower case if the original event is undefined and the lower 4192 last event to lower case. (Normally any upper case event is converted
4256 case equivalent is defined.) This argument is provided mostly for 4193 to lower case if the original event is undefined and the lower case
4257 FSF compatibility; the equivalent effect can be achieved more generally 4194 equivalent is defined.) This argument is provided mostly for FSF
4258 by binding `retry-undefined-key-binding-unshifted' to nil around the 4195 compatibility; the equivalent effect can be achieved more generally by
4259 call to `read-key-sequence'. 4196 binding `retry-undefined-key-binding-unshifted' to nil around the call
4260 4197 to `read-key-sequence'.
4261 A C-g typed while in this function is treated like any other character,
4262 and `quit-flag' is not set.
4263 4198
4264 If the user selects a menu item while we are prompting for a key-sequence, 4199 If the user selects a menu item while we are prompting for a key-sequence,
4265 the returned value will be a vector of a single menu-selection event. 4200 the returned value will be a vector of a single menu-selection event.
4266 An error will be signalled if you pass this value to `lookup-key' or a 4201 An error will be signalled if you pass this value to `lookup-key' or a
4267 related function. 4202 related function.
4268 4203
4269 `read-key-sequence' checks `function-key-map' for function key 4204 `read-key-sequence' checks `function-key-map' for function key
4270 sequences, where they wouldn't conflict with ordinary bindings. See 4205 sequences, where they wouldn't conflict with ordinary bindings.
4271 `function-key-map' for more details. 4206 See `function-key-map' for more details.
4272 */ 4207 */
4273 (prompt, continue_echo, dont_downcase_last)) 4208 (prompt, continue_echo, dont_downcase_last))
4274 { 4209 {
4275 /* This function can GC */ 4210 /* This function can GC */
4276 struct console *con = XCONSOLE (Vselected_console); /* #### correct? 4211 struct console *con = XCONSOLE (Vselected_console); /* #### correct?
4402 Lstream_flush (XLSTREAM (Vdribble_file)); 4337 Lstream_flush (XLSTREAM (Vdribble_file));
4403 } 4338 }
4404 4339
4405 DEFUN ("open-dribble-file", Fopen_dribble_file, 1, 1, 4340 DEFUN ("open-dribble-file", Fopen_dribble_file, 1, 1,
4406 "FOpen dribble file: ", /* 4341 "FOpen dribble file: ", /*
4407 Start writing all keyboard characters to a dribble file called FILE. 4342 Start writing all keyboard characters to a dribble file called FILENAME.
4408 If FILE is nil, close any open dribble file. 4343 If FILENAME is nil, close any open dribble file.
4409 */ 4344 */
4410 (file)) 4345 (filename))
4411 { 4346 {
4412 /* This function can GC */ 4347 /* This function can GC */
4413 /* XEmacs change: always close existing dribble file. */ 4348 /* XEmacs change: always close existing dribble file. */
4414 /* FSFmacs uses FILE *'s here. With lstreams, that's unnecessary. */ 4349 /* FSFmacs uses FILE *'s here. With lstreams, that's unnecessary. */
4415 if (!NILP (Vdribble_file)) 4350 if (!NILP (Vdribble_file))
4416 { 4351 {
4417 Lstream_close (XLSTREAM (Vdribble_file)); 4352 Lstream_close (XLSTREAM (Vdribble_file));
4418 Vdribble_file = Qnil; 4353 Vdribble_file = Qnil;
4419 } 4354 }
4420 if (!NILP (file)) 4355 if (!NILP (filename))
4421 { 4356 {
4422 int fd; 4357 int fd;
4423 4358
4424 file = Fexpand_file_name (file, Qnil); 4359 filename = Fexpand_file_name (filename, Qnil);
4425 fd = open ((char*) XSTRING_DATA (file), 4360 fd = open ((char*) XSTRING_DATA (filename),
4426 O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY, 4361 O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY,
4427 CREAT_MODE); 4362 CREAT_MODE);
4428 if (fd < 0) 4363 if (fd < 0)
4429 error ("Unable to create dribble file"); 4364 error ("Unable to create dribble file");
4430 Vdribble_file = make_filedesc_output_stream (fd, 0, 0, LSTR_CLOSING); 4365 Vdribble_file = make_filedesc_output_stream (fd, 0, 0, LSTR_CLOSING);
4498 defsymbol (&Qunread_command_events, "unread-command-events"); 4433 defsymbol (&Qunread_command_events, "unread-command-events");
4499 defsymbol (&Qunread_command_event, "unread-command-event"); 4434 defsymbol (&Qunread_command_event, "unread-command-event");
4500 defsymbol (&Qpre_idle_hook, "pre-idle-hook"); 4435 defsymbol (&Qpre_idle_hook, "pre-idle-hook");
4501 defsymbol (&Qhandle_pre_motion_command, "handle-pre-motion-command"); 4436 defsymbol (&Qhandle_pre_motion_command, "handle-pre-motion-command");
4502 defsymbol (&Qhandle_post_motion_command, "handle-post-motion-command"); 4437 defsymbol (&Qhandle_post_motion_command, "handle-post-motion-command");
4503 #if 0 /* FSF Emacs crap */
4504 defsymbol (&Qpost_command_idle_hook, "post-command-idle-hook");
4505 defsymbol (&Qdeferred_action_function, "deferred-action-function");
4506 #endif
4507 defsymbol (&Qretry_undefined_key_binding_unshifted, 4438 defsymbol (&Qretry_undefined_key_binding_unshifted,
4508 "retry-undefined-key-binding-unshifted"); 4439 "retry-undefined-key-binding-unshifted");
4509 defsymbol (&Qauto_show_make_point_visible, 4440 defsymbol (&Qauto_show_make_point_visible,
4510 "auto-show-make-point-visible"); 4441 "auto-show-make-point-visible");
4511 4442
4599 If this variable is set to t, then XEmacs will not gratuitously change 4530 If this variable is set to t, then XEmacs will not gratuitously change
4600 the keyboard focus. XEmacs cannot in general detect when this mode is 4531 the keyboard focus. XEmacs cannot in general detect when this mode is
4601 used by the window manager, so it is up to the user to set it. 4532 used by the window manager, so it is up to the user to set it.
4602 */ ); 4533 */ );
4603 focus_follows_mouse = 0; 4534 focus_follows_mouse = 0;
4604
4605 #if 0 /* FSF Emacs crap */
4606 /* Ill-conceived because it's not run in all sorts of cases
4607 where XEmacs is blocking. That's what `pre-idle-hook'
4608 is designed to solve. */
4609 xxDEFVAR_LISP ("post-command-idle-hook", &Vpost_command_idle_hook /*
4610 Normal hook run after each command is executed, if idle.
4611 `post-command-idle-delay' specifies a time in microseconds that XEmacs
4612 must be idle for in order for the functions on this hook to be called.
4613 Errors running the hook are caught and ignored.
4614 */ );
4615 Vpost_command_idle_hook = Qnil;
4616
4617 xxDEFVAR_INT ("post-command-idle-delay", &post_command_idle_delay /*
4618 Delay time before running `post-command-idle-hook'.
4619 This is measured in microseconds.
4620 */ );
4621 post_command_idle_delay = 5000;
4622
4623 /* Random FSFmacs crap. There is absolutely nothing to gain,
4624 and a great deal to lose, in using this in place of just
4625 setting `post-command-hook'. */
4626 xxDEFVAR_LISP ("deferred-action-list", &Vdeferred_action_list /*
4627 List of deferred actions to be performed at a later time.
4628 The precise format isn't relevant here; we just check whether it is nil.
4629 */ );
4630 Vdeferred_action_list = Qnil;
4631
4632 xxDEFVAR_LISP ("deferred-action-function", &Vdeferred_action_function /*
4633 Function to call to handle deferred actions, after each command.
4634 This function is called with no arguments after each command
4635 whenever `deferred-action-list' is non-nil.
4636 */ );
4637 Vdeferred_action_function = Qnil;
4638 #endif /* FSF Emacs crap */
4639 4535
4640 DEFVAR_LISP ("last-command-event", &Vlast_command_event /* 4536 DEFVAR_LISP ("last-command-event", &Vlast_command_event /*
4641 Last keyboard or mouse button event that was part of a command. This 4537 Last keyboard or mouse button event that was part of a command. This
4642 variable is off limits: you may not set its value or modify the event that 4538 variable is off limits: you may not set its value or modify the event that
4643 is its value, as it is destructively modified by `read-key-sequence'. If 4539 is its value, as it is destructively modified by `read-key-sequence'. If
4813 *Non-nil makes modifier keys sticky. 4709 *Non-nil makes modifier keys sticky.
4814 This means that you can release the modifier key before pressing down 4710 This means that you can release the modifier key before pressing down
4815 the key that you wish to be modified. Although this is non-standard 4711 the key that you wish to be modified. Although this is non-standard
4816 behavior, it is recommended because it reduces the strain on your hand, 4712 behavior, it is recommended because it reduces the strain on your hand,
4817 thus reducing the incidence of the dreaded Emacs-pinky syndrome. 4713 thus reducing the incidence of the dreaded Emacs-pinky syndrome.
4714
4715 Modifier keys are sticky within the inverval specified by
4716 `modifier-keys-sticky-time'.
4818 */ ); 4717 */ );
4819 modifier_keys_are_sticky = 0; 4718 modifier_keys_are_sticky = 0;
4719
4720 DEFVAR_LISP ("modifier-keys-sticky-time", &Vmodifier_keys_sticky_time /*
4721 *Modifier keys are sticky within this many milliseconds.
4722 If you don't want modifier keys sticking to be bounded, set this to
4723 non-integer value.
4724
4725 This variable has no effect when `modifier-keys-are-sticky' is nil.
4726 Currently only implemented under X Window System.
4727 */ );
4728 Vmodifier_keys_sticky_time = make_int (500);
4820 4729
4821 #ifdef HAVE_XIM 4730 #ifdef HAVE_XIM
4822 DEFVAR_LISP ("composed-character-default-binding", 4731 DEFVAR_LISP ("composed-character-default-binding",
4823 &Vcomposed_character_default_binding /* 4732 &Vcomposed_character_default_binding /*
4824 The default keybinding to use for key events from composed input. 4733 The default keybinding to use for key events from composed input.
4934 last-command-char last-input-char 4843 last-command-char last-input-char
4935 (recent-keys) (this-command-keys)))) 4844 (recent-keys) (this-command-keys))))
4936 (global-set-key "\^Q" 'foo) 4845 (global-set-key "\^Q" 'foo)
4937 4846
4938 without the read-key-sequence: 4847 without the read-key-sequence:
4939 ^Q ==> (65 17 65 [... ^Q] [^Q]) 4848 ^Q ==> (?A ?\^Q ?A [... ^Q] [^Q])
4940 ^U^U^Q ==> (65 17 65 [... ^U ^U ^Q] [^U ^U ^Q]) 4849 ^U^U^Q ==> (?A ?\^Q ?A [... ^U ^U ^Q] [^U ^U ^Q])
4941 ^U^U^U^G^Q ==> (65 17 65 [... ^U ^U ^U ^G ^Q] [^Q]) 4850 ^U^U^U^G^Q ==> (?A ?\^Q ?A [... ^U ^U ^U ^G ^Q] [^Q])
4942 4851
4943 with the read-key-sequence: 4852 with the read-key-sequence:
4944 ^Qb ==> (65 [b] 17 98 [... ^Q b] [b]) 4853 ^Qb ==> (?A [b] ?\^Q ?b [... ^Q b] [b])
4945 ^U^U^Qb ==> (65 [b] 17 98 [... ^U ^U ^Q b] [b]) 4854 ^U^U^Qb ==> (?A [b] ?\^Q ?b [... ^U ^U ^Q b] [b])
4946 ^U^U^U^G^Qb ==> (65 [b] 17 98 [... ^U ^U ^U ^G ^Q b] [b]) 4855 ^U^U^U^G^Qb ==> (?A [b] ?\^Q ?b [... ^U ^U ^U ^G ^Q b] [b])
4947 4856
4948 ;the evi-mode command "4dlj.j.j.j.j.j." is also a good testcase (gag) 4857 ;the evi-mode command "4dlj.j.j.j.j.j." is also a good testcase (gag)
4949 4858
4950 ;(setq x (list (read-char) quit-flag))^J^G 4859 ;(setq x (list (read-char) quit-flag))^J^G
4951 ;(let ((inhibit-quit t)) (setq x (list (read-char) quit-flag)))^J^G 4860 ;(let ((inhibit-quit t)) (setq x (list (read-char) quit-flag)))^J^G
4952 ;for BOTH, x should get set to (7 t), but no result should be printed. 4861 ;for BOTH, x should get set to (7 t), but no result should be printed.
4862 ;; #### According to the doc of quit-flag, second test should return
4863 ;; (?\^G nil). Accidentaly XEmacs returns correct value. However,
4864 ;; XEmacs 21.1.12 and 21.2.36 both fails on first test.
4953 4865
4954 ;also do this: make two frames, one viewing "*scratch*", the other "foo". 4866 ;also do this: make two frames, one viewing "*scratch*", the other "foo".
4955 ;in *scratch*, type (sit-for 20)^J 4867 ;in *scratch*, type (sit-for 20)^J
4956 ;wait a couple of seconds, move cursor to foo, type "a" 4868 ;wait a couple of seconds, move cursor to foo, type "a"
4957 ;a should be inserted in foo. Cursor highlighting should not change in 4869 ;a should be inserted in foo. Cursor highlighting should not change in
4967 (list (condition-case c 4879 (list (condition-case c
4968 (sleep-for 20) 4880 (sleep-for 20)
4969 (quit c)) 4881 (quit c))
4970 (read-char))) 4882 (read-char)))
4971 4883
4972 (tst)^Ja^G ==> ((quit) 97) with no signal 4884 (tst)^Ja^G ==> ((quit) ?a) with no signal
4973 (tst)^J^Ga ==> ((quit) 97) with no signal 4885 (tst)^J^Ga ==> ((quit) ?a) with no signal
4974 (tst)^Jabc^G ==> ((quit) 97) with no signal, and "bc" inserted in buffer 4886 (tst)^Jabc^G ==> ((quit) ?a) with no signal, and "bc" inserted in buffer
4975 4887
4976 ; with sit-for only do the 2nd test. 4888 ; with sit-for only do the 2nd test.
4977 ; Do all 3 tests with (accept-process-output nil 20) 4889 ; Do all 3 tests with (accept-process-output nil 20)
4978 4890
4979 Do this: 4891 Do this: