Commit graph

96 commits

Author SHA1 Message Date
Chris Feng
993ca8a13a Update copyright year to 2019 2019-02-01 00:00:00 +00:00
Chris Feng
404c94568d Automatically iconify floating X windows
* exwm-layout.el (exwm-layout-auto-iconify): New user option to
specify whether to automatically iconify X windows.
(exwm-layout--auto-iconify): Automatically iconify floating X windows
when its main X window (if any) is iconified.
(exwm-layout--show, exwm-layout--hide): Use it.
2018-12-30 00:00:00 +00:00
Chris Feng
58f7916619 ; Improve debug logs. 2018-12-02 00:00:00 +00:00
Chris Feng
fec85bb72a Select more sensible buffers after creating new windows
* exwm-layout.el (exwm-layout--refresh-other)
(exwm-layout--refresh-workspace): When filling vacated windows
select more sensible buffer by calling `switch-to-next-buffer' for
newly created windows.
2018-11-04 00:00:00 +00:00
Adrián Medraño Calvo
eb91ee2c77 Restore keyboard grabbing after exiting fullscreen
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.
2018-10-21 12:00:00 +00:00
Adrián Medraño Calvo
dba1ed94c2 Do away with `exwm-input--input-mode'
* exwm-input.el (exwm-input--update-mode-line): Remove.
(exwm-input--on-ButtonPress, exwm-input--on-KeyPress)
(exwm-input--update-mode-line, exwm-input-toggle-keyboard): Use
`exwm--input-mode' variable directly.
2018-10-21 12:00:00 +00:00
Adrián Medraño Calvo
dff1ef6a3c Simplify input handling
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.
2018-10-08 12:00:00 +00:00
Adrián Medraño Calvo
5f6b866cfe Refresh layout after activating/deactivating workspaces
* exwm-workspace.el (exwm-workspace--set-active): Refresh layout
after activating or deactivating workspaces.

* exwm-layout.el (exwm-layout--refresh-workspace): Hide X windows on
inactive workspaces.
2018-08-30 12:00:00 +00:00
Chris Feng
2b1ed2ce70 Merge branch 'medranocalvo/fix-x-window-vanish' into externals/exwm 2018-08-19 00:00:00 +00:00
Adrián Medraño Calvo
d4a772f536 ; Comment layout algorithm. 2018-08-19 00:00:00 +00:00
Adrián Medraño Calvo
f820217d00 Split exwm-layout--refresh into three functions
* exwm-layout.el (exwm-layout--refresh): Split in three functions
for clarity.
(exwm-layout--refresh-workspace, exwm-layout--refresh-other)
(exwm-layout--refresh-floating):  New functions.
2018-08-16 12:00:00 +00:00
Adrián Medraño Calvo
633065ad55 Don't assume order of `get-buffer-window-list' results
It only guarantees that the first result *if* the buffer appears on the
selected window.
2018-08-16 12:00:00 +00:00
Adrián Medraño Calvo
11fecb5186 Use more explicit argument for excluding minibuffers
* exwm-layout.el (exwm-layout--refresh): Use a more intuitive
value for specifying exclusion of minibuffers.
2018-08-16 12:00:00 +00:00
Adrián Medraño Calvo
5c1aa4dc31 Consider windows of the frame being refreshed, not the selected one at the time exwm-layout--refresh runs
* exwm-layout.el (exwm-layout--refresh): Consider windows of the
frame being refreshed instead of the selected frame.
2018-08-16 12:00:00 +00:00
Adrián Medraño Calvo
33dec8d1a3 Trace more functions 2018-08-13 12:00:00 +00:00
Chris Feng
e6527227b3 Exclude irrelevant X windows when refreshing
* exwm-layout.el (exwm-layout--refresh): Only check X windows on the
workspace being examined.
2018-08-12 00:00:00 +00:00
Chris Feng
aebcb0344f When mapping an X window check if it's on an active workspace
* exwm-layout.el (exwm-layout--refresh): Avoid mapping X windows on
inactive workspaces.
2018-08-05 00:00:00 +00:00
Chris Feng
bc5f0b3ffa ; Use `derived-mode-p'. 2018-07-15 00:00:00 +08:00
Chris Feng
df8de92113 Provide a fallback value for X window geometry
* exwm-manage.el (exwm-manage--update-geometry): Ditto.
2018-05-20 16:14:01 +08:00
Chris Feng
0037cba87b Avoid hiding full screen X windows unexpectedly
* 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.
2018-05-13 23:57:36 +08:00
Paul Eggert
ff4ae82fd7 Port to 32-bit Emacs on master branch 2018-04-15 14:53:01 -07:00
Chris Feng
87db8b42a3 Preserve keyboard grab state after quitting fullscreen mode
* exwm-layout.el (exwm-layout-set-fullscreen)
(exwm-layout-unset-fullscreen, exwm-layout-toggle-fullscreen): Ditto.
2018-04-01 23:38:48 +08:00
Chris Feng
3f6c609a2b Fix regressions
(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'.
2018-03-10 17:28:43 +08:00
Chris Feng
2f430db735 Minor fixes 2018-03-09 01:06:39 +08:00
Adrián Medraño Calvo
c00331a7e6 Cleanup exwm-layout on exit
* exwm-layout.el (exwm-layout--exit): Remove
`window-pixel-width-before-size-change' hook.
2018-03-06 00:00:00 +00:00
Chris Feng
46fe764634 Fix fullscreen mode after switching workspace and back
* 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.
2018-03-04 12:29:24 +08:00
Chris Feng
5c5729c0d4 Fix various issues with multi-monitor support
* exwm-workspace.el (exwm-workspace-switch): Do not hide X windows
when switching to a workspace on another output; update the
timestamp (last switched to) of a workspace frame.
(exwm-workspace-move-window): Do not hide an X window when moving it
to an active workspace on another output.

