summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2020-11-04 13:44:51 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2020-11-04 13:44:51 -0500
commit1c9500da6615ecaa6e7a5029e0f5d0200d66e7ef (patch)
tree1d4cfd1ed4778dd3fdb6eda2293ffbf9a5c93a7c /src/term.c
parent125956725be2f7aea8e7436530f4b32cf621d9ac (diff)
downloademacs-1c9500da6615ecaa6e7a5029e0f5d0200d66e7ef.tar.gz
* src/term.c (handle_one_term_event): Simplify.
Remove the `hold_quit` argument which was never used. Streamline the control flow. Thanks to Jared Finder <jared@finder.org> for pointing it out. * src/keyboard.c (tty_read_avail_input): Simplify accordingly.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c86
1 files changed, 41 insertions, 45 deletions
diff --git a/src/term.c b/src/term.c
index ff1aabfed23..3a13da165e5 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2550,67 +2550,63 @@ term_mouse_click (struct input_event *result, Gpm_Event *event,
}
int
-handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event,
- struct input_event *hold_quit)
+handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event)
{
struct frame *f = XFRAME (tty->top_frame);
struct input_event ie;
- bool do_help = 0;
int count = 0;
EVENT_INIT (ie);
ie.kind = NO_EVENT;
ie.arg = Qnil;
- if (event->type & (GPM_MOVE | GPM_DRAG)) {
- previous_help_echo_string = help_echo_string;
- help_echo_string = Qnil;
+ if (event->type & (GPM_MOVE | GPM_DRAG))
+ {
+ previous_help_echo_string = help_echo_string;
+ help_echo_string = Qnil;
- Gpm_DrawPointer (event->x, event->y, fileno (tty->output));
+ Gpm_DrawPointer (event->x, event->y, fileno (tty->output));
- if (!term_mouse_movement (f, event))
- help_echo_string = previous_help_echo_string;
+ if (!term_mouse_movement (f, event))
+ help_echo_string = previous_help_echo_string;
- /* If the contents of the global variable help_echo_string
- has changed, generate a HELP_EVENT. */
- if (!NILP (help_echo_string)
- || !NILP (previous_help_echo_string))
- do_help = 1;
+ /* If the contents of the global variable help_echo_string
+ has changed, generate a HELP_EVENT. */
+ if (!NILP (help_echo_string)
+ || !NILP (previous_help_echo_string))
+ {
+ Lisp_Object frame;
- goto done;
- }
- else {
- f->mouse_moved = 0;
- term_mouse_click (&ie, event, f);
- if (tty_handle_tab_bar_click (f, event->x, event->y,
- (ie.modifiers & down_modifier) != 0, &ie))
- {
- /* tty_handle_tab_bar_click stores 2 events in the event
- queue, so we are done here. */
- count += 2;
- return count;
- }
- }
+ if (f)
+ XSETFRAME (frame, f);
+ else
+ frame = Qnil;
- done:
- if (ie.kind != NO_EVENT)
- {
- kbd_buffer_store_event_hold (&ie, hold_quit);
- count++;
+ gen_help_event (help_echo_string, frame, help_echo_window,
+ help_echo_object, help_echo_pos);
+ count++;
+ }
}
-
- if (do_help
- && !(hold_quit && hold_quit->kind != NO_EVENT))
+ else
{
- Lisp_Object frame;
-
- if (f)
- XSETFRAME (frame, f);
- else
- frame = Qnil;
-
- gen_help_event (help_echo_string, frame, help_echo_window,
- help_echo_object, help_echo_pos);
+ f->mouse_moved = 0;
+ term_mouse_click (&ie, event, f);
+ /* eassert (ie.kind == GPM_CLICK_EVENT); */
+ if (tty_handle_tab_bar_click (f, event->x, event->y,
+ (ie.modifiers & down_modifier) != 0, &ie))
+ {
+ /* eassert (ie.kind == GPM_CLICK_EVENT
+ * || ie.kind == TAB_BAR_EVENT); */
+ /* tty_handle_tab_bar_click stores 2 events in the event
+ queue, so we are done here. */
+ /* FIXME: Actually, `tty_handle_tab_bar_click` returns true
+ without storing any events, when
+ (ie.modifiers & down_modifier) != 0 */
+ count += 2;
+ return count;
+ }
+ /* eassert (ie.kind == GPM_CLICK_EVENT); */
+ kbd_buffer_store_event (&ie);
count++;
}