From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: How to restore the layout? Date: Sat, 29 Jun 2013 16:48:36 -0700 (PDT) Message-ID: References: <51C5AA68.4000204@alice.it> <51CA0D4C.7080204@alice.it> <51CC3E42.7020409@alice.it> <51CC4CC1.3030202@alice.it> <51CC8403.1030009@gmx.at> <51CCA56A.8000508@gmx.at> <51CD49CF.1090103@gmx.at> <2FB4C583-960C-4DA8-8B2E-29DF8D96770E@swipnet.se> <51CD6324.2040504@gmx.at> <834ncifkq9.fsf@gnu.org> <83zjuae19s.fsf@gnu.org> <83r4fmdsw5.fsf@gnu.org> <85k3ldtion.fsf@member.fsf.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1372549729 24813 80.91.229.3 (29 Jun 2013 23:48:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Jun 2013 23:48:49 +0000 (UTC) Cc: Emacs developers To: Juanma Barranquero , Stephen Leake Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 30 01:48:49 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ut4sq-0003WN-No for ged-emacs-devel@m.gmane.org; Sun, 30 Jun 2013 01:48:48 +0200 Original-Received: from localhost ([::1]:34881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ut4sq-0005z7-6J for ged-emacs-devel@m.gmane.org; Sat, 29 Jun 2013 19:48:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ut4sl-0005yq-Kf for emacs-devel@gnu.org; Sat, 29 Jun 2013 19:48:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ut4sk-0004n0-67 for emacs-devel@gnu.org; Sat, 29 Jun 2013 19:48:43 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:27981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ut4sj-0004mk-Vt for emacs-devel@gnu.org; Sat, 29 Jun 2013 19:48:42 -0400 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r5TNmcjx019548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 29 Jun 2013 23:48:39 GMT Original-Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r5TNmbua026811 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 29 Jun 2013 23:48:38 GMT Original-Received: from abhmt117.oracle.com (abhmt117.oracle.com [141.146.116.69]) by userz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r5TNmbdQ026806; Sat, 29 Jun 2013 23:48:37 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.7 (607090) [OL 12.0.6668.5000 (x86)] X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:161310 Archived-At: > > Moving the frame outside the current display is an issue; it would be > > nice if the restore could detect that, and keep the frames in view. >=20 > How can I do that? Is there any way to get from Emacs the maximum > dimensions of a frame in the current display, other than >=20 > (let ((frame (make-frame '((fullscreen . maximized))))) > (prog1 > (cons (frame-width frame) (frame-height frame)) > (delete-frame frame))) >=20 > which has the downside of being noticeable to the user? Dunno whether it helps, but this is what I do in frame-cmds.el, to determine the screen space available for positioning and resizing frames, e.g., for moving them about or tiling them. 1. Provide a user option, `available-screen-pixel-bounds', which defaults to nil and otherwise is a list of the pixel coordinates of the upper left and the lower right corners of the available screen space, measured from screen absolute origin, (0, 0), at the upper left. For example, (x0 y0 x1 y1), where (x0, y0) is the upper left position and (x1, y1) is the lower right position. 2. If the option is nil then the available space is calculated by the function with the same name. It tries to return the currently available screen area. The option is available to let you declare some known outside area off limits (e.g., the MS Windows task bar). (defun available-screen-pixel-bounds () (or available-screen-pixel-bounds (if (fboundp 'mac-display-available-pixel-bounds) ; Mac-OS (mac-display-available-pixel-bounds) (list 0 0 (x-display-pixel-width) (x-display-pixel-height))))) 3. Function `effective-screen-pixel-bounds' starts with `available-screen-pixel-bounds' and removes the space used by the standalone minibuffer frame of oneonone.el: (defun effective-screen-pixel-bounds () (if (boundp '1on1-minibuffer-frame) (append (butlast (available-screen-pixel-bounds)) (list (frame-geom-value-numeric 'top (cdr (assq 'top (frame-parameters 1on1-minibuffer-frame)))))) (available-screen-pixel-bounds))) [`frame-geom-value-numeric' returns a numeric value (pixels) that is equivalent to a frame geometry spec. Examples:=20 Assuming display height/width=3D1024, frame height/width=3D600: 300 inside display edge: 300 =3D> 300 (+ 300) =3D> 300 300 inside opposite display edge: (- 300) =3D> -300 -300 =3D> -300 300 beyond display edge (=3D 724 inside opposite display edge): (+ -300) =3D> -724 300 beyond display edge (=3D 724 inside opposite display edge): (- -300) =3D> 724 In the last two examples, the returned value is relative to the opposite frame edge from the edge indicated in the input spec.] Again, dunno whether such an approach helps you. It is based on `x-display-pixel-(width|height)'. Whether that helps when using multiple monitors etc., I'm not sure. The idea of letting users override an available-space calculation might be something to consider, at least. 4. In the same library, frame-cmds.el, I have commands that move a frame incrementally up/down/left/right. You can easily move a frame off the display that way, so you no longer see it. Or you can move it back onto the display, if off. There is a user option, `move-frame-wrap-within-display-flag', that determines whether continuing to move a frame in some direction brings it back around from the opposite screen border, i.e., wraps the movement so the frame comes back onto the display. If the option is nil then you can keep moving a frame as far off the display as you like. IIRC, with multiple displays, moving a frame off of one display can move it onto another. HTH.