about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--exwm-randr.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/exwm-randr.el b/exwm-randr.el
index 37f40f12c197..485d9c882643 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")