From dad0668fc8162effe5eb66d821606ad80484484f Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 11 Jun 2024 17:07:26 -0700 Subject: [PATCH] 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`. --- exwm-randr.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exwm-randr.el b/exwm-randr.el index b9fc2c6..386b3c9 100644 --- a/exwm-randr.el +++ b/exwm-randr.el @@ -93,8 +93,8 @@ corresponding monitors whenever the monitors are active. (defvar exwm-randr--last-timestamp 0 "Used for debouncing events.") -(defvar exwm-randr--prev-screen-change-seqnum nil - "The most recent ScreenChangeNotify sequence number.") +(defvar exwm-randr--prev-screen-change-timestamp 0 + "The most recent ScreenChangeNotify config change timestamp.") (defvar exwm-randr--compatibility-mode nil "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) (let ((evt (make-instance 'xcb:randr:ScreenChangeNotify))) (xcb:unmarshal evt data) - (let ((seqnum (slot-value evt '~sequence))) - (unless (equal seqnum exwm-randr--prev-screen-change-seqnum) - (setq exwm-randr--prev-screen-change-seqnum seqnum) + (let ((ts (slot-value evt 'config-timestamp))) + (unless (equal ts exwm-randr--prev-screen-change-timestamp) + (setq exwm-randr--prev-screen-change-timestamp ts) (run-hooks 'exwm-randr-screen-change-hook))))) (defun exwm-randr--on-Notify (data _synthetic)