unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: raman <raman@google.com>, emacs-devel@gnu.org
Subject: Re: HowTo: Detect when a frame's size changes
Date: Wed, 05 Apr 2017 09:54:07 +0200	[thread overview]
Message-ID: <58E4A29F.6080603@gmx.at> (raw)
In-Reply-To: <58E49596.70202@gmx.at>

 > 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	other threads:[~2017-04-05  7:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05  3:03 HowTo: Detect when a frame's size changes raman
2017-04-05  6:58 ` martin rudalics
2017-04-05  7:54   ` martin rudalics [this message]
     [not found]     ` <p91a87uhon5.fsf@raman-glaptop2>
2017-04-05 17:26       ` martin rudalics
2017-04-05 17:32         ` T.V Raman
2017-04-05 18:05           ` martin rudalics
2017-04-05 18:12             ` T.V Raman
2017-04-11 10:55           ` martin rudalics
2017-04-12 15:22             ` raman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58E4A29F.6080603@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=raman@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).