mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 04:58:00 +01:00
Add support for automatic cursor warping
* exwm-workspace.el (exwm-workspace-warp-cursor): New user option. (exwm-workspace-switch): Automatically warp cursor after workspace switch.
This commit is contained in:
parent
c1b6a296a8
commit
1364f80f09
1 changed files with 15 additions and 0 deletions
|
@ -47,6 +47,10 @@ deleted, moved, etc)."
|
|||
"Non-nil to show buffers on other workspaces."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom exwm-workspace-warp-cursor nil
|
||||
"Non-nil to warp cursor automatically after workspace switch."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom exwm-workspace-number 1
|
||||
"Initial number of workspaces."
|
||||
:type 'integer)
|
||||
|
@ -595,6 +599,17 @@ for internal use only."
|
|||
(make-instance 'xcb:ewmh:set-_NET_CURRENT_DESKTOP
|
||||
:window exwm--root :data index))
|
||||
(xcb:flush exwm--connection))
|
||||
(when exwm-workspace-warp-cursor
|
||||
(with-slots (win-x win-y)
|
||||
(xcb:+request-unchecked+reply exwm--connection
|
||||
(make-instance 'xcb:QueryPointer
|
||||
:window (frame-parameter frame
|
||||
'exwm-outer-id)))
|
||||
(when (or (> win-x (frame-pixel-width frame))
|
||||
(> win-y (frame-pixel-height)))
|
||||
(set-mouse-position frame
|
||||
(/ (frame-width frame) 2)
|
||||
(/ (frame-height frame) 2)))))
|
||||
(when (frame-live-p old-frame)
|
||||
(with-selected-frame old-frame
|
||||
(run-hooks 'focus-out-hook)))
|
||||
|
|
Loading…
Reference in a new issue