* exwm-floating.el (exwm-floating--set-floating):
* exwm-layout.el (exwm-layout-set-fullscreen):
* exwm-manage.el (exwm-manage--manage-window)
(exwm-manage--on-ConfigureRequest):
* exwm-systemtray.el (exwm-systemtray--refresh)
(exwm-systemtray--init):
Correct coordinate calculations.

* exwm-workspace.el (exwm-workspace--current-width): Removed since no
longer used.
2018-02-19 22:40:27 +08:00
Chris Feng
b8ce20b4f3 Support displaying floating X windows on all workspaces
; Setting _NET_WM_DESKTOP to 0xffffffff makes an X windows appearing
; on all desktops (EWMH).  It's tricky to do it for tiling X windows
; so it's not implemented.

* exwm-core.el (exwm--desktop): New buffer-local variable recording
the value of _NET_WM_DESKTOP.
* exwm-layout.el (exwm-layout--hide): Do not hide X windows with this
property set to 0xffffffff.

* exwm.el (exwm--update-desktop): New function for fetching the value
of _NET_WM_DESKTOP and setting `exwm--desktop'.
* exwm-manage.el (exwm-manage--manage-window): Use it.

* exwm-workspace.el (exwm-workspace--set-desktop): Also update
`exwm--desktop'.
2018-02-19 22:34:03 +08:00
Chris Feng
d22e6740d7 Add customization settings
; Also fix documentations.
2018-02-19 00:04:27 +08:00
Chris Feng
7823eb988c Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window.  This is mainly to make EXWM compatible with third-party compositors.  Other issues like wrong absolute position should also get resolved by the way.  The workspace containers ("virtual roots") are also removed.  However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.

* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.

* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.

* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.

* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes.  As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded.  It remains to be seen if this change will raise input focus issues.

* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.

* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.

* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.

* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-18 01:04:04 +08:00
Chris Feng
83c0a2db34 Avoid crashing Emacs by resizing its frame into 0x0
* exwm-floating.el (exwm-floating--do-moveresize):
* exwm-layout.el (exwm-layout-enlarge-window): Resizing a frame into
0x0 crashes Emacs so additional checks are required.
2018-02-04 22:38:02 +08:00
Chris Feng
895633fe61 Raise docks after quitting full screen mode
* exwm-layout.el (exwm-layout-unset-fullscreen): Raise docks lowered
when entering full screen mode.
2018-01-14 23:46:04 +08:00
Chris Feng
76d6f608bc Update copyright year to 2018 2017-12-31 20:49:37 +08:00
Chris Feng
71a39840b2 Fix various input focus issues
* exwm-input.el (exwm-input--on-buffer-list-update): Cancel the frame
redirection introduced by 421c0512f7.

* exwm-input.el (exwm-input--on-buffer-list-update): Only ignore temp
buffers just switched from.

* exwm-input.el (exwm-input--update-focus-commit): New function for
ensuring the input focus lock can always be released.
(exwm-input--update-focus-defer, exwm-input--update-focus): Use it.

* exwm-input.el (exwm-input--update-focus): No need to select frames;
only transfer X input focus.

* exwm-core.el (exwm--defer): New macro for correcting the use of
`run-with-idle-timer' by taking `current-idle-time' into account.
* exwm-input.el (exwm-input--update-focus-defer)
(exwm-input--update-focus):
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change):
* exwm-manage.el (exwm-manage--unmanage-window)
(exwm-workspace--prompt-delete):
* exwm-workspace.el (exwm-workspace-switch)
(exwm-workspace--add-frame-as-workspace):
Use it.
2017-11-19 14:51:45 +08:00
Chris Feng
f221f837cb Fix checkdoc warnings 2017-02-05 17:50:52 +08:00
Chris Feng
9926d87b65 Update copyright year to 2017 2017-02-05 17:49:42 +08:00
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
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
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
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
dcec998bb4 * exwm-layout.el (exwm-layout--show): Fix the position of floating
X windows.
2016-08-06 21:42: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
76ced38ae4 Fix input focus issues revealed by recent commits
* exwm-input.el (exwm-input--update-focus-window)
(exwm-input--on-buffer-list-update, exwm-input--update-focus-interval)
(exwm-input--update-focus-lock, exwm-input--update-focus-defer-timer)
(exwm-input--update-focus-timer, exwm-input--update-focus-defer)
(defun exwm-input--update-focus): Rework the input focus update
mechanism, mainly to overcome the input focus update contention.

