about summary refs log tree commit diff
path: root/exwm-floating.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-08-09T05·20+0800
committerChris Feng <chris.w.feng@gmail.com>2016-08-09T05·20+0800
commit6e0b944c2de14fe67d292f3351bf4353f7b846d8 (patch)
tree59e56fb41131841d0a0c3a9341f9833fc402560d /exwm-floating.el
parent06c1b0485a1815d13ded7bd717adf5d9735be3df (diff)
Ensure floating hooks are run in the right context
* exwm-floating.el (exwm-floating-setup-hook, exwm-floating-exit-hook):
Fix doc string.
(exwm-floating--set-floating, exwm-floating--unset-floating): Set the
context.
Diffstat (limited to 'exwm-floating.el')
-rw-r--r--exwm-floating.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/exwm-floating.el b/exwm-floating.el
index 6702e38d61..464dd20e10 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -34,9 +34,11 @@
   "Border color of the floating window.")
 
 (defvar exwm-floating-setup-hook nil
-  "Normal hook run when a window has been made floating.")
+  "Normal hook run when an X window has been made floating, in the
+context of the corresponding buffer.")
 (defvar exwm-floating-exit-hook nil
-  "Normal hook run when a window has exited floating state.")
+  "Normal hook run when an X window has exited floating state, in the
+context of the corresponding buffer.")
 
 ;; Cursors for moving/resizing a window
 (defvar exwm-floating--cursor-move nil)
@@ -252,7 +254,8 @@
                                              xcb:ConfigWindow:Y)
                          :x 0 :y 0))
       (xcb:flush exwm--connection)))
-  (run-hooks 'exwm-floating-setup-hook)
+  (with-current-buffer (exwm--id->buffer id)
+    (run-hooks 'exwm-floating-setup-hook))
   ;; Redraw the frame.
   (redisplay))
 
@@ -324,7 +327,8 @@
       (let ((window (frame-selected-window exwm-workspace--current)))
         (set-window-buffer window buffer)
         (select-window window))))
-  (run-hooks 'exwm-floating-exit-hook))
+  (with-current-buffer (exwm--id->buffer id)
+    (run-hooks 'exwm-floating-exit-hook)))
 
 ;;;###autoload
 (defun exwm-floating-toggle-floating ()