Commit graph

74 commits

Author SHA1 Message Date
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
2497c45a1d ; Remove dead code 2016-09-22 19:02:54 +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
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
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
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
fc542bbcc9 ; Eliminate compile warnings 2016-07-31 13:16:51 +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
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
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
e6bf1b45ad Always update input focus on entering minibuffer
* exwm-input.el (exwm-input--on-minibuffer-setup): New function for
setting input focus on the workspace frame.
(exwm-input--init): Add the function to `minibuffer-setup-hook'.
* exwm-workspace.el (exwm-workspace--on-minibuffer-setup): Avoid setting
input focus here.
2016-07-26 21:42:22 +08:00
Chris Feng
f4d89d7e2f Minor fixes for past few commits
* exwm-input.el (exwm-input--unread-event): Temporarily disable it
due to bug#23980.

* exwm-workspace.el (exwm-workspace--init): Set the default frame
internal border to 0.

* exwm-workspace.el (exwm-workspace--remove-frame-as-workspace):
Fix a typo.
2016-07-25 12:14:26 +08:00
Chris Feng
5529790b03 ; * exwm-input.el: Prevent moving/resizing a tiling X window. 2016-07-22 12:31:22 +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
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
3909f65bae Add support for attachable/detachable minibuffer
* exwm-workspace.el (exwm-workspace--update-minibuffer-height): Renamed
from `exwm-workspace--update-minibuffer' to better reflect its usage.

* exwm-input.el (exwm-input--update-focus): Directly put the floating
X window at top since the minibuffer is no longer a sibling.
* exwm-workspace.el (exwm-workspace--resize-minibuffer-frame): Calculate
position in absolute coordinate; put minibuffer at bottom by default;
resize the minibuffer frame with ConfigureWindow rather than
`set-frame-width'.
(exwm-workspace-switch): No need to reparent minibuffer any more.
(exwm-workspace--on-ConfigureNotify): Calculate position in absolute
coordinate.
(exwm-workspace--show-minibuffer, exwm-workspace--hide-minibuffer):
Show/Hide the minibuffer by adjusting the stacking order rather than
mapping/unmapping.
(exwm-workspace--init): Map the minibuffer frame container on creation.

* exwm-workspace.el (exwm-workspace--minibuffer-attached-p):
New function telling whether the minibuffer is attached.
(exwm-workspace--attached-minibuffer-height): New variable storing the
height of the attached minibuffer.
(exwm-workspace-attach-minibuffer, exwm-workspace-detach-minibuffer):
New functions for attaching/detaching the minibuffer.

* exwm-workspace.el (exwm-workspace--show-minibuffer): Remove the
workaround for minibuffer cursor (seems fixed).
2016-07-19 19:23:37 +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
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
0b8a373e4f Fix a `unread-command-events' issue for Emacs 24
* exwm-input.el (exwm-input--unread-event)
(exwm-input--on-KeyPress-line-mode): Use `unread-command-events'
differently on Emacs 24 and 25.
2016-07-15 08:11:33 +08:00
Chris Feng
39dc328157 Fix various stability issues
* exwm-input.el (exwm-input--on-KeyPress-line-mode)
(exwm-input--on-KeyPress-char-mode): Append events at the tail.

* exwm-manage.el (exwm-manage--unmanage-window): Remove the
_NET_WM_DESKTOP property when an X window is withdrawn.

* exwm-systemtray.el (exwm-systemtray--init):
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs):
Issue warning rather than error when there's an existing tray running.

* exwm.el (exwm--on-ClientMessage): The buffer window can be on a
floating frame.
2016-07-14 22:08:27 +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
eee5c6fa4d * exwm-input.el (exwm-input--on-KeyPress-char-mode): No need to
force events to be added to `this-command-keys' (and it causes problems).
2016-07-12 20:08:28 +08:00
Chris Feng
9c8e95b376 Fix a bug of simulation keys
* exwm-input.el (exwm-input--on-KeyPress-line-mode)
(exwm-input--on-KeyPress-char-mode): Force events to be added to
`this-command-keys'.
(exwm-input-send-next-key): The read event can now be (t . EVENT).
2016-07-12 11:55:02 +08:00
Chris Feng
4a1b177bce Allow buffer-local simulation keys
* exwm-input.el (exwm-input-set-local-simulation-keys): New function for
setting buffer-local simulation keys.
(exwm-input--local-simulation-keys): New internal variable.
(exwm-input--update-simulation-prefix-keys): Modify either
`exwm-mode-map' or the local keymap accordingly.
2016-06-17 18:45:34 +08:00
Chris Feng
2ec88bd32d * exwm-input.el (exwm-input--update-focus): Do not update input focus
when there's an active minibjffer
2016-05-24 21:50:04 +08:00
Chris Feng
1b2ae3749e Add cleanup codes for Emacs daemon
* exwm-floating.el (exwm-floating--exit):
* exwm-input.el (exwm-input--exit):
* exwm-layout.el (exwm-layout--exit):
* exwm-manage.el (exwm-manage--exit):
* exwm-randr.el (exwm-randr--exit):
* exwm-systemtray.el (exwm-systemtray--exit):
* exwm-workspace.el (exwm-workspace--exit):
New functions for cleanup each module.

