Commit graph

110 commits

Author SHA1 Message Date
Chris Feng
6593236366 Handle and skip problematic per-application configurations
* exwm-manage.el (exwm-manage--get-configurations): Select the first
usable configuration.
2019-09-08 00:00:00 +00:00
Chris Feng
5505cff826 Fix a lock issue with _NET_CLOSE_WINDOW and WM_DELETE_WINDOW
* exwm.el (exwm--on-ClientMessage): Calling `kill-buffer' directly
from an event context won't work since the DestroyNotify event for a
WM_DELETE_WINDOW request won't be handled until the current event
context terminates.

* exwm-manage.el (exwm-manage--kill-buffer-query-function): Avoid
potential side effects with MapWindow.
2019-08-25 00:00:00 +00:00
Chris Feng
d78c562f9a Make `exwm-manage-configurations' more user friendly
* exwm-manage.el (exwm-manage-configurations): Specify type for each
configuration option.
2019-08-11 00:00:00 +00:00
Chris Feng
4ac0d6c1fd Clarify the usage of `exwm-manage-configurations' 2019-04-14 00:00:00 +00:00
Chris Feng
73b4d6f966 ; Follows up 2019-03-24 00:00:00 +00:00
Chris Feng
397ca5497e Remove loading order dependency on `mouse-autoselect-window'
* exwm-core.el (exwm--get-client-event-mask): Renamed from
`exwm--client-event-mask' and used as a function.
* exwm-floating.el (exwm-floating--unset-floating):
* exwm-layout.el (exwm-layout--hide):
* exwm-manage.el (exwm-manage--manage-window): Use it.
2019-03-17 00:00:00 +00:00
Chris Feng
0f7269c4ec Add input method support
; 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.
2019-02-06 00:00:00 +00:00
Chris Feng
65d371d55f Fetch necessary properties before checking per-app configurations
* exwm-manage.el (exwm-manage--manage-window): Fetch X window title &
protocols so they can be available when checking per-application
configurations.
2019-02-01 00:00:00 +00:00
Chris Feng
993ca8a13a Update copyright year to 2019 2019-02-01 00:00:00 +00:00
Chris Feng
2efd7495d9 Avoid unnecessary focus changes when creating/killing buffers
* 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.
2018-12-16 00:00:00 +00:00
Chris Feng
58f7916619 ; Improve debug logs. 2018-12-02 00:00:00 +00:00
Chris Feng
dc3b86d1b8 Add support for 'managed' per-application configuration
* exwm-manage.el (exwm-manage-configurations): Add a new value type
'managed' to allow users to specify whether a certain X window should
be managed or not.
(exwm-manage--manage-window): Use it.
2018-11-18 00:00:00 +00:00
Chris Feng
d650159648 Fix wrong stacking order of tiling X windows
* exwm-manage.el (exwm-manage--on-MapNotify): Avoid restacking tiling
X windows on the top when force triggering hierarchy change events.
2018-11-11 00:00:00 +00:00
Chris Feng
472f7cb82b Simplify debugging and fix dynamic-scoping `eval'
* exwm-core.el (exwm-debug): New global minor mode to replace
`exwm-debug-on' and `exwm-debug-toggle'.

* exwm-manage.el (exwm-manage--get-configurations): Use
lexical-scoping `eval'.
2018-09-16 00:00:00 +00:00
Adrián Medraño Calvo
6978c1f45c Restack X-Windows after being mapped to ensure EnterNotify events fire
* exwm-manage.el (exwm-manage--on-MapNotify, exwm-manage--init):
Restack X windows after being mapped in order to ensure they receive
an EnterNotify event (does not happen under XQuartz).
2018-09-04 12:00:00 +00:00
Adrián Medraño Calvo
33dec8d1a3 Trace more functions 2018-08-13 12:00:00 +00:00
Chris Feng
13a14579cc Fix issues with destroying full screen X windows
* 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.
2018-07-29 00:00:00 +00:00
Chris Feng
c1b6a296a8 Shrink Emacs frames with X request
* 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.
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
b6d660042e Add workspace support in per-application configurations
* exwm-manage.el (exwm-manage-configurations)
(exwm-manage--manage-window): Allow to specify which workspace an
applications should be created on.
2018-03-23 23:51:32 +08:00
Chris Feng
2f430db735 Minor fixes 2018-03-09 01:06:39 +08:00
Adrián Medraño Calvo
4f7abf4bfd Cleanup exwm-manage on exit
* 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.
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
7013b0122a Add header-line format support in per-application configurations
* 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.
2018-03-04 01:39:12 +08:00
Chris Feng
e141ee6847 Add various per-application configurations
* 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.
2018-03-03 01:00:28 +08:00
Chris Feng
dbc06b50ff Add initial support for per-application configurations
* 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.
2018-03-02 00:52:03 +08:00
Chris Feng
ad90af19a6 Make `exwm-manage-ping-timeout' a user option
* exwm-manage.el (exwm-manage-ping-timeout): Now a user option.
2018-02-26 00:25:11 +08:00
Chris Feng
bfa35c0e38 Remove redundant code for fullscreen mode
* exwm-manage.el (exwm-manage--unmanage-window)
(exwm--on-ClientMessage): No need to modify workspace when an X window
enters/leaves fullscreen mode.
2018-02-20 22:09:27 +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
76d6f608bc Update copyright year to 2018 2017-12-31 20:49:37 +08:00
Chris Feng
589b840409 Fix possible wrong context when killing buffers
* exwm-manage.el (exwm-manage--unmanage-window): Make sure to use the
correct context to read/set buffer-local variables when killing
buffers.
2017-11-24 22:43:16 +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
Ram Krishnan
93d96757b6 Fix for "Selecting deleted buffer" exception 2017-11-05 08:13:09 -08:00
Chris Feng
46dfaeb031 Avoid reusing dedicated window
* exwm-floating.el (exwm-floating--unset-floating):
* exwm-manage.el (exwm-manage--on-MapRequest):
Do not select a dedicated window for displaying a buffer.
2017-08-31 00:58:39 +08:00
Chris Feng
7a5bb1156d Only add graphic frames to `exwm-manage--frame-outer-id-list'
* exwm-manage.el (exwm-manage--add-frame, exwm-manage--remove-frame):
Add checks for graphic frames.
2017-04-10 00:30:43 +08:00
Chris Feng
9926d87b65 Update copyright year to 2017 2017-02-05 17:49:42 +08:00
Chris Feng
b11ac2e6dc Fix a bug with zero floating border width
* exwm-manage.el (exwm-manage--manage-window): Avoid setting ColorMap
mask when creating an X window if floating border is zero.
2016-12-26 22:22:46 +08:00
Chris Feng
1c8101afbf Fix a frame resizing problem for Lucid build
* exwm-manage.el (exwm-manage--frame-outer-id-list): New variable for
storing frame window-outer-id's.
(exwm-manage--add-frame, exwm-manage--remove-frame): New functions for
adding/removing ids to/from the variable.
(exwm-manage--init): Add the functions to the corresponding hooks.
(exwm-manage--on-ConfigureRequest): Check for frames and avoid handling
them.
2016-09-25 19:58:16 +08:00
Chris Feng
7fbd5220f2 Fix `exwm-manage--kill-buffer-query-function'
* exwm-manage.el (exwm-manage--kill-buffer-query-function): Check
buffer-local variables for destroyed X windows; Avoid force killing
clients that support WM_DELETE_WINDOW but not _NET_WM_PING; Use
`y-or-n-p' instead for querying.
2016-09-25 19:54:13 +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
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
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
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