Commit graph

48 commits

Author SHA1 Message Date
Adrián Medraño Calvo
8d15a39c4d Print log output to an EXWM-specific messages buffer
Using `message' to log debugging information is cumbersome, as the output
appears constantly in the minibuffer, obscuring prompts and other information.
In the case of long messages, it might resize the minibuffer, which causes EXWM
to perform additional actions due to the log output.

This change reimplements EXWM debug logging using a separate
buffer (*EXWM-DEBUG*).  Basic functionality, like scrolling when point is at the
end of the buffer is maintained.

* exwm-core.el (exwm--log): Use `exwm-debug--message' instead of
`message'.  Prefix all messages with the name of the function.
Make FORMAT-STRING argument optional.

* exwm-debug.el: New file.
(exwm-debug-buffer): New variable holding the buffer where debug
messages are output to.
(exwm-debug--message): New function printing a message to
`exwm-debug-buffer'.
(exwm-debug--backtrace): New function printing a backtrace.
2018-08-13 12:00:00 +00:00
Chris Feng
f4aa8389fc Fix a compatibility issue with Emacs 24
* exwm-core.el (exwm--defer): `time-add' in Emacs 24 only accept lists.
2018-03-23 23:57:18 +08:00
Adrián Medraño Calvo
7aae6efdcd Support replacing and being replaced by other window managers
* exwm.el (exwm--on-SelectionClear, exwm--init-icccm-ewmh)
(exwm--exit-icccm-ewmh, exwm--wmsn-acquire, exwm--wmsn-release):
Get the window manager selection; die when it is cleared.
2018-03-06 00:00:00 +00:00
Adrián Medraño Calvo
dd0f10775a Support disabling default `exwm-mode-map' bindings
* exwm-input.el (exwm-input--on-KeyPress-line-mode): Use
`lookup-key' to check whether a the event is defined in the
`exwm-mode-map' keymap.
2018-03-06 00:04:36 +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
a6cfe3f22d Forward keys defined in `exwm-mode-map' to Emacs by default
* exwm-input.el (exwm-input-prefix-keys): Remove ?\C-c.
(exwm-input--on-KeyPress-line-mode):
* exwm-core.el (): Detect keys in `exwm-mode-map' in line-mode.
2018-02-26 00:23:40 +08:00
Chris Feng
6200417697 Grab global keys on top-level X windows
* exwm-input.el (exwm-input--on-CreateNotify): New function for
grabbing global keys on newly created X windows.
(exwm-input--update-global-prefix-keys): Grab global keys on top-level
X windows instead of the root window.
(exwm-input--grab-global-prefix-keys): New function for grabbing
global keys on X windows.
(exwm-input--release-keyboard): Grab global keys in char-mode.
(exwm-input--init): Select CreateNotify events.

* exwm-core.el (exwm--unlock):
* exwm-input.el (exwm-input--on-FocusIn, exwm-input--init): Do not
handle FocusIn events on the root window.
2018-02-22 00:26:04 +08:00
Chris Feng
86f2215be3 Fix unexpected focus change after a global key binding is activated
* exwm-core.el (exwm--unlock): Select FocusChange events on the root
window.

* exwm-input.el (exwm-input--on-FocusIn): Input focus should stay on
the current workspace when the root window receives a FocusIn event.
2018-02-20 22:24:26 +08:00
Chris Feng
7d4c57a6ab Add Customize interface for simulation keys
* exwm-input.el (exwm-input-simulation-keys): New user option for
setting simulation keys.
(exwm-input--init): Initialize simulation keys from this variable.

* exwm-input.el (exwm-input--simulation-prefix-keys)
(exwm-input--on-KeyPress-line-mode)
(exwm-input--update-simulation-prefix-keys)
(exwm-input-set-simulation-keys, exwm-input-set-local-simulation-keys)
(exwm-input-send-simulation-key): `exwm-input--simulation-keys' is now
a hash table storing both simulation keys and prefix keys.
(exwm-input--unset-simulation-keys): Clear the hash table.
(exwm-input--exit): Use `exwm-input--unset-simulation-keys'.
* exwm-core.el (exwm--kmacro-map, exwm-mode-menu): Adapt to the
change of `exwm-input--simulation-keys'.

* exwm-config.el (exwm-config-default): Update the example.
2018-02-20 21:57:49 +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
dd0a62c405 Add support for `mouse-autoselect-window'
; This feature requires both `mouse-autoselect-window` and
; `focus-follows-mouse' being set.  Delaying autoselection is not
; supported yet.

* exwm-core.el (exwm--client-event-mask): Select the EnterNotify event
on each X window when `mouse-autoselect-window' is set.
* exwm-input.el (exwm-input--on-EnterNotify): New function for making
`mouse-autoselect-window' work on X windows.
(exwm-input--init): Listen to EnterNotify event when
`mouse-autoselect-window' is set.
2017-12-31 20:53:58 +08:00
Chris Feng
76d6f608bc Update copyright year to 2018 2017-12-31 20:49:37 +08:00
Chris Feng
dd6596b1f4 Another fix for input focus issues
* exwm-core.el (exwm--defer):
* exwm-input.el (exwm-input--update-focus-defer): Avoid unnecessarily
long delay.

