Further reduce monitor change event duplication

* src/xterm.c (handle_one_xevent): Also don't store duplicate
events for ConfigureNotify events bound for the root window.
This commit is contained in:
Po Lu 2022-08-02 15:15:03 +08:00
parent 0381e90fe7
commit 0b233d3e5f

View file

@ -16499,8 +16499,6 @@ x_wait_for_cell_change (Lisp_Object cell, struct timespec timeout)
}
}
#if defined USE_GTK || defined HAVE_XRANDR
/* Find whether or not an undelivered MONITORS_CHANGED_EVENT is
already on the event queue. DPYINFO is the display any such event
must apply to. */
@ -16524,8 +16522,6 @@ x_find_monitors_changed_event (struct x_display_info *dpyinfo)
return false;
}
#endif
#ifdef USE_GTK
static void
x_monitors_changed_cb (GdkScreen *gscr, gpointer user_data)
@ -18914,13 +18910,20 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (configureEvent.xconfigure.width != dpyinfo->screen_width
|| configureEvent.xconfigure.height != dpyinfo->screen_height)
{
inev.ie.kind = MONITORS_CHANGED_EVENT;
XSETTERMINAL (inev.ie.arg, dpyinfo->terminal);
/* Also avoid storing duplicate events here, since
Fx_display_monitor_attributes_list will return the
same information for both invocations of the
hook. */
if (!x_find_monitors_changed_event (dpyinfo))
{
inev.ie.kind = MONITORS_CHANGED_EVENT;
XSETTERMINAL (inev.ie.arg, dpyinfo->terminal);
/* Store this event now since inev.ie.type could be set to
MOVE_FRAME_EVENT later. */
kbd_buffer_store_event (&inev.ie);
inev.ie.kind = NO_EVENT;
/* Store this event now since inev.ie.type could be set to
MOVE_FRAME_EVENT later. */
kbd_buffer_store_event (&inev.ie);
inev.ie.kind = NO_EVENT;
}
/* Also update the position of the drag-and-drop
tooltip. */