Commit graph

110 commits

Author SHA1 Message Date
Adrián Medraño Calvo
612e64bf9b Update copyright year to 2023 2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
b62d5e79b0 Use active-minibuffer-window' rather than minibuffer-window'
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change): Use
`active-minibuffer-window`, instead of the minibuffer window of
selected frame, as there's no guarantee that the selected frame is
the frame containing the minibuffer.  Also make sure the frame is
an EXWM workspace.
2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
d6f62ff55a Check EXWM terminal instead of client or graphical frames
* exwm-core.el (exwm--terminal-p): Add function.
* exwm.el (exwm--confirm-kill-terminal): Use it.
* exwm-input.el (exwm-input--on-buffer-list-update): Use it.
(exwm-input--on-minibuffer-setup)
(exwm-input--on-minibuffer-exit): Use it.
(exwm-input--on-minibuffer-exit): Use the minibuffer's selected
window's frame or selected frame instead of current workspace.
(exwm-input--on-echo-area-dirty): Removed test, as it's checked in
`exwm-input--on-minibuffer-setup'.
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change): Use it.
(exwm-layout--on-echo-area-change): Refresh layout the
frame of selected window's minibuffer if it's an EXWM frame.
* exwm-workspace.el (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-workspace--on-delete-frame): Use it.
* exwm-workspace.el (exwm-workspace--client-p-hash-table): Remove
variable.
(exwm-workspace--client-p): Remove function.
2022-02-01 00:00:00 +00:00
Adrián Medraño Calvo
08f20ea0b9 Fix previous commit "Remove duplicate code"
* exwm-layout.el (exwm-layout-unset-fullscreen):
`xcb:Atom:_NET_WM_STATE_FULLSCREEN' must be excised before
invoking `exwm-layout--show'.
2021-11-10 00:00:00 +00:00
Adrián Medraño Calvo
571ca227e7 Remove duplicate code
* exwm-layout.el (exwm-layout-unset-fullscreen): Remove double
removal of `xcb:Atom:_NET_WM_STATE_FULLSCREEN' from
`exwm--ewmh-state'.
2021-10-30 00:00:00 +00:00
Adrián Medraño Calvo
c1206ac665 Update copyright year to 2021 2021-10-29 00:00:00 +00:00
Chris Feng
edb930005b Fix fullscreen states
* exwm-layout.el (exwm-layout-set-fullscreen,
exwm-layout-unset-fullscreen): Use `exwm--id' for interactive use.
(exwm-layout-unset-fullscreen): Mandatorily clear fullscreen states.
2020-06-14 00:00:00 +00:00
Chris Feng
3dbf1b1bed Add support for _NET_WM_STATE_HIDDEN
* exwm-layout.el (exwm-layout--set-ewmh-state): New function for
setting _NET_WM_STATE (according to local state).
* exwm.el (exwm--init-icccm-ewmh): Declare the support for this atom.
2020-03-29 00:00:00 +00:00
Chris Feng
27a884e947 Update copyright year to 2020 2020-02-02 00:00:00 +00:00
Chris Feng
988f983233 Fix `exwm-layout-enlarge-window' for floating X windows
* exwm-layout.el (exwm-layout-enlarge-window): Correct the height of
outer frame.
2019-09-15 00:00:00 +00:00
Chris Feng
f167bc979c Replace `frame-geometry'
* exwm-workspace.el (exwm-workspace--frame-y-offset)
exwm-workspace--window-y-offset, exwm-workspace--update-offsets): New
variables & function for the calculation of Emacs frame offsets, as
`frame-geometry' is not available in Emacs 24.
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--do-moveresize):
* exwm-layout.el (exwm-layout--show):
* exwm-systemtray.el (exwm-systemtray--on-workspace-switch)
(exwm-systemtray--on-randr-refresh, exwm-systemtray--init): Use them.

* exwm-systemtray.el (exwm-systemtray--refresh-all): Renamed from
`exwm-systemtray--on-randr-refresh'.
(exwm-systemtray--init, exwm-systemtray--exit): Use it.

* exwm-floating.el (exwm-floating--stop-moveresize): Send a
ConfigureNotify event to floating frame to update its position (seems
required by Emacs 24).
2019-09-14 00:00:00 +00:00
Chris Feng
eb49e57f76 Fix hiding floating X windows
* exwm-layout.el (exwm-layout--floating-hidden-position): A place far
enough from the origin to actually hide floating X window containers.
(exwm-layout--show, exwm-layout--hide): Use it.
2019-09-13 00:00:00 +00:00
Chris Feng
ccc4cce0e0 Fix floating X window size with menu-bar/tool-bar enabled
* exwm-floating.el (exwm-floating--set-floating)
exwm-floating--do-moveresize)
exwm-layout.el (exwm-layout--show): Take menu-bar/tool-bar into
consideration.
2019-09-08 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
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