about summary refs log tree commit diff
path: root/exwm-layout.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-02-20T06·52+0800
committerChris Feng <chris.w.feng@gmail.com>2016-02-20T06·52+0800
commit1c79e1c2384128915357ea629fc2a0503bd36733 (patch)
treeea513389fc4628128d78b6d6a4080b93dba6e945 /exwm-layout.el
parent33254c37df052996d63ff2a55efeb2b6e8799694 (diff)
Prevent/Reduce flickering issues with floating X windows
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating): Prevent flickering when creating/removing
a floating X window.
* exwm-layout.el (exwm-layout--show): Show X windows after resizing to
prevent flickering.
* exwm-manage.el (exwm-manage--unmanage-window): Reduce flickering by
hiding the container.
(exwm-manage--kill-buffer-query-function): Prevent flickering by hiding the
container (except that the X window destroys itself after receiving the
WM_DELETE_WINDOW client message).
Diffstat (limited to 'exwm-layout.el')
-rw-r--r--exwm-layout.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/exwm-layout.el b/exwm-layout.el
index c0f3c6147289..e3c1febc4478 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -53,14 +53,6 @@
 (defun exwm-layout--show (id &optional window)
   "Show window ID exactly fit in the Emacs window WINDOW."
   (exwm--log "Show #x%x in %s" id window)
-  (xcb:+request exwm--connection (make-instance 'xcb:MapWindow :window id))
-  (with-current-buffer (exwm--id->buffer id)
-    (xcb:+request exwm--connection
-        (make-instance 'xcb:MapWindow :window exwm--container)))
-  (xcb:+request exwm--connection
-      (make-instance 'xcb:icccm:set-WM_STATE
-                     :window id :state xcb:icccm:WM_STATE:NormalState
-                     :icon xcb:Window:None))
   (let* ((edges (window-inside-absolute-pixel-edges window))
          (width (- (elt edges 2) (elt edges 0)))
          (height (- (elt edges 3) (elt edges 1))))
@@ -93,7 +85,16 @@
                                          (elt relative-edges 0)
                                          (elt relative-edges 1)
                                          width height
-                                         (active-minibuffer-window)))))
+                                         (active-minibuffer-window))))
+      ;; Make the resizing take effect.
+      (xcb:flush exwm--connection)
+      (xcb:+request exwm--connection (make-instance 'xcb:MapWindow :window id))
+      (xcb:+request exwm--connection
+          (make-instance 'xcb:MapWindow :window exwm--container))
+      (xcb:+request exwm--connection
+          (make-instance 'xcb:icccm:set-WM_STATE
+                         :window id :state xcb:icccm:WM_STATE:NormalState
+                         :icon xcb:Window:None)))
     (xcb:+request exwm--connection
         (make-instance 'xcb:SendEvent
                        :propagate 0 :destination id