union android_event configureEvent;
struct frame *f, *any, *mouse_frame;
Mouse_HLInfo *hlinfo;
- union buffered_input_event inev;
+ struct input_event inev;
int modifiers, count, do_help;
struct android_touch_point *touchpoint, **last;
Lisp_Object window;
if (any && any->wait_event_type == event->type)
any->wait_event_type = 0; /* Indicates we got it. */
- EVENT_INIT (inev.ie);
+ EVENT_INIT (inev);
switch (event->type)
{
if (!FRAME_TOOLTIP_P (f)
&& (old_left != f->left_pos || old_top != f->top_pos))
{
- inev.ie.kind = MOVE_FRAME_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = MOVE_FRAME_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
if (f && FRAME_OUTPUT_DATA (f)->need_cursor_updates)
memset (&compose_status, 0, sizeof (compose_status));
/* Common for all keysym input events. */
- XSETFRAME (inev.ie.frame_or_window, any);
- inev.ie.modifiers
+ XSETFRAME (inev.frame_or_window, any);
+ inev.modifiers
= android_android_to_emacs_modifiers (dpyinfo, modifiers);
- inev.ie.timestamp = event->xkey.time;
+ inev.timestamp = event->xkey.time;
keysym = event->xkey.keycode;
if (event->xkey.keycode == (uint32_t) -1)
{
- inev.ie.kind = PREEDIT_TEXT_EVENT;
- inev.ie.arg = Qnil;
+ inev.kind = PREEDIT_TEXT_EVENT;
+ inev.arg = Qnil;
/* If text was looked up, decode it and make it the
preedit text. */
if (status_return == ANDROID_LOOKUP_CHARS && nchars)
{
copy_bufptr[nchars] = 0;
- inev.ie.arg = from_unicode_buffer (copy_bufptr);
+ inev.arg = from_unicode_buffer (copy_bufptr);
}
goto done_keysym;
/* Deal with characters. */
if (copy_bufptr[0] < 128)
- inev.ie.kind = ASCII_KEYSTROKE_EVENT;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
else
- inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+ inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
- inev.ie.code = copy_bufptr[0];
+ inev.code = copy_bufptr[0];
}
else if (nchars < 2 && keysym)
{
/* Next, deal with special ``characters'' by giving the
keycode to keyboard.c. */
- inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
- inev.ie.code = keysym;
+ inev.kind = NON_ASCII_KEYSTROKE_EVENT;
+ inev.code = keysym;
}
else
{
for (i = 0; i < nchars; ++i)
{
- inev.ie.kind = (SINGLE_BYTE_CHAR_P (copy_bufptr[i])
- ? ASCII_KEYSTROKE_EVENT
- : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
- inev.ie.code = copy_bufptr[i];
+ inev.kind = (SINGLE_BYTE_CHAR_P (copy_bufptr[i])
+ ? ASCII_KEYSTROKE_EVENT
+ : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+ inev.code = copy_bufptr[i];
/* If the character is actually '\n', then change this
to RET. */
if (copy_bufptr[i] == '\n')
{
- inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
- inev.ie.code = 66;
+ inev.kind = NON_ASCII_KEYSTROKE_EVENT;
+ inev.code = 66;
}
- kbd_buffer_store_buffered_event (&inev, hold_quit);
+ kbd_buffer_store_event_hold (&inev, hold_quit);
}
count += nchars;
- inev.ie.kind = NO_EVENT; /* Already stored above. */
+ inev.kind = NO_EVENT; /* Already stored above. */
}
goto done_keysym;
case ANDROID_FOCUS_IN:
case ANDROID_FOCUS_OUT:
- android_detect_focus_change (dpyinfo, any, event, &inev.ie);
+ android_detect_focus_change (dpyinfo, any, event, &inev);
goto OTHER;
case ANDROID_WINDOW_ACTION:
if (!f)
goto OTHER;
- inev.ie.kind = DELETE_WINDOW_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = DELETE_WINDOW_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
}
&& !EQ (window, last_mouse_window)
&& !EQ (window, selected_window))
{
- inev.ie.kind = SELECT_WINDOW_EVENT;
- inev.ie.frame_or_window = window;
+ inev.kind = SELECT_WINDOW_EVENT;
+ inev.frame_or_window = window;
}
/* Remember the last window where we saw the mouse. */
if (!(tab_bar_p && NILP (tab_bar_arg)) && !tool_bar_p)
if (! popup_activated ())
{
- android_construct_mouse_click (&inev.ie, &event->xbutton, f);
+ android_construct_mouse_click (&inev, &event->xbutton, f);
if (!NILP (tab_bar_arg))
- inev.ie.arg = tab_bar_arg;
+ inev.arg = tab_bar_arg;
}
}
/* Simply update the tool position and send an update. */
touchpoint->x = event->touch.x;
touchpoint->y = event->touch.y;
- android_update_tools (any, &inev.ie);
- inev.ie.timestamp = event->touch.time;
+ android_update_tools (any, &inev);
+ inev.timestamp = event->touch.time;
goto OTHER;
}
}
/* Now generate the Emacs event. */
- 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);
+ 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);
goto OTHER;
touchpoint->x = event->touch.x;
touchpoint->y = event->touch.y;
- android_update_tools (any, &inev.ie);
- inev.ie.timestamp = event->touch.time;
+ android_update_tools (any, &inev);
+ inev.timestamp = event->touch.time;
goto OTHER;
grabbed by the tool bar). */
xfree (touchpoint);
- inev.ie.kind = TOUCHSCREEN_END_EVENT;
- inev.ie.timestamp = event->touch.time;
+ inev.kind = TOUCHSCREEN_END_EVENT;
+ inev.timestamp = event->touch.time;
/* Report whether the sequence has been canceled. */
if (event->touch.flags & ANDROID_TOUCH_SEQUENCE_CANCELED)
- inev.ie.modifiers = 1;
+ inev.modifiers = 1;
- 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);
+ 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);
/* Break out of the loop. */
goto OTHER;
}
/* Determine what kind of event to send. */
- inev.ie.kind = ((fabs (wheel_event_y)
+ inev.kind = ((fabs (wheel_event_y)
>= fabs (wheel_event_x))
? WHEEL_EVENT : HORIZ_WHEEL_EVENT);
- inev.ie.timestamp = event->wheel.time;
+ inev.timestamp = event->wheel.time;
/* Set the event coordinates. */
- XSETINT (inev.ie.x, event->wheel.x);
- XSETINT (inev.ie.y, event->wheel.y);
+ XSETINT (inev.x, event->wheel.x);
+ XSETINT (inev.y, event->wheel.y);
/* Set the frame. */
- XSETFRAME (inev.ie.frame_or_window, any);
+ XSETFRAME (inev.frame_or_window, any);
/* Figure out the scroll direction. */
- inev.ie.modifiers = (signbit ((fabs (wheel_event_x)
- >= fabs (wheel_event_y))
- ? wheel_event_x
- : wheel_event_y)
- ? down_modifier : up_modifier);
+ inev.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,
scroll_unit = pow (scroll_height, 2.0 / 3.0);
/* Add the keyboard modifiers. */
- inev.ie.modifiers
+ inev.modifiers
|= android_android_to_emacs_modifiers (dpyinfo,
event->wheel.state);
/* Finally include the scroll deltas. */
- inev.ie.arg = list3 (Qnil,
- make_float (wheel_event_x
- * scroll_unit),
- make_float (wheel_event_y
- * scroll_unit));
+ inev.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;
SET_FRAME_VISIBLE (any, false);
SET_FRAME_ICONIFIED (any, true);
- inev.ie.kind = ICONIFY_EVENT;
- XSETFRAME (inev.ie.frame_or_window, any);
+ inev.kind = ICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, any);
goto OTHER;
case ANDROID_DEICONIFIED:
SET_FRAME_VISIBLE (any, true);
SET_FRAME_ICONIFIED (any, false);
- inev.ie.kind = DEICONIFY_EVENT;
- XSETFRAME (inev.ie.frame_or_window, any);
+ inev.kind = DEICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, any);
goto OTHER;
/* Context menu handling. */
goto OTHER;
/* Generate a drag and drop event to convey its position. */
- 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);
+ 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);
goto OTHER;
case ANDROID_DND_URI_EVENT:
content or file URI or a string to be inserted. Generate an
event with this information. */
- 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));
+ 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));
free (event->dnd.uri_or_string);
goto OTHER;
case ANDROID_NOTIFICATION_ACTION:
if (event->notification.type == ANDROID_NOTIFICATION_DELETED)
- android_notification_deleted (&event->notification, &inev.ie);
+ android_notification_deleted (&event->notification, &inev);
else
{
Lisp_Object action;
action = android_decode_utf16 (event->notification.action,
event->notification.length);
- android_notification_action (&event->notification, &inev.ie,
- action);
+ android_notification_action (&event->notification, &inev, action);
}
/* Free dynamically allocated data. */
}
OTHER:
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
{
- kbd_buffer_store_buffered_event (&inev, hold_quit);
+ kbd_buffer_store_event_hold (&inev, hold_quit);
count++;
}
{
Lisp_Object tail, tem;
struct frame *f = NULL;
- union buffered_input_event inev;
+ struct input_event inev;
guint keysym = event->key.keyval;
unsigned int xstate;
gunichar uc;
&& !FRAME_DISPLAY_INFO (f)->prefer_native_input)
return true;
- EVENT_INIT (inev.ie);
- XSETFRAME (inev.ie.frame_or_window, f);
+ EVENT_INIT (inev);
+ XSETFRAME (inev.frame_or_window, f);
xstate = xg_virtual_mods_to_x (FRAME_DISPLAY_INFO (f),
event->key.state);
- inev.ie.modifiers
+ inev.modifiers
|= x_x_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), xstate);
- inev.ie.timestamp = event->key.time;
+ inev.timestamp = event->key.time;
#ifdef HAVE_XINPUT2
if (event->key.time == pending_keystroke_time)
FRAME_DISPLAY_INFO (f)->pending_keystroke_source);
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
#endif
if (keysym >= 32 && keysym < 128)
/* Avoid explicitly decoding each ASCII character. */
{
- inev.ie.kind = ASCII_KEYSTROKE_EVENT;
- inev.ie.code = keysym;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
+ inev.code = keysym;
goto done;
}
if (keysym >= 0x01000000 && keysym <= 0x0110FFFF)
{
if (keysym < 0x01000080)
- inev.ie.kind = ASCII_KEYSTROKE_EVENT;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
else
- inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
- inev.ie.code = keysym & 0xFFFFFF;
+ inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+ inev.code = keysym & 0xFFFFFF;
goto done;
}
/* Any "vendor-specific" key is ok. */
|| (keysym & (1 << 28))))
{
- inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
- inev.ie.code = keysym;
+ inev.kind = NON_ASCII_KEYSTROKE_EVENT;
+ inev.code = keysym;
goto done;
}
if (uc)
{
- inev.ie.kind = (SINGLE_BYTE_CHAR_P (uc)
- ? ASCII_KEYSTROKE_EVENT
- : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
- inev.ie.code = uc;
+ inev.kind = (SINGLE_BYTE_CHAR_P (uc)
+ ? ASCII_KEYSTROKE_EVENT
+ : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+ inev.code = uc;
}
else
{
- inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
- inev.ie.code = keysym;
+ inev.kind = NON_ASCII_KEYSTROKE_EVENT;
+ inev.code = keysym;
}
done:
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
{
xg_pending_quit_event.kind = NO_EVENT;
- kbd_buffer_store_buffered_event (&inev, &xg_pending_quit_event);
+ kbd_buffer_store_event_hold (&inev, &xg_pending_quit_event);
}
XNoOp (FRAME_X_DISPLAY (f));
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 (union buffered_input_event *);
+static bool is_ignored_event_kind (enum event_kind);
/* Advance or retreat a buffered input event pointer. */
&& (event->kind == FOCUS_IN_EVENT
|| event->kind == FOCUS_OUT_EVENT))
|| (input_pending_p_filter_events
- && is_ignored_event (event))))
+ && is_ignored_event_kind (event->kind))))
#ifdef USE_TOOLKIT_SCROLL_BARS
&& !((flags & READABLE_EVENTS_IGNORE_SQUEEZABLES)
&& (event->kind == SCROLL_BAR_CLICK_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.
subsequent input events have been parsed (and discarded). */
void
-kbd_buffer_store_buffered_event (union buffered_input_event *event,
- struct input_event *hold_quit)
+kbd_buffer_store_event_hold (struct input_event *event,
+ struct input_event *hold_quit)
{
if (event->kind == NO_EVENT)
emacs_abort ();
if (event->kind == ASCII_KEYSTROKE_EVENT)
{
- int c = event->ie.code & 0377;
+ int c = event->code & 0377;
- if (event->ie.modifiers & ctrl_modifier)
+ if (event->modifiers & ctrl_modifier)
c = make_ctrl_char (c);
- c |= (event->ie.modifiers
+ c |= (event->modifiers
& (meta_modifier | alt_modifier
| hyper_modifier | super_modifier));
if (c == quit_char)
{
- KBOARD *kb = FRAME_KBOARD (XFRAME (event->ie.frame_or_window));
+ KBOARD *kb = FRAME_KBOARD (XFRAME (event->frame_or_window));
if (single_kboard && kb != current_kboard)
{
kset_kbd_queue
- (kb, list2 (make_lispy_switch_frame (event->ie.frame_or_window),
+ (kb, list2 (make_lispy_switch_frame (event->frame_or_window),
make_fixnum (c)));
kb->kbd_queue_has_data = true;
if (hold_quit)
{
- *hold_quit = event->ie;
+ *hold_quit = *event;
return;
}
{
Lisp_Object focus;
- focus = FRAME_FOCUS_FRAME (XFRAME (event->ie.frame_or_window));
+ focus = FRAME_FOCUS_FRAME (XFRAME (event->frame_or_window));
if (NILP (focus))
- focus = event->ie.frame_or_window;
+ focus = event->frame_or_window;
internal_last_event_frame = focus;
Vlast_event_frame = focus;
}
union buffered_input_event *next_slot = next_kbd_event (kbd_store_ptr);
if (kbd_fetch_ptr != next_slot)
{
- *kbd_store_ptr = *event;
+ kbd_store_ptr->ie = *event;
kbd_store_ptr = next_slot;
-#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 */
+ beware_long_paste ();
}
- /* 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;
+ maybe_quit_while_no_input (event->kind);
+}
+
+/* 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);
}
/* Limit help event positions to this range, to avoid overflow problems. */
}
static bool
-is_ignored_event (union buffered_input_event *event)
+is_ignored_event_kind (enum event_kind kind)
{
Lisp_Object ignore_event;
- switch (event->kind)
+ switch (kind)
{
case FOCUS_IN_EVENT: ignore_event = Qfocus_in; break;
case FOCUS_OUT_EVENT: ignore_event = Qfocus_out; break;
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_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 kbd_buffer_store_event_hold (struct input_event *,
+ struct input_event *);
+extern void kbd_buffer_store_selection_event_hold (struct selection_input_event *,
+ struct input_event *);
extern void poll_for_input_1 (void);
extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object);
static void
-evq_enqueue (union buffered_input_event *ev)
+evq_grow_if_needed (struct event_queue_t *evq)
{
- struct event_queue_t *evq = &event_q;
- struct frame *frame;
- struct pgtk_display_info *dpyinfo;
-
if (evq->cap == 0)
{
evq->cap = 4;
evq->cap += evq->cap / 2;
evq->q = xrealloc (evq->q, sizeof *evq->q * evq->cap);
}
+}
+
+static void
+evq_enqueue (struct input_event const *ev)
+{
+ struct event_queue_t *evq = &event_q;
+ struct frame *frame;
+ struct pgtk_display_info *dpyinfo;
- evq->q[evq->nr++] = *ev;
+ evq_grow_if_needed (evq);
+ evq->q[evq->nr++].ie = *ev;
- if (ev->ie.kind != SELECTION_REQUEST_EVENT
- && ev->ie.kind != SELECTION_CLEAR_EVENT)
- {
- frame = NULL;
+ frame = NULL;
- if (WINDOWP (ev->ie.frame_or_window))
- frame = WINDOW_XFRAME (XWINDOW (ev->ie.frame_or_window));
+ if (WINDOWP (ev->frame_or_window))
+ frame = WINDOW_XFRAME (XWINDOW (ev->frame_or_window));
- if (FRAMEP (ev->ie.frame_or_window))
- frame = XFRAME (ev->ie.frame_or_window);
+ if (FRAMEP (ev->frame_or_window))
+ frame = XFRAME (ev->frame_or_window);
- if (frame)
- {
- dpyinfo = FRAME_DISPLAY_INFO (frame);
+ if (frame)
+ {
+ dpyinfo = FRAME_DISPLAY_INFO (frame);
- if (dpyinfo->last_user_time < ev->ie.timestamp)
- dpyinfo->last_user_time = ev->ie.timestamp;
- }
+ if (dpyinfo->last_user_time < ev->timestamp)
+ dpyinfo->last_user_time = ev->timestamp;
}
raise (SIGIO);
}
+static void
+evq_selection_enqueue (struct selection_input_event const *ev)
+{
+ struct event_queue_t *evq = &event_q;
+
+ evq_grow_if_needed (evq);
+ evq->q[evq->nr++].sie = *ev;
+
+ raise (SIGIO);
+}
+
static int
evq_flush (struct input_event *hold_quit)
{
while (evq->nr > 0)
{
- /* kbd_buffer_store_buffered_event may do longjmp, so
- we need to shift event queue first and pass the event
- to kbd_buffer_store_buffered_event so that events in
+ /* Because kbd_buffer_store_event_hold and
+ kbd_buffer_store_selection_event_hold may do longjmp,
+ we need to shift event queue before passing a pointer
+ to a copy of the event, so that events in
queue are not processed twice. Bug#52941 */
- union buffered_input_event ev = evq->q[0];
- int i;
- for (i = 1; i < evq->nr; i++)
- evq->q[i - 1] = evq->q[i];
evq->nr--;
- kbd_buffer_store_buffered_event (&ev, hold_quit);
+ if (evq->q[0].kind == SELECTION_REQUEST_EVENT
+ || evq->q[0].kind == SELECTION_CLEAR_EVENT)
+ {
+ struct selection_input_event sinev = evq->q[0].sie;
+ memmove (&evq->q[0], &evq->q[1], evq->nr * sizeof evq->q[0]);
+ kbd_buffer_store_selection_event_hold (&sinev, hold_quit);
+ }
+ else
+ {
+ struct input_event inev = evq->q[0].ie;
+ memmove (&evq->q[0], &evq->q[1], evq->nr * sizeof evq->q[0]);
+ kbd_buffer_store_event_hold (&inev, hold_quit);
+ }
+
n++;
}
pgtk_send_scroll_bar_event (Lisp_Object window, enum scroll_bar_part part,
int portion, int whole, bool horizontal)
{
- union buffered_input_event inev;
+ struct input_event inev;
- EVENT_INIT (inev.ie);
+ EVENT_INIT (inev);
- inev.ie.kind = (horizontal
- ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT
- : SCROLL_BAR_CLICK_EVENT);
- inev.ie.frame_or_window = window;
- inev.ie.arg = Qnil;
- inev.ie.timestamp = 0;
- inev.ie.code = 0;
- inev.ie.part = part;
- inev.ie.x = make_fixnum (portion);
- inev.ie.y = make_fixnum (whole);
- inev.ie.modifiers = 0;
+ inev.kind = (horizontal
+ ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT
+ : SCROLL_BAR_CLICK_EVENT);
+ inev.frame_or_window = window;
+ inev.arg = Qnil;
+ inev.timestamp = 0;
+ inev.code = 0;
+ inev.part = part;
+ inev.x = make_fixnum (portion);
+ inev.y = make_fixnum (whole);
+ inev.modifiers = 0;
evq_enqueue (&inev);
}
pgtk_handle_event (GtkWidget *widget, GdkEvent *event, gpointer *data)
{
struct frame *f;
- union buffered_input_event inev;
GtkWidget *frame_widget;
gint x, y;
&x, &y);
if (f)
{
-
- inev.ie.kind = PINCH_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
- XSETINT (inev.ie.x, x);
- XSETINT (inev.ie.y, y);
- inev.ie.arg = list4 (make_float (event->touchpad_pinch.dx),
- make_float (event->touchpad_pinch.dy),
- make_float (event->touchpad_pinch.scale),
- make_float (event->touchpad_pinch.angle_delta));
- inev.ie.modifiers = pgtk_gtk_to_emacs_modifiers (FRAME_DISPLAY_INFO (f),
+ struct input_event inev;
+ inev.kind = PINCH_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
+ XSETINT (inev.x, x);
+ XSETINT (inev.y, y);
+ inev.arg = list4 (make_float (event->touchpad_pinch.dx),
+ make_float (event->touchpad_pinch.dy),
+ make_float (event->touchpad_pinch.scale),
+ make_float (event->touchpad_pinch.angle_delta));
+ inev.modifiers = pgtk_gtk_to_emacs_modifiers (FRAME_DISPLAY_INFO (f),
event->touchpad_pinch.state);
- inev.ie.device
+ inev.device
= pgtk_get_device_for_event (FRAME_DISPLAY_INFO (f), event);
evq_enqueue (&inev);
}
return;
for (; *ustr != 0; ustr++)
{
- union buffered_input_event inev;
+ struct input_event inev;
Lisp_Object c = make_fixnum (*ustr);
- EVENT_INIT (inev.ie);
- inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
- ? ASCII_KEYSTROKE_EVENT
- : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
- inev.ie.arg = Qnil;
- inev.ie.code = XFIXNAT (c);
- XSETFRAME (inev.ie.frame_or_window, f);
- inev.ie.modifiers = 0;
- inev.ie.timestamp = 0;
+ EVENT_INIT (inev);
+ inev.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
+ ? ASCII_KEYSTROKE_EVENT
+ : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+ inev.arg = Qnil;
+ inev.code = XFIXNAT (c);
+ XSETFRAME (inev.frame_or_window, f);
+ inev.modifiers = 0;
+ inev.timestamp = 0;
evq_enqueue (&inev);
}
void
pgtk_enqueue_preedit (struct frame *f, Lisp_Object preedit)
{
- union buffered_input_event inev;
- EVENT_INIT (inev.ie);
- inev.ie.kind = PREEDIT_TEXT_EVENT;
- inev.ie.arg = preedit;
- inev.ie.code = 0;
- XSETFRAME (inev.ie.frame_or_window, f);
- inev.ie.modifiers = 0;
- inev.ie.timestamp = 0;
+ struct input_event inev;
+ EVENT_INIT (inev);
+ inev.kind = PREEDIT_TEXT_EVENT;
+ inev.arg = preedit;
+ inev.code = 0;
+ XSETFRAME (inev.frame_or_window, f);
+ inev.modifiers = 0;
+ inev.timestamp = 0;
evq_enqueue (&inev);
}
static gboolean
key_press_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data)
{
- union buffered_input_event inev;
+ struct input_event inev;
ptrdiff_t nbytes;
Mouse_HLInfo *hlinfo;
struct frame *f;
struct pgtk_display_info *dpyinfo;
f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
- EVENT_INIT (inev.ie);
+ EVENT_INIT (inev);
hlinfo = MOUSE_HL_INFO (f);
nbytes = 0;
orig_keysym = keysym;
/* Common for all keysym input events. */
- XSETFRAME (inev.ie.frame_or_window, f);
- inev.ie.modifiers
+ XSETFRAME (inev.frame_or_window, f);
+ inev.modifiers
= pgtk_gtk_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), modifiers);
- inev.ie.timestamp = event->key.time;
+ inev.timestamp = event->key.time;
/* First deal with keysyms which have defined
translations to characters. */
if (keysym >= 32 && keysym < 128)
/* Avoid explicitly decoding each ASCII character. */
{
- inev.ie.kind = ASCII_KEYSTROKE_EVENT;
- inev.ie.code = keysym;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
+ inev.code = keysym;
- inev.ie.device
+ inev.device
= pgtk_get_device_for_event (FRAME_DISPLAY_INFO (f), event);
goto done;
}
if (keysym >= 0x01000000 && keysym <= 0x0110FFFF)
{
if (keysym < 0x01000080)
- inev.ie.kind = ASCII_KEYSTROKE_EVENT;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
else
- inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
- inev.ie.code = keysym & 0xFFFFFF;
+ inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+ inev.code = keysym & 0xFFFFFF;
- inev.ie.device
+ inev.device
= pgtk_get_device_for_event (FRAME_DISPLAY_INFO (f), event);
goto done;
}
&& (c = Fgethash (make_fixnum (keysym),
Vpgtk_keysym_table, Qnil), FIXNATP (c)))
{
- inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
- ? ASCII_KEYSTROKE_EVENT
- : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
- inev.ie.code = XFIXNAT (c);
+ inev.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
+ ? ASCII_KEYSTROKE_EVENT
+ : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+ inev.code = XFIXNAT (c);
- inev.ie.device
+ inev.device
= pgtk_get_device_for_event (FRAME_DISPLAY_INFO (f), event);
goto done;
}
{
/* make_lispy_event will convert this to a symbolic
key. */
- inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
- inev.ie.code = keysym;
+ inev.kind = NON_ASCII_KEYSTROKE_EVENT;
+ inev.code = keysym;
- inev.ie.device
+ inev.device
= pgtk_get_device_for_event (FRAME_DISPLAY_INFO (f), event);
goto done;
}
{
- inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
- inev.ie.arg = make_unibyte_string ((char *) copy_bufptr, nbytes);
- inev.ie.device
+ inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+ inev.arg = make_unibyte_string ((char *) copy_bufptr, nbytes);
+ inev.device
= pgtk_get_device_for_event (FRAME_DISPLAY_INFO (f), event);
if (keysym == GDK_KEY_VoidSymbol)
}
done:
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
{
- XSETFRAME (inev.ie.frame_or_window, f);
+ XSETFRAME (inev.frame_or_window, f);
evq_enqueue (&inev);
}
gpointer *user_data)
{
struct frame *f = pgtk_any_window_to_frame (event->any.window);
- union buffered_input_event inev;
+ struct input_event inev;
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
if (f)
{
if (iconified)
{
- inev.ie.kind = DEICONIFY_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = DEICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
}
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
evq_enqueue (&inev);
return FALSE;
}
{
struct frame *f = pgtk_any_window_to_frame (event->window_state.window);
GdkWindowState new_state;
- union buffered_input_event inev;
+ struct input_event inev;
new_state = event->window_state.new_window_state;
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
if (new_state & GDK_WINDOW_STATE_FULLSCREEN)
store_frame_param (f, Qfullscreen, Qfullboth);
else
{
FRAME_X_OUTPUT (f)->has_been_visible = true;
- inev.ie.kind = DEICONIFY_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = DEICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
SET_FRAME_ICONIFIED (f, false);
SET_FRAME_VISIBLE (f, true);
}
else
store_frame_param (f, Qsticky, Qnil);
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
evq_enqueue (&inev);
return FALSE;
}
GdkEvent *event, gpointer *user_data)
{
struct frame *f = pgtk_any_window_to_frame (event->any.window);
- union buffered_input_event inev;
+ struct input_event inev;
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
if (f)
{
- inev.ie.kind = DELETE_WINDOW_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = DELETE_WINDOW_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
evq_enqueue (&inev);
return TRUE;
}
static void
pgtk_focus_changed (gboolean is_enter, int state,
struct pgtk_display_info *dpyinfo, struct frame *frame,
- union buffered_input_event *bufp)
+ struct input_event *bufp)
{
if (is_enter)
{
/* Don't stop displaying the initial startup message
for a switch-frame event we don't need. */
/* When run as a daemon, Vterminal_frame is always NIL. */
- bufp->ie.arg = (((NILP (Vterminal_frame)
- || !FRAME_PGTK_P (XFRAME (Vterminal_frame))
- || EQ (Fdaemonp (), Qt))
- && CONSP (Vframe_list)
- && !NILP (XCDR (Vframe_list))) ? Qt : Qnil);
- bufp->ie.kind = FOCUS_IN_EVENT;
- XSETFRAME (bufp->ie.frame_or_window, frame);
+ bufp->arg = (((NILP (Vterminal_frame)
+ || !FRAME_PGTK_P (XFRAME (Vterminal_frame))
+ || EQ (Fdaemonp (), Qt))
+ && CONSP (Vframe_list)
+ && !NILP (XCDR (Vframe_list))) ? Qt : Qnil);
+ bufp->kind = FOCUS_IN_EVENT;
+ XSETFRAME (bufp->frame_or_window, frame);
}
frame->output_data.pgtk->focus_state |= state;
dpyinfo->x_focus_event_frame = 0;
pgtk_new_focus_frame (dpyinfo, NULL);
- bufp->ie.kind = FOCUS_OUT_EVENT;
- XSETFRAME (bufp->ie.frame_or_window, frame);
+ bufp->kind = FOCUS_OUT_EVENT;
+ XSETFRAME (bufp->frame_or_window, frame);
}
if (frame->pointer_invisible)
enter_notify_event (GtkWidget *widget, GdkEvent *event,
gpointer *user_data)
{
- union buffered_input_event inev;
+ struct input_event inev;
struct frame *frame
= pgtk_any_window_to_frame (gtk_widget_get_window (widget));
int focus_state
= focus_frame ? focus_frame->output_data.pgtk->focus_state : 0;
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
if (event->crossing.detail != GDK_NOTIFY_INFERIOR
&& event->crossing.focus && !(focus_state & FOCUS_EXPLICIT))
pgtk_focus_changed (TRUE, FOCUS_IMPLICIT, dpyinfo, frame, &inev);
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
evq_enqueue (&inev);
return TRUE;
}
leave_notify_event (GtkWidget *widget, GdkEvent *event,
gpointer *user_data)
{
- union buffered_input_event inev;
+ struct input_event inev;
struct frame *frame
= pgtk_any_window_to_frame (gtk_widget_get_window (widget));
hlinfo->mouse_face_mouse_frame = 0;
}
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
if (event->crossing.detail != GDK_NOTIFY_INFERIOR
&& event->crossing.focus && !(focus_state & FOCUS_EXPLICIT))
}
}
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
evq_enqueue (&inev);
return TRUE;
}
static gboolean
focus_in_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data)
{
- union buffered_input_event inev;
+ struct input_event inev;
struct frame *frame
= pgtk_any_window_to_frame (gtk_widget_get_window (widget));
if (frame == NULL)
return TRUE;
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
pgtk_focus_changed (TRUE, FOCUS_EXPLICIT,
FRAME_DISPLAY_INFO (frame), frame, &inev);
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
evq_enqueue (&inev);
pgtk_im_focus_in (frame);
static gboolean
focus_out_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data)
{
- union buffered_input_event inev;
+ struct input_event inev;
struct frame *frame
= pgtk_any_window_to_frame (gtk_widget_get_window (widget));
if (frame == NULL)
return TRUE;
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
pgtk_focus_changed (FALSE, FOCUS_EXPLICIT,
FRAME_DISPLAY_INFO (frame), frame, &inev);
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
evq_enqueue (&inev);
pgtk_im_focus_out (frame);
motion_notify_event (GtkWidget *widget, GdkEvent *event,
gpointer *user_data)
{
- union buffered_input_event inev;
+ struct input_event inev;
struct frame *f, *frame;
struct pgtk_display_info *dpyinfo;
Mouse_HLInfo *hlinfo;
&& (gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN)))
return FALSE;
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
previous_help_echo_string = help_echo_string;
help_echo_string = Qnil;
&& !EQ (window, last_mouse_window)
&& !EQ (window, selected_window))
{
- inev.ie.kind = SELECT_WINDOW_EVENT;
- inev.ie.frame_or_window = window;
+ inev.kind = SELECT_WINDOW_EVENT;
+ inev.frame_or_window = window;
}
/* Remember the last window where we saw the mouse. */
if (!NILP (help_echo_string) || !NILP (previous_help_echo_string))
do_help = 1;
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
evq_enqueue (&inev);
if (do_help > 0)
button_event (GtkWidget *widget, GdkEvent *event,
gpointer *user_data)
{
- union buffered_input_event inev;
+ struct input_event inev;
struct frame *f, *frame;
struct pgtk_display_info *dpyinfo;
&& (gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN)))
return FALSE;
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
/* ignore double click and triple click. */
if (event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE)
&& event->button.time > ignore_next_mouse_click_timeout)
{
ignore_next_mouse_click_timeout = 0;
- construct_mouse_click (&inev.ie, &event->button, f);
+ construct_mouse_click (&inev, &event->button, f);
}
if (event->type == GDK_BUTTON_RELEASE)
ignore_next_mouse_click_timeout = 0;
}
else
- construct_mouse_click (&inev.ie, &event->button, f);
+ construct_mouse_click (&inev, &event->button, f);
if (!NILP (tab_bar_arg))
- inev.ie.arg = tab_bar_arg;
+ inev.arg = tab_bar_arg;
}
}
if (f != 0)
f->mouse_moved = false;
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
evq_enqueue (&inev);
return TRUE;
}
static gboolean
scroll_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data)
{
- union buffered_input_event inev;
+ struct input_event inev;
struct frame *f, *frame;
struct pgtk_display_info *dpyinfo;
GdkScrollDirection dir;
double delta_x, delta_y;
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
frame = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
dpyinfo = FRAME_DISPLAY_INFO (frame);
else
f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
- inev.ie.kind = NO_EVENT;
- inev.ie.timestamp = event->scroll.time;
- inev.ie.modifiers
+ inev.kind = NO_EVENT;
+ inev.timestamp = event->scroll.time;
+ inev.modifiers
= pgtk_gtk_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), event->scroll.state);
- XSETINT (inev.ie.x, event->scroll.x);
- XSETINT (inev.ie.y, event->scroll.y);
- XSETFRAME (inev.ie.frame_or_window, f);
- inev.ie.arg = Qnil;
+ XSETINT (inev.x, event->scroll.x);
+ XSETINT (inev.y, event->scroll.y);
+ XSETFRAME (inev.frame_or_window, f);
+ inev.arg = Qnil;
if (gdk_event_is_scroll_stop_event (event))
{
- inev.ie.kind = TOUCH_END_EVENT;
- inev.ie.device
+ inev.kind = TOUCH_END_EVENT;
+ inev.device
= pgtk_get_device_for_event (FRAME_DISPLAY_INFO (f), event);
evq_enqueue (&inev);
return TRUE;
switch (dir)
{
case GDK_SCROLL_UP:
- inev.ie.kind = WHEEL_EVENT;
- inev.ie.modifiers |= up_modifier;
+ inev.kind = WHEEL_EVENT;
+ inev.modifiers |= up_modifier;
break;
case GDK_SCROLL_DOWN:
- inev.ie.kind = WHEEL_EVENT;
- inev.ie.modifiers |= down_modifier;
+ inev.kind = WHEEL_EVENT;
+ inev.modifiers |= down_modifier;
break;
case GDK_SCROLL_LEFT:
- inev.ie.kind = HORIZ_WHEEL_EVENT;
- inev.ie.modifiers |= up_modifier;
+ inev.kind = HORIZ_WHEEL_EVENT;
+ inev.modifiers |= up_modifier;
break;
case GDK_SCROLL_RIGHT:
- inev.ie.kind = HORIZ_WHEEL_EVENT;
- inev.ie.modifiers |= down_modifier;
+ inev.kind = HORIZ_WHEEL_EVENT;
+ inev.modifiers |= down_modifier;
break;
case GDK_SCROLL_SMOOTH: /* shut up warning */
break;
{
if (!mwheel_coalesce_scroll_events)
{
- inev.ie.kind = ((fabs (delta_x) > fabs (delta_y))
- ? HORIZ_WHEEL_EVENT
- : WHEEL_EVENT);
- inev.ie.modifiers |= (inev.ie.kind == HORIZ_WHEEL_EVENT
- ? (delta_x >= 0 ? up_modifier : down_modifier)
- : (delta_y >= 0 ? down_modifier : up_modifier));
- inev.ie.arg = list3 (Qnil, make_float (-delta_x * 100),
- make_float (-delta_y * 100));
+ inev.kind = ((fabs (delta_x) > fabs (delta_y))
+ ? HORIZ_WHEEL_EVENT
+ : WHEEL_EVENT);
+ inev.modifiers |= (inev.kind == HORIZ_WHEEL_EVENT
+ ? (delta_x >= 0 ? up_modifier : down_modifier)
+ : (delta_y >= 0 ? down_modifier : up_modifier));
+ inev.arg = list3 (Qnil, make_float (-delta_x * 100),
+ make_float (-delta_y * 100));
}
else
{
if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line)
{
int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
- inev.ie.kind = WHEEL_EVENT;
- inev.ie.modifiers |= down_modifier;
- inev.ie.arg = list3 (make_fixnum (nlines),
- make_float (-dpyinfo->scroll.acc_x * 100),
- make_float (-dpyinfo->scroll.acc_y * 100));
+ inev.kind = WHEEL_EVENT;
+ inev.modifiers |= down_modifier;
+ inev.arg = list3 (make_fixnum (nlines),
+ make_float (-dpyinfo->scroll.acc_x * 100),
+ make_float (-dpyinfo->scroll.acc_y * 100));
dpyinfo->scroll.acc_y -= dpyinfo->scroll.y_per_line * nlines;
}
else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line)
{
int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
- inev.ie.kind = WHEEL_EVENT;
- inev.ie.modifiers |= up_modifier;
- inev.ie.arg = list3 (make_fixnum (nlines),
- make_float (-dpyinfo->scroll.acc_x * 100),
- make_float (-dpyinfo->scroll.acc_y * 100));
+ inev.kind = WHEEL_EVENT;
+ inev.modifiers |= up_modifier;
+ inev.arg = list3 (make_fixnum (nlines),
+ make_float (-dpyinfo->scroll.acc_x * 100),
+ make_float (-dpyinfo->scroll.acc_y * 100));
dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
}
|| !mwheel_coalesce_scroll_events)
{
int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
- inev.ie.kind = HORIZ_WHEEL_EVENT;
- inev.ie.modifiers |= up_modifier;
- inev.ie.arg = list3 (make_fixnum (nchars),
- make_float (-dpyinfo->scroll.acc_x * 100),
- make_float (-dpyinfo->scroll.acc_y * 100));
+ inev.kind = HORIZ_WHEEL_EVENT;
+ inev.modifiers |= up_modifier;
+ inev.arg = list3 (make_fixnum (nchars),
+ make_float (-dpyinfo->scroll.acc_x * 100),
+ make_float (-dpyinfo->scroll.acc_y * 100));
dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
}
else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
{
int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
- inev.ie.kind = HORIZ_WHEEL_EVENT;
- inev.ie.modifiers |= down_modifier;
- inev.ie.arg = list3 (make_fixnum (nchars),
- make_float (-dpyinfo->scroll.acc_x * 100),
- make_float (-dpyinfo->scroll.acc_y * 100));
+ inev.kind = HORIZ_WHEEL_EVENT;
+ inev.modifiers |= down_modifier;
+ inev.arg = list3 (make_fixnum (nchars),
+ make_float (-dpyinfo->scroll.acc_x * 100),
+ make_float (-dpyinfo->scroll.acc_y * 100));
dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
}
}
}
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
{
- inev.ie.device
+ inev.device
= pgtk_get_device_for_event (FRAME_DISPLAY_INFO (f), event);
evq_enqueue (&inev);
}
guint time, gpointer user_data)
{
struct frame *f;
- union buffered_input_event inev;
+ struct input_event inev;
f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
g_object_unref);
}
- EVENT_INIT (inev.ie);
+ EVENT_INIT (inev);
- inev.ie.kind = DRAG_N_DROP_EVENT;
- inev.ie.modifiers = 0;
- inev.ie.arg = Qnil;
- inev.ie.timestamp = time;
+ inev.kind = DRAG_N_DROP_EVENT;
+ inev.modifiers = 0;
+ inev.arg = Qnil;
+ inev.timestamp = time;
- XSETINT (inev.ie.x, 0);
- XSETINT (inev.ie.y, 0);
- XSETFRAME (inev.ie.frame_or_window, f);
+ XSETINT (inev.x, 0);
+ XSETINT (inev.y, 0);
+ XSETFRAME (inev.frame_or_window, f);
evq_enqueue (&inev);
}
{
struct frame *f;
- union buffered_input_event inev;
+ struct input_event inev;
GdkAtom name;
GdkDragAction suggestion;
name = gdk_drag_get_selection (context);
suggestion = gdk_drag_context_get_suggested_action (context);
- EVENT_INIT (inev.ie);
+ EVENT_INIT (inev);
- inev.ie.kind = DRAG_N_DROP_EVENT;
- inev.ie.modifiers = 0;
- inev.ie.arg = list4 (Qlambda, intern (gdk_atom_name (name)),
- make_uint (time),
- drag_action_to_symbol (suggestion));
- inev.ie.timestamp = time;
+ inev.kind = DRAG_N_DROP_EVENT;
+ inev.modifiers = 0;
+ inev.arg = list4 (Qlambda, intern (gdk_atom_name (name)),
+ make_uint (time),
+ drag_action_to_symbol (suggestion));
+ inev.timestamp = time;
- XSETINT (inev.ie.x, x);
- XSETINT (inev.ie.y, y);
- XSETFRAME (inev.ie.frame_or_window, f);
+ XSETINT (inev.x, x);
+ XSETINT (inev.y, y);
+ XSETFRAME (inev.frame_or_window, f);
evq_enqueue (&inev);
int x, int y, guint time, gpointer user_data)
{
struct frame *f;
- union buffered_input_event inev;
+ struct input_event inev;
GdkAtom name;
GdkDragAction selected_action;
name = gdk_drag_get_selection (context);
selected_action = gdk_drag_context_get_selected_action (context);
- EVENT_INIT (inev.ie);
+ EVENT_INIT (inev);
- inev.ie.kind = DRAG_N_DROP_EVENT;
- inev.ie.modifiers = 0;
- inev.ie.arg = list4 (Qquote, intern (gdk_atom_name (name)),
- make_uint (time),
- drag_action_to_symbol (selected_action));
- inev.ie.timestamp = time;
+ inev.kind = DRAG_N_DROP_EVENT;
+ inev.modifiers = 0;
+ inev.arg = list4 (Qquote, intern (gdk_atom_name (name)),
+ make_uint (time),
+ drag_action_to_symbol (selected_action));
+ inev.timestamp = time;
- XSETINT (inev.ie.x, x);
- XSETINT (inev.ie.y, y);
- XSETFRAME (inev.ie.frame_or_window, f);
+ XSETINT (inev.x, x);
+ XSETINT (inev.y, y);
+ XSETFRAME (inev.frame_or_window, f);
evq_enqueue (&inev);
struct pgtk_display_info *dpyinfo;
struct frame *f;
EMACS_INT local_detail;
- union buffered_input_event inev;
+ struct input_event inev;
struct pgtk_touch_point *touchpoint;
Lisp_Object arg = Qnil;
int state;
- EVENT_INIT (inev.ie);
+ EVENT_INIT (inev);
f = pgtk_any_window_to_frame (gtk_widget_get_window (self));
eassert (f);
event->touch.x, event->touch.y,
f);
/* Generate the input event. */
- inev.ie.kind = TOUCHSCREEN_BEGIN_EVENT;
- inev.ie.timestamp = event->touch.time;
- XSETFRAME (inev.ie.frame_or_window, f);
- XSETINT (inev.ie.x, lrint (event->touch.x));
- XSETINT (inev.ie.y, lrint (event->touch.y));
- XSETINT (inev.ie.arg, local_detail);
+ inev.kind = TOUCHSCREEN_BEGIN_EVENT;
+ inev.timestamp = event->touch.time;
+ XSETFRAME (inev.frame_or_window, f);
+ XSETINT (inev.x, lrint (event->touch.x));
+ XSETINT (inev.y, lrint (event->touch.y));
+ XSETINT (inev.arg, local_detail);
break;
case GDK_TOUCH_UPDATE:
/* Construct the input event. */
touchpoint->x = lrint (event->touch.x);
touchpoint->y = lrint (event->touch.y);
- inev.ie.kind = TOUCHSCREEN_UPDATE_EVENT;
- inev.ie.timestamp = event->touch.time;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = TOUCHSCREEN_UPDATE_EVENT;
+ inev.timestamp = event->touch.time;
+ XSETFRAME (inev.frame_or_window, f);
for (touchpoint = dpyinfo->touchpoints;
touchpoint; touchpoint = touchpoint->next)
arg);
}
- inev.ie.arg = arg;
+ inev.arg = arg;
break;
case GDK_TOUCH_END:
if (state)
{
/* ... generate a suitable event. */
- inev.ie.kind = TOUCHSCREEN_END_EVENT;
- inev.ie.timestamp = event->touch.time;
- inev.ie.modifiers = (event->type != GDK_TOUCH_END);
-
- XSETFRAME (inev.ie.frame_or_window, f);
- XSETINT (inev.ie.x, lrint (event->touch.x));
- XSETINT (inev.ie.y, lrint (event->touch.y));
- XSETINT (inev.ie.arg, local_detail);
+ inev.kind = TOUCHSCREEN_END_EVENT;
+ inev.timestamp = event->touch.time;
+ inev.modifiers = (event->type != GDK_TOUCH_END);
+
+ XSETFRAME (inev.frame_or_window, f);
+ XSETINT (inev.x, lrint (event->touch.x));
+ XSETINT (inev.y, lrint (event->touch.y));
+ XSETINT (inev.arg, local_detail);
}
break;
/* If the above produced a workable event, report the name of the
device that gave rise to it. */
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
{
- inev.ie.device = pgtk_get_device_for_event (dpyinfo, event);
+ inev.device = pgtk_get_device_for_event (dpyinfo, event);
evq_enqueue (&inev);
/* Next, save this event for future menu activations, unless it is
}
}
- return inev.ie.kind != NO_EVENT;
+ return inev.kind != NO_EVENT;
}
\f
pgtk_monitors_changed_cb (GdkScreen *screen, gpointer user_data)
{
struct terminal *terminal;
- union buffered_input_event inev;
+ struct input_event inev;
- EVENT_INIT (inev.ie);
+ EVENT_INIT (inev);
terminal = user_data;
- inev.ie.kind = MONITORS_CHANGED_EVENT;
- XSETTERMINAL (inev.ie.arg, terminal);
+ inev.kind = MONITORS_CHANGED_EVENT;
+ XSETTERMINAL (inev.arg, terminal);
evq_enqueue (&inev);
}
gpointer user_data)
{
struct frame *f;
- union buffered_input_event inev;
if (event->type == GDK_PROPERTY_NOTIFY)
pgtk_handle_property_notify (&event->property);
if (f)
{
- EVENT_INIT (inev.ie);
+ struct selection_input_event sinev = {0};
- inev.sie.kind = (event->type == GDK_SELECTION_CLEAR
+ sinev.kind = (event->type == GDK_SELECTION_CLEAR
? SELECTION_CLEAR_EVENT
: SELECTION_REQUEST_EVENT);
- SELECTION_EVENT_DPYINFO (&inev.sie) = FRAME_DISPLAY_INFO (f);
- SELECTION_EVENT_SELECTION (&inev.sie) = event->selection.selection;
- SELECTION_EVENT_TIME (&inev.sie) = event->selection.time;
+ SELECTION_EVENT_DPYINFO (&sinev) = FRAME_DISPLAY_INFO (f);
+ SELECTION_EVENT_SELECTION (&sinev) = event->selection.selection;
+ SELECTION_EVENT_TIME (&sinev) = event->selection.time;
if (event->type == GDK_SELECTION_REQUEST)
{
It would make sense to wait for the transfer to
complete. But I don't know if GDK actually does
that. */
- SELECTION_EVENT_REQUESTOR (&inev.sie) = event->selection.requestor;
- SELECTION_EVENT_TARGET (&inev.sie) = event->selection.target;
- SELECTION_EVENT_PROPERTY (&inev.sie) = event->selection.property;
+ SELECTION_EVENT_REQUESTOR (&sinev) = event->selection.requestor;
+ SELECTION_EVENT_TARGET (&sinev) = event->selection.target;
+ SELECTION_EVENT_PROPERTY (&sinev) = event->selection.property;
}
- evq_enqueue (&inev);
+ evq_selection_enqueue (&sinev);
return TRUE;
}
}
#endif
int *finish, struct input_event *hold_quit)
{
- union buffered_input_event inev;
+ struct input_event inev;
int count = 0;
int do_help = 0;
#ifdef HAVE_XINPUT2
*finish = X_EVENT_NORMAL;
- EVENT_INIT (inev.ie);
- inev.ie.kind = NO_EVENT;
- inev.ie.arg = Qnil;
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
#ifdef HAVE_XINPUT2
gen_help_device = NULL;
#endif
if (!f)
goto OTHER; /* May be a dialog that is to be removed */
- inev.ie.kind = DELETE_WINDOW_EVENT;
- inev.ie.timestamp = event->xclient.data.l[1];
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = DELETE_WINDOW_EVENT;
+ inev.timestamp = event->xclient.data.l[1];
+ XSETFRAME (inev.frame_or_window, f);
goto done;
}
/* 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.ie);
+ x_scroll_bar_to_input_event (dpyinfo, event, &inev);
*finish = X_EVENT_GOTO_OUT;
goto done;
/* 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.ie);
+ x_horizontal_scroll_bar_to_input_event (dpyinfo, event, &inev);
*finish = X_EVENT_GOTO_OUT;
goto done;
{
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.ie);
+ x_detect_focus_change (dpyinfo, any, event, &inev);
*finish = X_EVENT_GOTO_OUT;
goto done;
rc = x_coords_from_dnd_message (dpyinfo, (XEvent *) event,
&dx, &dy);
- if (x_handle_dnd_message (f, &event->xclient, dpyinfo, &inev.ie,
+ if (x_handle_dnd_message (f, &event->xclient, dpyinfo, &inev,
rc, dx, dy))
*finish = X_EVENT_DROP;
}
|| dpyinfo->motif_drag_atom_time <= eventp->time))
dpyinfo->motif_drag_atom = None;
- 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;
+ 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;
if (x_use_pending_selection_requests)
+ x_push_selection_request (&sinev);
+ else
{
- x_push_selection_request (&inev.sie);
- EVENT_INIT (inev.ie);
+ kbd_buffer_store_selection_event_hold (&sinev, hold_quit);
+ count++;
}
}
break;
{
const XSelectionRequestEvent *eventp = &event->xselectionrequest;
- 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;
+ 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;
/* 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
{
- x_push_selection_request (&inev.sie);
- EVENT_INIT (inev.ie);
+ kbd_buffer_store_selection_event_hold (&sinev, hold_quit);
+ count++;
}
if (x_dnd_waiting_for_finish
SET_FRAME_ICONIFIED (f, false);
f->output_data.x->has_been_visible = true;
- inev.ie.kind = DEICONIFY_EVENT;
+ inev.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. */
f->was_invisible = false;
}
#endif
- XSETFRAME (inev.ie.frame_or_window, f);
+ XSETFRAME (inev.frame_or_window, f);
}
else if (!not_hidden && !FRAME_ICONIFIED_P (f))
{
SET_FRAME_VISIBLE (f, 0);
SET_FRAME_ICONIFIED (f, true);
- inev.ie.kind = ICONIFY_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = ICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
}
set. Handling UnmapNotify also checks for
_NET_WM_STATE_HIDDEN, and thus suffers from the same
problem. */
- x_handle_wm_state (f, &inev.ie);
+ x_handle_wm_state (f, &inev);
if (f && FRAME_X_OUTPUT (f)->alpha_identical_p
&& (event->xproperty.atom
(f, build_string ("UnmapNotify, visible | iconified"));
SET_FRAME_ICONIFIED (f, true);
- inev.ie.kind = ICONIFY_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = ICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
else if (CONSP (frame_size_history))
frame_size_history_plain
if ((not_hidden || FRAME_X_EMBEDDED_P (f)) && iconified)
{
- inev.ie.kind = DEICONIFY_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = DEICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
}
goto OTHER;
orig_keysym = keysym;
/* Common for all keysym input events. */
- XSETFRAME (inev.ie.frame_or_window, f);
- inev.ie.modifiers
- = x_x_to_emacs_modifiers (dpyinfo, modifiers);
- inev.ie.timestamp = xkey.time;
+ XSETFRAME (inev.frame_or_window, f);
+ inev.modifiers = x_x_to_emacs_modifiers (dpyinfo, modifiers);
+ inev.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.ie.kind = ASCII_KEYSTROKE_EVENT;
- inev.ie.code = keysym;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
+ inev.code = keysym;
#ifdef HAVE_XINPUT2
if (event->xkey.time == pending_keystroke_time)
dpyinfo->pending_keystroke_source);
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
#endif
if (keysym >= 0x01000000 && keysym <= 0x0110FFFF)
{
if (keysym < 0x01000080)
- inev.ie.kind = ASCII_KEYSTROKE_EVENT;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
else
- inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
- inev.ie.code = keysym & 0xFFFFFF;
+ inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+ inev.code = keysym & 0xFFFFFF;
#ifdef HAVE_XINPUT2
if (event->xkey.time == pending_keystroke_time)
dpyinfo->pending_keystroke_source);
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
#endif
Qnil),
FIXNATP (c)))
{
- inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
- ? ASCII_KEYSTROKE_EVENT
- : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
- inev.ie.code = XFIXNAT (c);
+ inev.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
+ ? ASCII_KEYSTROKE_EVENT
+ : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+ inev.code = XFIXNAT (c);
#ifdef HAVE_XINPUT2
if (event->xkey.time == pending_keystroke_time)
dpyinfo->pending_keystroke_source);
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
#endif
STORE_KEYSYM_FOR_DEBUG (keysym);
/* make_lispy_event will convert this to a symbolic
key. */
- inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
- inev.ie.code = keysym;
+ inev.kind = NON_ASCII_KEYSTROKE_EVENT;
+ inev.code = keysym;
#ifdef HAVE_XINPUT2
if (event->xkey.time == pending_keystroke_time)
dpyinfo->pending_keystroke_source);
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
#endif
if (nbytes)
{
- inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
- inev.ie.arg = make_unibyte_string ((char *) copy_bufptr, nbytes);
+ inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+ inev.arg = make_unibyte_string ((char *) copy_bufptr, nbytes);
Fput_text_property (make_fixnum (0), make_fixnum (nbytes),
- Qcoding, coding, inev.ie.arg);
+ Qcoding, coding, inev.arg);
#ifdef HAVE_XINPUT2
if (event->xkey.time == pending_keystroke_time
dpyinfo->pending_keystroke_source);
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
#endif
}
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.ie);
+ x_detect_focus_change (dpyinfo, any, event, &inev);
#endif /* defined USE_X_TOOLKIT || (defined USE_GTK && !defined HAVE_GTK3) */
#ifdef HAVE_XINPUT2
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.ie);
+ x_detect_focus_change (dpyinfo, any, event, &inev);
#endif /* !defined USE_X_TOOLKIT || (!defined USE_GTK || defined HAVE_GTK3) */
f = any;
SET_FRAME_VISIBLE (f, 1);
SET_FRAME_ICONIFIED (f, false);
f->output_data.x->has_been_visible = true;
- inev.ie.kind = DEICONIFY_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = DEICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
}
- x_detect_focus_change (dpyinfo, any, event, &inev.ie);
+ x_detect_focus_change (dpyinfo, any, event, &inev);
goto OTHER;
case LeaveNotify:
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.ie);
+ x_detect_focus_change (dpyinfo, any, event, &inev);
#endif /* defined USE_X_TOOLKIT || (defined USE_GTK && !defined HAVE_GTK3) */
#ifdef HAVE_XINPUT2
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.ie);
+ x_detect_focus_change (dpyinfo, any, event, &inev);
#endif /* !defined USE_X_TOOLKIT || (!defined USE_GTK || defined HAVE_GTK3) */
#ifdef HAVE_XWIDGETS
if (dpyinfo->supports_xi2)
goto OTHER;
#endif
- x_detect_focus_change (dpyinfo, any, event, &inev.ie);
+ x_detect_focus_change (dpyinfo, any, event, &inev);
goto OTHER;
case MotionNotify:
&& !EQ (window, last_mouse_window)
&& !EQ (window, selected_window))
{
- inev.ie.kind = SELECT_WINDOW_EVENT;
- inev.ie.frame_or_window = window;
+ inev.kind = SELECT_WINDOW_EVENT;
+ inev.frame_or_window = window;
}
/* Remember the last window where we saw the mouse. */
hook. */
if (!x_find_monitors_changed_event (dpyinfo))
{
- inev.ie.kind = MONITORS_CHANGED_EVENT;
- XSETTERMINAL (inev.ie.arg, dpyinfo->terminal);
+ inev.kind = MONITORS_CHANGED_EVENT;
+ XSETTERMINAL (inev.arg, dpyinfo->terminal);
- /* Store this event now since inev.ie.type could be set to
+ /* Store this event now since inev.type could be set to
MOVE_FRAME_EVENT later. */
- kbd_buffer_store_event (&inev.ie);
- inev.ie.kind = NO_EVENT;
+ kbd_buffer_store_event (&inev);
+ inev.kind = NO_EVENT;
}
/* Also update the position of the drag-and-drop
if (!FRAME_TOOLTIP_P (f)
&& (old_left != f->left_pos || old_top != f->top_pos))
{
- inev.ie.kind = MOVE_FRAME_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = MOVE_FRAME_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
}
if (!EQ (selected_window, xvw->w) && (event->xbutton.button < 4))
{
- inev.ie.kind = SELECT_WINDOW_EVENT;
- inev.ie.frame_or_window = xvw->w;
+ inev.kind = SELECT_WINDOW_EVENT;
+ inev.frame_or_window = xvw->w;
}
*finish = X_EVENT_DROP;
&& event->xbutton.time > ignore_next_mouse_click_timeout)
{
ignore_next_mouse_click_timeout = 0;
- x_construct_mouse_click (&inev.ie, &event->xbutton,
+ x_construct_mouse_click (&inev, &event->xbutton,
f, false);
}
if (event->type == ButtonRelease)
ignore_next_mouse_click_timeout = 0;
}
else
- x_construct_mouse_click (&inev.ie, &event->xbutton, f, false);
+ x_construct_mouse_click (&inev, &event->xbutton, f, false);
*finish = X_EVENT_DROP;
goto OTHER;
&& event->xbutton.time > ignore_next_mouse_click_timeout)
{
ignore_next_mouse_click_timeout = 0;
- x_construct_mouse_click (&inev.ie, &event->xbutton,
+ x_construct_mouse_click (&inev, &event->xbutton,
f, false);
}
if (event->type == ButtonRelease)
ignore_next_mouse_click_timeout = 0;
}
else
- x_construct_mouse_click (&inev.ie, &event->xbutton,
+ x_construct_mouse_click (&inev, &event->xbutton,
f, false);
if (!NILP (tab_bar_arg))
- inev.ie.arg = tab_bar_arg;
+ inev.arg = tab_bar_arg;
}
if (FRAME_X_EMBEDDED_P (f)
scroll bars. */
if (bar && event->xbutton.state & ControlMask)
{
- x_scroll_bar_handle_click (bar, event, &inev.ie, Qnil);
+ x_scroll_bar_handle_click (bar, event, &inev, Qnil);
*finish = X_EVENT_DROP;
}
#else /* not USE_TOOLKIT_SCROLL_BARS */
if (bar)
- x_scroll_bar_handle_click (bar, event, &inev.ie, Qnil);
+ x_scroll_bar_handle_click (bar, event, &inev, Qnil);
#endif /* not USE_TOOLKIT_SCROLL_BARS */
}
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.ie.kind = MENU_BAR_ACTIVATE_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = MENU_BAR_ACTIVATE_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
*finish = X_EVENT_DROP;
#ifdef USE_MOTIF
}
SET_FRAME_VISIBLE (f, 1);
SET_FRAME_ICONIFIED (f, false);
f->output_data.x->has_been_visible = true;
- inev.ie.kind = DEICONIFY_EVENT;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = DEICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
}
}
if (fabs (total_x) > 0 || fabs (total_y) > 0)
{
- inev.ie.kind = (fabs (total_y) >= fabs (total_x)
- ? WHEEL_EVENT : HORIZ_WHEEL_EVENT);
- inev.ie.timestamp = xev->time;
-
- XSETINT (inev.ie.x, lrint (real_x));
- XSETINT (inev.ie.y, lrint (real_y));
- XSETFRAME (inev.ie.frame_or_window, f);
-
- inev.ie.modifiers = (signbit (fabs (total_y) >= fabs (total_x)
- ? total_y : total_x)
- ? down_modifier : up_modifier);
- inev.ie.modifiers
+ inev.kind = (fabs (total_y) >= fabs (total_x)
+ ? WHEEL_EVENT : HORIZ_WHEEL_EVENT);
+ inev.timestamp = xev->time;
+
+ XSETINT (inev.x, lrint (real_x));
+ XSETINT (inev.y, lrint (real_y));
+ XSETFRAME (inev.frame_or_window, f);
+
+ inev.modifiers = (signbit (fabs (total_y) >= fabs (total_x)
+ ? total_y : total_x)
+ ? down_modifier : up_modifier);
+ inev.modifiers
|= x_x_to_emacs_modifiers (dpyinfo,
xev->mods.effective);
- inev.ie.arg = list3 (Qnil,
- make_float (total_x),
- make_float (total_y));
+ inev.arg = list3 (Qnil,
+ make_float (total_x),
+ make_float (total_y));
}
else
{
- inev.ie.kind = TOUCH_END_EVENT;
- inev.ie.timestamp = xev->time;
+ inev.kind = TOUCH_END_EVENT;
+ inev.timestamp = xev->time;
- XSETINT (inev.ie.x, lrint (real_x));
- XSETINT (inev.ie.y, lrint (real_y));
- XSETFRAME (inev.ie.frame_or_window, f);
+ XSETINT (inev.x, lrint (real_x));
+ XSETINT (inev.y, lrint (real_y));
+ XSETFRAME (inev.frame_or_window, f);
}
if (source && !NILP (source->name))
- inev.ie.device = source->name;
+ inev.device = source->name;
if (!other_valuators_found)
goto XI_OTHER;
&& !EQ (window, last_mouse_window)
&& !EQ (window, selected_window))
{
- inev.ie.kind = SELECT_WINDOW_EVENT;
- inev.ie.frame_or_window = window;
+ inev.kind = SELECT_WINDOW_EVENT;
+ inev.frame_or_window = window;
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
/* Remember the last window where we saw the mouse. */
if (!EQ (selected_window, xvw->w) && (xev->detail < 4))
{
- inev.ie.kind = SELECT_WINDOW_EVENT;
- inev.ie.frame_or_window = xvw->w;
+ inev.kind = SELECT_WINDOW_EVENT;
+ inev.frame_or_window = xvw->w;
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
*finish = X_EVENT_DROP;
&real_x, &real_y);
if (xev->detail <= 5)
- inev.ie.kind = WHEEL_EVENT;
+ inev.kind = WHEEL_EVENT;
else
- inev.ie.kind = HORIZ_WHEEL_EVENT;
+ inev.kind = HORIZ_WHEEL_EVENT;
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
- inev.ie.timestamp = xev->time;
+ inev.timestamp = xev->time;
- XSETINT (inev.ie.x, real_x);
- XSETINT (inev.ie.y, real_y);
- XSETFRAME (inev.ie.frame_or_window, f);
+ XSETINT (inev.x, real_x);
+ XSETINT (inev.y, real_y);
+ XSETFRAME (inev.frame_or_window, f);
- inev.ie.modifiers
+ inev.modifiers
|= x_x_to_emacs_modifiers (dpyinfo,
xev->mods.effective);
- inev.ie.modifiers |= xev->detail % 2 ? down_modifier : up_modifier;
+ inev.modifiers |= xev->detail % 2 ? down_modifier : up_modifier;
}
*finish = X_EVENT_DROP;
if (xev->evtype == XI_ButtonRelease)
{
if (xev->detail <= 5)
- inev.ie.kind = WHEEL_EVENT;
+ inev.kind = WHEEL_EVENT;
else
- inev.ie.kind = HORIZ_WHEEL_EVENT;
+ inev.kind = HORIZ_WHEEL_EVENT;
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
- inev.ie.timestamp = xev->time;
+ inev.timestamp = xev->time;
- XSETINT (inev.ie.x, lrint (xev->event_x));
- XSETINT (inev.ie.y, lrint (xev->event_y));
- XSETFRAME (inev.ie.frame_or_window, f);
+ XSETINT (inev.x, lrint (xev->event_x));
+ XSETINT (inev.y, lrint (xev->event_y));
+ XSETFRAME (inev.frame_or_window, f);
- inev.ie.modifiers
+ inev.modifiers
|= x_x_to_emacs_modifiers (dpyinfo,
xev->mods.effective);
- inev.ie.modifiers |= xev->detail % 2 ? down_modifier : up_modifier;
+ inev.modifiers |= xev->detail % 2 ? down_modifier : up_modifier;
}
goto XI_OTHER;
&& xev->time > ignore_next_mouse_click_timeout)
{
ignore_next_mouse_click_timeout = 0;
- x_construct_mouse_click (&inev.ie, &bv, f, true);
+ x_construct_mouse_click (&inev, &bv, f, true);
}
if (xev->evtype == XI_ButtonRelease)
ignore_next_mouse_click_timeout = 0;
}
else
- x_construct_mouse_click (&inev.ie, &bv, f, true);
+ x_construct_mouse_click (&inev, &bv, f, true);
if (!NILP (tab_bar_arg))
- inev.ie.arg = tab_bar_arg;
+ inev.arg = tab_bar_arg;
}
if (FRAME_X_EMBEDDED_P (f)
#ifndef USE_TOOLKIT_SCROLL_BARS
if (bar)
- x_scroll_bar_handle_click (bar, (XEvent *) &bv, &inev.ie,
+ x_scroll_bar_handle_click (bar, (XEvent *) &bv, &inev,
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.ie,
+ x_scroll_bar_handle_click (bar, (XEvent *) &bv, &inev,
source ? source->name : Qnil);
*finish = X_EVENT_DROP;
}
device->grab &= ~(1 << xev->detail);
}
- if (source && inev.ie.kind != NO_EVENT)
- inev.ie.device = source->name;
+ if (source && inev.kind != NO_EVENT)
+ inev.device = source->name;
if (f)
f->mouse_moved = false;
*finish = X_EVENT_DROP;
#endif /* USE_GTK */
- XSETFRAME (inev.ie.frame_or_window, f);
- inev.ie.timestamp = xev->time;
+ XSETFRAME (inev.frame_or_window, f);
+ inev.timestamp = xev->time;
#ifdef HAVE_X_I18N
if (FRAME_XIC (f))
}
}
- inev.ie.modifiers = x_x_to_emacs_modifiers (dpyinfo, state);
+ inev.modifiers = x_x_to_emacs_modifiers (dpyinfo, state);
#ifdef XK_F1
if (x_dnd_in_progress
if (keysym >= 32 && keysym < 128)
/* Avoid explicitly decoding each ASCII character. */
{
- inev.ie.kind = ASCII_KEYSTROKE_EVENT;
- inev.ie.code = keysym;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
+ inev.code = keysym;
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
goto xi_done_keysym;
}
if (keysym >= 0x01000000 && keysym <= 0x0110FFFF)
{
if (keysym < 0x01000080)
- inev.ie.kind = ASCII_KEYSTROKE_EVENT;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
else
- inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+ inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
- inev.ie.code = keysym & 0xFFFFFF;
+ inev.code = keysym & 0xFFFFFF;
goto xi_done_keysym;
}
Qnil),
FIXNATP (c)))
{
- inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
+ inev.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT);
- inev.ie.code = XFIXNAT (c);
+ inev.code = XFIXNAT (c);
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
goto xi_done_keysym;
}
STORE_KEYSYM_FOR_DEBUG (keysym);
/* make_lispy_event will convert this to a symbolic
key. */
- inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
- inev.ie.code = keysym;
+ inev.kind = NON_ASCII_KEYSTROKE_EVENT;
+ inev.code = keysym;
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
goto xi_done_keysym;
}
if (nbytes)
{
- inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
- inev.ie.arg = make_unibyte_string (copy_bufptr, nbytes);
+ inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+ inev.arg = make_unibyte_string (copy_bufptr, nbytes);
Fput_text_property (make_fixnum (0), make_fixnum (nbytes),
- Qcoding, coding, inev.ie.arg);
+ Qcoding, coding, inev.arg);
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
goto xi_done_keysym;
}
xev->event_x,
xev->event_y, f);
- 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);
+ 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);
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
x_uncatch_errors ();
if (f && device->direct_p)
{
- inev.ie.kind = TOUCHSCREEN_UPDATE_EVENT;
- inev.ie.timestamp = xev->time;
- XSETFRAME (inev.ie.frame_or_window, f);
+ inev.kind = TOUCHSCREEN_UPDATE_EVENT;
+ inev.timestamp = xev->time;
+ XSETFRAME (inev.frame_or_window, f);
for (touchpoint = device->touchpoints;
touchpoint; touchpoint = touchpoint->next)
}
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
- inev.ie.arg = arg;
+ inev.arg = arg;
}
goto XI_OTHER;
if (f && device->direct_p)
{
- inev.ie.kind = TOUCHSCREEN_END_EVENT;
- inev.ie.timestamp = xev->time;
- inev.ie.modifiers = state != 2;
+ inev.kind = TOUCHSCREEN_END_EVENT;
+ inev.timestamp = xev->time;
+ inev.modifiers = state != 2;
- 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);
+ 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);
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
}
if (pev->event == FRAME_X_WINDOW (any))
xi_compute_root_window_offset_pinch (any, pev);
- inev.ie.kind = PINCH_EVENT;
- inev.ie.modifiers
+ inev.kind = PINCH_EVENT;
+ inev.modifiers
= x_x_to_emacs_modifiers (dpyinfo, pev->mods.effective);
- 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));
+ 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));
if (source)
- inev.ie.device = source->name;
+ inev.device = source->name;
}
/* Once again GTK seems to crash when confronted by
already an undelivered event on the queue. */
goto OTHER;
- inev.ie.kind = MONITORS_CHANGED_EVENT;
- inev.ie.timestamp = timestamp;
- XSETTERMINAL (inev.ie.arg, dpyinfo->terminal);
+ inev.kind = MONITORS_CHANGED_EVENT;
+ inev.timestamp = timestamp;
+ XSETTERMINAL (inev.arg, dpyinfo->terminal);
/* Also don't do anything if the monitor configuration
didn't really change. */
current_monitors
- = Fx_display_monitor_attributes_list (inev.ie.arg);
+ = Fx_display_monitor_attributes_list (inev.arg);
if (!NILP (Fequal (current_monitors,
dpyinfo->last_monitor_attributes_list)))
- inev.ie.kind = NO_EVENT;
+ inev.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.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
x_dnd_update_tooltip_now ();
}
#endif
}
done:
- if (inev.ie.kind != NO_EVENT)
+ if (inev.kind != NO_EVENT)
{
- kbd_buffer_store_buffered_event (&inev, hold_quit);
+ kbd_buffer_store_event_hold (&inev, hold_quit);
count++;
}