* exwm-input.el (exwm-input--on-FocusIn): Filter out FocusIn events
generated as a result of grab/ungrab or when the keyboard is grabbed.
2017-11-24 22:47:42 +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
d0e9895748 ; Expose `exwm-input-line-mode-passthrough' as a public interface. 2017-02-24 23:25:02 +08:00
Chris Feng
6723436052 Correct a renamed variable
* exwm-core.el (exwm--kmacro-map): Correct
`exwm-input--during-key-sequence' that was left out in 089afdc8.
2017-02-10 22:14:56 +08:00
Chris Feng
d69e7075ad Add a menu entry to `exwm-mode-map'
* exwm-core.el (exwm-mode-menu): Add a menu entry for closing X windows.
2017-02-05 17:51:43 +08:00
Chris Feng
9926d87b65 Update copyright year to 2017 2017-02-05 17:49:42 +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
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
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
Chris Feng
d86db3edd6 Add minibuffer toggle command
* exwm-workspace.el (exwm-workspace-toggle-minibuffer): Add minibuffer
toggle command.

* exwm-core.el (exwm-mode-menu, exwm-mode-map): Substitute minibuffer
attach/detach commands with minibuffer toggle command.

* exwm-workspace.el (exwm-workspace-toggle-minibuffer): Insert various
auto load cookies.
2016-07-22 12:26:29 +08:00
Chris Feng
f48b8eafb0 Minor fixes
* exwm-core.el (exwm-mode-menu, exwm-mode-map): Add workspace
attach/detach commands.

* exwm-workspace.el (exwm-workspace--add-frame-as-workspace):
Cleanup containers.

* exwm-workspace.el (exwm-workspace--update-ewmh-props): Create the
frame in size 1x1 (Lucid build does no support zero sized frames).

* exwm-workspace.el (exwm-workspace--post-init): Reset the 'fullscreen'
frame parameter for emacsclient.
2016-07-21 12:44:05 +08:00
Chris Feng
6571bb5761 Minor cleanups
; Eliminate compile warnings.
; Rename frame parameter 'exwm--urgency' to 'exwm-urgency'.
; Simplify expressions.
2016-07-21 12:41:51 +08:00
Chris Feng
b51f3e65f1 Mention dynamic workspace in various places
* README.md:
* exwm.el: Update README and comments.

* exwm-core.el (exwm-mode-menu exwm-mode-map): Add menu entries for
dynamic workspace feature.
2016-07-19 10:36:14 +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
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
2195316821 Add major mode menu
* exwm-core.el (exwm--keyboard-grabbed): New buffer-local variable for
recoding grabbing state.
(exwm-mode-menu, exwm-mode-map): Add major mode menu.
* exwm-input.el (exwm-input-set-key): Update prefix keys when a global
binding is interactively set.
(exwm-input-grab-keyboard, exwm-input-release-keyboard): Update grabbing
state.
2016-07-17 12:46:19 +08:00
Chris Feng
6c8255bf39 Add/improve some ICCCM/EWMH features
* exwm-floating.el (exwm-floating--set-allowed-actions)
(exwm-floating--set-floating, exwm-floating--unset-floating):
Add _NET_WM_ALLOWED_ACTIONS support.

* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating): Support initial state hint.
* exwm.el (exwm--update-hints): Fetch initial state.
(exwm--update-state, exwm--on-PropertyNotify):
WM_STATE is not intended to be read.
* exwm-core.el (exwm-state):
* exwm-floating.el (exwm-floating-hide):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--set-state)
(exwm-layout--iconic-state-p, exwm-layout--show, exwm-layout--hide):
* exwm-manage.el (exwm-manage--on-MapRequest):
Improve WM_STATE support.

* exwm-input.el (exwm-input--set-focus):
* exwm-input.el (exwm-input--update-focus)
(exwm-input--set-active-window):
* exwm.el (exwm--on-ClientMessage): Add _NET_ACTIVE_WINDOW support.

* exwm-layout.el (exwm-layout--set-client-list-stacking):
Improve _NET_CLIENT_LIST_STACKING support.

* exwm-manage.el (exwm-manage--set-client-list)
(exwm-manage--manage-window, exwm-manage--unmanage-window):
Improve _NET_CLIENT_LIST support.

* exwm-manage.el (exwm-manage--manage-window):
* exwm-workspace.el (exwm-workspace--set-desktop)
(exwm-workspace-move-window):
* exwm.el (exwm--on-ClientMessage): Add _NET_WM_DESKTOP support.

* exwm-randr.el (exwm-randr--refresh):
* exwm-workspace.el (exwm-workspace--set-desktop-geometry)
(exwm-workspace--init): Add _NET_DESKTOP_GEOMETRY support.

* exwm-workspace.el (exwm-workspace--set-desktop-geometry):
Renamed from `exwm-workspace--update-desktop-geometry'.
* exwm-randr.el (exwm-randr--refresh): Improve _NET_WORKAREA support.