* exwm-input.el (exwm-input--on-pre-command, exwm-input--on-post-command)
(exwm-input--init): Name lambda functions.

* exwm-layout.el (exwm-layout--timer, exwm-layout--init): Save timer.

* exwm-randr.el (exwm-randr-enable): Register the cleanup function.

* exwm-systemtray.el (exwm-systemtray--init): Force refresh atoms in XEMBED
and system tray protocols.
(exwm-systemtray-enable): Register the cleanup function.

* exwm-workspace.el (exwm-workspace--client): Save the server process.
(exwm-workspace--confirm-kill-emacs): Add emacsclient-specific
cleanup codes.
(exwm-workspace--timer): Save the timer.
(exwm-workspace--init): Save the server process and timer;
fix problems with emacsclient frames.

* exwm.el (exwm-init): Always select the newly created frame;
force refresh ICCCM & EWMH atoms.
(exwm-exit-hook): New hook for holding cleanup codes.
(exwm--exit): Run `exwm-exit-hook', execute cleanup codes for
each module and reset the environment.
2016-05-23 19:13:42 +08:00
Chris Feng
ac3f8098c7 Use cl-case' instead of case' 2016-03-08 13:01:05 +08:00
Adrián Medraño Calvo
1342fe1789 Change input mode of window being clicked
When clicking a mode-line of other window to switch the EXWM input
mode, `window-buffer' does not return the window whose mode-line has
been clicked, but the current one.  This change ensures that the right
window has its input mode and mode-line updated.

* exwm-input.el (exwm-input--update-mode-line): Factor out setting
`mode-line-process'.
(exwm-input--grab-keyboard, exwm-input--release-keyboard)
(exwm-input-grab-keyboard, exwm-input-release-keyboard): Make sure
the buffer of the window being clicked has its input mode updated.
2016-03-07 00:00:00 +00:00
Chris Feng
93e42136e3 Avoid unnecessary input focus changes in line-mode
* exwm-input.el (exwm-input--grab-keyboard, exwm-input--release-keyboard):
Grab keys on X windows instead to prevent unexpected input focus changes.

* exwm-workspace.el (exwm-workspace--show-minibuffer): The workaround for
cursor flickering issue is no more needed.
2016-03-01 18:53:31 +08:00
Chris Feng
4838f2b7fa Make input focus revert to pointer root
* exwm-input.el (exwm-input--set-focus): Input focus should not revert to
parent (which was the Emacs frame) any more.
2016-02-23 19:04:51 +08:00
Chris Feng
e3d33a4aad Prevent Emacs frames from restacking themselves
Putting Emacs frames (workspace frames, floating frames) into dedicated
containers greatly simplifies the stacking order management and totally
fixes relevant issues.

* exwm-floating.el (exwm-floating--set-floating): Create floating frame
container.  Remove redundant stacking order modification code.
(exwm-floating--unset-floating): Destroy the floating frame container.
No need to reparent the X window container.
(exwm-floating--do-moveresize): Resize the floating frame container.
* exwm-input.el (exwm-input--update-focus): No need to restack frames.
* exwm-layout.el (exwm-layout--show, exwm-layout--set-frame-fullscreen)
(exwm-layout-enlarge-window): Resize the floating frame container.
* exwm-manage.el (exwm-manage--on-ConfigureRequest): Re-enable stacking
order modification on ConfigureRequest.

* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): Reparent out all
frames on exit.  No need to remove selected events or created resources.
(exwm-workspace--init): Create workspace frame containers.

* exwm-layout.el (exwm-layout-set-fullscreen):
* exwm-manage.el (exwm-manage--unmanage-window): Remove a redundant call to
`xcb:flush'.

* exwm-manage.el (exwm-manage--unmanage-window): Force unmap the X window.
Unmap the floating frame before reparent it.
2016-02-20 21:52:07 +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
Felix Lange
0006523474 Resize minibuffer only when it's in its own frame
0e4055d339 introduced a few calls to exwm-workspace--resize-minibuffer
in various places. This function only works when the minibuffer is
displayed in its own frame but was called unconditionally in some cases.

