Various fixes

* Prevent marking the end of a key sequence with a single `C-u'.
* Enable `C-u' prefix for key simulation since it's not possible for users to
  define simulation keys starting with `C-u'.
* Make Emacs idle only after the visual parts are updated to prevent from
  disturbing users.
* Should use '?\s' instead of '? '.
This commit is contained in:
Chris Feng 2015-08-05 14:10:44 +08:00
parent ee3ce55c48
commit 3fc0cb2bf7
2 changed files with 14 additions and 11 deletions

View file

@ -108,10 +108,12 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
(defun exwm-input--finish-key-sequence () (defun exwm-input--finish-key-sequence ()
"Mark the end of a key sequence (with the aid of `pre-command-hook')." "Mark the end of a key sequence (with the aid of `pre-command-hook')."
(setq exwm-input--during-key-sequence nil) (when (and exwm-input--during-key-sequence
(when exwm-input--temp-line-mode (not (equal [?\C-u] (this-single-command-keys))))
(setq exwm-input--temp-line-mode nil) (setq exwm-input--during-key-sequence nil)
(exwm-input--release-keyboard))) (when exwm-input--temp-line-mode
(setq exwm-input--temp-line-mode nil)
(exwm-input--release-keyboard))))
(defun exwm-input--on-MappingNotify (data synthetic) (defun exwm-input--on-MappingNotify (data synthetic)
"Handle MappingNotify event." "Handle MappingNotify event."
@ -403,18 +405,19 @@ SIMULATION-KEYS is a list of alist (key-sequence1 . key-sequence2)."
(cl-pushnew `(,(vconcat (car i)) . ,(cdr i)) exwm-input--simulation-keys)) (cl-pushnew `(,(vconcat (car i)) . ,(cdr i)) exwm-input--simulation-keys))
(exwm-input--update-simulation-prefix-keys)) (exwm-input--update-simulation-prefix-keys))
(defun exwm-input-send-simulation-key () (defun exwm-input-send-simulation-key (times)
"Fake a key event according to last input key sequence." "Fake a key event according to last input key sequence."
(interactive) (interactive "p")
(let ((pair (assoc (this-command-keys-vector) ;FIXME: pefix (let ((pair (assoc (this-single-command-keys)
exwm-input--simulation-keys)) exwm-input--simulation-keys))
key) key)
(when pair (when pair
(setq pair (cdr pair)) (setq pair (cdr pair))
(unless (listp pair) (unless (listp pair)
(setq pair (list pair))) (setq pair (list pair)))
(dolist (i pair) (dotimes (i times)
(exwm-input--fake-key i))))) (dolist (j pair)
(exwm-input--fake-key j))))))
(defun exwm-input--init () (defun exwm-input--init ()
"Initialize the keyboard module." "Initialize the keyboard module."

View file

@ -115,7 +115,6 @@ The optional FORCE option is for internal use only."
(setq exwm-workspace--current frame (setq exwm-workspace--current frame
exwm-workspace-current-index index) exwm-workspace-current-index index)
(select-frame-set-input-focus frame) (select-frame-set-input-focus frame)
(exwm--make-emacs-idle-for 0.1) ;FIXME
;; Move mouse when necessary ;; Move mouse when necessary
(let ((position (mouse-pixel-position)) (let ((position (mouse-pixel-position))
x y w h) x y w h)
@ -140,6 +139,7 @@ The optional FORCE option is for internal use only."
(set-frame-parameter frame 'exwm--urgency nil) (set-frame-parameter frame 'exwm--urgency nil)
;; Update switch workspace history ;; Update switch workspace history
(exwm-workspace--update-switch-history) (exwm-workspace--update-switch-history)
(exwm--make-emacs-idle-for 0.1) ;FIXME
;; Update _NET_CURRENT_DESKTOP ;; Update _NET_CURRENT_DESKTOP
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_CURRENT_DESKTOP (make-instance 'xcb:ewmh:set-_NET_CURRENT_DESKTOP
@ -196,7 +196,7 @@ The optional FORCE option is for internal use only."
(defun exwm-workspace-rename-buffer (newname) (defun exwm-workspace-rename-buffer (newname)
"Rename a buffer." "Rename a buffer."
(if (/= ? (aref newname 0)) (if (/= ?\s (aref newname 0))
(rename-buffer newname t) (rename-buffer newname t)
;; If a buffer name is prefixed with a space, Emacs append a random ;; If a buffer name is prefixed with a space, Emacs append a random
;; number before renaming it. This is not desired behavior. ;; number before renaming it. This is not desired behavior.