* exwm-workspace.el (exwm-workspace--set-fullscreen):
Correct variables names.

* exwm-workspace.el (exwm-workspace--init):
* exwm.el (exwm--init-icccm-ewmh):
Set _NET_NUMBER_OF_DESKTOPS in workspace module.

* exwm-workspace.el (exwm-workspace--init):
* exwm.el (exwm--init-icccm-ewmh):
Set _NET_DESKTOP_VIEWPORT in workspace module.

* exwm.el (exwm--on-ClientMessage): Improve _NET_CURRENT_DESKTOP
support.

* exwm.el (exwm--on-ClientMessage): Add _NET_CLOSE_WINDOW support.

* exwm.el (exwm--on-ClientMessage): Add WM_CHANGE_STATE support.

* exwm.el (exwm--init-icccm-ewmh): Update supported atoms.
2016-07-13 19:36:50 +08:00
Chris Feng
3dba5f156f Manage a certain type of undecorated X windows
* exwm-core.el (exwm--mwm-hints): Removed.
(exwm--mwm-hints-decorations): New buffer-local variable for
indicating whether the X window should have decorations.
* exwm-floating.el (exwm-floating--set-floating): Hide the mode-line
of undecorated floating X windows by default.
* exwm-manage.el (exwm-manage--update-mwm-hints):
Set exwm--mwm-hints-decorations;
(exwm-manage--manage-window): Manage an undecorated X window if its
input model is not 'No Input' or 'Globally Active'.
2016-05-24 12:30:53 +08:00
Chris Feng
5a39c5c2fa Allow user to hide floating X windows
* exwm-core.el (exwm-mode-map): Add a new key to hide floating X windows.
* exwm-floating.el (exwm-floating-hide): New command to hide a floating X
window.

* exwm-workspace.el: Fix a compile warning.
2016-02-25 12:41:35 +08:00
Chris Feng
33254c37df Redefine mode-specific keys
* exwm-core.el (exwm-mode-map): Redefine mode-specific keys to comply with
the key binding conventions.
2016-02-20 10:02:11 +08:00
Chris Feng
fc589b899b Fix system tray issues after updating workspaces
* exwm-workspace.el (exwm-workspace-switch-hook): New hook run by
`exwm-workspace-switch'.
* exwm-randr.el (exwm-randr-refresh-hook): New hook run by
`exwm-randr--refresh'.
* exwm-systemtray.el (exwm-systemtray--on-randr-refresh)
(exwm-systemtray--on-workspace-switch, exwm-systemtray--init): Update the
system tray in `exwm-randr-refresh-hook' and `exwm-workspace-switch-hook'.

* exwm-layout.el (exwm-layout--set-frame-fullscreen):
* exwm-workspace.el (exwm-workspace--post-init): Wait until all workspace
frames are set fullscreen.

* exwm-workspace.el (exwm-workspace--current-width)
(exwm-workspace--current-height): New functions for retrieving the width
and height of the current workspace.
* 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):
* exwm-workspace.le (exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--on-ConfigureNotify): Switch to
`exwm-workspace--current-width' and `exwm-workspace--current-height'.

* exwm-core.el:
* exwm-floating.el:
* exwm-floating.el:
* exwm-input.el:
* exwm-layout.el:
* exwm-manage.el:
* exwm-randr.el:
* exwm-systemtray.el:
* exwm-workspace.el:
* exwm.el:
Clean up loading file.  Set/Unset some functions as commands.

* README.md: Add intro to system tray.
2016-02-19 17:12:43 +08:00
Chris Feng
3f7722079c Fix floating X window bugs introduced by 9c95c03e
* exwm-floating.el (exwm-floating--set-floating): Make floating frames
invisible before resizing them.
(exwm-floating--fit-frame-to-window): Removed since unused.
* exwm-layout.el (exwm-layout-hide-mode-line, exwm-layout-show-mode-line):
Use set frame height instead of exwm-floating--fit-frame-to-window.

