{
union buffered_input_event *ev;
Time timestamp;
+ Lisp_Object current_monitors;
if (event->type == (dpyinfo->xrandr_event_base
+ RRScreenChangeNotify))
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.ie.arg);
+
+ if (Fequal (current_monitors,
+ dpyinfo->last_monitor_attributes_list))
+ inev.ie.kind = NO_EVENT;
+
+ dpyinfo->last_monitor_attributes_list = current_monitors;
}
#endif
OTHER:
#endif
#ifdef HAVE_XRANDR
+ Lisp_Object term;
+
+ dpyinfo->last_monitor_attributes_list = Qnil;
dpyinfo->xrandr_supported_p
= XRRQueryExtension (dpy, &dpyinfo->xrandr_event_base,
&dpyinfo->xrandr_error_base);
+
+ XSETTERMINAL (term, terminal);
+
if (dpyinfo->xrandr_supported_p)
{
XRRQueryVersion (dpy, &dpyinfo->xrandr_major_version,
if (dpyinfo->xrandr_major_version == 1
&& dpyinfo->xrandr_minor_version >= 2)
- XRRSelectInput (dpyinfo->display,
- dpyinfo->root_window,
- (RRScreenChangeNotifyMask
- | RRCrtcChangeNotifyMask
- | RROutputChangeNotifyMask
- /* Emacs doesn't actually need this, but GTK
- selects for it when the display is
- initialized. */
- | RROutputPropertyNotifyMask));
+ {
+ dpyinfo->last_monitor_attributes_list
+ = Fx_display_monitor_attributes_list (term);
+
+ XRRSelectInput (dpyinfo->display,
+ dpyinfo->root_window,
+ (RRScreenChangeNotifyMask
+ | RRCrtcChangeNotifyMask
+ | RROutputChangeNotifyMask
+ /* Emacs doesn't actually need this, but GTK
+ selects for it when the display is
+ initialized. */
+ | RROutputPropertyNotifyMask));
+ }
}
#endif
mark_object (val);
}
-#if defined HAVE_XINPUT2 || defined USE_TOOLKIT_SCROLL_BARS
+#if defined HAVE_XINPUT2 || defined USE_TOOLKIT_SCROLL_BARS || defined HAVE_XRANDR
for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
{
#ifdef HAVE_XINPUT2
#ifdef USE_TOOLKIT_SCROLL_BARS
for (i = 0; i < dpyinfo->n_protected_windows; ++i)
mark_object (dpyinfo->protected_windows[i]);
+#endif
+#ifdef HAVE_XRANDR
+ mark_object (dpyinfo->last_monitor_attributes_list);
#endif
}
#endif