From c75a8b82ec2747a6fe7fc4b3a0dfaf1adca7ea64 Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Fri, 18 Sep 2015 22:15:45 +0800 Subject: [PATCH] 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. --- exwm-input.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/exwm-input.el b/exwm-input.el index afa619b87..042467b96 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