* exwm-layout.el (exwm-layout--show): Fix the position of floating

X windows.
This commit is contained in:
Chris Feng 2016-08-06 21:42:43 +08:00
parent 0d00a92fad
commit dcec998bb4

View file

@ -68,18 +68,24 @@
"Show window ID exactly fit in the Emacs window WINDOW." "Show window ID exactly fit in the Emacs window WINDOW."
(exwm--log "Show #x%x in %s" id window) (exwm--log "Show #x%x in %s" id window)
(let* ((edges (window-inside-absolute-pixel-edges window)) (let* ((edges (window-inside-absolute-pixel-edges window))
(width (- (elt edges 2) (elt edges 0))) (x (pop edges))
(height (- (elt edges 3) (elt edges 1))) (y (pop edges))
(width (- (pop edges) x))
(height (- (pop edges) y))
(edges (window-inside-pixel-edges window))
(relative-x (pop edges))
(relative-y (pop edges))
frame-width frame-height) frame-width frame-height)
(with-current-buffer (exwm--id->buffer id) (with-current-buffer (exwm--id->buffer id)
(if (not exwm--floating-frame) (if (not exwm--floating-frame)
(let ((relative-edges (window-inside-pixel-edges window))) (exwm-layout--resize-container id exwm--container
(exwm-layout--resize-container relative-x relative-y width height
id exwm--container ;; Keep the size of the X window if
(elt relative-edges 0) (elt relative-edges 1) width height ;; it's the minibuffer that resized.
;; Do not resize the X window if the minibuffer resizes itself. (and
(and (active-minibuffer-window) (active-minibuffer-window)
(< 1 (window-height (active-minibuffer-window)))))) (< 1 (window-height
(active-minibuffer-window)))))
;; A floating X window is of the same size as the Emacs window, ;; A floating X window is of the same size as the Emacs window,
;; whereas its container is of the same size as the Emacs frame. ;; whereas its container is of the same size as the Emacs frame.
(setq frame-width (frame-pixel-width exwm--floating-frame) (setq frame-width (frame-pixel-width exwm--floating-frame)
@ -106,8 +112,8 @@
xcb:ConfigWindow:Y xcb:ConfigWindow:Y
xcb:ConfigWindow:Width xcb:ConfigWindow:Width
xcb:ConfigWindow:Height) xcb:ConfigWindow:Height)
:x exwm-floating-border-width :x relative-x
:y exwm-floating-border-width :y relative-y
:width width :width width
:height height))) :height height)))
;; Make the resizing take effect. ;; Make the resizing take effect.
@ -122,11 +128,13 @@
:event-mask xcb:EventMask:StructureNotify :event-mask xcb:EventMask:StructureNotify
:event (xcb:marshal :event (xcb:marshal
(make-instance 'xcb:ConfigureNotify (make-instance 'xcb:ConfigureNotify
:event id :window id :event id
:window id
:above-sibling xcb:Window:None :above-sibling xcb:Window:None
:x (elt edges 0) :x x
:y (elt edges 1) :y y
:width width :height height :width width
:height height
:border-width 0 :border-width 0
:override-redirect 0) :override-redirect 0)
exwm--connection)))) exwm--connection))))