[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm 412d2a5 1/3: Fix wrong/missing ConfigureNotify eve
From: |
Chris Feng |
Subject: |
[elpa] externals/exwm 412d2a5 1/3: Fix wrong/missing ConfigureNotify events |
Date: |
Sat, 19 Sep 2015 02:10:34 +0000 |
branch: externals/exwm
commit 412d2a52bde98bb72fff9a848d5d28b6c5dff4c4
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>
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.
---
exwm-floating.el | 51 +++++++++++++++++++++++++++++++++++++++++++++------
exwm-layout.el | 17 ++++++++++++-----
2 files changed, 57 insertions(+), 11 deletions(-)
diff --git a/exwm-floating.el b/exwm-floating.el
index 346f02e..36a658a 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -161,10 +161,7 @@
;; Rationale: the frame will not be ready for some time, thus we cannot
;; infer the correct window size from its geometry.
(with-current-buffer (exwm--id->buffer id)
- (setq exwm--floating-edges
- (vector exwm-floating-border-width exwm-floating-border-width
- (+ width exwm-floating-border-width)
- (+ height exwm-floating-border-width))))
+ (setq exwm--floating-edges (vector x y (+ width x) (+ height y))))
;; Fit frame to client
(exwm-floating--fit-frame-to-window outer-id width height)
;; Reparent window to this frame
@@ -436,6 +433,28 @@ are provided. You should call `xcb:flush' and restore the
value of
"Stop move/resize."
(xcb:+request exwm--connection
(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)
(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))
(let* ((id (frame-parameter exwm--floating-frame 'exwm-outer-id))
(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
(make-instance 'xcb:ConfigureWindow
:window id
:value-mask (logior xcb:ConfigWindow:X
xcb:ConfigWindow:Y)
: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)))
(defun exwm-floating--init ()
diff --git a/exwm-layout.el b/exwm-layout.el
index 2c9ab75..13bd085 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -40,11 +40,17 @@
(let* ((buffer (exwm--id->buffer id))
(edges (or (and buffer
(with-current-buffer buffer exwm--floating-edges))
- (window-inside-pixel-edges window)))
- (x (elt edges 0))
- (y (elt edges 1))
+ (window-inside-absolute-pixel-edges window)))
(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
(make-instance 'xcb:ConfigureWindow
:window id
@@ -64,7 +70,8 @@
(make-instance 'xcb:ConfigureNotify
:event id :window id
:above-sibling xcb:Window:None
- :x x :y y
+ :x (elt edges 0)
+ :y (elt edges 1)
:width width :height height
:border-width 0
:override-redirect 0)