* exwm-workspace.el (exwm-workspace--remove-frame-as-workspace):
Add optional argument quit.
* exwm-background.el (exwm-background--exit):
* exwm-input.el (exwm-input--exit):
* exwm-manage.el (exwm-manage--unmanage-window):
* exwm-systemtray.el (exwm-systemtray--exit):
* exwm-workspace.el (exwm-workspace--exit-minibuffer-frame)
(exwm-workspace--exit):
* exwm-xim.el (exwm-xim--exit): Observe connection status when
deinitializing in order to support deinitializing when the
connection breaks.
`exwm-input--exit` could be called (via `exwm-exit`) from `exwm-init`
in case of error when initialising EXWM. It could happen that the bit
that failed when exwm-init is executed was the call to `xcb:connect`,
hence `exwm--connection` would be nil when errors are handled (and
`exwm-exit` is called).
Without this patch, in the case above, the user will see a crash as
there's no method allowing a nil XCB connection object:
Debugger entered--Lisp error:
(cl-no-applicable-method xcb:-+request nil #<xcb:SetInputFocus ...
even worse, not even giving the chance to the `warn` call in
`exwm-init`'s error handler to actually inform the user about the
actual problem ("[XELB] Connection timeout", for instance).
* exwm-input.el (exwm-input--exit): Check `exwm--connection' is
set before trying to send requests.
* exwm-core.el (exwm--terminal-p): Add function.
* exwm.el (exwm--confirm-kill-terminal): Use it.
* exwm-input.el (exwm-input--on-buffer-list-update): Use it.
(exwm-input--on-minibuffer-setup)
(exwm-input--on-minibuffer-exit): Use it.
(exwm-input--on-minibuffer-exit): Use the minibuffer's selected
window's frame or selected frame instead of current workspace.
(exwm-input--on-echo-area-dirty): Removed test, as it's checked in
`exwm-input--on-minibuffer-setup'.
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change): Use it.
(exwm-layout--on-echo-area-change): Refresh layout the
frame of selected window's minibuffer if it's an EXWM frame.
* exwm-workspace.el (exwm-workspace--update-minibuffer-height)
(exwm-workspace--on-minibuffer-setup)
(exwm-workspace--on-minibuffer-exit)
(exwm-workspace--on-echo-area-dirty)
(exwm-workspace--on-echo-area-clear)
(exwm-workspace--on-delete-frame): Use it.
* exwm-workspace.el (exwm-workspace--client-p-hash-table): Remove
variable.
(exwm-workspace--client-p): Remove function.
* exwm-input.el (exwm-input-input-mode-change-hook): Add new hook
for code to run upon input mode change.
(exwm-input--grab-keyboard, exwm-input--release-keyboard): Run it.
Local variable `exwm--input-mode' from different buffer when current buffer don't contains #id window.
`with-current-buffer' changes buffer after `cl-case' with local `exwm--input-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.
* exwm-input.el (exwm-input--set-focus): Check for current focused
X window before making an input focus transfer.
(exwm-input--on-buffer-list-update): Remove the `this-command' check.
* exwm-input.el (exwm-input--read-keys): Return nil on empty input so
that `exwm-input-set-simulation-key' can ignore it.
(exwm-input-set-simulation-key): Improve prompt.
* exwm-input.el (exwm-input-pre-post-command-blacklist): Add
`minibuffer-keyboard-quit' to the blacklist. This is invoked when the user
aborts a the minibuffer with C-g.
There's no guarantee that the global current buffer matches the selected
window's buffer. For example, the following will output "*Messages*" regardless
of the actual current buffer:
(progn
(run-at "1 sec" nil (lambda ()
(with-current-buffer (get-buffer "*Messages*")
(sit-for 5))))
(run-at "2 sec" nil (lambda () (message (buffer-name)))))
* exwm-input.el (exwm-input--on-KeyPress): Set the current buffer to selected
window's current buffer.
* exwm-input.el (exwm-input--exit): Set input focus 'revert-to' to
'PointerRoot' so that user can set input focus to X windows with
pointer after EXWM exits (and there's no other WM).
* exwm-input.el (exwm-input--echo-area-timer): New variable storing
the timer used for detecting echo area messages.
(exwm-input--on-minibuffer-setup, exwm-input--on-minibuffer-exit)
(exwm-input--on-echo-area-dirty, exwm-input--on-echo-area-clear): New
functions for grabbing/releasing keyboard when minibuffer/echo becomes
active/inactive.
(exwm-input--init, exwm-input--exit): Register/Unregister them.
(exwm-input--grab-keyboard, exwm-input--release-keyboard): Validate
buffers.
* exwm-input.el (exwm-input--on-buffer-list-update): The way of
detecting a switch from a `*temp*' buffer does not always work.
Disable it until we find a better way.
* exwm-input.el (exwm-input--grab-global-prefix-keys)
(exwm-input--fake-key):
* exwm-xim.el (exwm-xim--handle-forward-event-request): X11 allows
multiple combinations of KEYSYM-MODIFIERS to generate a same
KEYSYM, thus the result of an Emacs event to KEYSYM-MODIFIERS
conversion is not necessarily unique. Previously the result of
`xcb:keysyms:event->keysym' is misused as the modifiers returned is
actually the ones should be consumed.
* exwm-input.el (exwm-input--last-enter-notify-position): New variable
storing last mouse position.
(exwm-input--on-EnterNotify): Avoid switching workspace when mouse
position is not changed (the event is a result of a workspace switch).
* exwm-input.el (exwm-input-simulation-keys): Original key only has
one option, so probably shouldn’t be a `choice` type; Move the
"User-defined" key value to the top, since that’s the one someone is
most likely to want).
* exwm-config.el (exwm-config-default): Only set custom vars if there
isn’t a saved value for them.
; The code is basically refactored from
; https://github.com/ch11ng/exim to get better maintenance.
* exwm-xim.el: New module making Emacs's builtin input methods usable
for interacting with X windows.
* exwm-core.el (exwm--intern-atom): New function for intern X11 atoms.
* exwm-input.el (exwm-input--init):
* exwm-manage.el (exwm-manage--init): Use it.
* exwm-input.el (exwm-input--skip-buffer-list-update): New internal
variable for skipping the next 'buffer-list-update'.
(exwm-input--on-buffer-list-update): Skip when
`exwm-input--skip-buffer-list-update` is set.
* exwm-manage.el (exwm-manage--manage-window): Set
`exwm-input--skip-buffer-list-update` when creating/killing buffers.
* exwm-input.el (exwm-input--event-hook): New variable.
(exwm-input--on-ButtonPress, exwm-input--on-KeyPress): Run
`exwm-input--event-hook'.
* exwm-workspace.el (exwm-workspace--init, exwm-workspace--exit):
Hide minibuffer upon noticing an event.
Recover the difference between the input mode selected by the user and
actual one, which might be transient. This was inadvertently removed in
recent changes.
* exwm-core.el (exwm--selected-input-mode): New variable.
* exwm-input.el (exwm-input-grab-keyboard)
(exwm-input-release-keyboard): Use it.
* exwm-layout.el (exwm-layout-unset-fullscreen): Return to the
selected input mode.
* exwm-input.el (exwm-input--event-passthrough-p): Predicate
checking whether an event should be forwarded to Emacs.
(exwm-input--on-KeyPress-line-mode): Use it.
* exwm-input.el (exwm-input--cache-event): Protect against
translations swallow the event.
* exwm-input.el (exwm-input--on-ButtonPress-line-mode)
(exwm-input--on-ButtonPress-char-mode): New functions.
(exwm-input--on-ButtonPress): Forward bound mouse events to Emacs
when in line-mode.
* exwm-input.el (exwm-input--update-focus): Focus the minibuffer's
frame, which is different than that of the
`minibuffer-selected-window' on minibuffer-only frames.
(exwm-input--on-minibuffer-setup, exwm-input--init)
(exwm-input-exit): Remove unneeded function.
No functional change.
* exwm-input.el (exwm-input--current-input-mode): New function
indicating keyboard input mode.
(exwm-input--on-KeyPress, exwm-input--update-mode-line): Use
`exwm-input--current-input-mode'.
(exwm-input-grab-keyboard, exwm-input-release-keyboard)
(exwm-input--update-mode-line): Simplify.
* exwh-core.el (exwm--on-KeyPress): Remove variable, use
`exwm--keyboard-grabbed' and `exwm-input--current-input-mode'
instead.