Remember the geometries of floating X windows

* exwm-floating.el (exwm-floating--stop-moveresize):
* exwm-layout.el (exwm-layout-enlarge-window):
Update the geometry after resizing.
This commit is contained in:
Chris Feng 2016-09-23 18:36:09 +08:00
parent 0833e8dc4a
commit 2597f74c7f
2 changed files with 24 additions and 9 deletions

View file

@ -550,22 +550,35 @@ context of the corresponding buffer.")
;; Unmanaged. ;; Unmanaged.
(eq major-mode 'exwm-mode)) (eq major-mode 'exwm-mode))
(let ((edges (window-inside-absolute-pixel-edges (frame-selected-window))) (let ((edges (window-inside-absolute-pixel-edges (frame-selected-window)))
(id (buffer-local-value 'exwm--id x y width height id)
(window-buffer (frame-selected-window))))) (setq x (pop edges)
y (pop edges)
width (- (pop edges) x)
height (- (pop edges) y))
(with-current-buffer (window-buffer (frame-selected-window))
(setq id exwm--id)
(with-slots ((x* x)
(y* y)
(width* width)
(height* height))
exwm--geometry
(setf x* x
y* y
width* width
height* height)))
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:SendEvent (make-instance 'xcb:SendEvent
:propagate 0 :destination id :propagate 0
:destination id
: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 (- (elt edges 2) :width width
(elt edges 0)) :height height
:height (- (elt edges 3)
(elt edges 1))
:border-width 0 :border-width 0
:override-redirect 0) :override-redirect 0)
exwm--connection))))) exwm--connection)))))

View file

@ -460,6 +460,7 @@ windows."
(setq width (max (+ exwm--normal-hints-min-width margin) (setq width (max (+ exwm--normal-hints-min-width margin)
(+ width delta)))))) (+ width delta))))))
(when width (when width
(setf (slot-value exwm--geometry 'width) width)
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ConfigureWindow (make-instance 'xcb:ConfigureWindow
:window (frame-parameter exwm--floating-frame :window (frame-parameter exwm--floating-frame
@ -492,6 +493,7 @@ windows."
(setq height (max (+ exwm--normal-hints-min-height margin) (setq height (max (+ exwm--normal-hints-min-height margin)
(+ height delta)))))) (+ height delta))))))
(when height (when height
(setf (slot-value exwm--geometry 'height) height)
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ConfigureWindow (make-instance 'xcb:ConfigureWindow
:window (frame-parameter exwm--floating-frame :window (frame-parameter exwm--floating-frame