mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-27 06:48:00 +01:00
Fix wrong/missing ConfigureNotify events
* exwm-floating.el (exwm-floating--set-floating): Set exwm--floating-edges as absolute edges (the relative edges can be easily determined). * exwm-layout.el (exwm-layout--show): Send correct absolute positions to floating X windows. * exwm-floating.el (exwm-floating--stop-moveresize, exwm-floating-move): Send ConfigureNotify events after moving floating X windows.
This commit is contained in:
parent
4255f078a6
commit
412d2a52bd
2 changed files with 57 additions and 11 deletions
|
@ -161,10 +161,7 @@
|
||||||
;; Rationale: the frame will not be ready for some time, thus we cannot
|
;; Rationale: the frame will not be ready for some time, thus we cannot
|
||||||
;; infer the correct window size from its geometry.
|
;; infer the correct window size from its geometry.
|
||||||
(with-current-buffer (exwm--id->buffer id)
|
(with-current-buffer (exwm--id->buffer id)
|
||||||
(setq exwm--floating-edges
|
(setq exwm--floating-edges (vector x y (+ width x) (+ height y))))
|
||||||
(vector exwm-floating-border-width exwm-floating-border-width
|
|
||||||
(+ width exwm-floating-border-width)
|
|
||||||
(+ height exwm-floating-border-width))))
|
|
||||||
;; Fit frame to client
|
;; Fit frame to client
|
||||||
(exwm-floating--fit-frame-to-window outer-id width height)
|
(exwm-floating--fit-frame-to-window outer-id width height)
|
||||||
;; Reparent window to this frame
|
;; Reparent window to this frame
|
||||||
|
@ -436,6 +433,28 @@ are provided. You should call `xcb:flush' and restore the value of
|
||||||
"Stop move/resize."
|
"Stop move/resize."
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:UngrabPointer :time xcb:Time:CurrentTime))
|
(make-instance 'xcb:UngrabPointer :time xcb:Time:CurrentTime))
|
||||||
|
;; Inform the X window that its absolute position is changed
|
||||||
|
(when exwm-floating--moveresize-calculate
|
||||||
|
(let ((edges (window-inside-absolute-pixel-edges (frame-selected-window)))
|
||||||
|
(id (with-current-buffer (window-buffer (frame-selected-window))
|
||||||
|
exwm--id)))
|
||||||
|
(xcb:+request exwm--connection
|
||||||
|
(make-instance 'xcb:SendEvent
|
||||||
|
:propagate 0 :destination id
|
||||||
|
:event-mask xcb:EventMask:StructureNotify
|
||||||
|
:event (xcb:marshal
|
||||||
|
(make-instance 'xcb:ConfigureNotify
|
||||||
|
:event id :window id
|
||||||
|
:above-sibling xcb:Window:None
|
||||||
|
:x (elt edges 0)
|
||||||
|
:y (elt edges 1)
|
||||||
|
:width (- (elt edges 2)
|
||||||
|
(elt edges 0))
|
||||||
|
:height (- (elt edges 3)
|
||||||
|
(elt edges 1))
|
||||||
|
:border-width 0
|
||||||
|
:override-redirect 0)
|
||||||
|
exwm--connection)))))
|
||||||
(xcb:flush exwm--connection)
|
(xcb:flush exwm--connection)
|
||||||
(setq exwm-floating--moveresize-calculate nil))
|
(setq exwm-floating--moveresize-calculate nil))
|
||||||
|
|
||||||
|
@ -473,14 +492,34 @@ Both DELTA-X and DELTA-Y default to 1. This command should be bound locally."
|
||||||
(unless (and (= 0 delta-x) (= 0 delta-y))
|
(unless (and (= 0 delta-x) (= 0 delta-y))
|
||||||
(let* ((id (frame-parameter exwm--floating-frame 'exwm-outer-id))
|
(let* ((id (frame-parameter exwm--floating-frame 'exwm-outer-id))
|
||||||
(geometry (xcb:+request-unchecked+reply exwm--connection
|
(geometry (xcb:+request-unchecked+reply exwm--connection
|
||||||
(make-instance 'xcb:GetGeometry :drawable id))))
|
(make-instance 'xcb:GetGeometry :drawable id)))
|
||||||
|
(edges (window-inside-absolute-pixel-edges)))
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:ConfigureWindow
|
(make-instance 'xcb:ConfigureWindow
|
||||||
:window id
|
:window id
|
||||||
:value-mask (logior xcb:ConfigWindow:X
|
:value-mask (logior xcb:ConfigWindow:X
|
||||||
xcb:ConfigWindow:Y)
|
xcb:ConfigWindow:Y)
|
||||||
:x (+ (slot-value geometry 'x) delta-x)
|
:x (+ (slot-value geometry 'x) delta-x)
|
||||||
:y (+ (slot-value geometry 'y) delta-y))))
|
:y (+ (slot-value geometry 'y) delta-y)))
|
||||||
|
;; Inform the X window that its absolute position is changed
|
||||||
|
(xcb:+request exwm--connection
|
||||||
|
(make-instance 'xcb:SendEvent
|
||||||
|
:propagate 0 :destination exwm--id
|
||||||
|
:event-mask xcb:EventMask:StructureNotify
|
||||||
|
:event (xcb:marshal
|
||||||
|
(make-instance 'xcb:ConfigureNotify
|
||||||
|
:event exwm--id
|
||||||
|
:window exwm--id
|
||||||
|
:above-sibling xcb:Window:None
|
||||||
|
:x (+ (elt edges 0) delta-x)
|
||||||
|
:y (+ (elt edges 1) delta-y)
|
||||||
|
:width (- (elt edges 2)
|
||||||
|
(elt edges 0))
|
||||||
|
:height (- (elt edges 3)
|
||||||
|
(elt edges 1))
|
||||||
|
:border-width 0
|
||||||
|
:override-redirect 0)
|
||||||
|
exwm--connection))))
|
||||||
(xcb:flush exwm--connection)))
|
(xcb:flush exwm--connection)))
|
||||||
|
|
||||||
(defun exwm-floating--init ()
|
(defun exwm-floating--init ()
|
||||||
|
|
|
@ -40,11 +40,17 @@
|
||||||
(let* ((buffer (exwm--id->buffer id))
|
(let* ((buffer (exwm--id->buffer id))
|
||||||
(edges (or (and buffer
|
(edges (or (and buffer
|
||||||
(with-current-buffer buffer exwm--floating-edges))
|
(with-current-buffer buffer exwm--floating-edges))
|
||||||
(window-inside-pixel-edges window)))
|
(window-inside-absolute-pixel-edges window)))
|
||||||
(x (elt edges 0))
|
|
||||||
(y (elt edges 1))
|
|
||||||
(width (- (elt edges 2) (elt edges 0)))
|
(width (- (elt edges 2) (elt edges 0)))
|
||||||
(height (- (elt edges 3) (elt edges 1))))
|
(height (- (elt edges 3) (elt edges 1)))
|
||||||
|
x y)
|
||||||
|
(if exwm--floating-edges
|
||||||
|
;; The relative position of a floating X window is determinate
|
||||||
|
(setq x exwm-floating-border-width
|
||||||
|
y exwm-floating-border-width)
|
||||||
|
(let ((relative-edges (window-inside-pixel-edges window)))
|
||||||
|
(setq x (elt relative-edges 0)
|
||||||
|
y (elt relative-edges 1))))
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:ConfigureWindow
|
(make-instance 'xcb:ConfigureWindow
|
||||||
:window id
|
:window id
|
||||||
|
@ -64,7 +70,8 @@
|
||||||
(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 x :y y
|
:x (elt edges 0)
|
||||||
|
:y (elt edges 1)
|
||||||
:width width :height height
|
:width width :height height
|
||||||
:border-width 0
|
:border-width 0
|
||||||
:override-redirect 0)
|
:override-redirect 0)
|
||||||
|
|
Loading…
Reference in a new issue