Make the creation/destruction of floating frames more silent

* exwm-floating.el (exwm-floating--set-floating): Reparent floating frames
  as late as possible.
* exwm-manage.el (exwm-manage--unmanage-window): Hide floating frames first
  on unmanagement.
This commit is contained in:
Chris Feng 2015-10-28 14:04:41 +08:00
parent 11cc84d77e
commit 2779d2e418
2 changed files with 16 additions and 11 deletions

View file

@ -31,7 +31,7 @@
(eval-when-compile (require 'exwm-workspace)) (eval-when-compile (require 'exwm-workspace))
(defvar exwm-floating-border-width 1 "Border width of the floating window.") (defvar exwm-floating-border-width 1 "Border width of the floating window.")
(defvar exwm-floating-border-color "blue" (defvar exwm-floating-border-color "navy"
"Border color of the floating window.") "Border color of the floating window.")
(defvar exwm-floating-setup-hook nil (defvar exwm-floating-setup-hook nil
@ -79,6 +79,8 @@
`((minibuffer . nil) ;use the one on workspace `((minibuffer . nil) ;use the one on workspace
(background-color . ,exwm-floating-border-color) (background-color . ,exwm-floating-border-color)
(internal-border-width . ,exwm-floating-border-width) (internal-border-width . ,exwm-floating-border-width)
(left . 10000)
(top . 10000)
(unsplittable . t))) ;and fix the size later (unsplittable . t))) ;and fix the size later
(exwm--unlock)))) (exwm--unlock))))
(frame-id (string-to-number (frame-parameter frame 'window-id))) (frame-id (string-to-number (frame-parameter frame 'window-id)))
@ -155,12 +157,6 @@
(make-instance 'xcb:ChangeWindowAttributes (make-instance 'xcb:ChangeWindowAttributes
:window frame-id :value-mask xcb:CW:EventMask :window frame-id :value-mask xcb:CW:EventMask
:event-mask xcb:EventMask:SubstructureRedirect)) :event-mask xcb:EventMask:SubstructureRedirect))
;; Reparent this frame to the original one
(xcb:+request exwm--connection
(make-instance 'xcb:ReparentWindow
:window outer-id :parent original-id
:x (- x exwm-floating-border-width)
:y (- y exwm-floating-border-width)))
;; Save the geometry ;; Save the geometry
;; 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.
@ -182,6 +178,12 @@
(make-instance 'xcb:ChangeWindowAttributes (make-instance 'xcb:ChangeWindowAttributes
:window id :value-mask xcb:CW:EventMask :window id :value-mask xcb:CW:EventMask
:event-mask exwm--client-event-mask)) :event-mask exwm--client-event-mask))
;; Reparent this frame to the original one
(xcb:+request exwm--connection
(make-instance 'xcb:ReparentWindow
:window outer-id :parent original-id
:x (- x exwm-floating-border-width)
:y (- y exwm-floating-border-width)))
(xcb:flush exwm--connection) (xcb:flush exwm--connection)
;; Set window/buffer ;; Set window/buffer
(with-current-buffer (exwm--id->buffer id) (with-current-buffer (exwm--id->buffer id)

View file

@ -139,9 +139,9 @@ corresponding buffer.")
height) height)
2))))) 2)))))
(xcb:flush exwm--connection) (xcb:flush exwm--connection)
(setq kill-buffer-query-functions nil)
(setq exwm--id-buffer-alist (assq-delete-all id exwm--id-buffer-alist)) (setq exwm--id-buffer-alist (assq-delete-all id exwm--id-buffer-alist))
(kill-buffer (current-buffer)) (let ((kill-buffer-query-functions nil))
(kill-buffer (current-buffer)))
(throw 'return 'ignored)) (throw 'return 'ignored))
;; Manage the window ;; Manage the window
(exwm--log "Manage #x%x" id) (exwm--log "Manage #x%x" id)
@ -190,6 +190,9 @@ corresponding buffer.")
(xcb:flush exwm--connection) (xcb:flush exwm--connection)
(when (buffer-live-p buffer) (when (buffer-live-p buffer)
(with-current-buffer buffer (with-current-buffer buffer
(when exwm--floating-frame
(make-frame-invisible exwm--floating-frame)
(redisplay))
(setq exwm-workspace--switch-history-outdated t) (setq exwm-workspace--switch-history-outdated t)
;; ;;
(when withdraw-only (when withdraw-only
@ -224,8 +227,8 @@ corresponding buffer.")
(make-instance 'xcb:DeleteProperty (make-instance 'xcb:DeleteProperty
:window id :property xcb:Atom:WM_STATE)) :window id :property xcb:Atom:WM_STATE))
(xcb:flush exwm--connection)) (xcb:flush exwm--connection))
(setq kill-buffer-query-functions nil) (let ((kill-buffer-query-functions nil)
(let ((floating exwm--floating-frame)) (floating exwm--floating-frame))
(kill-buffer) (kill-buffer)
(when floating (when floating
(select-window (select-window