mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 21:18:00 +01:00
Only call exwm-randr-screen-change-hook on new event sequence number
Multiple event callbacks are triggered per physical monitor plug event. This de-duplicates the events triggering the running of the hook.
This commit is contained in:
parent
58f7916619
commit
e6892216a6
1 changed files with 9 additions and 2 deletions
|
@ -95,6 +95,8 @@ corresponding monitors whenever the monitors are active.
|
||||||
|
|
||||||
(defvar exwm-workspace--fullscreen-frame-count)
|
(defvar exwm-workspace--fullscreen-frame-count)
|
||||||
(defvar exwm-workspace--list)
|
(defvar exwm-workspace--list)
|
||||||
|
(defvar exwm-randr--prev-screen-change-seqnum nil
|
||||||
|
"The most recent ScreenChangeNotify sequence number.")
|
||||||
(declare-function exwm-workspace--count "exwm-workspace.el")
|
(declare-function exwm-workspace--count "exwm-workspace.el")
|
||||||
(declare-function exwm-workspace--set-active "exwm-workspace.el"
|
(declare-function exwm-workspace--set-active "exwm-workspace.el"
|
||||||
(frame active))
|
(frame active))
|
||||||
|
@ -193,12 +195,17 @@ corresponding monitors whenever the monitors are active.
|
||||||
(define-obsolete-function-alias 'exwm-randr--refresh #'exwm-randr-refresh
|
(define-obsolete-function-alias 'exwm-randr--refresh #'exwm-randr-refresh
|
||||||
"27.1")
|
"27.1")
|
||||||
|
|
||||||
(defun exwm-randr--on-ScreenChangeNotify (_data _synthetic)
|
(defun exwm-randr--on-ScreenChangeNotify (data _synthetic)
|
||||||
"Handle `ScreenChangeNotify' event.
|
"Handle `ScreenChangeNotify' event.
|
||||||
|
|
||||||
Run `exwm-randr-screen-change-hook' (usually user scripts to configure RandR)."
|
Run `exwm-randr-screen-change-hook' (usually user scripts to configure RandR)."
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
(run-hooks 'exwm-randr-screen-change-hook))
|
(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)
|
||||||
|
(run-hooks 'exwm-randr-screen-change-hook)))))
|
||||||
|
|
||||||
(defun exwm-randr--on-Notify (data _synthetic)
|
(defun exwm-randr--on-Notify (data _synthetic)
|
||||||
"Handle `CrtcChangeNotify' and `OutputChangeNotify' events.
|
"Handle `CrtcChangeNotify' and `OutputChangeNotify' events.
|
||||||
|
|
Loading…
Reference in a new issue