From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: raman@google.com (T.V Raman) Newsgroups: gmane.emacs.devel Subject: Re: HowTo: Detect when a frame's size changes Date: Wed, 5 Apr 2017 10:32:54 -0700 Message-ID: <22757.10822.198203.59700@retriever.mtv.corp.google.com> References: <58E49596.70202@gmx.at> <58E4A29F.6080603@gmx.at> <58E528DF.9000808@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1491413604 31370 195.159.176.226 (5 Apr 2017 17:33:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 5 Apr 2017 17:33:24 +0000 (UTC) Cc: emacs-devel@gnu.org, raman@google.com To: rudalics@gmx.at Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 05 19:33:20 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvonv-0007G2-OD for ged-emacs-devel@m.gmane.org; Wed, 05 Apr 2017 19:33:11 +0200 Original-Received: from localhost ([::1]:41634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvoo1-0002LZ-Kc for ged-emacs-devel@m.gmane.org; Wed, 05 Apr 2017 13:33:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvonm-0002Jn-SP for emacs-devel@gnu.org; Wed, 05 Apr 2017 13:33:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvonh-00038z-Vx for emacs-devel@gnu.org; Wed, 05 Apr 2017 13:33:02 -0400 Original-Received: from mail-pg0-x22c.google.com ([2607:f8b0:400e:c05::22c]:34740) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cvonh-00037g-QI for emacs-devel@gnu.org; Wed, 05 Apr 2017 13:32:57 -0400 Original-Received: by mail-pg0-x22c.google.com with SMTP id 21so11351243pgg.1 for ; Wed, 05 Apr 2017 10:32:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:mime-version:content-transfer-encoding:message-id:date:to:cc :subject:in-reply-to:references; bh=1AQfLY7oXGikX5adEKM6vXKmIuG5xCgk2yRNcKgzDqM=; b=WC6unq0HdrmiDa+YDlXRgDHAaPBJ3tLvc8hyUQt5xVw/K2tMhPQsaRODQuIIf1x36K CbQqiW8pmMbBiHL6RtrC7+xe5JES5kjPiRWhMudIFL4mF6dl+wK6BYJ2vRodZBs/p2GO 5tQ/FGZEBtYQEPXo0DoTPNpMqgk2j8rvxLgF7ioHhqX7aVZKgyGgxtPXLKy2cC3xYjjw gpkljNC0CXNxcZDaGZAtxgZbsgFQ7SXDWzMQVFS8My+X71+Vp4DzL/b4z301aYYxF3+b vk0BOjsPMu5KlL5AX8dsjtKRN9+tdXYmfE5PxyinpPh/g/BMX9h3gTI+ieckXoEe4n8D Dxig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:content-transfer-encoding :message-id:date:to:cc:subject:in-reply-to:references; bh=1AQfLY7oXGikX5adEKM6vXKmIuG5xCgk2yRNcKgzDqM=; b=WszTq+KlWRde6rbGzN9rxwjLPNTovxR3uvJ5HSbsp00Jdmgds06AX1SuIgV7w/k9v5 nspqepdu73+Km8exmSXNuJ1kudw9czJZGnlr8ww/3rCq9a0QNEdwwA6fmg0JO6HTPEWU OUbJdmo0tomzTW0rEK9rcsxn5xawQ9aRlirqH8TEi35aob8wpb5JDbk92QbZHomaBAE6 1MeB7eXoIRSX0q4mJFXCdC7tZsCOygIxJQjTHLlvYL3k8HTOwDpcFlLNLCtUUp0smV52 oozL/CCYelW/k1gjGPxNObjwLoZ7FJ6A6YR98wHM5Xa4FRsY0JR4WUDHWi2c5yOGUk7w lAJw== X-Gm-Message-State: AFeK/H3awxDmwX4FAAoUY6cnfapx8a476RIC3oxh71EjQNqzILxvHXyIVgn0jiFPMw5cJUGT X-Received: by 10.99.115.68 with SMTP id d4mr31359404pgn.146.1491413576602; Wed, 05 Apr 2017 10:32:56 -0700 (PDT) Original-Received: from retriever.mtv.corp.google.com ([100.98.8.138]) by smtp.gmail.com with ESMTPSA id t66sm38715188pfk.53.2017.04.05.10.32.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 10:32:55 -0700 (PDT) Original-Received: by retriever.mtv.corp.google.com (Postfix, from userid 13930) id 631331A1E65; Wed, 5 Apr 2017 10:32:54 -0700 (PDT) In-Reply-To: <58E528DF.9000808@gmx.at> X-Mailer: VM 8.1.1 under 26.0.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:213680 Archived-At: Thanks Martin! frame-size-changed-p would be nice --- Basically I was writing myself some code in Emacspeak so it would cue me via sounds to the position of the current window relative to the overall layout. I wrote myself this function: -- and was looking to see if I could avoid some of the computes by cacheing values --- though for now it doesn't look like the code I have is sufficiently inefficient to deserve cacheing. (sox-multiwindow ...) used below uses SoX to produce a short tone, and the tone's pitch and left/right pan get paramaeterized appropriately=20= (defun emacspeak--sox-multiwindow (corners) "Takes `window-edges' and plays a sound cue based on position of curr= ent window with respect to the overall window layout." (let ((tr 0) (mr (/ (frame-height) 2)) (br (1- (frame-height))) (lc 0) (mc (/ (frame-width) 2)) (rc (frame-width))) (cond ((equal corners `(,lc ,tr ,mc ,br)) (sox-multiwindow) 'left-half) ((equal corners `(,mc ,tr ,rc, br)) (sox-multiwindow 'swap) 'right-half) ((equal corners `(,lc ,tr ,rc ,mr)) (sox-multiwindow nil 2) 'top-half) ((equal corners `(,lc ,mr ,rc ,br)) (sox-multiwindow nil 1.3) 'bottom-half) ((equal corners `(,lc ,tr ,mc ,mr))=20 (sox-multiwindow nil 2.5) 'top-left) ((equal corners `(,mc ,tr ,rc ,mr)) (sox-multiwindow t 2.5) 'top-right) ((equal corners `(,lc ,mr ,mc ,br)) (sox-multiwindow nil 0.9) 'bottom-left) ((equal corners `(,mc ,mr ,rc ,br)) (sox-multiwindow 'swap 0.9) 'bottom-right) (t "")))) martin rudalics writes: > > Thanks! will try that >=20 > Hmmm... rather not. You will still get false positives when the > minibuffer window is resized. For the moment stick to my earlier > proposal: When you run your =E2=80=98window-size-change-functions=E2= =80=99 function > remember the old values of =E2=80=98frame-pixel-width=E2=80=99 and =E2= =80=98frame-pixel-height=E2=80=99 > (maybe in a frame parameter) and the next time you run it compare th= em > with the current values. >=20 > I will fix that soon probably by providing a =E2=80=98frame-size-cha= nged-p=E2=80=99 > function that you can use during =E2=80=98window-size-change-functio= ns=E2=80=99. > Providing a separate =E2=80=98frame-size-change-functions=E2=80=99 h= ook would be also > possible but the interaction of these could be tricky. >=20 > martin --=20 --