Commit graph

312 commits

Author SHA1 Message Date
Chris Feng
6be75083c2 Use X window borders
; This commit replaces the internal borders of Emacs frames with X
; window borders.  This should make the flickering issue of floating X
; windows less serious.

* exwm-floating.el (exwm-floating--border-pixel)
(exwm-floating--border-colormap): New variables for storing border pixel
and its colormap.
(exwm-floating--set-floating): Do not set the internal border (and
background color) of floating frames; do not take
`exwm-floating-border-width' into account when calculating geometries;
set the border of floating X window containers.
(exwm-floating--unset-floating): No need to restore the position of X
windows any more; hide the border of floating X window containers.
(exwm-floating--init): Initialize the border pixel.
* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen): Show/Hide container border respectively.
* exwm-manage.el (exwm-manage--manage-window): Set the border pixel and
colormap of X window containers.
* exwm-workspace.el (exwm-workspace-move-window): Do not set the
internal border and background color of floating frames.
* exwm.el (exwm--on-ClientMessage): Simplify the code for calculating
_NET_REQUEST_FRAME_EXTENTS.
2016-09-23 18:41:43 +08:00
Chris Feng
2597f74c7f Remember the geometries of floating X windows
* exwm-floating.el (exwm-floating--stop-moveresize):
* exwm-layout.el (exwm-layout-enlarge-window):
Update the geometry after resizing.
2016-09-23 18:36:09 +08:00
Chris Feng
0833e8dc4a Redirect KeyPress events sent to system tray icons
* exwm-systemtray.el (exwm-systemtray--embed): Select KeyPress events on
system tray icons.
(exwm-systemtray--on-KeyPress): New function for redirecting KeyPress
events.
(exwm-systemtray--init): Attach the event listener.

* exwm-systemtray.el (exwm-systemtray--init): Fix a typo.
2016-09-23 18:29:11 +08:00
Chris Feng
84dad20d66 Allow selecting an X window from another workspace
* exwm-input.el (exwm-input--on-buffer-list-update): Filter out
switch-frame events.
(exwm-input--update-focus): Switch workspace to set input focus on an X
window from another workspace.
2016-09-23 18:24:37 +08:00
Chris Feng
f96f565d54 Add support for keyboard macro
* exwm-core.el (exwm--kmacro-map): New keymap used when executing
keyboard macros.
(exwm-mode): Use `exwm--kmacro-map' to override the default keymap.
* exwm-input.el (exwm-input--on-KeyPress-line-mode): Send extra key
events when defining keyboard macros.
2016-09-22 19:10:38 +08:00
Chris Feng
43af6bb6a2 Drop support for _NET_WM_STATE_MODAL
; Modal X windows are not necessarily floating.