* exwm-input.el (defun exwm-input--update-focus): Use `select-window'
instead of `exwm-workspace-switch'; calling the latter is too expensive.

* exwm-layout.el (exwm-layout--on-minibuffer-setup): Drop a unnecessary
line.

* exwm-workspace.el (exwm-workspace-switch): Set input focus to the new
workspace frame.
2016-07-21 12:51:37 +08:00
Chris Feng
73d890aad4 Fix various minor issues
; Coding style fixes

* exwm-core.el (exwm-mode-menu exwm-mode-map):
Use `exwm-workspace--count'.
* exwm-workspace.el (exwm-workspace--set-fullscreen)
(exwm-workspace--on-focus-in, exwm-workspace--set-desktop):
Use `exwm-workspace--position'.

* exwm-workspace.el (exwm-workspace-swap, exwm-workspace-move):
Renamed from `exwm-workspace-swap-workspace' and
`exwm-workspace-move-workspace'.

* exwm-workspace.el (exwm-workspace--update-ewmh-props):
Update comments.

* exwm-workspace.el (exwm-workspace--switch-map-nth-prefix):
Fix a calculation.

* exwm-workspace.el (exwm-workspace-switch): Fix a potential timer
problem.

* exwm-workspace.el (exwm-workspace-swap, exwm-workspace-move)
(exwm-workspace--remove-frame-as-workspace): Update workspace and
clients involved.

* exwm-workspace.el (exwm-workspace--remove-frame-as-workspace):
Remove workspace first.
2016-07-19 10:24:23 +08:00
Adrián Medraño Calvo
07120a0562 Work with workspace frames instead of indices
* exwm.el (exwm--on-ClientMessage):
	* exwm-workspace.el (exwm-workspace-switch)
	(exwm-workspace-move-window, exwm-workspace-switch-to-buffer):
	* exwm-layout.el (exwm-layout--refresh):
	* exwm-input.el (exwm-input--update-focus)
	(exwm-input--on-ButtonPress): Accept frame as well as workspace
	index as argument.
	* exwm-workspace.el
	(exwm-workspace--workspace-from-frame-or-index): New function.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
9018545726 New function exwm-workspace--workspace-p
* exwm-workspace.el (exwm-workspace--workspace-p): New function.
	* exwm-input.el (exwm-input--on-ButtonPress):
	* exwm-workspace.el (exwm-workspace-switch):
	* exwm-layout.el (exwm-layout--refresh): Use it.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
ed6a18a697 Add `exwm-workspace--position' helper
* exwm-workspace.el (exwm-workspace--position): New function.
	* exwm-layout.el (exwm-layout--refresh):
	* exwm-input.el (exwm-input--on-ButtonPress):
	* exwm-workspace.el (exwm-workspace--update-switch-history):
	* exwm.el (exwm--on-ClientMessage, exwm-workspace--init): Use it.
2016-07-17 12:00:00 +00:00
Adrián Medraño Calvo
983fd468dc Add missing declarations
* exwm-systemtray.el :
	* exwm-manage.el :
	* exwm-layout.el :
	* exwm-input.el :
	* exwm-floating.el :
	* exwm-core.el : Add missing function declarations.
2016-07-17 12:00:00 +00:00
Chris Feng
4ac71a7ddc Add RandR support for docks and reuse workareas
* exwm-workspace (exwm-workspace--update-struts): Add RandR support for
docks.

* exwm-workspace (exwm-workspace--workareas): New variable for storing
workareas.
(exwm-workspace--update-workareas): Update workareas and set
_NET_WORKAREA (replaces `exwm-workspace--set-workareas').
(exwm-workspace--set-fullscreen): Reuse workareas for
resizing and drop optional arguments.
(exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--on-ConfigureNotify): Reuse workareas for
resizing/reposition the (optional) dedicated minibuffer frame.

* exwm-layout.el (exwm-layout-set-fullscreen): Do not use
`exwm-workspace--set-fullscreen' here.

* exwm-manage.el (exwm-manage--unmanage-window):
* exwm-randr.el (exwm-randr--refresh):
* exwm.el (exwm--update-struts-legacy, exwm--update-struts-partial):
Update workareas before resizing workspaces.

* exwm.el (exwm--update-struts-legacy, exwm--update-struts-partial):
Remove the corresponding record on receiving invalid struts.

* exwm-workspace.el (exwm-workspace--get-geometry): New utility
function for retrieving workspace geometry.
2016-07-16 14:34:57 +08:00