about summary refs log tree commit diff
path: root/exwm-randr.el
diff options
context:
space:
mode:
authorAdrián Medraño Calvo <adrian@medranocalvo.com>2018-03-06T00·00+0000
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2018-03-06T00·00+0000
commitd3be64e743b0e794b91743fa1fa31b721d1a3aca (patch)
tree821cde5d1701daddeac73f8c2cdcc496f93ddad0 /exwm-randr.el
parent4f7abf4bfd41932fe23ce3e9544b8c425f1b2cd3 (diff)
Factor out `exwm-randr--on-ScreenChangeNotify'
* exwm-randr.el (exwm-randr--on-ScreenChangeNotify)
(exwm-randr--init): Factor ScreenChangeNotify event callback into
a function.
Diffstat (limited to 'exwm-randr.el')
-rw-r--r--exwm-randr.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/exwm-randr.el b/exwm-randr.el
index 37f40f12c1..485d9c8826 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")