about summary refs log tree commit diff
path: root/exwm-input.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-09-18T14·15+0800
committerChris Feng <chris.w.feng@gmail.com>2015-09-18T14·15+0800
commitc75a8b82ec2747a6fe7fc4b3a0dfaf1adca7ea64 (patch)
tree82cc686b8284d4cf4151c218741476d3e91da662 /exwm-input.el
parent26ebc32e605249284f1ded69555006f10891cbba (diff)
Prevent Emacs cursor style change when pointer is in an X window
* exwm-input.el (exwm-input--on-KeyPress-char-mode): Compensate FocusOut
  event by sending a synthetic FocusIn event to prevent the change of cursor
  style (e.g. box to hollow) when pointer is in an X window.
Diffstat (limited to 'exwm-input.el')
-rw-r--r--exwm-input.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/exwm-input.el b/exwm-input.el
index afa619b87369..042467b96125 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -268,6 +268,21 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
   (with-slots (detail state) key-press
     (let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state))
           event)
+      ;; Compensate FocusOut event (prevent cursor style change)
+      (unless (eq major-mode 'exwm-mode)
+        (let ((id (frame-parameter nil 'exwm-window-id)))
+          (xcb:+request exwm--connection
+              (make-instance 'xcb:SendEvent
+                             :propagate 0
+                             :destination id
+                             :event-mask xcb:EventMask:StructureNotify
+                             :event
+                             (xcb:marshal
+                              (make-instance 'xcb:FocusIn
+                                             :detail xcb:NotifyDetail:Inferior
+                                             :event id
+                                             :mode xcb:NotifyMode:Normal)
+                              exwm--connection)))))
       (when (and keysym (setq event (xcb:keysyms:keysym->event keysym state)))
         (when (eq major-mode 'exwm-mode)
           (setq exwm-input--temp-line-mode t