* exwm-core.el (exwm-mode): Replace `exwm-manage--close-window' with
`exwm-manage--kill-buffer-query-function'.
* exwm-floating.el (exwm-floating--unset-floating): Reparent out floating
frames.
* exwm-manage.el (exwm-manage--unmanage-window): Reparent out floating
frames.  Hide floating frames.
(exwm-manage--close-window, exwm-manage--kill-buffer-query-function):
Rename `exwm-manage--close-window' since it's only used in
`kill-buffer-query-functions'.  Reparent out floating frames.
2016-02-18 19:56:01 +08:00
Chris Feng
e2edf81271 Add some useful key bindings
* exwm-core.el (exwm--floating-mode-line-format, exwm--mode-line-format)
(exwm-mode-map):
* exwm-floating.el (exwm-floating-hide-mode-line)
(exwm-floating-show-mode-line):
* exwm-layout.el (exwm-layout-hide-mode-line, exwm-layout-show-mode-line)
(exwm-layout-toggle-mode-line):
Allow hide/show mode-line for all `exwm-mode' buffers with 'C-c M'.

* exwm-config.el (exwm-config-default): Add simulation keys for 'C-d' and
'C-k'.
2016-02-07 10:45:59 +08:00
Chris Feng
2d42fee327 Merge branch 'feat/virtual-root' 2016-02-03 13:30:14 +08:00
Chris Feng
9c95c03e18 Rework the X windows hierarchy model
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.
2016-02-03 12:12:24 +08:00
Chris Feng
0db666b4fb Update copyright year to 2016 2016-02-02 22:33:58 +08:00
Chris Feng
b2ee102051 Improve robustness of killing buffers
* exwm-core.el (exwm-mode): Use the return value of
  exwm-manage--close-window.
* exwm-manage.el (exwm-manage--close-window): Kill empty buffers; Handle X
  windows that does not support _NET_WM_PING.
  (exwm-manage--kill-client): Kill X windows supporting _NET_WM_PID with
  both SIGKILL and KillClient.
2015-10-29 18:32:55 +08:00
Chris Feng
e8bc51280d Fix workspace switch issues
* 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.
2015-10-25 14:51:06 +08:00
Chris Feng
5184f0d7c1 Work around subrs that block EXWM; other minor fixes
Some subrs (e.g. x-file-dialog) create X windows and block the execution of
EXWM, so they won't work normally.  This commit partly fixes this issue by
invoking them in a subordinate Emacs instance and trying to fetch the
result back.

* exwm.el (exwm-blocking-subrs): New variable for specify such subrs.
* exwm.el (exwm-enable, exwm--server-name, exwm--server-stop)
  (exwm--server-eval-at): The implementation.

* exwm-core.el:
* exwm-floating.el:
* exwm-layout.el:
* exwm-manage.el:
* exwm-randr.el:
  Evaluate constants at compile-time.

* README.md: Renamed from README.org to make the 'Commentary:' section
  used by GNU ELPA instead.

* exwm.el: Depends on XELB version 0.3.
2015-09-27 19:43:06 +08:00
Chris Feng
b35430429e Check _MOTIF_WM_HINTS when attempting to manage an X window
* exwm-core.el: New buffer-local variable exwm--mwm-hints.
* exwm-manage.el: New variable exwm--atom-_MOTIF_WM_HINTS for holding the
  value of _MOTIF_WM_HINTS atom; new function exwm--update-mwm-hints for
  updating the _MOTIF_WM_HINTS property of an X window.
* exwm-manage.el (exwm-manage--init): Intern the _MOTIF_WM_HINTS atom.
* exwm-manage.el (exwm-manage--manage-window): Avoid managing windows
  without decoration (implied by _MOTIF_WM_HINTS).
2015-09-19 16:53:45 +08:00
Chris Feng
eafd031c55 Allow hide/show mode-line on floating frames
* exwm-core.el: new buffer-local variable exwm--floating-mode-line-format for
  saving mode-line-format when mode-line is hidden
* exwm-floating.el (exwm-floating--fit-frame-to-window)
  (exwm-floating-hide-mode-line, exwm-floating-show-mode-line): new functions
  for resizing frames, hiding/showing mode-line respectively;
  (exwm-floating--set-floating): use exwm-floating--fit-frame-to-window to
  resize frames
2015-09-07 17:33:22 +08:00
Chris Feng
6d63c71280 Prepare for GNU ELPA release
* Transfer copyright to Free Software Foundation
* Add packaging components (e.g. headers)
* Coding style fixes:
  + Quote functions with "#'"
  + Wrap long lines
  + Fix doc strings / comments
* Replace `string-to-int' with `string-to-number'
* Fix compiling errors / eliminate compiling warnings
  + Add exwm-core.el to hold common variables, functions and macros
* Remove the redundant COPYING file
* Add .gitignore
* Rename README to README.md
2015-09-04 09:15:20 +08:00