about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--exwm-input.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/exwm-input.el b/exwm-input.el
index 79bc78ef0fe9..2c65116aa33c 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -1215,12 +1215,13 @@ One use is to access the keymap bound to KEYS (as prefix keys) in char-mode."
   (when exwm-input--update-focus-timer
     (cancel-timer exwm-input--update-focus-timer))
   ;; Make input focus working even without a WM.
-  (xcb:+request exwm--connection
-      (make-instance 'xcb:SetInputFocus
-                     :revert-to xcb:InputFocus:PointerRoot
-                     :focus exwm--root
-                     :time xcb:Time:CurrentTime))
-  (xcb:flush exwm--connection))
+  (when exwm--connection
+    (xcb:+request exwm--connection
+        (make-instance 'xcb:SetInputFocus
+                       :revert-to xcb:InputFocus:PointerRoot
+                       :focus exwm--root
+                       :time xcb:Time:CurrentTime))
+    (xcb:flush exwm--connection)))