Factor out `exwm-randr--on-ScreenChangeNotify'

* exwm-randr.el (exwm-randr--on-ScreenChangeNotify)
(exwm-randr--init): Factor ScreenChangeNotify event callback into
a function.
This commit is contained in:
Adrián Medraño Calvo 2018-03-06 00:00:00 +00:00
parent 4f7abf4bfd
commit d3be64e743

View file

@ -170,6 +170,11 @@ the first one in result being the primary output."
(xcb:flush exwm--connection) (xcb:flush exwm--connection)
(run-hooks 'exwm-randr-refresh-hook)))) (run-hooks 'exwm-randr-refresh-hook))))
(defun exwm-randr--on-ScreenChangeNotify (_data _synthetic)
(exwm--log "(RandR) ScreenChangeNotify")
(run-hooks 'exwm-randr-screen-change-hook)
(exwm-randr--refresh))
(defun exwm-randr--init () (defun exwm-randr--init ()
"Initialize RandR extension and EXWM RandR module." "Initialize RandR extension and EXWM RandR module."
(if (= 0 (slot-value (xcb:get-extension-data exwm--connection 'xcb:randr) (if (= 0 (slot-value (xcb:get-extension-data exwm--connection 'xcb:randr)
@ -186,10 +191,7 @@ the first one in result being the primary output."
(run-hooks 'exwm-randr-screen-change-hook) (run-hooks 'exwm-randr-screen-change-hook)
(exwm-randr--refresh) (exwm-randr--refresh)
(xcb:+event exwm--connection 'xcb:randr:ScreenChangeNotify (xcb:+event exwm--connection 'xcb:randr:ScreenChangeNotify
(lambda (_data _synthetic) #'exwm-randr--on-ScreenChangeNotify)
(exwm--log "(RandR) ScreenChangeNotify")
(run-hooks 'exwm-randr-screen-change-hook)
(exwm-randr--refresh)))
;; (xcb:+event exwm--connection 'xcb:randr:Notify ;; (xcb:+event exwm--connection 'xcb:randr:Notify
;; (lambda (_data _synthetic) ;; (lambda (_data _synthetic)
;; (exwm--log "(RandR) Notify") ;; (exwm--log "(RandR) Notify")