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.
This commit is contained in:
Chris Feng 2015-09-18 22:15:45 +08:00
parent 26ebc32e60
commit c75a8b82ec

View file

@ -268,6 +268,21 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
(with-slots (detail state) key-press (with-slots (detail state) key-press
(let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state)) (let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state))
event) 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 (and keysym (setq event (xcb:keysyms:keysym->event keysym state)))
(when (eq major-mode 'exwm-mode) (when (eq major-mode 'exwm-mode)
(setq exwm-input--temp-line-mode t (setq exwm-input--temp-line-mode t