help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to determine menu-bar dimensions?


From: rgb
Subject: Re: how to determine menu-bar dimensions?
Date: 8 Jul 2005 23:52:18 -0700
User-agent: G2/0.2

Drew Adams wrote:
> How to determine the menu-bar dimensions: width and height, say in pixels?
>
> In some cases, such as Windows, the menu-bar characters seem to be set by
> the window manager; in other cases they are governed by the Emacs `menu'
> face or the .Xdefaults file. Anyone have an idea how to calculate the
> overall dimensions of the menu-bar? (Similarly for the tool-bar.)

I messed with this for a very long time.  I don't know why. I don't
actually care.  I guess I thought it should be easy and got caught up
in it after a while.

This works for the toolbar provided there is only 1 window in the
frame.

(progn (tool-bar-mode 0)
       (sit-for 0)
       (let ((fph (frame-pixel-height))
             (wh (window-height)))
         (tool-bar-mode 1)
         (sit-for 0)
         (+ (* (- wh (window-height))
               (frame-char-height))
            (- (frame-pixel-height) fph))))

But there seems to be a bug (cvs) that prevents similar code from
working for the menu bar.  Apparently (frame-char-height) doesn't
count the menu bar and for that matter neither does (frame-height).
I'll try to write it up in the morning.  If you're working on a non MS
Windows system the bug may not apply and the above may work for
toggling menu-bar-mode too.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]