* exwm.el (exwm--on-ClientMessage, exwm--init-icccm-ewmh): Drop support
for _NET_WM_STATE_MODAL.
2016-09-22 19:08:13 +08:00
Chris Feng
2497c45a1d ; Remove dead code 2016-09-22 19:02:54 +08:00
Chris Feng
4287d31df1 Merge branch 'vedvyas/workspace-move-window-tweak' into externals/exwm 2016-08-31 19:27:46 +08:00
Chris Feng
b4517fbfa0 Force using visible buffers in `other-buffer'
* exwm-floating.el (exwm-floating--set-floating):
* exwm-workspace.el (exwm-workspace-move-window):
Buffers visible on other frames should be treated as invisible.  One
side effect is visible buffers on the current frame is also taken into
account.
2016-08-31 19:18:42 +08:00
Ved Vyas
9105f23121 Improve exwm-workspace-move-window behavior in specific case
This is a small change that improves the behavior of
`exwm-workspace-move-window` in the following situation:

0. `exwm-workspace-show-all-buffers` and `exwm-layout-show-all-buffers`
are `nil`*.
1. On active workspace `i`, there is X window `a` in the selected Emacs
window.
2. On workspace `j`, there is X window `b` in the selected Emacs window
on that workspace frame.
3. While workspace `i` is active, use `exwm-workspace-move-window` to
move `a` to workspace `j`.
4. Switch to workspace `j` and use `exwm-workspace-move-window` to move
`a` back to workspace `i`.

Expected behavior: X window `a` is once again shown in the selected
Emacs window on workspace `i` and X window `b` is once again shown in
the selected Emacs window on workspace `j`.

What is observed: `a` is OK but the selected Emacs window on workspace
`j` does not show `b`. However, `b` is the first candidate when doing a
`switch-to-buffer` in that Emacs window on workspace `j`.

I'm not sure if this is the correct and complete change required, but it
is working well so far.

*The expected behavior is observed with EXWM 0.10 if
exwm-{workspace,layout}-show-all-buffers are non-nil.
2016-08-30 12:10:45 -04:00
Chris Feng
cfcaed691b Bump version to 0.10 2016-08-28 12:59:22 +08:00
Chris Feng
a913621302 Add toggle commands
* exwm-input.el (exwm-input-toggle-keyboard): New command for toggling
keyboard mode.
* exwm-layout.el (exwm-layout-toggle-fullscreen): New command for
toggling fullscreen mode.
* exwm-core.el (exwm-mode-menu, exwm-mode-map): Use them.
2016-08-24 19:21:17 +08:00
Chris Feng
cb75d4814d ; Fix typos 2016-08-15 22:59:48 +08:00
Chris Feng
9ff99d6328 Do not set _NET_WORKAREA
* exwm-workspace.el (exwm-workspace--update-workareas): Do not set
_NET_WORKAREA.
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): Remove
_NET_WORKAREA from the supported list.
2016-08-15 18:42:35 +08:00
Chris Feng
d8940d1fe6 Merge branch 'feat/compositor' into externals/exwm 2016-08-14 18:21:05 +08:00
Chris Feng
a5ea75e9a2 Document the compositing manager module
* README.md:
* exwm.el:
Mention this new feature.
2016-08-14 18:19:16 +08:00
Chris Feng
c97ceadce5 Implement compositing manager module
* exwm-cm.el: New compositing manager module.
2016-08-14 18:16:55 +08:00
Chris Feng
ea0fbaf8cf Bump version to 0.9 2016-08-14 12:27:14 +08:00
Chris Feng
fe653ba244 Only check input focus for globally active model
* exwm-input.el (exwm-input--set-focus): Partly revert 810b471.
2016-08-14 12:24:40 +08:00
Chris Feng
108b3949c2 Fix _NET_DESKTOP_VIEWPORT
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh):
Set _NET_DESKTOP_VIEWPORT on startup since it's a constant.
2016-08-12 20:30:07 +08:00
Chris Feng
badf1c30a0 Raise all docks/panels when switching workspace
* exwm.el (exwm--update-struts-legacy, exwm--update-struts-partial):
Always set the struts value, even it's nil.
* exwm-workspace.el (exwm-workspace--update-struts): Check for nil
struts values.
2016-08-12 20:28:05 +08:00
Chris Feng
ebcc9591f3 Check for _NET_WM_STATE_FULLSCREEN on managing
* exwm-core.el (exwm--fullscreen): Removed.
(exwm--ewmh-state): New variable for recording the _NET_WM_STATE hint.
* exwm-core.el (exwm-mode-menu, exwm-mode-map):
* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--unmanage-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 the new variable.
* exwm-manage.el (exwm-manage--update-ewmh-state): New function for
updating _NET_WM_STATE.
(exwm-manage--manage-window): Update _NET_WM_STATE and check for
_NET_WM_STATE_FULLSCREEN.
2016-08-12 19:27:26 +08:00
Chris Feng
e4ecd79210 * exwm-manage.el (exwm-manage--unmanage-window): Do not clear struts
when unmapping.
2016-08-12 19:25:14 +08:00
Chris Feng
8a438c2c17 Always put the desktop at bottom
* exwm-manage.el (exwm-manage--desktop): New variable for recording the
desktop X window.
(exwm-manage--manage-window): Check for desktop.
* exwm-workspace.el (exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--hide-minibuffer): Put the minibuffer container above
desktop if any.
2016-08-12 19:22:18 +08:00
Chris Feng
6bd85db300 * exwm-manage.el (exwm-manage--scan): Check for possibly
destroyed child.
2016-08-12 19:19:58 +08:00
Chris Feng
db5128c1b9 Fix CreateWindow attributes
; Also fix various compile warnings.

* exwm-floating.el (exwm-floating--set-floating):
* exwm-manage.el (exwm-manage--manage-window):
* exwm-systemtray.el (exwm-systemtray--init):
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace)
(exwm-workspace--init):
* exwm.el (exwm--init-icccm-ewmh):
Explicitly specify the class (InputOutput or InputOnly) and for an
InputOutput X window the background pixmap when creating an X window.
2016-08-12 19:18:32 +08:00
Chris Feng
8e3fc3602f Adapt for the changes in `window-configuration-change-hook'
* exwm-layout.el (exwm-layout--refresh): Accept frame as an optional
argument.
(exwm-layout--init): Add `exwm-layout--refresh' to
`window-size-change-functions' when appropriate.
2016-08-10 19:45:52 +08:00
Chris Feng
810b4716a1 Update timestamp for WM_TAKE_FOCUS ClientMessage
* exwm-input.el (exwm-input--timestamp-window)
(exwm-input--timestamp-atom, exwm-input--timestamp-callback): New
variables for updating timestamp.
(exwm-input--set-focus): Send WM_TAKE_FOCUS ClientMessage with updated
timestamp.
(exwm-input--update-timestamp): New utility function for fetching
timestamp.
(exwm-input--on-PropertyNotify): New function for handling
PropertyNotify event to extract the timestamp.
(exwm-input--init): Create resources for updating timestamp; attach the
event listener.
(exwm-input--on-ButtonPress, exwm-input--on-KeyPress):
* exwm.el (exwm--on-PropertyNotify): No longer update timestamp.

