unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: frame size&position woes
Date: Sun, 21 Jul 2013 16:03:15 +0200	[thread overview]
Message-ID: <51EBEA23.2000805@gmx.at> (raw)
In-Reply-To: <CAAeL0STYcvr_JJ2DwrRkyzQi0HbXRxYD+_c4AAev-SHuLcYwwg@mail.gmail.com>

 > Now I'm dealing with something related to bug#25 (yeah, the report is
 > that old, and even older), which Glenn merged with #14795 though they
 > are really different.
 >
 > The problem I'm seeing is this:
 >
 >   emacs -Q
 >   M-: (frame-height) <RET>    => 38   ;; (1)
 >   ;; Now, make the frame narrower until the menu wraps just after "Tools"
 >   M-: (frame-height) <RET>    => 36   ;; (2)
 >   ;; For extra fun, make the frame just wide enough to wrap after "Help"

Gets me still 36 (wrapping _before_ "Help").

 >   M-: (frame-height) <RET>    => 38   ;; (3)
 >
 > (1) is the "real" height, or at least, what we do say that's the real height.

It's not possible to tell what the real height of a frame is.

 > (2) happens even when (frame-parameter nil 'menu-bar-lines) is still 1

FWIW this parameter is ignored on Windows since the later itself resizes
the menubar (basically, we'd have to deduce the number of lines from the
frame heights).  One can, however, truncate menubars on Windows which is
the default on GNU/Linux

 > (3) happens (depending on your default font, I suppose), because when you do
 >     M-: whatever you're using the minibuffer menu, which has less items.

I'm not sure what you mean here.  Note that on Windows the toolbar is
included in the frame's height.

 > If all that behavior is considered sane, I'm spechless.

IIRC Windows won't tell you whether it wrapped the menubar.  So you can
tell only by comparing the sizes of the outer rectangle and the client
rectangle taking into account the font of the menubar.

 > To fix that problem for desktop-restore-frames (and it is a problem,
 > because a frame with a wrapped menu gets shorter and shorter with each
 > save/restore cycle). other than adding new APIs to get real
 > dimensions, the only answer I can think of is
 >
 >   (let ((mblines (frame-parameter *f* 'menu-bar-lines)))
 >     (set-frame-parameter *f* 'menu-bar-lines 0)
 >     (prog1
 >         (frame-height *f*)
 >       (set-frame-parameter *f* 'menu-bar-lines mblines)))
 >
 > which works, but it is visible to the user (removing the menu, even
 > briefly, obviously triggers redisplay of the frame).

I never tried too experiment with invisible frames and getting
information from them.  Maybe they could be used here.

 > Which brings me to that other problem:
 >
 > Just yesterday I added a fix for saving & restoring iconified frames.
 > Iconified frames have nonsensical positions (left + -32000) (top +
 > -32000), so I have to remove them to allow Emacs to set them at a
 > default position when restored. The ideal answer would be to get the
 > real position of the de-iconified frame, but again... to get these
 > values I must de-iconize, record the values, re-iconize again... which
 > is visible to the user.

On Windows you should be able to get the normal position and size of an
iconified frame.  I'm not sure about other systems.  In the worst case
we'd have to save them before processing an iconify request.

 > And the same happens with maximized / fullscreen / fullwidth /
 > fullheight frames. I'm not storing their original size & position to
 > avoid the user the "flash" of restoring/maximizing back.

We could "store" the values softly, that is, not via
`modify-frame-parameters'.

 > At this point, I'm really thinking of just adding an option
 > desktop-restore-frames-extra-accurate (name irrelevant) that, when
 > set, will give me permission to freely manipulate (temporarily)
 > frames' menu bars, tool bars, maximized states and whatever I need in
 > order to get the correct info. The user will trade a bit of discomfort
 > when saving the desktop for a better restoring experience.
 >
 > But, to get back on track, I strongly believe we need better ways of
 > asking about basic frame metrics. Does anyone else agree, or I'm being
 > grumpy and unreasonable?

We have not even agreed upon what frame metrics are.  Asking here will
get you at least five different opinions.

martin



  parent reply	other threads:[~2013-07-21 14:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-21 12:56 frame size&position woes Juanma Barranquero
2013-07-21 12:58 ` Juanma Barranquero
2013-07-21 14:03 ` martin rudalics [this message]
2013-07-21 15:42   ` Juanma Barranquero
2013-07-21 15:58     ` Juanma Barranquero
2013-07-22  8:22     ` martin rudalics
2013-07-22  9:40       ` Juanma Barranquero
2013-07-22 15:52         ` Eli Zaretskii
2013-07-22 20:36           ` Juanma Barranquero
2013-07-23  2:45             ` Eli Zaretskii
2013-07-23 23:47               ` Juanma Barranquero
2013-07-24  3:55                 ` Eli Zaretskii
2013-07-24 10:42                   ` Juanma Barranquero
2013-07-24 14:37                     ` Eli Zaretskii
2013-07-24 14:51                       ` Juanma Barranquero
2013-07-24 16:55                         ` Eli Zaretskii
2013-07-24 17:01                           ` Juanma Barranquero
2013-07-24 17:41                             ` Eli Zaretskii
2013-07-24 17:49                               ` Juanma Barranquero

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=51EBEA23.2000805@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.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).