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.
This commit is contained in:
Chris Feng 2016-08-09 13:26:15 +08:00
parent 6e0b944c2d
commit 767abdf9e6
2 changed files with 20 additions and 22 deletions

View file

@ -105,15 +105,15 @@ context of the corresponding buffer.")
(x (slot-value exwm--geometry 'x)) (x (slot-value exwm--geometry 'x))
(y (slot-value exwm--geometry 'y)) (y (slot-value exwm--geometry 'y))
(width (slot-value exwm--geometry 'width)) (width (slot-value exwm--geometry 'width))
(height (slot-value exwm--geometry 'height)) (height (slot-value exwm--geometry 'height)))
(frame-geometry (frame-parameter original-frame 'exwm-geometry)))
(exwm--log "Floating geometry (original, absolute): %dx%d%+d%+d" (exwm--log "Floating geometry (original, absolute): %dx%d%+d%+d"
width height x y) width height x y)
(when (and frame-geometry (when (and (/= x 0)
(/= x 0)
(/= y 0)) (/= y 0))
(setq x (- x (slot-value frame-geometry 'x)) (let ((workarea (elt exwm-workspace--workareas
y (- y (slot-value frame-geometry 'y)))) (exwm-workspace--position original-frame))))
(setq x (- x (aref workarea 0))
y (- y (aref workarea 1)))))
(exwm--log "Floating geometry (original, relative): %dx%d%+d%+d" (exwm--log "Floating geometry (original, relative): %dx%d%+d%+d"
width height x y) width height x y)
;; Save frame parameters. ;; Save frame parameters.
@ -561,14 +561,12 @@ context of the corresponding buffer.")
(defun exwm-floating--do-moveresize (data _synthetic) (defun exwm-floating--do-moveresize (data _synthetic)
"Perform move/resize." "Perform move/resize."
(when exwm-floating--moveresize-calculate (when exwm-floating--moveresize-calculate
(let ((obj (make-instance 'xcb:MotionNotify)) (let* ((obj (make-instance 'xcb:MotionNotify))
(geometry (frame-parameter exwm-workspace--current 'exwm-geometry)) (workarea (elt exwm-workspace--workareas
(frame-x 0) exwm-workspace-current-index))
(frame-y 0) (frame-x (aref workarea 0))
result value-mask width height buffer-or-id container-or-id) (frame-y (aref workarea 1))
(when geometry result value-mask width height buffer-or-id container-or-id)
(setq frame-x (slot-value geometry 'x)
frame-y (slot-value geometry 'y)))
(xcb:unmarshal obj data) (xcb:unmarshal obj data)
(setq result (funcall exwm-floating--moveresize-calculate (setq result (funcall exwm-floating--moveresize-calculate
(slot-value obj 'root-x) (slot-value obj 'root-y)) (slot-value obj 'root-x) (slot-value obj 'root-y))

View file

@ -170,15 +170,15 @@ corresponding buffer.")
exwm-window-type) exwm-window-type)
(memq xcb:Atom:_NET_WM_WINDOW_TYPE_DOCK (memq xcb:Atom:_NET_WM_WINDOW_TYPE_DOCK
exwm-window-type)) exwm-window-type))
(let ((frame-geometry (frame-parameter exwm-workspace--current (let ((workspace (frame-parameter exwm-workspace--current
'exwm-geometry)) 'exwm-workspace))
(workspace (frame-parameter exwm-workspace--current workarea)
'exwm-workspace))) (when (and (/= x 0)
(when (and frame-geometry
(/= x 0)
(/= y 0)) (/= y 0))
(setq x (- x (slot-value frame-geometry 'x)) (setq workarea (elt exwm-workspace--workareas
y (- y (slot-value frame-geometry 'y)))) exwm-workspace-current-index)
x (- x (aref workarea 0))
y (- y (aref workarea 1))))
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ReparentWindow (make-instance 'xcb:ReparentWindow
:window id :window id