mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 13:07:59 +01:00
Fix floating X window size with menu-bar/tool-bar enabled
* exwm-floating.el (exwm-floating--set-floating) exwm-floating--do-moveresize) exwm-layout.el (exwm-layout--show): Take menu-bar/tool-bar into consideration.
This commit is contained in:
parent
323e919876
commit
ccc4cce0e0
2 changed files with 27 additions and 12 deletions
|
@ -211,10 +211,14 @@ This is also used by X window containers.")
|
||||||
;; The frame will be made visible by `select-frame-set-input-focus'.
|
;; The frame will be made visible by `select-frame-set-input-focus'.
|
||||||
(make-frame-invisible frame)
|
(make-frame-invisible frame)
|
||||||
(let* ((edges (window-inside-pixel-edges window))
|
(let* ((edges (window-inside-pixel-edges window))
|
||||||
|
(geometry (frame-geometry frame))
|
||||||
(frame-width (+ width (- (frame-pixel-width frame)
|
(frame-width (+ width (- (frame-pixel-width frame)
|
||||||
(- (elt edges 2) (elt edges 0)))))
|
(- (elt edges 2) (elt edges 0)))))
|
||||||
(frame-height (+ height (- (frame-pixel-height frame)
|
(frame-height (+ height (- (frame-pixel-height frame)
|
||||||
(- (elt edges 3) (elt edges 1)))))
|
(- (elt edges 3) (elt edges 1)))
|
||||||
|
;; Use `frame-outer-height' in the future.
|
||||||
|
(or (cddr (assq 'menu-bar-size geometry)) 0)
|
||||||
|
(or (cddr (assq 'tool-bar-size geometry)) 0)))
|
||||||
(floating-mode-line (plist-get exwm--configurations
|
(floating-mode-line (plist-get exwm--configurations
|
||||||
'floating-mode-line))
|
'floating-mode-line))
|
||||||
(floating-header-line (plist-get exwm--configurations
|
(floating-header-line (plist-get exwm--configurations
|
||||||
|
@ -466,7 +470,7 @@ This is also used by X window containers.")
|
||||||
height (frame-pixel-height frame))
|
height (frame-pixel-height frame))
|
||||||
(unless type
|
(unless type
|
||||||
;; Determine the resize type according to the pointer position
|
;; Determine the resize type according to the pointer position
|
||||||
;; Clicking the center 1/3 part to resize has not effect
|
;; Clicking the center 1/3 part to resize has no effect
|
||||||
(setq x (/ (* 3 win-x) (float width))
|
(setq x (/ (* 3 win-x) (float width))
|
||||||
y (/ (* 3 win-y) (float height))
|
y (/ (* 3 win-y) (float height))
|
||||||
type (cond ((and (< x 1) (< y 1))
|
type (cond ((and (< x 1) (< y 1))
|
||||||
|
@ -603,7 +607,8 @@ This is also used by X window containers.")
|
||||||
"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))
|
||||||
result value-mask x y width height buffer-or-id container-or-id)
|
result value-mask x y width height buffer-or-id container-or-id
|
||||||
|
geometry y-offset)
|
||||||
(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))
|
||||||
|
@ -613,13 +618,19 @@ This is also used by X window containers.")
|
||||||
y (aref result 3)
|
y (aref result 3)
|
||||||
width (max 1 (aref result 4))
|
width (max 1 (aref result 4))
|
||||||
height (max 1 (aref result 5)))
|
height (max 1 (aref result 5)))
|
||||||
(setq container-or-id
|
(if (not (bufferp buffer-or-id))
|
||||||
(if (bufferp buffer-or-id)
|
;; Unmanaged.
|
||||||
;; Managed.
|
(setq container-or-id buffer-or-id)
|
||||||
(with-current-buffer buffer-or-id
|
;; Managed.
|
||||||
(frame-parameter exwm--floating-frame 'exwm-container))
|
(setq container-or-id
|
||||||
;; Unmanaged.
|
(with-current-buffer buffer-or-id
|
||||||
buffer-or-id))
|
(frame-parameter exwm--floating-frame 'exwm-container))
|
||||||
|
geometry (frame-geometry exwm--floating-frame)
|
||||||
|
;; Use `frame-outer-height' in the future.
|
||||||
|
y-offset (+ (or (cddr (assq 'menu-bar-size geometry)) 0)
|
||||||
|
(or (cddr (assq 'tool-bar-size geometry)) 0))
|
||||||
|
y (- y y-offset)
|
||||||
|
height (+ height y-offset)))
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:ConfigureWindow
|
(make-instance 'xcb:ConfigureWindow
|
||||||
:window container-or-id
|
:window container-or-id
|
||||||
|
|
|
@ -102,11 +102,15 @@
|
||||||
(y (pop edges))
|
(y (pop edges))
|
||||||
(width (- (pop edges) x))
|
(width (- (pop edges) x))
|
||||||
(height (- (pop edges) y))
|
(height (- (pop edges) y))
|
||||||
frame-x frame-y frame-width frame-height)
|
geometry frame-x frame-y frame-width frame-height)
|
||||||
(with-current-buffer (exwm--id->buffer id)
|
(with-current-buffer (exwm--id->buffer id)
|
||||||
(when exwm--floating-frame
|
(when exwm--floating-frame
|
||||||
(setq frame-width (frame-pixel-width exwm--floating-frame)
|
(setq frame-width (frame-pixel-width exwm--floating-frame)
|
||||||
frame-height (frame-pixel-height exwm--floating-frame))
|
geometry (frame-geometry exwm--floating-frame)
|
||||||
|
frame-height (+ (frame-pixel-height exwm--floating-frame)
|
||||||
|
;; Use `frame-outer-height' in the future.
|
||||||
|
(or (cddr (assq 'menu-bar-size geometry)) 0)
|
||||||
|
(or (cddr (assq 'tool-bar-size geometry)) 0)))
|
||||||
(when exwm--floating-frame-position
|
(when exwm--floating-frame-position
|
||||||
(setq frame-x (elt exwm--floating-frame-position 0)
|
(setq frame-x (elt exwm--floating-frame-position 0)
|
||||||
frame-y (elt exwm--floating-frame-position 1)
|
frame-y (elt exwm--floating-frame-position 1)
|
||||||
|
|
Loading…
Reference in a new issue