* exwm-input.el (exwm-input--set-focus): Avoid setting input focus on
already focused X windows, or when the input focus in not on a Emacs
frame if globally active model is in use.

* exwm-floating.el (exwm-floating--set-floating):
* exwm-workspace.el (exwm-workspace-move-window)
(exwm-workspace--add-frame-as-workspace, exwm-workspace--init):
Set 'exwm-id' frame parameter as the numerical (inner) frame X ID.
2016-08-09 13:34:29 +08:00
Chris Feng
767abdf9e6 Fix coordinates calculations concerning workspaces
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--do-moveresize):
* exwm-manage.el (exwm-manage--manage-window):
Use the computed workareas rather than RandR output geometries.
2016-08-09 13:26:15 +08:00
Chris Feng
6e0b944c2d Ensure floating hooks are run in the right context
* exwm-floating.el (exwm-floating-setup-hook, exwm-floating-exit-hook):
Fix doc string.
(exwm-floating--set-floating, exwm-floating--unset-floating): Set the
context.
2016-08-09 13:20:36 +08:00
Chris Feng
06c1b0485a Set background pixmap for system tray embedder
* exwm-systemtray.el (exwm-systemtray--init): Make embedder use the same
depth and pixmap of the parent; the parent is always a Emacs frame.
2016-08-07 13:34:50 +08:00
Chris Feng
dcec998bb4 * exwm-layout.el (exwm-layout--show): Fix the position of floating
X windows.
2016-08-06 21:42:43 +08:00
Chris Feng
0d00a92fad Avoid setting input focus on workspace containers
* exwm-input.el (exwm-input--on-FocusIn): Set input focus to the
workspace frame when input focus is received by a workspace container.
(exwm-input--on-workspace-list-change): Select FocusChange event mask on
workspace containers.
(exwm-input--init): Attach the event listener; adapt function calls.
2016-08-06 21:38:43 +08:00
Chris Feng
f04b041cae Fix emacsclient issues
* exwm-workspace.el (exwm-workspace--client-p): New function for testing
emacsclient frames.
(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-input.el (exwm-input--on-buffer-list-update)
(exwm-input--on-minibuffer-setup):
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change):
Use it.

* exwm-workspace.el (exwm-workspace--add-frame-as-workspace): Always
clear the 'client' frame parameter.
(exwm-workspace--init): Fix a typo.
2016-08-01 19:53:04 +08:00
Chris Feng
e7ff9a9f90 Fix restarting issues
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): Prompt for
unsaved files before restarting; avoid running `server-force-stop'
early; restore the 'client' frame parameter before calling `exwm--exit';
correctly handle emacsclient.

