]> git.eshelyaron.com Git - emacs.git/commit
Avoid some union buffered_input_event uses
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 Mar 2025 17:32:08 +0000 (09:32 -0800)
committerEshel Yaron <me@eshelyaron.com>
Tue, 4 Mar 2025 21:03:52 +0000 (22:03 +0100)
commit2ad34b22a5813d98c5613ef244c2d3754ab59b48
treec29c1564a1d3b55544fa58db011924132d94d4dd
parentf445be07ecc7c4bc2b0539d9b8ab2858971cde57
Avoid some union buffered_input_event uses

Simplify by using separate local vars for struct input_event and
struct selection_input_event, rather than a single local var that
is the union of the two.  This makes the code easier to follow by
the human reader, and should help avoid GCC bug 117423
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117423> and
therefore work around Emacs bug 76559 <https://bugs.gnu.org/76559>.
* src/androidterm.c (handle_one_android_event):
* src/gtkutil.c (xg_widget_key_press_event_cb):
* src/pgtkterm.c (evq_flush):
* src/xterm.c (handle_one_xevent): Use struct input_event and
kbd_buffer_store_event_hold, or struct selection_input_event and
kbd_buffer_store_selection_event_hold, rather than union
buffered_input_event and union buffered_input_event.
* src/keyboard.c (beware_long_paste, maybe_quit_while_no_input):
New functions, broken out from kbd_buffer_store_buffered_event.
(kbd_buffer_store_event_hold): Define here, with a simplified
version of the body of the old kbd_buffer_store_buffered_event,
rather than defining in keyboard.h.  Specialize to struct
input_event.
(kbd_buffer_store_selection_event_hold): New function; it is
a simplified version of the old kbd_buffer_store_buffered_event,
specialized to struct selection_input_event.
(is_ignored_event_kind): Accept enum event_kind instead of
union buffered_input_event.  All callers changed.
* src/keyboard.h (kbd_buffer_store_event_hold):
Remove definition, as keyboard.c now defines it.
* src/pgtkterm.c (evq_grow_if_needed): New function.
(evq_enqueue, evq_selection_enqueue): Two functions now,
not one.  Args are now struct input_event const * or
struct selection_input_event const *, not
union buffered_input_event *.  All callers changed.
This lets us simplify the callers so that they need
not use the union.

(cherry picked from commit 29a9fd4f4ba17822eca0f00c2037da3868bd874e)
src/androidterm.c
src/gtkutil.c
src/keyboard.c
src/keyboard.h
src/pgtkterm.c
src/xterm.c