This commit add workspace and X window containers support to avoid using
Emacs frames as the parents of X windows. This should make it easier to
set input focus.
* exwm-core.el (exwm--container, exwm--floating-frame-position): New file
local variables.
(exwm--floating-frame-geometry): Removed file local variable.
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating--do-moveresize)
(exwm-floating-move): Use container.
(exwm-floating--fit-frame-to-window): No longer adjust stacking order.
(exwm-floating--fit-frame-to-window): The first member is changed to
buffer.
(exwm-floating--start-moveresize): Use container. Correctly set input
focus.
* exwm-input.el (exwm-input--redirected, exwm-input--on-focus-in): Removed.
(exwm-input--on-buffer-list-update): Remove the restriction on floating
frames which is no longer valid.
(exwm-input--update-focus): Adjust stacking order.
(exwm-input--on-minibuffer-setup): New function for setting focus on the
Emacs frame when entering minibuffer.
(exwm-input--on-KeyPress-line-mode): No longer compensate FocusOut event.
(exwm-input--grab-keyboard, exwm-input--release-keyboard): Local keys are
now grabbed on the X window container.
(exwm-input--init): Add `exwm-input--on-minibuffer-setup' to
`minibuffer-setup-hook'.
* exwm-layout.el (exwm-layout--resize-container): New function to
resize/reposition both the X window and its container.
(exwm-layout--show, exwm-layout--hide): Use container.
(exwm-layout-set-fullscreen): Use container. No longer save width and
height.
(exwm-layout-unset-fullscreen, exwm-layout--set-frame-fullscreen): Use
container.
(exwm-layout--refresh): Update a frame parameter. Remove dead code.
* exwm-manage.el (exwm-manage--manage-window): Reparent unmanaged X windows
to the workspace. Create X window container as the parent of the X window.
(exwm-manage--unmanage-window): Unmap/destroy container when appropriate.
Use the position of container.
(exwm-manage--unmanage-window): Destroy the container.
* exwm-randr.el (exwm-randr--refresh): Resize workspace using container.
* exwm-workspace.el (exwm-workspace-switch): Raise workspace.
Correctly set input focus.
(exwm-workspace--on-focus-in): Removed.
(exwm-workspace-move-window): Reparent to workspace container.
(exwm-workspace--init): Create workspace frames as visible.
Create workspace containers.
Remove exwm-workspace--on-focus-in from focus-in-hook.
Update _NET_VIRTUAL_ROOTS.
* exwm.el (exwm-init): No longer disable hourglass window.
Initialize workspace module before input.
* exwm-core.el (exwm--debug): New macro for setting debug forms.
* exwm-floating.el (exwm-floating--set-floating): No longer do `exwm--lock'
and `exwm--unlock' since `make-frame' is already adviced to take care of
everything. Correctly set input focus to the newly created floating
X window.
* exwm-core.el (exwm--floating-edges): Removed file local variable.
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating):
* exwm-layout.el (exwm-layout--show, exwm-layout-enlarge-window):
* exwm-manage.el (exwm-manage--on-ConfigureRequest):
No longer use floating geometry.
* exwm-input.el (exwm-input--update-global-prefix-keys): Grab global keys
on workspaces containers instead of the root window (or input focus would
transfer to the workspace containing the pointer when the grab is active).
* exwm-workspace.el (exwm-workspace-switch): No longer move mouse.
* exwm-workspace.el (exwm-workspace-switch, exwm-workspace--on-focus-in):
Delay closing minibuffer until Emacs is idle. This prevent nonlocal exits
from interrupting remaining code.
* exwm-workspace.el (exwm-workspace-switch, exwm-workspace--on-focus-in):
Use handle-switch-frame instead of exwm-workspace--switch-count to filter
out events.
* exwm-workspace.el (exwm-workspace--init): Delay making workspaces
fullscreen.
* exwm-workspace.el (exwm-workspace-move-window):
* exwm-floating.el (exwm-floating--set-floating):
* exwm-layout.el (exwm-layout--refresh):
`set-buffer-major-mode` does not accept buffer names.
* exwm-core.el (exwm--make-emacs-idle-for): Removed.
* exwm-workspace.el (exwm-workspace--switch-count): New variable.
(exwm-workspace-switch): Increase exwm-workspace--switch-count when
necessary; Remove the call to exwm--make-emacs-idle-for.
(exwm-workspace--on-focus-in): Consume exwm-workspace--switch-count.
* exwm-workspace.el (exwm-workspace--on-focus-in): Close active minibuffer.
* exwm-workspace.el (exwm-workspace-switch): An active minibuffer on another
workspace might cause problems for input. Closing it should be
sufficient.
* exwm-input.el (exwm-input--on-KeyPress-line-mode, exwm-input-prefix-keys):
Allow users to disable 'C-c' prefixed keys; Add 'C-c' to / remove 'M-!'
from the default prefix keys.
* exwm-workspace.el (exwm-workspace--x-create-frame, exwm-workspace--init):
Advice `x-create-frame' to prevent it from hanging EXWM, making e.g.
speedbar working.
* exwm-floating.el (exwm-floating--set-floating): Remove the now unnecessary
request that sets override-redirect on floating frames.
to its buffer
* exwm-workspace.el (exwm-workspace-show-all-buffers, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace-switch-to-buffer): Show buffers
on other workspaces if `exwm-workspace-show-all-buffers' is non-nil.
* exwm-layout.el (exwm-layout-show-all-buffers, exwm-layout--refresh): Allow
moving an X window by switch to its corresponding buffer from another
workspace when `exwm-layout-show-all-buffers' is non-nil.
* exwm.el (exwm--ido-buffer-window-other-frame): Handle the case when
`exwm-layout-show-all-buffers' is non-nil.
* exwm-floating.el (exwm-floating--set-floating): Handle the case when
*scratch* buffer is killed.
* exwm-workspace.el (exwm-workspace-switch-to-buffer): Renamed from
`exwm-workspace-switch-to-window' to better reflect its role.
* exwm-workspace.el (exwm-workspace-move-window): Hide buffer on the original
Emacs window when moving an X window to the current workspace.
* exwm-workspace.el: New function exwm-workspace-switch-to-window for
interactively moving an X window on another workspace to the current one.
When Emacs is invoked as `emacsclient -a '' -c`, it creates a frame that can
be deleted without any prompt. This commit removes the `client` parameter from
that frame to avoid such inconvenience.
* exwm.el (exwm--on-ClientMessage): Handle fullscreen requests
for frames.
(exwm-init): Initialize workspaces after unlocking events.
* exwm-workspace.el (exwm-workspace--init): Create frames as
invisible, then make them visible only once their OverrideRedirect
property has been set.
* exwm-randr.el (exwm-randr--refresh): New frame parameter
`exwm-geometry'.
* exwm-layout.el (exwm-layout--set-frame-fullscreen): New
function.
The Emacs code is buggy, see https://github.com/ch11ng/exwm/issues/39https://github.com/ch11ng/exwm/pull/42
This commit should fix most input focus bugs (especially those related to
floating windows). The actual settings of input focus are delayed to exclude
redundant event. Dead code since this commit is removed.
This commit also fixes a bug for non-floating windows converted form floating
state. The workaround for `ido-mode` is also improved to properly handle
`exwm-mode` buffers.
* Fix input focus lost after moving window to another workspace
* Enhance `exwm-reset` to provide user a way to reset input focus when it's
lost unexpectedly
* Fix `exwm-reset`
* Make input mode buffer local
* Allow window to stay in `char-mode` while setting input focus to other window
or switching to other workspace
* Correct ConfigureNotify events sent to fullscreen windows.
* Exit fullscreen mode before switching workspace.
* Temporarily treat `xcb:Atom:_NET_WM_STATE_ABOVE` as
`xcb:Atom:_NET_WM_STATE_FULLSCREEN` since
a) "plugin-container" (Flash Player) seems only set this, and
b) it's not normally used by applications.
This makes fullscreen videos working in e.g. iceweasel.
* 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 '? '.