* exwm.el (exwm-restart): Always kill subordinate Emacs instances.
2016-08-01 19:49:43 +08:00
Chris Feng
173bbde885 Bump version to 0.8 2016-07-31 13:17:12 +08:00
Chris Feng
fc542bbcc9 ; Eliminate compile warnings 2016-07-31 13:16:51 +08:00
Chris Feng
a3dba8edd9 Fix restarting issues
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs):
* exwm.el (exwm-restart): Run `kill-emacs-hook' early; do not check for
X windows before restarting.
2016-07-31 13:14:43 +08:00
Chris Feng
1e78045f95 Add restart support
* exwm-input.el (exwm-input--exit): Cancel timers.

* exwm-manage.el (exwm-manage--manage-window): Add reparented X windows
to save-set.
* exwm-systemtray.el (exwm-systemtray--embed): Add embeded icons to
save-set.

* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): No need to
unmanage; also hide Emacs frames; always call `exwm--exit'.

* exwm.el (exwm-restart): New command for restarting EXWM.
(exwm--exit-icccm-ewmh): New function for cleaning up ICCCM/EWMH
properties.
(exwm-exit-hook): Update doc string.
(exwm--exit): Call `exwm--exit-icccm-ewmh' and do not reset variables.
2016-07-30 19:01:33 +08:00
Chris Feng
b87f4fbd71 ; * exwm.el (exwm-enable): Ignore unrecognized command line arguments. 2016-07-30 18:59:19 +08:00
Chris Feng
8061e93878 ; * exwm-workspace.el (exwm-workspace-switch): Input focus should be set
; on the frame where the target window resides.
2016-07-30 18:57:27 +08:00
Chris Feng
a9b775638d Merge branch 'uemurax/reset-fullscreen-frame-count' into externals/exwm 2016-07-30 18:55:43 +08:00
Taichi Uemura
0b0982b5ac set fullscreen-frame-count to 0 on exiting 2016-07-30 18:48:09 +09:00
Chris Feng
d225f191a9 Fit the *Completions* buffer
* exwm-workspace.el (exwm-workspace--on-minibuffer-setup): Work around
the *Completions* buffer not getting fitted problem.

* exwm.el (exwm-enable): Enable `window-resize-pixelwise'.
2016-07-30 10:17:57 +08:00
Chris Feng
aa7de9dc6f Exit the active minibuffer on unmanaging X windows
* exwm-manage.el (exwm-manage--unmanage-window): Exit the minibuffer as
a precaution to prevent the "selecting deleted buffer" error.
2016-07-30 10:12:31 +08:00
Chris Feng
ba0f41db1b ; * exwm-manage.el (exwm-manage--manage-window): Check the value range
; of _NET_WM_DESKTOP.
2016-07-30 10:09:43 +08:00
Chris Feng
9f68fbd906 Grab global keys on newly created workspaces
* exwm-input.el (exwm-input--update-global-prefix-keys): Label grabbed
workspaces and re-grab keys only when keys change or there are newly
created workspaces.
(exwm-input--init, exwm-input--exit): Use the function in
`exwm-workspace-list-change-hook'.
2016-07-30 10:06:00 +08:00
Chris Feng
6bfedf8bf7 Fix input focus transfer between workspaces
* exwm-input.el (exwm-input--set-focus): Make input focus revert to
parent by default (to prevent input focus from following pointer).

* exwm-input.el (exwm-input--update-focus): Switch to another workspace
if input focus is transfered to it.
* exwm-workspace.el (exwm-workspace--on-focus-in, exwm-workspace--init)
(exwm-workspace--exit): Remove `exwm-workspace--on-focus-in' and related
uses.
2016-07-30 10:00:11 +08:00
Chris Feng
f52848595d ; * exwm-floating.el (exwm-floating--unset-floating): Reposition an X
; window when it changes from floating to tiling layout.
2016-07-29 17:11:28 +08:00
Chris Feng
719b825bc4 Sync with XELB
* exwm-input.el (exwm-input--update-global-prefix-keys)
(exwm-input--on-KeyPress-line-mode, exwm-input--on-KeyPress-char-mode)
(exwm-input--fake-key, exwm-input--init): Sync with XELB.

* exwm-input.el (exwm-input--on-KeyPress)
(exwm-input--on-KeyPress-line-mode): Resend XKB events with SendEvent
since AllowEvents in ReplayKeyboard mode doesn't seem to work.
2016-07-29 17:05:09 +08:00