X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fevent-stream.c;h=de65d4e77b67f294825774fdf5838c39096c9e96;hb=7b241b273a632ab80d7c620b5add28d5f11b0fd3;hp=b390e524a36da02490fd6fb4d6eba88cc3c3c525;hpb=041e98cf4c48018877365e3bfb37cfc09b54cc6d;p=chise%2Fxemacs-chise.git.1 diff --git a/src/event-stream.c b/src/event-stream.c index b390e52..de65d4e 100644 --- a/src/event-stream.c +++ b/src/event-stream.c @@ -423,7 +423,7 @@ check_event_stream_ok (enum event_stream_operation op) case EVENT_STREAM_READ: error ("Can't read events in -batch mode"); default: - abort (); + ABORT (); } } else if (!event_stream) @@ -701,7 +701,8 @@ reset_key_echo (struct command_builder *command_builder, /* This function can GC */ struct frame *f = selected_frame (); - command_builder->echo_buf_index = -1; + if (command_builder) + command_builder->echo_buf_index = -1; if (remove_echo_area_echo) clear_echo_area (f, Qcommand, 0); @@ -745,7 +746,7 @@ maybe_kbd_translate (Lisp_Object event) This way is safer. */ zero_event (&ev2); character_to_event (XCHAR (traduit), &ev2, - XCONSOLE (EVENT_CHANNEL (XEVENT (event))), 1, 1); + XCONSOLE (EVENT_CHANNEL (XEVENT (event))), 0, 1); XEVENT (event)->event.key.keysym = ev2.event.key.keysym; XEVENT (event)->event.key.modifiers = ev2.event.key.modifiers; did_translate = 1; @@ -767,7 +768,7 @@ maybe_kbd_translate (Lisp_Object event) zero_event (&ev2); character_to_event (XCHAR (traduit), &ev2, - XCONSOLE (EVENT_CHANNEL (XEVENT (event))), 1, 1); + XCONSOLE (EVENT_CHANNEL (XEVENT (event))), 0, 1); XEVENT (event)->event.key.keysym = ev2.event.key.keysym; XEVENT (event)->event.key.modifiers |= ev2.event.key.modifiers; did_translate = 1; @@ -1386,7 +1387,7 @@ is a race condition. That's why the RESIGNAL argument exists. Lisp_Object lid; id = event_stream_generate_wakeup (msecs, msecs2, function, object, 0); lid = make_int (id); - if (id != XINT (lid)) abort (); + if (id != XINT (lid)) ABORT (); return lid; } @@ -1465,7 +1466,7 @@ is a race condition. That's why the RESIGNAL argument exists. Lisp_Object lid; id = event_stream_generate_wakeup (msecs, msecs2, function, object, 1); lid = make_int (id); - if (id != XINT (lid)) abort (); + if (id != XINT (lid)) ABORT (); return lid; } @@ -2203,8 +2204,6 @@ The returned event will be one of the following types: switch (XEVENT_TYPE (event)) { - default: - goto RETURN; case button_release_event: case misc_user_event: /* don't echo menu accelerator keys */ @@ -2214,6 +2213,8 @@ The returned event will be one of the following types: goto STORE_AND_EXECUTE_KEY; case key_press_event: /* any key input can trigger autosave */ break; + default: + goto RETURN; } maybe_do_auto_save (); @@ -2465,7 +2466,7 @@ A user event is a key press, button press, button release, or } if (!NILP (command_event_queue) || !NILP (command_event_queue_tail)) - abort (); + ABORT (); /* Now tack our chain of events back on to the front of the queue. Actually, since the queue is now drained, we can just replace it. @@ -3040,7 +3041,7 @@ execute_internal_event (Lisp_Object event) return; } default: - abort (); + ABORT (); } } @@ -3408,7 +3409,7 @@ modify them. Lisp_Object e = XVECTOR_DATA (Vrecent_keys_ring)[j]; if (NILP (e)) - abort (); + ABORT (); XVECTOR_DATA (val)[i] = Fcopy_event (e, Qnil); if (++j >= recent_keys_ring_size) j = 0; @@ -3504,16 +3505,24 @@ Set the maximum number of events to be stored internally. void reset_this_command_keys (Lisp_Object console, int clear_echo_area_p) { - struct command_builder *command_builder = - XCOMMAND_BUILDER (XCONSOLE (console)->command_builder); - - reset_key_echo (command_builder, clear_echo_area_p); + if (!NILP (console)) + { + /* console is nil if we just deleted the console as a result of C-x 5 + 0. Unfortunately things are currently in a messy situation where + some stuff is console-local and other stuff isn't, so we need to + do everything that's not console-local. */ + struct command_builder *command_builder = + XCOMMAND_BUILDER (XCONSOLE (console)->command_builder); + + reset_key_echo (command_builder, clear_echo_area_p); + reset_current_events (command_builder); + } + else + reset_key_echo (0, clear_echo_area_p); deallocate_event_chain (Vthis_command_keys); Vthis_command_keys = Qnil; Vthis_command_keys_tail = Qnil; - - reset_current_events (command_builder); } static void @@ -3544,7 +3553,7 @@ extract_this_command_keys_nth_mouse_event (int n) { if (!n) { - /* must copy to avoid an abort() in next_event_internal() */ + /* must copy to avoid an ABORT() in next_event_internal() */ if (!NILP (XEVENT_NEXT (event))) return Fcopy_event (event, Qnil); else @@ -3675,7 +3684,7 @@ lookup_command_event (struct command_builder *command_builder, || e->event_type == button_release_event) e->event.button.modifiers |= XEMACS_MOD_META; else - abort (); + ABORT (); { int tckn = event_chain_count (Vthis_command_keys); @@ -3785,8 +3794,8 @@ is_scrollbar_event (Lisp_Object event) EQ (fun, Qscrollbar_to_right) || EQ (fun, Qscrollbar_horizontal_drag)); #else - return 0 -#endif + return 0; +#endif /* HAVE_SCROLLBARS */ } static void @@ -3917,7 +3926,8 @@ execute_command_event (struct command_builder *command_builder, post_command_hook (); - if (!NILP (con->prefix_arg)) + /* Console might have been deleted by command */ + if (CONSOLE_LIVE_P (con) && !NILP (con->prefix_arg)) { /* Commands that set the prefix arg don't update last-command, don't reset the echoing state, and don't go into keyboard macros unless @@ -3946,7 +3956,8 @@ execute_command_event (struct command_builder *command_builder, so we don't either */ if (!is_scrollbar_event (event)) - reset_this_command_keys (make_console (con), 0); + reset_this_command_keys (CONSOLE_LIVE_P (con) ? make_console (con) + : Qnil, 0); } } @@ -4303,6 +4314,7 @@ See `function-key-map' for more details. struct gcpro gcpro1; GCPRO1 (event); + record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); if (!NILP (prompt)) CHECK_STRING (prompt); /* else prompt = Fkeymap_prompt (current_buffer->keymap); may GC */ @@ -4469,7 +4481,7 @@ CONSOLE defaults to the selected console if omitted. /* This junk is so that timestamps don't get to be negative, but contain as many bits as this particular emacs will allow. */ - return make_int (((1L << (VALBITS - 1)) - 1) & tiempo); + return make_int (EMACS_INT_MAX & tiempo); }