mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-23 13:07:59 +01:00
Make exwm-mode buffers work with winner-mode
* exwm-input.el (exwm-input--noop): New placeholder command. (exwm-input--on-pre-command, exwm-input--on-post-command): Ignore this command. (exwm-input--on-KeyPress-line-mode): Set `last-command' to make winner-undo start over from the newest config; run `post-command-hook' to make winner-mode save configs; run `pre-command-hook' in case required by some other package.
This commit is contained in:
parent
48db94f48b
commit
ed0f63327d
1 changed files with 17 additions and 6 deletions
|
@ -649,6 +649,10 @@ Current buffer must be an `exwm-mode' buffer."
|
||||||
(lookup-key (current-local-map) (vector event))
|
(lookup-key (current-local-map) (vector event))
|
||||||
(gethash event exwm-input--simulation-keys)))
|
(gethash event exwm-input--simulation-keys)))
|
||||||
|
|
||||||
|
(defun exwm-input--noop (&rest _args)
|
||||||
|
"A placeholder command."
|
||||||
|
(interactive))
|
||||||
|
|
||||||
(defun exwm-input--on-KeyPress-line-mode (key-press raw-data)
|
(defun exwm-input--on-KeyPress-line-mode (key-press raw-data)
|
||||||
"Parse X KeyPress event to Emacs key event and then feed the command loop."
|
"Parse X KeyPress event to Emacs key event and then feed the command loop."
|
||||||
(with-slots (detail state) key-press
|
(with-slots (detail state) key-press
|
||||||
|
@ -678,10 +682,15 @@ Current buffer must be an `exwm-mode' buffer."
|
||||||
:destination (slot-value key-press 'event)
|
:destination (slot-value key-press 'event)
|
||||||
:event-mask xcb:EventMask:NoEvent
|
:event-mask xcb:EventMask:NoEvent
|
||||||
:event raw-data)))
|
:event raw-data)))
|
||||||
;; Make Emacs aware of this event when defining keyboard macros.
|
(if defining-kbd-macro
|
||||||
(when (and defining-kbd-macro event)
|
(when event
|
||||||
(set-transient-map '(keymap (t . (lambda () (interactive)))))
|
;; Make Emacs aware of this event when defining keyboard macros.
|
||||||
(exwm-input--unread-event event)))
|
(set-transient-map `(keymap (t . ,#'exwm-input--noop)))
|
||||||
|
(exwm-input--unread-event event))
|
||||||
|
;; Fool some packages into thinking there is a change in the buffer.
|
||||||
|
(setq last-command #'exwm-input--noop)
|
||||||
|
(run-hooks 'pre-command-hook)
|
||||||
|
(run-hooks 'post-command-hook)))
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:AllowEvents
|
(make-instance 'xcb:AllowEvents
|
||||||
:mode mode
|
:mode mode
|
||||||
|
@ -1067,12 +1076,14 @@ One use is to access the keymap bound to KEYS (as prefix keys) in char-mode."
|
||||||
|
|
||||||
(defun exwm-input--on-pre-command ()
|
(defun exwm-input--on-pre-command ()
|
||||||
"Run in `pre-command-hook'."
|
"Run in `pre-command-hook'."
|
||||||
(unless (memq this-command exwm-input-pre-post-command-blacklist)
|
(unless (or (eq this-command #'exwm-input--noop)
|
||||||
|
(memq this-command exwm-input-pre-post-command-blacklist))
|
||||||
(setq exwm-input--during-command t)))
|
(setq exwm-input--during-command t)))
|
||||||
|
|
||||||
(defun exwm-input--on-post-command ()
|
(defun exwm-input--on-post-command ()
|
||||||
"Run in `post-command-hook'."
|
"Run in `post-command-hook'."
|
||||||
(setq exwm-input--during-command nil))
|
(unless (eq this-command #'exwm-input--noop)
|
||||||
|
(setq exwm-input--during-command nil)))
|
||||||
|
|
||||||
(defun exwm-input--on-minibuffer-setup ()
|
(defun exwm-input--on-minibuffer-setup ()
|
||||||
"Run in `minibuffer-setup-hook' to grab keyboard if necessary."
|
"Run in `minibuffer-setup-hook' to grab keyboard if necessary."
|
||||||
|
|
Loading…
Reference in a new issue