Using `message' to log debugging information is cumbersome, as the output
appears constantly in the minibuffer, obscuring prompts and other information.
In the case of long messages, it might resize the minibuffer, which causes EXWM
to perform additional actions due to the log output.
This change reimplements EXWM debug logging using a separate
buffer (*EXWM-DEBUG*). Basic functionality, like scrolling when point is at the
end of the buffer is maintained.
* exwm-core.el (exwm--log): Use `exwm-debug--message' instead of
`message'. Prefix all messages with the name of the function.
Make FORMAT-STRING argument optional.
* exwm-debug.el: New file.
(exwm-debug-buffer): New variable holding the buffer where debug
messages are output to.
(exwm-debug--message): New function printing a message to
`exwm-debug-buffer'.
(exwm-debug--backtrace): New function printing a backtrace.
* exwm-manage.el (exwm-manage--unmanage-window): Set the Emacs window
of an full screen X window as non-dedicated before killing its buffer
so as not to cause other side effects.
* exwm-manage.el (exwm-manage--on-ConfigureRequest): There's a problem
in shrinking Emacs frames with `set-frame-width' and
`set-frame-height'. Use `exwm--set-geometry' instead.
; A change has been made in Xorg server 1.20 that replaying a key
; event with keyboard grabbed would generate extra focus change and
; enter/leave events. This basically breaks line-mode for apps like
; Firefox. This commit reimplements the grab & replay functionality
; with XI2 and XTEST.
* exwm-input.el (exwm-input--devices): New variable for caching slave
keyboards.
(exwm-input--update-devices): Update it and re-grab keys if necessary.
(exwm-input--on-Hierarchy): Event listener for the Hierarchy event
that would in turn call `exwm-input--update-devices' to update the
cache.
* exwm-input.el (exwm-input--on-KeyPress): Use XI2 KeyPress events.
(exwm-input--on-KeyRelease): Event listener for the KeyRelease events.
(exwm-input--grab-global-prefix-keys): Use XI2 and also select
KeyRelease events.
(exwm-input--on-KeyPress-line-mode): Use XI2 KeyPress events and
replay key events with XTEST.
(exwm-input--on-KeyPress-char-mode, exwm-input--grab-keyboard)
(exwm-input--release-keyboard): Use XI2 KeyPress events.
* exwm-input.el (exwm-input--init): Initialize the XI2 and XTEST
extensions; add listeners for XI2 KeyPress, KeyRelease and Hierarchy
events.
* exwm-systemtray.el (exwm-systemtray--on-workspace-switch)
(exwm-systemtray--on-randr-refresh): Take menu-bar / tool-bar into
account when placing systemtray.
* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen): Set the Emacs window of a full screen
X window dedicated to its buffer such that newly created X windows
won't replace it.
* exwm-input.el (exwm-input--mimic-read-event): New function for
handling `extra-keyboard-modifiers' and `keyboard-translate-table'.
(exwm-input--cache-event): Do not unread events here.
(exwm-input--on-KeyPress-line-mode)
(exwm-input--on-KeyPress-char-mode): Compare with preprocessed events
and unread raw ones.
* exwm-input.el (exwm-input--on-KeyPress-line-mode): Add support for
`overriding-terminal-local-map'.
* exwm-input.el (exwm-input--on-KeyPress-line-mode): Do not test
`exwm-mode-map' to see if a key should be forwarded to Emacs as it's
overridden when local simulation keys are present.
* exwm-input.el (exwm-input--on-pre-command): Keys should be forwarded
to the X window (if its Emacs window is currently selected) after
exiting the minibuffer.
(exwm-init): Do not signal an error on startup.
* exwm-floating.el (exwm-floating-toggle-floating):
* exwm-input (exwm-input-send-next-key)
(exwm-input-send-simulation-key):
* exwm-layout (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen, exwm-layout-toggle-fullscreen): Fix
incorrect use of `cl-return-from'.
* exwm.el (exwm--on-SelectionClear, exwm--init-icccm-ewmh)
(exwm--exit-icccm-ewmh, exwm--wmsn-acquire, exwm--wmsn-release):
Get the window manager selection; die when it is cleared.
* exwm.el (exwm-init, exwm-exit): Clean up when failing to start.
(exwm--exit-icccm-ewmh): Stop deleting root window properties on
exit: delete function.
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace)
(exwm-workspace--init):
* exwm-input.el (exwm-input--init):
* exwm-floating.el (exwm-floating--set-floating): Name created
helper windows with prefix "EXWM".
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): Move
deinitialization to `exwm-workspace--exit'.
(exwm-workspace--exit): Reparent minibuffer frame to the root
window, turn workspace frames into regular frames, restore frame
parameters.
(exwm-workspace--init): Reset the fullscreen counter.
(exwm-workspace--remove-frame-as-workspace): Reset fullscreen
state.
(exwm-workspace--init-minibuffer-frame)
(exwm-workspace--exit-minibuffer-frame): New functions configuring
the minibuffer frame.
(exwm-workspace--init, exwm-workspace--exit): Use the above
functions to configure the minibuffer frame.
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Limit functionality
to the configuration of frames as workspaces.
(exwm-workspace--on-after-make-frame)
(exwm-workspace--on-delete-frame): Callbacks run on frame creation
and deletion that may use or stop them from being used as
workspaces.
* exwm-manage.el (exwm-manage--unmanage-window): Map windows when
quitting.
(exwm-manage--exit): Remap all windows.
* exwm.el (exwm--exit): Reorder deinitialization sequence so that
windows are reparented before the workspaces are removed.
* exwm-layout.el (exwm-layout--show): Always set an X window in
fullscreen mode the size in fullscreen.
(exwm-layout-unset-fullscreen): Leave the fullscreen mode first.
* exwm-layout.el (exwm-layout--fullscreen-p): New function telling
whether the current buffer is in fullscreen mode.
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen)
(exwm-layout-toggle-fullscreen):
* exwm-manage.el (exwm-manage--manage-window)
(exwm-manage--on-ConfigureRequest):
* exwm-workspace.el (exwm-workspace-switch, exwm-workspace-swap)
(exwm-workspace-move):
* exwm.el (exwm-reset, exwm--on-ClientMessage): Use it.
* exwm-manage.el (exwm-manage-configurations):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating): Allow customizing header-line format
for floating/tiling X windows.
* exwm-manage.el (exwm-manage-configurations): Add options for
fullscreen mode and floating & tiling mode-line formats.
(exwm-manage--manage-window): Add support for configuring
line-mode/char-mode, prefix keys, simulation keys and fullscreen mode.
* exwm-floating.el (exwm-floating--set-floating): Add support for
configuring the geometry, mode-line format and border width of a
floating X window.
(exwm-floating--unset-floating): Add support for configuring the
mode-line format of a tiling X window.
* exwm-core.el (exwm--configurations): New buffer-local variable
recording the configurations of an X window.
* exwm-manage.el (exwm-manage-configurations): New user option as the
per-application configurations.
(exwm-manage--get-configurations): New function for fetching the
configurations of this X window.
(exwm-manage--manage-window): Fetch the configurations and check if
the X window should be floating/tiling.