Mercurial > hg > xemacs-beta
comparison src/event-stream.c @ 430:a5df635868b2 r21-2-23
Import from CVS: tag r21-2-23
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:29:08 +0200 |
parents | 3ecd8885ac67 |
children | 9d177e8d4150 |
comparison
equal
deleted
inserted
replaced
429:8305706cbb93 | 430:a5df635868b2 |
---|---|
256 Lisp_Object Qmenu_down; | 256 Lisp_Object Qmenu_down; |
257 Lisp_Object Qmenu_left; | 257 Lisp_Object Qmenu_left; |
258 Lisp_Object Qmenu_right; | 258 Lisp_Object Qmenu_right; |
259 Lisp_Object Qmenu_select; | 259 Lisp_Object Qmenu_select; |
260 Lisp_Object Qmenu_escape; | 260 Lisp_Object Qmenu_escape; |
261 | |
262 Lisp_Object Qself_insert_defer_undo; | |
261 | 263 |
262 /* this is in keymap.c */ | 264 /* this is in keymap.c */ |
263 extern Lisp_Object Fmake_keymap (Lisp_Object name); | 265 extern Lisp_Object Fmake_keymap (Lisp_Object name); |
264 | 266 |
265 #ifdef DEBUG_XEMACS | 267 #ifdef DEBUG_XEMACS |
3096 | 3098 |
3097 #if defined(HAVE_X_WINDOWS) && defined(LWLIB_MENUBARS_LUCID) | 3099 #if defined(HAVE_X_WINDOWS) && defined(LWLIB_MENUBARS_LUCID) |
3098 static void | 3100 static void |
3099 menu_move_up (void) | 3101 menu_move_up (void) |
3100 { | 3102 { |
3101 widget_value *current, *prev; | 3103 widget_value *current = lw_get_entries (False); |
3102 widget_value *entries; | 3104 widget_value *entries = lw_get_entries (True); |
3103 | 3105 widget_value *prev = NULL; |
3104 current = lw_get_entries (False); | 3106 |
3105 entries = lw_get_entries (True); | 3107 while (entries != current) |
3106 prev = NULL; | 3108 { |
3107 if (current != entries) | 3109 if (entries->name /*&& entries->enabled*/) prev = entries; |
3108 { | 3110 entries = entries->next; |
3109 while (entries != current) | 3111 assert (entries); |
3110 { | |
3111 if (entries->name /*&& entries->enabled*/) prev = entries; | |
3112 entries = entries->next; | |
3113 assert (entries); | |
3114 } | |
3115 } | 3112 } |
3116 | 3113 |
3117 if (!prev) | 3114 if (!prev) |
3118 /* move to last item */ | 3115 /* move to last item */ |
3119 { | 3116 { |
3138 } | 3135 } |
3139 | 3136 |
3140 static void | 3137 static void |
3141 menu_move_down (void) | 3138 menu_move_down (void) |
3142 { | 3139 { |
3143 widget_value *current; | 3140 widget_value *current = lw_get_entries (False); |
3144 widget_value *new; | 3141 widget_value *new = current; |
3145 | |
3146 current = lw_get_entries (False); | |
3147 new = current; | |
3148 | 3142 |
3149 while (new->next) | 3143 while (new->next) |
3150 { | 3144 { |
3151 new = new->next; | 3145 new = new->next; |
3152 if (new->name /*&& new->enabled*/) break; | 3146 if (new->name /*&& new->enabled*/) break; |
3175 { | 3169 { |
3176 int level = lw_menu_level (); | 3170 int level = lw_menu_level (); |
3177 int l = level; | 3171 int l = level; |
3178 widget_value *current; | 3172 widget_value *current; |
3179 | 3173 |
3180 while (level >= 3) | 3174 while (level-- >= 3) |
3181 { | 3175 lw_pop_menu (); |
3182 --level; | 3176 |
3183 lw_pop_menu (); | |
3184 } | |
3185 menu_move_up (); | 3177 menu_move_up (); |
3186 current = lw_get_entries (False); | 3178 current = lw_get_entries (False); |
3187 if (l > 2 && current->contents) | 3179 if (l > 2 && current->contents) |
3188 lw_push_menu (current->contents); | 3180 lw_push_menu (current->contents); |
3189 } | 3181 } |
3193 { | 3185 { |
3194 int level = lw_menu_level (); | 3186 int level = lw_menu_level (); |
3195 int l = level; | 3187 int l = level; |
3196 widget_value *current; | 3188 widget_value *current; |
3197 | 3189 |
3198 while (level >= 3) | 3190 while (level-- >= 3) |
3199 { | 3191 lw_pop_menu (); |
3200 --level; | 3192 |
3201 lw_pop_menu (); | |
3202 } | |
3203 menu_move_down (); | 3193 menu_move_down (); |
3204 current = lw_get_entries (False); | 3194 current = lw_get_entries (False); |
3205 if (l > 2 && current->contents) | 3195 if (l > 2 && current->contents) |
3206 lw_push_menu (current->contents); | 3196 lw_push_menu (current->contents); |
3207 } | 3197 } |
4602 /* Reset the command builder for reading the next sequence. */ | 4592 /* Reset the command builder for reading the next sequence. */ |
4603 reset_this_command_keys (console, 1); | 4593 reset_this_command_keys (console, 1); |
4604 } | 4594 } |
4605 else /* key sequence is bound to a command */ | 4595 else /* key sequence is bound to a command */ |
4606 { | 4596 { |
4597 int magic_undo = 0; | |
4598 int magic_undo_count = 20; | |
4599 | |
4607 Vthis_command = leaf; | 4600 Vthis_command = leaf; |
4601 | |
4608 /* Don't push an undo boundary if the command set the prefix arg, | 4602 /* Don't push an undo boundary if the command set the prefix arg, |
4609 or if we are executing a keyboard macro, or if in the | 4603 or if we are executing a keyboard macro, or if in the |
4610 minibuffer. If the command we are about to execute is | 4604 minibuffer. If the command we are about to execute is |
4611 self-insert, it's tricky: up to 20 consecutive self-inserts may | 4605 self-insert, it's tricky: up to 20 consecutive self-inserts may |
4612 be done without an undo boundary. This counter is reset as | 4606 be done without an undo boundary. This counter is reset as |
4613 soon as a command other than self-insert-command is executed. | 4607 soon as a command other than self-insert-command is executed. |
4614 */ | 4608 |
4615 if (! EQ (leaf, Qself_insert_command)) | 4609 Programmers can also use the `self-insert-undo-magic' |
4610 property to install that behaviour on functions other | |
4611 than `self-insert-command', or to change the magic | |
4612 number 20 to something else. */ | |
4613 | |
4614 if (SYMBOLP (leaf)) | |
4615 { | |
4616 Lisp_Object prop = Fget (leaf, Qself_insert_defer_undo, Qnil); | |
4617 if (NATNUMP (prop)) | |
4618 magic_undo = 1, magic_undo_count = XINT (prop); | |
4619 else if (!NILP (prop)) | |
4620 magic_undo = 1; | |
4621 else if (EQ (leaf, Qself_insert_command)) | |
4622 magic_undo = 1; | |
4623 } | |
4624 | |
4625 if (!magic_undo) | |
4616 command_builder->self_insert_countdown = 0; | 4626 command_builder->self_insert_countdown = 0; |
4617 if (NILP (XCONSOLE (console)->prefix_arg) | 4627 if (NILP (XCONSOLE (console)->prefix_arg) |
4618 && NILP (Vexecuting_macro) | 4628 && NILP (Vexecuting_macro) |
4619 #if 0 | 4629 #if 0 |
4620 /* This was done in the days when there was no undo | 4630 /* This was done in the days when there was no undo |
4624 && !EQ (minibuf_window, Fselected_window (Qnil)) | 4634 && !EQ (minibuf_window, Fselected_window (Qnil)) |
4625 #endif | 4635 #endif |
4626 && command_builder->self_insert_countdown == 0) | 4636 && command_builder->self_insert_countdown == 0) |
4627 Fundo_boundary (); | 4637 Fundo_boundary (); |
4628 | 4638 |
4629 if (EQ (leaf, Qself_insert_command)) | 4639 if (magic_undo) |
4630 { | 4640 { |
4631 if (--command_builder->self_insert_countdown < 0) | 4641 if (--command_builder->self_insert_countdown < 0) |
4632 command_builder->self_insert_countdown = 20; | 4642 command_builder->self_insert_countdown = magic_undo_count; |
4633 } | 4643 } |
4634 execute_command_event | 4644 execute_command_event |
4635 (command_builder, | 4645 (command_builder, |
4636 internal_equal (event, command_builder-> most_current_event, 0) | 4646 internal_equal (event, command_builder-> most_current_event, 0) |
4637 ? event | 4647 ? event |
4813 the value of `this-command-keys' in addition to the raw original event. | 4823 the value of `this-command-keys' in addition to the raw original event. |
4814 That is not right. | 4824 That is not right. |
4815 | 4825 |
4816 Calling this function directs the translated event to replace | 4826 Calling this function directs the translated event to replace |
4817 the original event, so that only one version of the event actually | 4827 the original event, so that only one version of the event actually |
4818 appears in the echo area and in the value of `this-command-keys.'. | 4828 appears in the echo area and in the value of `this-command-keys'. |
4819 */ | 4829 */ |
4820 ()) | 4830 ()) |
4821 { | 4831 { |
4822 /* #### I don't understand this at all, so currently it does nothing. | 4832 /* #### I don't understand this at all, so currently it does nothing. |
4823 If there is ever a problem, maybe someone should investigate. */ | 4833 If there is ever a problem, maybe someone should investigate. */ |
4955 defsymbol (&Qmenu_left, "menu-left"); | 4965 defsymbol (&Qmenu_left, "menu-left"); |
4956 defsymbol (&Qmenu_right, "menu-right"); | 4966 defsymbol (&Qmenu_right, "menu-right"); |
4957 defsymbol (&Qmenu_select, "menu-select"); | 4967 defsymbol (&Qmenu_select, "menu-select"); |
4958 defsymbol (&Qmenu_escape, "menu-escape"); | 4968 defsymbol (&Qmenu_escape, "menu-escape"); |
4959 | 4969 |
4970 defsymbol (&Qself_insert_defer_undo, "self-insert-defer-undo"); | |
4960 defsymbol (&Qcancel_mode_internal, "cancel-mode-internal"); | 4971 defsymbol (&Qcancel_mode_internal, "cancel-mode-internal"); |
4961 } | 4972 } |
4962 | 4973 |
4963 void | 4974 void |
4964 reinit_vars_of_event_stream (void) | 4975 reinit_vars_of_event_stream (void) |