branch: elpa/golden-ratio
commit cbd076aa120d1ec287f5406a9a12e6b5930f518e
Merge: 79ead1cba6 0b90ffbf02
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    Merge pull request #34 from hickinbottoms/fix-mouse-window-select
    
    Fix mouse window select
---
 golden-ratio.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/golden-ratio.el b/golden-ratio.el
index d6e8c6a49a..c5bd4ba36f 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -122,6 +122,10 @@ will not cause the window to be resized to the golden 
ratio."
                                    (memq (car-safe com) this-command)))))
     (golden-ratio)))
 
+(defun golden-ratio--mouse-leave-buffer-hook ()
+  (run-at-time 0.1 nil (lambda ()
+                        (golden-ratio))))
+
 ;;;###autoload
 (define-minor-mode golden-ratio-mode
     "Enable automatic window resizing with golden ratio."
@@ -131,6 +135,7 @@ will not cause the window to be resized to the golden 
ratio."
       (progn
         (add-hook 'window-configuration-change-hook 'golden-ratio)
         (add-hook 'post-command-hook 'golden-ratio--post-command-hook)
+        (add-hook 'mouse-leave-buffer-hook 
'golden-ratio--mouse-leave-buffer-hook)
         (ad-activate 'other-window)
         (ad-activate 'pop-to-buffer))
       (remove-hook 'window-configuration-change-hook 'golden-ratio)

Reply via email to