From: martin rudalics <rudalics@gmx.at>
To: Kaushal Modi <kaushal.modi@gmail.com>, 21480@debbugs.gnu.org
Subject: bug#21480: 25.0.50; Frame width gets set to 16 pixels wider than the provided width in the args
Date: Tue, 15 Sep 2015 10:29:34 +0200 [thread overview]
Message-ID: <55F7D6EE.8050105@gmx.at> (raw)
In-Reply-To: <CAFyQvY2xQF4mQK1UbH_j1o0kAbyK2PcthDza59iT9Gt_eFKjYA@mail.gmail.com>
> (defvar bkp--frame-height-px nil)
> (defvar bkp--frame-width-px nil)
>
> (defun modi/toggle-menu-bar ()
> "Toggle the menu bar.
> Also restore the original frame size when disabling the menu bar."
> (interactive)
> (let ((frame-resize-pixelwise t))
> ;; If the menu bar is hidden currently, take a backup of the frame
> height.
> (when (null menu-bar-mode)
> (setq bkp--frame-height-px (frame-pixel-height))
> (setq bkp--frame-width-px (frame-pixel-width))
Here you use "pixel sizes" again. You have to use the "text sizes".
> ;; `frame-pixel-width' is returning a value higher by 16 pixels
> compared
> ;; to that set using `set-frame-size'. So the below adjustment has to
> be made.
> ;; (setq bkp--frame-width-px (- (frame-pixel-width) 16))
> )
> (menu-bar-mode 'toggle)
> ;; Restore frame size if menu bar is hidden after toggle
> (when (null menu-bar-mode)
> (set-frame-size nil bkp--frame-width-px bkp--frame-height-px
> :pixelwise))))
>
> (global-set-key (kbd "<f2>") #'modi/toggle-menu-bar)
>
> I noticed one more thing.. In my emacs setup, I need the adjustment of 16
> pixels (as shown in the code above).
> But in an emacs -Q session, I need an adj of 32 pixels. That might probably
> help narrow down the problem.
>
> Does it have to do with the fonts I use? Because emacs -Q starts with
> Dejavu Sans Mono font. Whereas my configured emacs uses PragmataPro font.
This means that the scroll bar + fringes widths differ in these setups.
BTW, setting ‘frame-inhibit-implied-resize’ to '(menu-bar-lines) should
allow to toggle the menu bar without any resize of the outer frame.
martin
next prev parent reply other threads:[~2015-09-15 8:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-14 21:13 bug#21480: 25.0.50; Frame width gets set to 16 pixels wider than the provided width in the args Kaushal Modi
2015-09-14 21:21 ` Kaushal Modi
2015-09-15 8:29 ` martin rudalics [this message]
2015-09-15 8:27 ` martin rudalics
2015-09-15 8:33 ` martin rudalics
2015-09-15 13:39 ` Kaushal Modi
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=55F7D6EE.8050105@gmx.at \
--to=rudalics@gmx.at \
--cc=21480@debbugs.gnu.org \
--cc=kaushal.modi@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).