From 767abdf9e6fa20699faccf7a3388ad2fa6a52b9f Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Tue, 9 Aug 2016 13:26:15 +0800 Subject: 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. --- exwm-floating.el | 26 ++++++++++++-------------- exwm-manage.el | 16 ++++++++-------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/exwm-floating.el b/exwm-floating.el index 464dd20e1061..56d2932d2c96 100644 --- a/exwm-floating.el +++ b/exwm-floating.el @@ -105,15 +105,15 @@ context of the corresponding buffer.") (x (slot-value exwm--geometry 'x)) (y (slot-value exwm--geometry 'y)) (width (slot-value exwm--geometry 'width)) - (height (slot-value exwm--geometry 'height)) - (frame-geometry (frame-parameter original-frame 'exwm-geometry))) + (height (slot-value exwm--geometry 'height))) (exwm--log "Floating geometry (original, absolute): %dx%d%+d%+d" width height x y) - (when (and frame-geometry - (/= x 0) + (when (and (/= x 0) (/= y 0)) - (setq x (- x (slot-value frame-geometry 'x)) - y (- y (slot-value frame-geometry 'y)))) + (let ((workarea (elt exwm-workspace--workareas + (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" width height x y) ;; Save frame parameters. @@ -561,14 +561,12 @@ context of the corresponding buffer.") (defun exwm-floating--do-moveresize (data _synthetic) "Perform move/resize." (when exwm-floating--moveresize-calculate - (let ((obj (make-instance 'xcb:MotionNotify)) - (geometry (frame-parameter exwm-workspace--current 'exwm-geometry)) - (frame-x 0) - (frame-y 0) - result value-mask width height buffer-or-id container-or-id) - (when geometry - (setq frame-x (slot-value geometry 'x) - frame-y (slot-value geometry 'y))) + (let* ((obj (make-instance 'xcb:MotionNotify)) + (workarea (elt exwm-workspace--workareas + exwm-workspace-current-index)) + (frame-x (aref workarea 0)) + (frame-y (aref workarea 1)) + result value-mask width height buffer-or-id container-or-id) (xcb:unmarshal obj data) (setq result (funcall exwm-floating--moveresize-calculate (slot-value obj 'root-x) (slot-value obj 'root-y)) diff --git a/exwm-manage.el b/exwm-manage.el index 0b7b475590b3..b88312455def 100644 --- a/exwm-manage.el +++ b/exwm-manage.el @@ -170,15 +170,15 @@ corresponding buffer.") exwm-window-type) (memq xcb:Atom:_NET_WM_WINDOW_TYPE_DOCK exwm-window-type)) - (let ((frame-geometry (frame-parameter exwm-workspace--current - 'exwm-geometry)) - (workspace (frame-parameter exwm-workspace--current - 'exwm-workspace))) - (when (and frame-geometry - (/= x 0) + (let ((workspace (frame-parameter exwm-workspace--current + 'exwm-workspace)) + workarea) + (when (and (/= x 0) (/= y 0)) - (setq x (- x (slot-value frame-geometry 'x)) - y (- y (slot-value frame-geometry 'y)))) + (setq workarea (elt exwm-workspace--workareas + exwm-workspace-current-index) + x (- x (aref workarea 0)) + y (- y (aref workarea 1)))) (xcb:+request exwm--connection (make-instance 'xcb:ReparentWindow :window id -- cgit 1.4.1