Revert “Avoid some union buffered_input_event uses”

Revert my commit 29a9fd4f4b
and the following commit 1ec0889e7b.
This fixes a bug where ‘emacs -nw’ would sometimes freeze when Emacs is
configured with ‘--with-pgtk --enable-link-time-optimization
--disable-gc-mark-trace’ on GNU/Linux x86-64 (Bug#76729).
As it is not yet clear whether this freeze is due to an Emacs bug that
I introduced, or due to GCC bug 117423
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117423>,
play it safe for now and revert to the previous state.
This commit is contained in:
Paul Eggert 2025-03-03 22:20:08 -08:00
parent 3e39b2418b
commit 9415941a9c
6 changed files with 629 additions and 689 deletions

View file

@ -841,7 +841,7 @@ handle_one_android_event (struct android_display_info *dpyinfo,
union android_event configureEvent;
struct frame *f, *any, *mouse_frame;
Mouse_HLInfo *hlinfo;
struct input_event inev;
union buffered_input_event inev;
int modifiers, count, do_help;
struct android_touch_point *touchpoint, **last;
Lisp_Object window;
@ -865,7 +865,7 @@ handle_one_android_event (struct android_display_info *dpyinfo,
if (any && any->wait_event_type == event->type)
any->wait_event_type = 0; /* Indicates we got it. */
EVENT_INIT (inev);
EVENT_INIT (inev.ie);
switch (event->type)
{
@ -936,8 +936,8 @@ handle_one_android_event (struct android_display_info *dpyinfo,
if (!FRAME_TOOLTIP_P (f)
&& (old_left != f->left_pos || old_top != f->top_pos))
{
inev.kind = MOVE_FRAME_EVENT;
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = MOVE_FRAME_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
if (f && FRAME_OUTPUT_DATA (f)->need_cursor_updates)
@ -996,10 +996,10 @@ handle_one_android_event (struct android_display_info *dpyinfo,
memset (&compose_status, 0, sizeof (compose_status));
/* Common for all keysym input events. */
XSETFRAME (inev.frame_or_window, any);
inev.modifiers
XSETFRAME (inev.ie.frame_or_window, any);
inev.ie.modifiers
= android_android_to_emacs_modifiers (dpyinfo, modifiers);
inev.timestamp = event->xkey.time;
inev.ie.timestamp = event->xkey.time;
keysym = event->xkey.keycode;
@ -1033,8 +1033,8 @@ handle_one_android_event (struct android_display_info *dpyinfo,
if (event->xkey.keycode == (uint32_t) -1)
{
inev.kind = PREEDIT_TEXT_EVENT;
inev.arg = Qnil;
inev.ie.kind = PREEDIT_TEXT_EVENT;
inev.ie.arg = Qnil;
/* If text was looked up, decode it and make it the
preedit text. */
@ -1042,7 +1042,7 @@ handle_one_android_event (struct android_display_info *dpyinfo,
if (status_return == ANDROID_LOOKUP_CHARS && nchars)
{
copy_bufptr[nchars] = 0;
inev.arg = from_unicode_buffer (copy_bufptr);
inev.ie.arg = from_unicode_buffer (copy_bufptr);
}
goto done_keysym;
@ -1061,11 +1061,11 @@ handle_one_android_event (struct android_display_info *dpyinfo,
/* Deal with characters. */
if (copy_bufptr[0] < 128)
inev.kind = ASCII_KEYSTROKE_EVENT;
inev.ie.kind = ASCII_KEYSTROKE_EVENT;
else
inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.code = copy_bufptr[0];
inev.ie.code = copy_bufptr[0];
}
else if (nchars < 2 && keysym)
{
@ -1075,8 +1075,8 @@ handle_one_android_event (struct android_display_info *dpyinfo,
/* Next, deal with special ``characters'' by giving the
keycode to keyboard.c. */
inev.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.code = keysym;
inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.ie.code = keysym;
}
else
{
@ -1084,25 +1084,25 @@ handle_one_android_event (struct android_display_info *dpyinfo,
for (i = 0; i < nchars; ++i)
{
inev.kind = (SINGLE_BYTE_CHAR_P (copy_bufptr[i])
? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT);
inev.code = copy_bufptr[i];
inev.ie.kind = (SINGLE_BYTE_CHAR_P (copy_bufptr[i])
? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT);
inev.ie.code = copy_bufptr[i];
/* If the character is actually '\n', then change this
to RET. */
if (copy_bufptr[i] == '\n')
{
inev.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.code = 66;
inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.ie.code = 66;
}
kbd_buffer_store_event_hold (&inev, hold_quit);
kbd_buffer_store_buffered_event (&inev, hold_quit);
}
count += nchars;
inev.kind = NO_EVENT; /* Already stored above. */
inev.ie.kind = NO_EVENT; /* Already stored above. */
}
goto done_keysym;
@ -1122,7 +1122,7 @@ handle_one_android_event (struct android_display_info *dpyinfo,
case ANDROID_FOCUS_IN:
case ANDROID_FOCUS_OUT:
android_detect_focus_change (dpyinfo, any, event, &inev);
android_detect_focus_change (dpyinfo, any, event, &inev.ie);
goto OTHER;
case ANDROID_WINDOW_ACTION:
@ -1150,8 +1150,8 @@ handle_one_android_event (struct android_display_info *dpyinfo,
if (!f)
goto OTHER;
inev.kind = DELETE_WINDOW_EVENT;
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = DELETE_WINDOW_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
}
@ -1210,8 +1210,8 @@ handle_one_android_event (struct android_display_info *dpyinfo,
&& !EQ (window, last_mouse_window)
&& !EQ (window, selected_window))
{
inev.kind = SELECT_WINDOW_EVENT;
inev.frame_or_window = window;
inev.ie.kind = SELECT_WINDOW_EVENT;
inev.ie.frame_or_window = window;
}
/* Remember the last window where we saw the mouse. */
@ -1392,10 +1392,10 @@ handle_one_android_event (struct android_display_info *dpyinfo,
if (!(tab_bar_p && NILP (tab_bar_arg)) && !tool_bar_p)
if (! popup_activated ())
{
android_construct_mouse_click (&inev, &event->xbutton, f);
android_construct_mouse_click (&inev.ie, &event->xbutton, f);
if (!NILP (tab_bar_arg))
inev.arg = tab_bar_arg;
inev.ie.arg = tab_bar_arg;
}
}
@ -1438,8 +1438,8 @@ handle_one_android_event (struct android_display_info *dpyinfo,
/* Simply update the tool position and send an update. */
touchpoint->x = event->touch.x;
touchpoint->y = event->touch.y;
android_update_tools (any, &inev);
inev.timestamp = event->touch.time;
android_update_tools (any, &inev.ie);
inev.ie.timestamp = event->touch.time;
goto OTHER;
}
@ -1512,12 +1512,12 @@ handle_one_android_event (struct android_display_info *dpyinfo,
}
/* Now generate the Emacs event. */
inev.kind = TOUCHSCREEN_BEGIN_EVENT;
inev.timestamp = event->touch.time;
XSETFRAME (inev.frame_or_window, any);
XSETINT (inev.x, event->touch.x);
XSETINT (inev.y, event->touch.y);
XSETINT (inev.arg, event->touch.pointer_id);
inev.ie.kind = TOUCHSCREEN_BEGIN_EVENT;
inev.ie.timestamp = event->touch.time;
XSETFRAME (inev.ie.frame_or_window, any);
XSETINT (inev.ie.x, event->touch.x);
XSETINT (inev.ie.y, event->touch.y);
XSETINT (inev.ie.arg, event->touch.pointer_id);
goto OTHER;
@ -1540,8 +1540,8 @@ handle_one_android_event (struct android_display_info *dpyinfo,
touchpoint->x = event->touch.x;
touchpoint->y = event->touch.y;
android_update_tools (any, &inev);
inev.timestamp = event->touch.time;
android_update_tools (any, &inev.ie);
inev.ie.timestamp = event->touch.time;
goto OTHER;
@ -1583,18 +1583,18 @@ handle_one_android_event (struct android_display_info *dpyinfo,
grabbed by the tool bar). */
xfree (touchpoint);
inev.kind = TOUCHSCREEN_END_EVENT;
inev.timestamp = event->touch.time;
inev.ie.kind = TOUCHSCREEN_END_EVENT;
inev.ie.timestamp = event->touch.time;
/* Report whether the sequence has been canceled. */
if (event->touch.flags & ANDROID_TOUCH_SEQUENCE_CANCELED)
inev.modifiers = 1;
inev.ie.modifiers = 1;
XSETFRAME (inev.frame_or_window, any);
XSETINT (inev.x, event->touch.x);
XSETINT (inev.y, event->touch.y);
XSETINT (inev.arg, event->touch.pointer_id);
XSETFRAME (inev.ie.frame_or_window, any);
XSETINT (inev.ie.x, event->touch.x);
XSETINT (inev.ie.y, event->touch.y);
XSETINT (inev.ie.arg, event->touch.pointer_id);
/* Break out of the loop. */
goto OTHER;
@ -1643,24 +1643,24 @@ handle_one_android_event (struct android_display_info *dpyinfo,
}
/* Determine what kind of event to send. */
inev.kind = ((fabs (wheel_event_y)
inev.ie.kind = ((fabs (wheel_event_y)
>= fabs (wheel_event_x))
? WHEEL_EVENT : HORIZ_WHEEL_EVENT);
inev.timestamp = event->wheel.time;
inev.ie.timestamp = event->wheel.time;
/* Set the event coordinates. */
XSETINT (inev.x, event->wheel.x);
XSETINT (inev.y, event->wheel.y);
XSETINT (inev.ie.x, event->wheel.x);
XSETINT (inev.ie.y, event->wheel.y);
/* Set the frame. */
XSETFRAME (inev.frame_or_window, any);
XSETFRAME (inev.ie.frame_or_window, any);
/* Figure out the scroll direction. */
inev.modifiers = (signbit ((fabs (wheel_event_x)
>= fabs (wheel_event_y))
? wheel_event_x
: wheel_event_y)
? down_modifier : up_modifier);
inev.ie.modifiers = (signbit ((fabs (wheel_event_x)
>= fabs (wheel_event_y))
? wheel_event_x
: wheel_event_y)
? down_modifier : up_modifier);
/* Figure out how much to scale the deltas by. */
window = window_from_coordinates (any, event->wheel.x,
@ -1678,14 +1678,16 @@ handle_one_android_event (struct android_display_info *dpyinfo,
scroll_unit = pow (scroll_height, 2.0 / 3.0);
/* Add the keyboard modifiers. */
inev.modifiers
inev.ie.modifiers
|= android_android_to_emacs_modifiers (dpyinfo,
event->wheel.state);
/* Finally include the scroll deltas. */
inev.arg = list3 (Qnil,
make_float (wheel_event_x * scroll_unit),
make_float (wheel_event_y * scroll_unit));
inev.ie.arg = list3 (Qnil,
make_float (wheel_event_x
* scroll_unit),
make_float (wheel_event_y
* scroll_unit));
wheel_event_x = 0.0;
wheel_event_y = 0.0;
@ -1705,8 +1707,8 @@ handle_one_android_event (struct android_display_info *dpyinfo,
SET_FRAME_VISIBLE (any, false);
SET_FRAME_ICONIFIED (any, true);
inev.kind = ICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, any);
inev.ie.kind = ICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, any);
goto OTHER;
case ANDROID_DEICONIFIED:
@ -1720,8 +1722,8 @@ handle_one_android_event (struct android_display_info *dpyinfo,
SET_FRAME_VISIBLE (any, true);
SET_FRAME_ICONIFIED (any, false);
inev.kind = DEICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, any);
inev.ie.kind = DEICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, any);
goto OTHER;
/* Context menu handling. */
@ -1769,12 +1771,12 @@ handle_one_android_event (struct android_display_info *dpyinfo,
goto OTHER;
/* Generate a drag and drop event to convey its position. */
inev.kind = DRAG_N_DROP_EVENT;
XSETFRAME (inev.frame_or_window, any);
inev.timestamp = ANDROID_CURRENT_TIME;
XSETINT (inev.x, event->dnd.x);
XSETINT (inev.y, event->dnd.y);
inev.arg = Fcons (inev.x, inev.y);
inev.ie.kind = DRAG_N_DROP_EVENT;
XSETFRAME (inev.ie.frame_or_window, any);
inev.ie.timestamp = ANDROID_CURRENT_TIME;
XSETINT (inev.ie.x, event->dnd.x);
XSETINT (inev.ie.y, event->dnd.y);
inev.ie.arg = Fcons (inev.ie.x, inev.ie.y);
goto OTHER;
case ANDROID_DND_URI_EVENT:
@ -1790,15 +1792,15 @@ handle_one_android_event (struct android_display_info *dpyinfo,
content or file URI or a string to be inserted. Generate an
event with this information. */
inev.kind = DRAG_N_DROP_EVENT;
XSETFRAME (inev.frame_or_window, any);
inev.timestamp = ANDROID_CURRENT_TIME;
XSETINT (inev.x, event->dnd.x);
XSETINT (inev.y, event->dnd.y);
inev.arg = Fcons ((event->type == ANDROID_DND_TEXT_EVENT
? Qtext : Quri),
android_decode_utf16 (event->dnd.uri_or_string,
event->dnd.length));
inev.ie.kind = DRAG_N_DROP_EVENT;
XSETFRAME (inev.ie.frame_or_window, any);
inev.ie.timestamp = ANDROID_CURRENT_TIME;
XSETINT (inev.ie.x, event->dnd.x);
XSETINT (inev.ie.y, event->dnd.y);
inev.ie.arg = Fcons ((event->type == ANDROID_DND_TEXT_EVENT
? Qtext : Quri),
android_decode_utf16 (event->dnd.uri_or_string,
event->dnd.length));
free (event->dnd.uri_or_string);
goto OTHER;
@ -1806,14 +1808,15 @@ handle_one_android_event (struct android_display_info *dpyinfo,
case ANDROID_NOTIFICATION_ACTION:
if (event->notification.type == ANDROID_NOTIFICATION_DELETED)
android_notification_deleted (&event->notification, &inev);
android_notification_deleted (&event->notification, &inev.ie);
else
{
Lisp_Object action;
action = android_decode_utf16 (event->notification.action,
event->notification.length);
android_notification_action (&event->notification, &inev, action);
android_notification_action (&event->notification, &inev.ie,
action);
}
/* Free dynamically allocated data. */
@ -1826,9 +1829,9 @@ handle_one_android_event (struct android_display_info *dpyinfo,
}
OTHER:
if (inev.kind != NO_EVENT)
if (inev.ie.kind != NO_EVENT)
{
kbd_buffer_store_event_hold (&inev, hold_quit);
kbd_buffer_store_buffered_event (&inev, hold_quit);
count++;
}

View file

@ -6382,7 +6382,7 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
{
Lisp_Object tail, tem;
struct frame *f = NULL;
struct input_event inev;
union buffered_input_event inev;
guint keysym = event->key.keyval;
unsigned int xstate;
gunichar uc;
@ -6419,15 +6419,15 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
&& !FRAME_DISPLAY_INFO (f)->prefer_native_input)
return true;
EVENT_INIT (inev);
XSETFRAME (inev.frame_or_window, f);
EVENT_INIT (inev.ie);
XSETFRAME (inev.ie.frame_or_window, f);
xstate = xg_virtual_mods_to_x (FRAME_DISPLAY_INFO (f),
event->key.state);
inev.modifiers
inev.ie.modifiers
|= x_x_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), xstate);
inev.timestamp = event->key.time;
inev.ie.timestamp = event->key.time;
#ifdef HAVE_XINPUT2
if (event->key.time == pending_keystroke_time)
@ -6436,7 +6436,7 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
FRAME_DISPLAY_INFO (f)->pending_keystroke_source);
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
#endif
@ -6455,8 +6455,8 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
if (keysym >= 32 && keysym < 128)
/* Avoid explicitly decoding each ASCII character. */
{
inev.kind = ASCII_KEYSTROKE_EVENT;
inev.code = keysym;
inev.ie.kind = ASCII_KEYSTROKE_EVENT;
inev.ie.code = keysym;
goto done;
}
@ -6464,10 +6464,10 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
if (keysym >= 0x01000000 && keysym <= 0x0110FFFF)
{
if (keysym < 0x01000080)
inev.kind = ASCII_KEYSTROKE_EVENT;
inev.ie.kind = ASCII_KEYSTROKE_EVENT;
else
inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.code = keysym & 0xFFFFFF;
inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.ie.code = keysym & 0xFFFFFF;
goto done;
}
@ -6523,8 +6523,8 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
/* Any "vendor-specific" key is ok. */
|| (keysym & (1 << 28))))
{
inev.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.code = keysym;
inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.ie.code = keysym;
goto done;
}
@ -6532,22 +6532,22 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
if (uc)
{
inev.kind = (SINGLE_BYTE_CHAR_P (uc)
? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT);
inev.code = uc;
inev.ie.kind = (SINGLE_BYTE_CHAR_P (uc)
? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT);
inev.ie.code = uc;
}
else
{
inev.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.code = keysym;
inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.ie.code = keysym;
}
done:
if (inev.kind != NO_EVENT)
if (inev.ie.kind != NO_EVENT)
{
xg_pending_quit_event.kind = NO_EVENT;
kbd_buffer_store_event_hold (&inev, &xg_pending_quit_event);
kbd_buffer_store_buffered_event (&inev, &xg_pending_quit_event);
}
XNoOp (FRAME_X_DISPLAY (f));

View file

@ -408,7 +408,7 @@ static void timer_resume_idle (void);
static void deliver_user_signal (int);
static char *find_user_signal_name (int);
static void store_user_signal_events (void);
static bool is_ignored_event_kind (enum event_kind);
static bool is_ignored_event (union buffered_input_event *);
/* Advance or retreat a buffered input event pointer. */
@ -3629,7 +3629,7 @@ readable_events (int flags)
&& (event->kind == FOCUS_IN_EVENT
|| event->kind == FOCUS_OUT_EVENT))
|| (input_pending_p_filter_events
&& is_ignored_event_kind (event->kind))))
&& is_ignored_event (event))))
#ifdef USE_TOOLKIT_SCROLL_BARS
&& !((flags & READABLE_EVENTS_IGNORE_SQUEEZABLES)
&& (event->kind == SCROLL_BAR_CLICK_EVENT
@ -3714,31 +3714,6 @@ kbd_buffer_store_event (register struct input_event *event)
kbd_buffer_store_event_hold (event, 0);
}
static void
beware_long_paste (void)
{
#ifdef subprocesses
if (! (kbd_buffer_nr_stored () <= KBD_BUFFER_SIZE / 2
&& kbd_on_hold_p ()))
{
/* Don't read keyboard input until we have processed kbd_buffer.
This happens when pasting text longer than KBD_BUFFER_SIZE/2. */
hold_keyboard_input ();
unrequest_sigio ();
stop_polling ();
}
#endif
}
/* If we're inside while-no-input, and this event qualifies
as input, set quit-flag to cause an interrupt. */
static void
maybe_quit_while_no_input (enum event_kind kind)
{
if (!NILP (Vthrow_on_input) && !is_ignored_event_kind (kind))
Vquit_flag = Vthrow_on_input;
}
/* Store EVENT obtained at interrupt level into kbd_buffer, fifo.
If HOLD_QUIT is 0, just stuff EVENT into the fifo.
@ -3750,8 +3725,8 @@ maybe_quit_while_no_input (enum event_kind kind)
subsequent input events have been parsed (and discarded). */
void
kbd_buffer_store_event_hold (struct input_event *event,
struct input_event *hold_quit)
kbd_buffer_store_buffered_event (union buffered_input_event *event,
struct input_event *hold_quit)
{
if (event->kind == NO_EVENT)
emacs_abort ();
@ -3761,23 +3736,23 @@ kbd_buffer_store_event_hold (struct input_event *event,
if (event->kind == ASCII_KEYSTROKE_EVENT)
{
int c = event->code & 0377;
int c = event->ie.code & 0377;
if (event->modifiers & ctrl_modifier)
if (event->ie.modifiers & ctrl_modifier)
c = make_ctrl_char (c);
c |= (event->modifiers
c |= (event->ie.modifiers
& (meta_modifier | alt_modifier
| hyper_modifier | super_modifier));
if (c == quit_char)
{
KBOARD *kb = FRAME_KBOARD (XFRAME (event->frame_or_window));
KBOARD *kb = FRAME_KBOARD (XFRAME (event->ie.frame_or_window));
if (single_kboard && kb != current_kboard)
{
kset_kbd_queue
(kb, list2 (make_lispy_switch_frame (event->frame_or_window),
(kb, list2 (make_lispy_switch_frame (event->ie.frame_or_window),
make_fixnum (c)));
kb->kbd_queue_has_data = true;
@ -3796,7 +3771,7 @@ kbd_buffer_store_event_hold (struct input_event *event,
if (hold_quit)
{
*hold_quit = *event;
*hold_quit = event->ie;
return;
}
@ -3807,9 +3782,9 @@ kbd_buffer_store_event_hold (struct input_event *event,
{
Lisp_Object focus;
focus = FRAME_FOCUS_FRAME (XFRAME (event->frame_or_window));
focus = FRAME_FOCUS_FRAME (XFRAME (event->ie.frame_or_window));
if (NILP (focus))
focus = event->frame_or_window;
focus = event->ie.frame_or_window;
internal_last_event_frame = focus;
Vlast_event_frame = focus;
}
@ -3832,47 +3807,28 @@ kbd_buffer_store_event_hold (struct input_event *event,
union buffered_input_event *next_slot = next_kbd_event (kbd_store_ptr);
if (kbd_fetch_ptr != next_slot)
{
kbd_store_ptr->ie = *event;
*kbd_store_ptr = *event;
kbd_store_ptr = next_slot;
beware_long_paste ();
#ifdef subprocesses
if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE / 2
&& ! kbd_on_hold_p ())
{
/* Don't read keyboard input until we have processed kbd_buffer.
This happens when pasting text longer than KBD_BUFFER_SIZE/2. */
hold_keyboard_input ();
unrequest_sigio ();
stop_polling ();
}
#endif /* subprocesses */
}
maybe_quit_while_no_input (event->kind);
/* If we're inside while-no-input, and this event qualifies
as input, set quit-flag to cause an interrupt. */
if (!NILP (Vthrow_on_input)
&& !is_ignored_event (event))
Vquit_flag = Vthrow_on_input;
}
#if defined HAVE_X11 || defined HAVE_PGTK
/* Store EVENT obtained at interrupt level into kbd_buffer, fifo.
This is like kbd_buffer_store_event_hold, but for struct
selection_input_event instead of struct input_event.
If HOLD_QUIT && HOLD_QUIT->kind != NO_EVENT, discard EVENT.
This is used to postpone the processing of the quit event until all
subsequent input events have been parsed (and discarded). */
void
kbd_buffer_store_selection_event_hold (struct selection_input_event *event,
struct input_event *hold_quit)
{
if (hold_quit && hold_quit->kind != NO_EVENT)
return;
/* Don't let the very last slot in the buffer become full,
since that would make the two pointers equal,
and that is indistinguishable from an empty buffer.
Discard the event if it would fill the last slot. */
union buffered_input_event *next_slot = next_kbd_event (kbd_store_ptr);
if (kbd_fetch_ptr != next_slot)
{
kbd_store_ptr->sie = *event;
kbd_store_ptr = next_slot;
beware_long_paste ();
}
maybe_quit_while_no_input (event->kind);
}
#endif /* HAVE_X11 || HAVE_PGTK */
/* Limit help event positions to this range, to avoid overflow problems. */
#define INPUT_EVENT_POS_MAX \
((ptrdiff_t) min (PTRDIFF_MAX, min (TYPE_MAXIMUM (Time) / 2, \
@ -12921,11 +12877,11 @@ init_while_no_input_ignore_events (void)
}
static bool
is_ignored_event_kind (enum event_kind kind)
is_ignored_event (union buffered_input_event *event)
{
Lisp_Object ignore_event;
switch (kind)
switch (event->kind)
{
case FOCUS_IN_EVENT: ignore_event = Qfocus_in; break;
case FOCUS_OUT_EVENT: ignore_event = Qfocus_out; break;

View file

@ -499,12 +499,17 @@ extern void clear_waiting_for_input (void);
extern void swallow_events (bool);
extern bool lucid_event_type_list_p (Lisp_Object);
extern void kbd_buffer_store_event (struct input_event *);
extern void kbd_buffer_store_event_hold (struct input_event *,
struct input_event *);
#if defined HAVE_X11 || defined HAVE_PGTK
extern void kbd_buffer_store_selection_event_hold (struct selection_input_event *,
struct input_event *);
#endif
extern void kbd_buffer_store_buffered_event (union buffered_input_event *,
struct input_event *);
INLINE void
kbd_buffer_store_event_hold (struct input_event *event,
struct input_event *hold_quit)
{
static_assert (alignof (struct input_event) == alignof (union buffered_input_event)
&& sizeof (struct input_event) == sizeof (union buffered_input_event));
kbd_buffer_store_buffered_event ((union buffered_input_event *) event,
hold_quit);
}
extern void poll_for_input_1 (void);
extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object);

File diff suppressed because it is too large Load diff

View file

@ -18881,7 +18881,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
#endif
int *finish, struct input_event *hold_quit)
{
struct input_event inev;
union buffered_input_event inev;
int count = 0;
int do_help = 0;
#ifdef HAVE_XINPUT2
@ -18924,9 +18924,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
*finish = X_EVENT_NORMAL;
EVENT_INIT (inev);
inev.kind = NO_EVENT;
inev.arg = Qnil;
EVENT_INIT (inev.ie);
inev.ie.kind = NO_EVENT;
inev.ie.arg = Qnil;
#ifdef HAVE_XINPUT2
gen_help_device = NULL;
#endif
@ -19257,9 +19257,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (!f)
goto OTHER; /* May be a dialog that is to be removed */
inev.kind = DELETE_WINDOW_EVENT;
inev.timestamp = event->xclient.data.l[1];
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = DELETE_WINDOW_EVENT;
inev.ie.timestamp = event->xclient.data.l[1];
XSETFRAME (inev.ie.frame_or_window, f);
goto done;
}
@ -19413,7 +19413,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
/* Convert the scroll bar event to an input event using
the first window entered into the scroll bar event
queue. */
x_scroll_bar_to_input_event (dpyinfo, event, &inev);
x_scroll_bar_to_input_event (dpyinfo, event, &inev.ie);
*finish = X_EVENT_GOTO_OUT;
goto done;
@ -19423,7 +19423,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
/* Convert the horizontal scroll bar event to an input
event using the first window entered into the scroll
bar event queue. */
x_horizontal_scroll_bar_to_input_event (dpyinfo, event, &inev);
x_horizontal_scroll_bar_to_input_event (dpyinfo, event,
&inev.ie);
*finish = X_EVENT_GOTO_OUT;
goto done;
@ -19435,7 +19436,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
{
enum xembed_message msg = event->xclient.data.l[1];
if (msg == XEMBED_FOCUS_IN || msg == XEMBED_FOCUS_OUT)
x_detect_focus_change (dpyinfo, any, event, &inev);
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
*finish = X_EVENT_GOTO_OUT;
goto done;
@ -19474,7 +19475,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
rc = x_coords_from_dnd_message (dpyinfo, (XEvent *) event,
&dx, &dy);
if (x_handle_dnd_message (f, &event->xclient, dpyinfo, &inev,
if (x_handle_dnd_message (f, &event->xclient, dpyinfo, &inev.ie,
rc, dx, dy))
*finish = X_EVENT_DROP;
}
@ -19510,18 +19511,15 @@ handle_one_xevent (struct x_display_info *dpyinfo,
|| dpyinfo->motif_drag_atom_time <= eventp->time))
dpyinfo->motif_drag_atom = None;
struct selection_input_event sinev = {0};
sinev.kind = SELECTION_CLEAR_EVENT;
SELECTION_EVENT_DPYINFO (&sinev) = dpyinfo;
SELECTION_EVENT_SELECTION (&sinev) = eventp->selection;
SELECTION_EVENT_TIME (&sinev) = eventp->time;
inev.sie.kind = SELECTION_CLEAR_EVENT;
SELECTION_EVENT_DPYINFO (&inev.sie) = dpyinfo;
SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection;
SELECTION_EVENT_TIME (&inev.sie) = eventp->time;
if (x_use_pending_selection_requests)
x_push_selection_request (&sinev);
else
{
kbd_buffer_store_selection_event_hold (&sinev, hold_quit);
count++;
x_push_selection_request (&inev.sie);
EVENT_INIT (inev.ie);
}
}
break;
@ -19537,25 +19535,22 @@ handle_one_xevent (struct x_display_info *dpyinfo,
{
const XSelectionRequestEvent *eventp = &event->xselectionrequest;
struct selection_input_event sinev;
sinev.kind = SELECTION_REQUEST_EVENT;
SELECTION_EVENT_DPYINFO (&sinev) = dpyinfo;
SELECTION_EVENT_REQUESTOR (&sinev) = eventp->requestor;
SELECTION_EVENT_SELECTION (&sinev) = eventp->selection;
SELECTION_EVENT_TARGET (&sinev) = eventp->target;
SELECTION_EVENT_PROPERTY (&sinev) = eventp->property;
SELECTION_EVENT_TIME (&sinev) = eventp->time;
inev.sie.kind = SELECTION_REQUEST_EVENT;
SELECTION_EVENT_DPYINFO (&inev.sie) = dpyinfo;
SELECTION_EVENT_REQUESTOR (&inev.sie) = eventp->requestor;
SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection;
SELECTION_EVENT_TARGET (&inev.sie) = eventp->target;
SELECTION_EVENT_PROPERTY (&inev.sie) = eventp->property;
SELECTION_EVENT_TIME (&inev.sie) = eventp->time;
/* If drag-and-drop or another modal dialog/menu is in
progress, handle SelectionRequest events immediately, by
pushing it onto the selection queue. */
if (x_use_pending_selection_requests)
x_push_selection_request (&sinev);
else
{
kbd_buffer_store_selection_event_hold (&sinev, hold_quit);
count++;
x_push_selection_request (&inev.sie);
EVENT_INIT (inev.ie);
}
if (x_dnd_waiting_for_finish
@ -19654,7 +19649,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
SET_FRAME_ICONIFIED (f, false);
f->output_data.x->has_been_visible = true;
inev.kind = DEICONIFY_EVENT;
inev.ie.kind = DEICONIFY_EVENT;
#if defined USE_GTK && defined HAVE_GTK3
/* If GTK3 wants to impose some old size here (Bug#24526),
tell it that the current size is what we want. */
@ -19665,7 +19660,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
f->was_invisible = false;
}
#endif
XSETFRAME (inev.frame_or_window, f);
XSETFRAME (inev.ie.frame_or_window, f);
}
else if (!not_hidden && !FRAME_ICONIFIED_P (f))
{
@ -19675,8 +19670,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
SET_FRAME_VISIBLE (f, 0);
SET_FRAME_ICONIFIED (f, true);
inev.kind = ICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = ICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
}
@ -19691,7 +19686,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
set. Handling UnmapNotify also checks for
_NET_WM_STATE_HIDDEN, and thus suffers from the same
problem. */
x_handle_wm_state (f, &inev);
x_handle_wm_state (f, &inev.ie);
if (f && FRAME_X_OUTPUT (f)->alpha_identical_p
&& (event->xproperty.atom
@ -20093,8 +20088,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
(f, build_string ("UnmapNotify, visible | iconified"));
SET_FRAME_ICONIFIED (f, true);
inev.kind = ICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = ICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
else if (CONSP (frame_size_history))
frame_size_history_plain
@ -20203,8 +20198,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if ((not_hidden || FRAME_X_EMBEDDED_P (f)) && iconified)
{
inev.kind = DEICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = DEICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
}
goto OTHER;
@ -20470,17 +20465,18 @@ handle_one_xevent (struct x_display_info *dpyinfo,
orig_keysym = keysym;
/* Common for all keysym input events. */
XSETFRAME (inev.frame_or_window, f);
inev.modifiers = x_x_to_emacs_modifiers (dpyinfo, modifiers);
inev.timestamp = xkey.time;
XSETFRAME (inev.ie.frame_or_window, f);
inev.ie.modifiers
= x_x_to_emacs_modifiers (dpyinfo, modifiers);
inev.ie.timestamp = xkey.time;
/* First deal with keysyms which have defined
translations to characters. */
if (keysym >= 32 && keysym < 128)
/* Avoid explicitly decoding each ASCII character. */
{
inev.kind = ASCII_KEYSTROKE_EVENT;
inev.code = keysym;
inev.ie.kind = ASCII_KEYSTROKE_EVENT;
inev.ie.code = keysym;
#ifdef HAVE_XINPUT2
if (event->xkey.time == pending_keystroke_time)
@ -20489,7 +20485,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
dpyinfo->pending_keystroke_source);
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
#endif
@ -20500,10 +20496,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (keysym >= 0x01000000 && keysym <= 0x0110FFFF)
{
if (keysym < 0x01000080)
inev.kind = ASCII_KEYSTROKE_EVENT;
inev.ie.kind = ASCII_KEYSTROKE_EVENT;
else
inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.code = keysym & 0xFFFFFF;
inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.ie.code = keysym & 0xFFFFFF;
#ifdef HAVE_XINPUT2
if (event->xkey.time == pending_keystroke_time)
@ -20512,7 +20508,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
dpyinfo->pending_keystroke_source);
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
#endif
@ -20526,10 +20522,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
Qnil),
FIXNATP (c)))
{
inev.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT);
inev.code = XFIXNAT (c);
inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT);
inev.ie.code = XFIXNAT (c);
#ifdef HAVE_XINPUT2
if (event->xkey.time == pending_keystroke_time)
@ -20538,7 +20534,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
dpyinfo->pending_keystroke_source);
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
#endif
@ -20644,8 +20640,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
STORE_KEYSYM_FOR_DEBUG (keysym);
/* make_lispy_event will convert this to a symbolic
key. */
inev.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.code = keysym;
inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.ie.code = keysym;
#ifdef HAVE_XINPUT2
if (event->xkey.time == pending_keystroke_time)
@ -20654,7 +20650,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
dpyinfo->pending_keystroke_source);
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
#endif
@ -20671,11 +20667,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (nbytes)
{
inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.arg = make_unibyte_string ((char *) copy_bufptr, nbytes);
inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.ie.arg = make_unibyte_string ((char *) copy_bufptr, nbytes);
Fput_text_property (make_fixnum (0), make_fixnum (nbytes),
Qcoding, coding, inev.arg);
Qcoding, coding, inev.ie.arg);
#ifdef HAVE_XINPUT2
if (event->xkey.time == pending_keystroke_time
@ -20689,7 +20685,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
dpyinfo->pending_keystroke_source);
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
#endif
}
@ -20764,7 +20760,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
to treat implicit focus correctly. (bug#65919) */
#if defined USE_X_TOOLKIT || (defined USE_GTK && !defined HAVE_GTK3)
if (x_top_window_to_frame (dpyinfo, event->xcrossing.window))
x_detect_focus_change (dpyinfo, any, event, &inev);
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
#endif /* defined USE_X_TOOLKIT || (defined USE_GTK && !defined HAVE_GTK3) */
#ifdef HAVE_XINPUT2
@ -20783,7 +20779,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
builds. */
#if !defined USE_X_TOOLKIT || (!defined USE_GTK || defined HAVE_GTK3)
if (x_top_window_to_frame (dpyinfo, event->xcrossing.window))
x_detect_focus_change (dpyinfo, any, event, &inev);
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
#endif /* !defined USE_X_TOOLKIT || (!defined USE_GTK || defined HAVE_GTK3) */
f = any;
@ -20857,12 +20853,12 @@ handle_one_xevent (struct x_display_info *dpyinfo,
SET_FRAME_VISIBLE (f, 1);
SET_FRAME_ICONIFIED (f, false);
f->output_data.x->has_been_visible = true;
inev.kind = DEICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = DEICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
}
x_detect_focus_change (dpyinfo, any, event, &inev);
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
goto OTHER;
case LeaveNotify:
@ -20874,7 +20870,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
to treat implicit focus correctly. */
#if defined USE_X_TOOLKIT || (defined USE_GTK && !defined HAVE_GTK3)
if (x_top_window_to_frame (dpyinfo, event->xcrossing.window))
x_detect_focus_change (dpyinfo, any, event, &inev);
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
#endif /* defined USE_X_TOOLKIT || (defined USE_GTK && !defined HAVE_GTK3) */
#ifdef HAVE_XINPUT2
@ -20906,7 +20902,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
builds. */
#if !defined USE_X_TOOLKIT || (!defined USE_GTK || defined HAVE_GTK3)
if (x_top_window_to_frame (dpyinfo, event->xcrossing.window))
x_detect_focus_change (dpyinfo, any, event, &inev);
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
#endif /* !defined USE_X_TOOLKIT || (!defined USE_GTK || defined HAVE_GTK3) */
#ifdef HAVE_XWIDGETS
@ -21007,7 +21003,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (dpyinfo->supports_xi2)
goto OTHER;
#endif
x_detect_focus_change (dpyinfo, any, event, &inev);
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
goto OTHER;
case MotionNotify:
@ -21317,8 +21313,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
&& !EQ (window, last_mouse_window)
&& !EQ (window, selected_window))
{
inev.kind = SELECT_WINDOW_EVENT;
inev.frame_or_window = window;
inev.ie.kind = SELECT_WINDOW_EVENT;
inev.ie.frame_or_window = window;
}
/* Remember the last window where we saw the mouse. */
@ -21409,13 +21405,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
hook. */
if (!x_find_monitors_changed_event (dpyinfo))
{
inev.kind = MONITORS_CHANGED_EVENT;
XSETTERMINAL (inev.arg, dpyinfo->terminal);
inev.ie.kind = MONITORS_CHANGED_EVENT;
XSETTERMINAL (inev.ie.arg, dpyinfo->terminal);
/* Store this event now since inev.type could be set to
/* Store this event now since inev.ie.type could be set to
MOVE_FRAME_EVENT later. */
kbd_buffer_store_event (&inev);
inev.kind = NO_EVENT;
kbd_buffer_store_event (&inev.ie);
inev.ie.kind = NO_EVENT;
}
/* Also update the position of the drag-and-drop
@ -21682,8 +21678,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (!FRAME_TOOLTIP_P (f)
&& (old_left != f->left_pos || old_top != f->top_pos))
{
inev.kind = MOVE_FRAME_EVENT;
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = MOVE_FRAME_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
}
@ -21749,8 +21745,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (!EQ (selected_window, xvw->w) && (event->xbutton.button < 4))
{
inev.kind = SELECT_WINDOW_EVENT;
inev.frame_or_window = xvw->w;
inev.ie.kind = SELECT_WINDOW_EVENT;
inev.ie.frame_or_window = xvw->w;
}
*finish = X_EVENT_DROP;
@ -22006,14 +22002,14 @@ handle_one_xevent (struct x_display_info *dpyinfo,
&& event->xbutton.time > ignore_next_mouse_click_timeout)
{
ignore_next_mouse_click_timeout = 0;
x_construct_mouse_click (&inev, &event->xbutton,
x_construct_mouse_click (&inev.ie, &event->xbutton,
f, false);
}
if (event->type == ButtonRelease)
ignore_next_mouse_click_timeout = 0;
}
else
x_construct_mouse_click (&inev, &event->xbutton, f, false);
x_construct_mouse_click (&inev.ie, &event->xbutton, f, false);
*finish = X_EVENT_DROP;
goto OTHER;
@ -22083,18 +22079,18 @@ handle_one_xevent (struct x_display_info *dpyinfo,
&& event->xbutton.time > ignore_next_mouse_click_timeout)
{
ignore_next_mouse_click_timeout = 0;
x_construct_mouse_click (&inev, &event->xbutton,
x_construct_mouse_click (&inev.ie, &event->xbutton,
f, false);
}
if (event->type == ButtonRelease)
ignore_next_mouse_click_timeout = 0;
}
else
x_construct_mouse_click (&inev, &event->xbutton,
x_construct_mouse_click (&inev.ie, &event->xbutton,
f, false);
if (!NILP (tab_bar_arg))
inev.arg = tab_bar_arg;
inev.ie.arg = tab_bar_arg;
}
if (FRAME_X_EMBEDDED_P (f)
@ -22113,12 +22109,12 @@ handle_one_xevent (struct x_display_info *dpyinfo,
scroll bars. */
if (bar && event->xbutton.state & ControlMask)
{
x_scroll_bar_handle_click (bar, event, &inev, Qnil);
x_scroll_bar_handle_click (bar, event, &inev.ie, Qnil);
*finish = X_EVENT_DROP;
}
#else /* not USE_TOOLKIT_SCROLL_BARS */
if (bar)
x_scroll_bar_handle_click (bar, event, &inev, Qnil);
x_scroll_bar_handle_click (bar, event, &inev.ie, Qnil);
#endif /* not USE_TOOLKIT_SCROLL_BARS */
}
@ -22175,8 +22171,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (!f->output_data.x->saved_menu_event)
f->output_data.x->saved_menu_event = xmalloc (sizeof *event);
*f->output_data.x->saved_menu_event = *event;
inev.kind = MENU_BAR_ACTIVATE_EVENT;
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = MENU_BAR_ACTIVATE_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
*finish = X_EVENT_DROP;
#ifdef USE_MOTIF
}
@ -22327,8 +22323,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
SET_FRAME_VISIBLE (f, 1);
SET_FRAME_ICONIFIED (f, false);
f->output_data.x->has_been_visible = true;
inev.kind = DEICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = DEICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
}
@ -22878,36 +22874,36 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (fabs (total_x) > 0 || fabs (total_y) > 0)
{
inev.kind = (fabs (total_y) >= fabs (total_x)
? WHEEL_EVENT : HORIZ_WHEEL_EVENT);
inev.timestamp = xev->time;
inev.ie.kind = (fabs (total_y) >= fabs (total_x)
? WHEEL_EVENT : HORIZ_WHEEL_EVENT);
inev.ie.timestamp = xev->time;
XSETINT (inev.x, lrint (real_x));
XSETINT (inev.y, lrint (real_y));
XSETFRAME (inev.frame_or_window, f);
XSETINT (inev.ie.x, lrint (real_x));
XSETINT (inev.ie.y, lrint (real_y));
XSETFRAME (inev.ie.frame_or_window, f);
inev.modifiers = (signbit (fabs (total_y) >= fabs (total_x)
? total_y : total_x)
? down_modifier : up_modifier);
inev.modifiers
inev.ie.modifiers = (signbit (fabs (total_y) >= fabs (total_x)
? total_y : total_x)
? down_modifier : up_modifier);
inev.ie.modifiers
|= x_x_to_emacs_modifiers (dpyinfo,
xev->mods.effective);
inev.arg = list3 (Qnil,
make_float (total_x),
make_float (total_y));
inev.ie.arg = list3 (Qnil,
make_float (total_x),
make_float (total_y));
}
else
{
inev.kind = TOUCH_END_EVENT;
inev.timestamp = xev->time;
inev.ie.kind = TOUCH_END_EVENT;
inev.ie.timestamp = xev->time;
XSETINT (inev.x, lrint (real_x));
XSETINT (inev.y, lrint (real_y));
XSETFRAME (inev.frame_or_window, f);
XSETINT (inev.ie.x, lrint (real_x));
XSETINT (inev.ie.y, lrint (real_y));
XSETFRAME (inev.ie.frame_or_window, f);
}
if (source && !NILP (source->name))
inev.device = source->name;
inev.ie.device = source->name;
if (!other_valuators_found)
goto XI_OTHER;
@ -23248,11 +23244,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
&& !EQ (window, last_mouse_window)
&& !EQ (window, selected_window))
{
inev.kind = SELECT_WINDOW_EVENT;
inev.frame_or_window = window;
inev.ie.kind = SELECT_WINDOW_EVENT;
inev.ie.frame_or_window = window;
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
/* Remember the last window where we saw the mouse. */
@ -23640,11 +23636,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (!EQ (selected_window, xvw->w) && (xev->detail < 4))
{
inev.kind = SELECT_WINDOW_EVENT;
inev.frame_or_window = xvw->w;
inev.ie.kind = SELECT_WINDOW_EVENT;
inev.ie.frame_or_window = xvw->w;
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
*finish = X_EVENT_DROP;
@ -23743,24 +23739,24 @@ handle_one_xevent (struct x_display_info *dpyinfo,
&real_x, &real_y);
if (xev->detail <= 5)
inev.kind = WHEEL_EVENT;
inev.ie.kind = WHEEL_EVENT;
else
inev.kind = HORIZ_WHEEL_EVENT;
inev.ie.kind = HORIZ_WHEEL_EVENT;
if (source)
inev.device = source->name;
inev.ie.device = source->name;
inev.timestamp = xev->time;
inev.ie.timestamp = xev->time;
XSETINT (inev.x, real_x);
XSETINT (inev.y, real_y);
XSETFRAME (inev.frame_or_window, f);
XSETINT (inev.ie.x, real_x);
XSETINT (inev.ie.y, real_y);
XSETFRAME (inev.ie.frame_or_window, f);
inev.modifiers
inev.ie.modifiers
|= x_x_to_emacs_modifiers (dpyinfo,
xev->mods.effective);
inev.modifiers |= xev->detail % 2 ? down_modifier : up_modifier;
inev.ie.modifiers |= xev->detail % 2 ? down_modifier : up_modifier;
}
*finish = X_EVENT_DROP;
@ -23781,24 +23777,24 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (xev->evtype == XI_ButtonRelease)
{
if (xev->detail <= 5)
inev.kind = WHEEL_EVENT;
inev.ie.kind = WHEEL_EVENT;
else
inev.kind = HORIZ_WHEEL_EVENT;
inev.ie.kind = HORIZ_WHEEL_EVENT;
if (source)
inev.device = source->name;
inev.ie.device = source->name;
inev.timestamp = xev->time;
inev.ie.timestamp = xev->time;
XSETINT (inev.x, lrint (xev->event_x));
XSETINT (inev.y, lrint (xev->event_y));
XSETFRAME (inev.frame_or_window, f);
XSETINT (inev.ie.x, lrint (xev->event_x));
XSETINT (inev.ie.y, lrint (xev->event_y));
XSETFRAME (inev.ie.frame_or_window, f);
inev.modifiers
inev.ie.modifiers
|= x_x_to_emacs_modifiers (dpyinfo,
xev->mods.effective);
inev.modifiers |= xev->detail % 2 ? down_modifier : up_modifier;
inev.ie.modifiers |= xev->detail % 2 ? down_modifier : up_modifier;
}
goto XI_OTHER;
@ -23867,16 +23863,16 @@ handle_one_xevent (struct x_display_info *dpyinfo,
&& xev->time > ignore_next_mouse_click_timeout)
{
ignore_next_mouse_click_timeout = 0;
x_construct_mouse_click (&inev, &bv, f, true);
x_construct_mouse_click (&inev.ie, &bv, f, true);
}
if (xev->evtype == XI_ButtonRelease)
ignore_next_mouse_click_timeout = 0;
}
else
x_construct_mouse_click (&inev, &bv, f, true);
x_construct_mouse_click (&inev.ie, &bv, f, true);
if (!NILP (tab_bar_arg))
inev.arg = tab_bar_arg;
inev.ie.arg = tab_bar_arg;
}
if (FRAME_X_EMBEDDED_P (f)
@ -23892,14 +23888,14 @@ handle_one_xevent (struct x_display_info *dpyinfo,
#ifndef USE_TOOLKIT_SCROLL_BARS
if (bar)
x_scroll_bar_handle_click (bar, (XEvent *) &bv, &inev,
x_scroll_bar_handle_click (bar, (XEvent *) &bv, &inev.ie,
source ? source->name : Qnil);
#else
/* Make the "Ctrl-Mouse-2 splits window" work for toolkit
scroll bars. */
if (bar && xev->mods.effective & ControlMask)
{
x_scroll_bar_handle_click (bar, (XEvent *) &bv, &inev,
x_scroll_bar_handle_click (bar, (XEvent *) &bv, &inev.ie,
source ? source->name : Qnil);
*finish = X_EVENT_DROP;
}
@ -23925,8 +23921,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
device->grab &= ~(1 << xev->detail);
}
if (source && inev.kind != NO_EVENT)
inev.device = source->name;
if (source && inev.ie.kind != NO_EVENT)
inev.ie.device = source->name;
if (f)
f->mouse_moved = false;
@ -24247,8 +24243,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
*finish = X_EVENT_DROP;
#endif /* USE_GTK */
XSETFRAME (inev.frame_or_window, f);
inev.timestamp = xev->time;
XSETFRAME (inev.ie.frame_or_window, f);
inev.ie.timestamp = xev->time;
#ifdef HAVE_X_I18N
if (FRAME_XIC (f))
@ -24360,7 +24356,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
}
}
inev.modifiers = x_x_to_emacs_modifiers (dpyinfo, state);
inev.ie.modifiers = x_x_to_emacs_modifiers (dpyinfo, state);
#ifdef XK_F1
if (x_dnd_in_progress
@ -24398,11 +24394,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (keysym >= 32 && keysym < 128)
/* Avoid explicitly decoding each ASCII character. */
{
inev.kind = ASCII_KEYSTROKE_EVENT;
inev.code = keysym;
inev.ie.kind = ASCII_KEYSTROKE_EVENT;
inev.ie.code = keysym;
if (source)
inev.device = source->name;
inev.ie.device = source->name;
goto xi_done_keysym;
}
@ -24411,14 +24407,14 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (keysym >= 0x01000000 && keysym <= 0x0110FFFF)
{
if (keysym < 0x01000080)
inev.kind = ASCII_KEYSTROKE_EVENT;
inev.ie.kind = ASCII_KEYSTROKE_EVENT;
else
inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
if (source)
inev.device = source->name;
inev.ie.device = source->name;
inev.code = keysym & 0xFFFFFF;
inev.ie.code = keysym & 0xFFFFFF;
goto xi_done_keysym;
}
@ -24429,13 +24425,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
Qnil),
FIXNATP (c)))
{
inev.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT);
inev.code = XFIXNAT (c);
inev.ie.code = XFIXNAT (c);
if (source)
inev.device = source->name;
inev.ie.device = source->name;
goto xi_done_keysym;
}
@ -24539,11 +24535,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
STORE_KEYSYM_FOR_DEBUG (keysym);
/* make_lispy_event will convert this to a symbolic
key. */
inev.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.code = keysym;
inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.ie.code = keysym;
if (source)
inev.device = source->name;
inev.ie.device = source->name;
goto xi_done_keysym;
}
@ -24555,14 +24551,14 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (nbytes)
{
inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.arg = make_unibyte_string (copy_bufptr, nbytes);
inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
inev.ie.arg = make_unibyte_string (copy_bufptr, nbytes);
Fput_text_property (make_fixnum (0), make_fixnum (nbytes),
Qcoding, coding, inev.arg);
Qcoding, coding, inev.ie.arg);
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
goto xi_done_keysym;
}
@ -24916,15 +24912,15 @@ handle_one_xevent (struct x_display_info *dpyinfo,
xev->event_x,
xev->event_y, f);
inev.kind = TOUCHSCREEN_BEGIN_EVENT;
inev.timestamp = xev->time;
XSETFRAME (inev.frame_or_window, f);
XSETINT (inev.x, lrint (xev->event_x));
XSETINT (inev.y, lrint (xev->event_y));
XSETINT (inev.arg, local_detail);
inev.ie.kind = TOUCHSCREEN_BEGIN_EVENT;
inev.ie.timestamp = xev->time;
XSETFRAME (inev.ie.frame_or_window, f);
XSETINT (inev.ie.x, lrint (xev->event_x));
XSETINT (inev.ie.y, lrint (xev->event_y));
XSETINT (inev.ie.arg, local_detail);
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
x_uncatch_errors ();
@ -25030,9 +25026,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (f && device->direct_p)
{
inev.kind = TOUCHSCREEN_UPDATE_EVENT;
inev.timestamp = xev->time;
XSETFRAME (inev.frame_or_window, f);
inev.ie.kind = TOUCHSCREEN_UPDATE_EVENT;
inev.ie.timestamp = xev->time;
XSETFRAME (inev.ie.frame_or_window, f);
for (touchpoint = device->touchpoints;
touchpoint; touchpoint = touchpoint->next)
@ -25044,9 +25040,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
}
if (source)
inev.device = source->name;
inev.ie.device = source->name;
inev.arg = arg;
inev.ie.arg = arg;
}
goto XI_OTHER;
@ -25081,17 +25077,17 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (f && device->direct_p)
{
inev.kind = TOUCHSCREEN_END_EVENT;
inev.timestamp = xev->time;
inev.modifiers = state != 2;
inev.ie.kind = TOUCHSCREEN_END_EVENT;
inev.ie.timestamp = xev->time;
inev.ie.modifiers = state != 2;
XSETFRAME (inev.frame_or_window, f);
XSETINT (inev.x, lrint (xev->event_x));
XSETINT (inev.y, lrint (xev->event_y));
XSETINT (inev.arg, local_detail);
XSETFRAME (inev.ie.frame_or_window, f);
XSETINT (inev.ie.x, lrint (xev->event_x));
XSETINT (inev.ie.y, lrint (xev->event_y));
XSETINT (inev.ie.arg, local_detail);
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
}
@ -25160,20 +25156,20 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (pev->event == FRAME_X_WINDOW (any))
xi_compute_root_window_offset_pinch (any, pev);
inev.kind = PINCH_EVENT;
inev.modifiers
inev.ie.kind = PINCH_EVENT;
inev.ie.modifiers
= x_x_to_emacs_modifiers (dpyinfo, pev->mods.effective);
XSETINT (inev.x, lrint (pev->event_x));
XSETINT (inev.y, lrint (pev->event_y));
XSETFRAME (inev.frame_or_window, any);
inev.arg = list4 (make_float (pev->delta_x),
make_float (pev->delta_y),
make_float (pev->scale),
make_float (pev->delta_angle));
XSETINT (inev.ie.x, lrint (pev->event_x));
XSETINT (inev.ie.y, lrint (pev->event_y));
XSETFRAME (inev.ie.frame_or_window, any);
inev.ie.arg = list4 (make_float (pev->delta_x),
make_float (pev->delta_y),
make_float (pev->scale),
make_float (pev->delta_angle));
if (source)
inev.device = source->name;
inev.ie.device = source->name;
}
/* Once again GTK seems to crash when confronted by
@ -25528,26 +25524,26 @@ handle_one_xevent (struct x_display_info *dpyinfo,
already an undelivered event on the queue. */
goto OTHER;
inev.kind = MONITORS_CHANGED_EVENT;
inev.timestamp = timestamp;
XSETTERMINAL (inev.arg, dpyinfo->terminal);
inev.ie.kind = MONITORS_CHANGED_EVENT;
inev.ie.timestamp = timestamp;
XSETTERMINAL (inev.ie.arg, dpyinfo->terminal);
/* Also don't do anything if the monitor configuration
didn't really change. */
current_monitors
= Fx_display_monitor_attributes_list (inev.arg);
= Fx_display_monitor_attributes_list (inev.ie.arg);
if (!NILP (Fequal (current_monitors,
dpyinfo->last_monitor_attributes_list)))
inev.kind = NO_EVENT;
inev.ie.kind = NO_EVENT;
dpyinfo->last_monitor_attributes_list = current_monitors;
if (x_dnd_in_progress && x_dnd_update_tooltip)
x_dnd_monitors = current_monitors;
if (inev.kind != NO_EVENT)
if (inev.ie.kind != NO_EVENT)
x_dnd_update_tooltip_now ();
}
#endif
@ -25595,9 +25591,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
}
done:
if (inev.kind != NO_EVENT)
if (inev.ie.kind != NO_EVENT)
{
kbd_buffer_store_event_hold (&inev, hold_quit);
kbd_buffer_store_buffered_event (&inev, hold_quit);
count++;
}