Fix it by wrapping all calls in an appropriate conditional and add an
assertion. Also rename the function so it is clearer that it resizes a
frame, which might prevent calling it unconditionally in the future.
2016-02-06 22:43:32 +01:00
Chris Feng
0e4055d339 Add auto-hiding minibuffer support
* exwm-floating.el (exwm-floating--set-floating): Take auto-hiding
minibuffer into account when calculating available height.
(exwm-floating--unset-floating): Restack the container to avoid further
restacking.
* exwm-input.el (exwm-input--update-focus): Use more accurate restacking.
(exwm-input--on-minibuffer-setup): Replaced by
`exwm-layout--on-minibuffer-setup' and `exwm-workspace--on-minibuffer-setup'.
(exwm-input-command-whitelist, exwm-input--during-command)
(exwm-input--on-KeyPress-line-mode): The functionality of
`exwm-input-command-whitelist' is replaced by `exwm-input--during-command',
which can automatically tell whether functions like `read-event' are being
called.
(exwm-input--init): Add/remove corresponding hooks.
* exwm-layout.el (exwm-layout--on-minibuffer-setup): Also set input focus.
(exwm-layout--on-echo-area-change): New function for refreshing layout when
the size of echo area changes.
(exwm-layout--init): Track size changes for fixed minibuffer and echo area.
* exwm-manage.el (exwm-manage--on-ConfigureRequest): Never grant restacking
requests initiated by other clients.
* exwm-workspace.el (exwm-workspace--minibuffer): New variable for the
auto-hiding minibuffer.
(exwm-workspace-minibuffer-position): For setting the position of the
auto-hiding minibuffer.
(exwm-workspace-display-echo-area-timeout): Seconds before echo area
auto-hides.
(exwm-workspace--display-echo-area-timer): The corresponding timer.
(exwm-workspace-switch): Configure the auto-hiding minibuffer when
switching workspace.
(exwm-workspace--update-minibuffer): New function for adjusting the height
of the auto-hiding minibuffer.
(exwm-workspace--on-ConfigureNotify): New function for configuring the
container of the auto-hiding minibuffer.
(exwm-workspace--display-buffer): New function for forcing
`minibuffer-completion-help' to use the workspace frame.
(exwm-workspace--show-minibuffer, exwm-workspace--hide-minibuffer):
New functions for showing/hiding the auto-hiding minibuffer (container).
(exwm-workspace--on-minibuffer-setup, exwm-workspace--on-minibuffer-exit):
New functions called when the auto-hiding minibuffer entered/exists.
(exwm-workspace--on-echo-area-dirty, exwm-workspace--on-echo-area-clear):
New functions when the auto-hiding echo area is ready to show/hide.
(exwm-workspace--init): Set up the auto-hiding minibuffer and workspace
frames.  Track sizes changes for auto-hiding minibuffer and echo area.
No need to set OverrideRedirect on workspace frames.
* exwm.el (exwm--init-icccm-ewmh): Correct the value of _NET_WORKAREA.
2016-02-06 12:59:33 +08:00
Chris Feng
2d42fee327 Merge branch 'feat/virtual-root' 2016-02-03 13:30:14 +08:00
Chris Feng
d8281abca4 Avoid unnecessary changes of stacking order
* exwm-input.el (exwm-input--update-focus): Only restack a tiling X window
when it's not the last but one sibling.  This should reduce flickering.
2016-02-03 13:23:55 +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
07921a3731 Remove the MappingNotify event listener
* exwm-input.el (exwm-input--on-MappingNotify, exwm-input--init): Remove
the event listener for MappingNotify event (it should be handled in the
underling library instead).
2015-12-13 16:57:04 +08:00
Chris Feng
45c24eac7a Use new calling conventions of xcb:keysyms
* exwm-input.el: Use new calling conventions of xcb:keysyms
2015-10-30 17:23:02 +08:00
Chris Feng
51f5e35aa6 Check KEYSYMs converted from events
* exwm-input.el (exwm-input--update-global-prefix-keys)
  (exwm-input--fake-key, exwm-input--init): Check the return value of
  xcb:keysyms:event->keysym.
2015-10-28 20:38:06 +08:00
Chris Feng
11cc84d77e Minor input focus fix
* exwm-input.el (exwm-input--on-buffer-list-update): Schedule input focus
  switch with idle timer.
2015-10-28 10:37:18 +08:00
Chris Feng
d05df51b05 Fix problems introduced/exposed by last commit
* exwm-workspace.el (exwm-workspace-switch, exwm-workspace--on-focus-in):
  Use handle-switch-frame instead of exwm-workspace--switch-count to filter
  out events.

* exwm-workspace.el (exwm-workspace--init): Delay making workspaces
  fullscreen.

* exwm-workspace.el (exwm-workspace-move-window):
* exwm-floating.el (exwm-floating--set-floating):
* exwm-layout.el (exwm-layout--refresh):
  `set-buffer-major-mode` does not accept buffer names.
2015-10-26 12:38:20 +08:00
Chris Feng
e70c6fad56 Allow certain commands to receive key events in line-mode
* exwm-input.el (exwm-input-command-whitelist): New variable.
  (exwm-input--on-KeyPress-line-mode): Allow certain commands which receive
  inputs without using the minibuffer to work in line-mode.
2015-10-17 11:02:32 +08:00
Chris Feng
46461d994b Improve robustness
* exwm-input.el (exwm-input--update-focus, exwm-input--on-ButtonPress):
  Make sure Emacs windows are alive before manipulating them.
2015-10-11 13:36:15 +08:00