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

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

bug#21480: 25.0.50; Frame width gets set to 16 pixels wider than the pro


From: martin rudalics
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

> (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






reply via email to

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