diff options
-rw-r--r-- | exwm-floating.el | 13 | ||||
-rw-r--r-- | exwm-workspace.el | 28 |
2 files changed, 28 insertions, 13 deletions
diff --git a/exwm-floating.el b/exwm-floating.el index b58e71a2de52..27a50169a1c7 100644 --- a/exwm-floating.el +++ b/exwm-floating.el @@ -240,7 +240,18 @@ (exwm-floating-hide)) (with-selected-frame exwm-workspace--current (exwm-layout--refresh)) - (select-frame-set-input-focus frame))) + (select-frame-set-input-focus frame)) + ;; FIXME: Strangely, the Emacs frame can move itself at this point + ;; when there are left/top struts set. Force resetting its + ;; position seems working, but it'd better to figure out why. + (when exwm-workspace--struts + (xcb:+request exwm--connection + (make-instance 'xcb:ConfigureWindow + :window outer-id + :value-mask (logior xcb:ConfigWindow:X + xcb:ConfigWindow:Y) + :x 0 :y 0)) + (xcb:flush exwm--connection))) (run-hooks 'exwm-floating-setup-hook) ;; Redraw the frame. (redisplay)) diff --git a/exwm-workspace.el b/exwm-workspace.el index d57505870a62..551ccbfba98d 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -232,32 +232,36 @@ Value nil means to use the default position which is fixed at bottom, while (`left (setq delta (- (aref w 0) width)) (when (and (< delta 0) - (< (max (aref position 0) (aref w 1)) - (min (aref position 1) - (+ (aref w 1) (aref w 3))))) + (or (not position) + (< (max (aref position 0) (aref w 1)) + (min (aref position 1) + (+ (aref w 1) (aref w 3)))))) (cl-incf (aref w 2) delta) (setf (aref w 0) width))) (`right (setq delta (- root-width (aref w 0) (aref w 2) width)) (when (and (< delta 0) - (< (max (aref position 0) (aref w 1)) - (min (aref position 1) - (+ (aref w 1) (aref w 3))))) + (or (not position) + (< (max (aref position 0) (aref w 1)) + (min (aref position 1) + (+ (aref w 1) (aref w 3)))))) (cl-incf (aref w 2) delta))) (`top (setq delta (- (aref w 1) width)) (when (and (< delta 0) - (< (max (aref position 0) (aref w 0)) - (min (aref position 1) - (+ (aref w 0) (aref w 2))))) + (or (not position) + (< (max (aref position 0) (aref w 0)) + (min (aref position 1) + (+ (aref w 0) (aref w 2)))))) (cl-incf (aref w 3) delta) (setf (aref w 1) width))) (`bottom (setq delta (- root-height (aref w 1) (aref w 3) width)) (when (and (< delta 0) - (< (max (aref position 0) (aref w 0)) - (min (aref position 1) - (+ (aref w 0) (aref w 2))))) + (or (not position) + (< (max (aref position 0) (aref w 0)) + (min (aref position 1) + (+ (aref w 0) (aref w 2)))))) (cl-incf (aref w 3) delta)))))) ;; Save the result. (setq exwm-workspace--workareas workareas) |