RandR: Track the config timestamp instead of the sequence number

The sequence number tracks how many request's we've sent, the config
timestamp tracks the last time the screen configuration was changed. The
previous logic only worked because we tended to send a lot of X messages
between screen change events, but that's no longer the case now that
we're using a different connection.

* exwm-randr.el (exwm-randr--prev-screen-change-timestamp): rename
`sequence` to `timestamp`.
(exwm-randr--on-ScreenChangeNotify): use `config-timestamp` instead of
`~sequence`.
This commit is contained in:
Steven Allen 2024-06-11 17:07:26 -07:00
parent dd95ff193a
commit dad0668fc8

View file

@ -93,8 +93,8 @@ corresponding monitors whenever the monitors are active.
(defvar exwm-randr--last-timestamp 0 "Used for debouncing events.") (defvar exwm-randr--last-timestamp 0 "Used for debouncing events.")
(defvar exwm-randr--prev-screen-change-seqnum nil (defvar exwm-randr--prev-screen-change-timestamp 0
"The most recent ScreenChangeNotify sequence number.") "The most recent ScreenChangeNotify config change timestamp.")
(defvar exwm-randr--compatibility-mode nil (defvar exwm-randr--compatibility-mode nil
"Non-nil when the server does not support RandR 1.5 protocol.") "Non-nil when the server does not support RandR 1.5 protocol.")
@ -291,9 +291,9 @@ Run `exwm-randr-screen-change-hook' (usually user scripts to configure RandR)."
(exwm--log) (exwm--log)
(let ((evt (make-instance 'xcb:randr:ScreenChangeNotify))) (let ((evt (make-instance 'xcb:randr:ScreenChangeNotify)))
(xcb:unmarshal evt data) (xcb:unmarshal evt data)
(let ((seqnum (slot-value evt '~sequence))) (let ((ts (slot-value evt 'config-timestamp)))
(unless (equal seqnum exwm-randr--prev-screen-change-seqnum) (unless (equal ts exwm-randr--prev-screen-change-timestamp)
(setq exwm-randr--prev-screen-change-seqnum seqnum) (setq exwm-randr--prev-screen-change-timestamp ts)
(run-hooks 'exwm-randr-screen-change-hook))))) (run-hooks 'exwm-randr-screen-change-hook)))))
(defun exwm-randr--on-Notify (data _synthetic) (defun exwm-randr--on-Notify (data _synthetic)