unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Lennart Borgman'" <lennart.borgman@gmail.com>,
	"'Jan Djärv'" <jan.h.d@swipnet.se>
Cc: 7296@debbugs.gnu.org
Subject: bug#7296: display-pixel-height not enough
Date: Sat, 30 Oct 2010 08:06:47 -0700	[thread overview]
Message-ID: <9549EA1551554B2C97BE46ADFB617435@us.oracle.com> (raw)
In-Reply-To: <AANLkTi=ihDWLrOmoLmgOC_MYPn-ObVdwHQC5uP+9TMRV@mail.gmail.com>

> >> The Emacs frame can be partly hidden by the taskbar...
> >> if the height is ... x-dsiplay-pixel-height...
> Every function that tries to maximize just height will do it.

Can you give a recipe starting from emacs -Q?  How are you setting the frame
height?  Remember that the frame `height' parameter should not include the frame
area outside the space available for text, and it is measured in lines, not
pixels.

If you are setting the `height' parameter based on the `x-display-pixel-height'
then you should first subtract frame borders, horizontal scroll bar (well, there
isn't any, but the same method applies for the width), title bar, and (except on
Mac) menu bar.  And then convert pixels to char size -  the `height' parameter
is the number of text lines available at the frame's char size.


See http://www.emacswiki.org/emacs/frame-cmds.el for examples.  The code
compensates for MacIntosh thingies that reduce the available space, but it uses
`x-display-pixel-height' otherwise.  See `maximize-frame-vertically' and
`maximize-frame', which do not overlap the Windows task bar.

Something like this calculates the `height' frame parameter:

(- (/ (- (x-display-pixel-height)
         (* 2 (cdr (assq 'border-width (frame-parameters FRAME))))
         (frame-extra-pixels-height FRAME)
         window-mgr-title-bar-pixel-height
         (smart-tool-bar-pixel-height))
      (frame-char-height FRAME))
   (if (eq window-system 'mac)
       0 ; Menu bar for Carbon Emacs is not in the frame.
     (cdr (assq 'menu-bar-lines (frame-parameters FRAME)))))))

Where:

(defun frame-extra-pixels-height (frame)
  "Pixel diff between FRAME total height and its text area height."
  (- (frame-pixel-height frame)
     (* (frame-char-height frame) (frame-height frame))))

(defcustom window-mgr-title-bar-pixel-height
           (if (eq window-system 'mac) 22 27)
  "*Height of frame title bar provided by the window manager, in pixels.
You might alternatively call this constant the title-bar \"width\" or
\"thickness\".  There is no way for Emacs to determine this, so you
must set it."
  :type 'integer)

(defun smart-tool-bar-pixel-height (&optional frame)
  "Pixel height of Mac smart tool bar."
  (if (and (boundp 'mac-tool-bar-display-mode)
           (> (frame-parameter frame 'tool-bar-lines) 0))
      (if (eq mac-tool-bar-display-mode 'icons) 40 56)
    0))






  reply	other threads:[~2010-10-30 15:06 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-28 10:11 bug#7296: display-pixel-height not enough Lennart Borgman
2010-10-28 18:01 ` Eli Zaretskii
2010-10-28 20:39   ` Lennart Borgman
2010-10-29  7:59     ` Eli Zaretskii
2010-10-29  8:03       ` Lennart Borgman
2010-10-29 10:12         ` Eli Zaretskii
2010-10-29  8:42       ` Lennart Borgman
2010-10-29 10:13       ` Jan Djärv
2010-10-29 10:57         ` Eli Zaretskii
2010-10-29 12:28           ` Lennart Borgman
2010-10-29 13:15             ` Jan D.
2010-10-29 13:38               ` Lennart Borgman
2010-10-29 14:51                 ` Drew Adams
2010-10-29 16:53                 ` Jan Djärv
2010-10-29 17:37                   ` Stefan Monnier
2010-10-29 19:27                     ` Lennart Borgman
2010-10-29 19:59                     ` Jan D.
2010-10-29 16:24               ` Stefan Monnier
2010-10-29 19:57                 ` Jan D.
2010-10-29 20:05                   ` Lennart Borgman
2010-10-30  7:28                     ` Jan Djärv
2010-10-30  9:25                       ` Lennart Borgman
2010-10-30 10:45                         ` Jan Djärv
2010-10-30 14:05                           ` Lennart Borgman
2010-10-30 15:06                             ` Drew Adams [this message]
2010-10-30 15:14                               ` Lennart Borgman
2010-10-30 17:27                             ` Jan Djärv
2010-10-30 17:41                               ` Lennart Borgman
2010-10-30 18:30                                 ` Jan Djärv
2010-10-30 18:59                                   ` Lennart Borgman
2010-10-31 10:51                                     ` Jan Djärv
2010-10-31 12:46                                       ` Lennart Borgman
2010-11-01 11:37                                         ` Jan Djärv
2010-11-01 12:00                                           ` Lennart Borgman
2010-11-01 19:38                                             ` Jan Djärv
2010-11-01 20:26                                               ` Eli Zaretskii
2010-11-01 20:35                                                 ` Lennart Borgman
2010-11-01 21:11                                                 ` Jan Djärv
2010-11-01 21:40                                                   ` Eli Zaretskii
2010-11-02  1:09                                                     ` Jason Rumney
2010-11-02  4:01                                                       ` Eli Zaretskii
2010-11-02 13:25                                                         ` Jan D.
2010-11-02 14:53                                                           ` Eli Zaretskii
2010-11-02 16:10                                                             ` Lennart Borgman
2010-11-02 17:48                                                             ` Drew Adams
2010-11-02 17:54                                                             ` Jan Djärv
2010-10-31  3:47                                   ` Stefan Monnier
2010-10-31  4:13                         ` YAMAMOTO Mitsuharu
2010-10-31 10:46                           ` Lennart Borgman
2010-11-01  0:10                             ` YAMAMOTO Mitsuharu
2010-11-01  0:24                               ` Lennart Borgman
2010-11-01  0:56                                 ` YAMAMOTO Mitsuharu
2010-11-01  1:26                                   ` Lennart Borgman
2010-11-01  2:46                                     ` YAMAMOTO Mitsuharu
2010-11-01 10:20                                       ` Lennart Borgman
2010-11-01 11:40                                         ` Jan Djärv
2010-11-01 12:04                                           ` Lennart Borgman
2010-11-01 19:40                                             ` Jan Djärv
2010-11-02  3:45                                         ` YAMAMOTO Mitsuharu
2010-11-01  7:44                                     ` Jason Rumney
2010-11-01 10:12                                       ` Lennart Borgman
2010-11-01 15:09                                     ` Drew Adams
2010-11-01 18:08                                       ` Lennart Borgman
2010-11-02 14:24                                       ` Stefan Monnier
2010-11-02 15:24                                         ` Lennart Borgman
2010-11-02 17:17                                           ` Stefan Monnier
2010-10-31 10:53                           ` Jan Djärv
2010-11-02 18:24 ` Drew Adams
2015-01-03 18:46 ` martin rudalics
2015-02-13 18:29   ` martin rudalics

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=9549EA1551554B2C97BE46ADFB617435@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=7296@debbugs.gnu.org \
    --cc=jan.h.d@swipnet.se \
    --cc=lennart.borgman@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).