From d3be64e743b0e794b91743fa1fa31b721d1a3aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Medra=C3=B1o=20Calvo?= Date: Tue, 6 Mar 2018 00:00:00 +0000 Subject: [PATCH] Factor out `exwm-randr--on-ScreenChangeNotify' * exwm-randr.el (exwm-randr--on-ScreenChangeNotify) (exwm-randr--init): Factor ScreenChangeNotify event callback into a function. --- exwm-randr.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exwm-randr.el b/exwm-randr.el index 37f40f1..485d9c8 100644 --- a/exwm-randr.el +++ b/exwm-randr.el @@ -170,6 +170,11 @@ the first one in result being the primary output." (xcb:flush exwm--connection) (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 () "Initialize RandR extension and EXWM RandR module." (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) (exwm-randr--refresh) (xcb:+event exwm--connection 'xcb:randr:ScreenChangeNotify - (lambda (_data _synthetic) - (exwm--log "(RandR) ScreenChangeNotify") - (run-hooks 'exwm-randr-screen-change-hook) - (exwm-randr--refresh))) + #'exwm-randr--on-ScreenChangeNotify) ;; (xcb:+event exwm--connection 'xcb:randr:Notify ;; (lambda (_data _synthetic) ;; (exwm--log "(RandR) Notify")