emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HowTo: Detect when a frame's size changes


From: martin rudalics
Subject: Re: HowTo: Detect when a frame's size changes
Date: Wed, 05 Apr 2017 09:54:07 +0200

> Note that `window-size-change-functions' is also called when the
> relative sizes of windows change.  So you have to store the previous
> frame size and compare it with the current one to find out whether the
> frame really changed size or only some of its windows.

Actually that shouldn't be necessary.  Try with

(defun beep-when-frame-size-changed (frame)
  (when (or (/= (window-pixel-width-before-size-change (frame-root-window 
frame))
                (window-pixel-width (frame-root-window frame)))
            (/= (window-pixel-height-before-size-change (frame-root-window 
frame))
                (window-pixel-height (frame-root-window frame))))
    (ding)))

(add-hook 'window-size-change-functions 'beep-when-frame-size-changed)

martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]