unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: ynyaaa@gmail.com
To: martin rudalics <rudalics@gmx.at>
Cc: 38705@debbugs.gnu.org
Subject: bug#38705: 26.3; set-frame-size pixelwise makes frame larger
Date: Tue, 24 Dec 2019 22:49:55 +0900	[thread overview]
Message-ID: <86lfr1al4s.fsf@gmail.com> (raw)
In-Reply-To: <40c9e794-3873-a4a4-eaea-8a7d2f6bacc7@gmx.at> (martin rudalics's message of "Mon, 23 Dec 2019 11:08:14 +0100")

martin rudalics <rudalics@gmx.at> writes:

> Right.  But here
>
> (progn (set-frame-size nil 500 500 t)
>        (list (list (frame-outer-width)
>                    (frame-pixel-width)
>                    (frame-inner-width)
>                    (frame-text-width))
>              (list (frame-outer-height)
>                    (frame-pixel-height)
>                    (frame-inner-height)
>                    (frame-text-height))))
> =>((540 532 532 500) (583 536 536 500))
>
> This is because 'set-frame-size' sets "the size of the text area of
> FRAME" and the size of the text area is returned by 'frame-text-width'
> and 'frame-text-height'.  Just another Emacs idiosyncrasy ...
>
> martin

I tried to set up the frame outer size like below.
  ;;; sample ~/.emacs.d/init.el
  (defun test-set-frame-outer-size (frame width height)
    (set-frame-size frame width height t)
    (set-frame-size frame
                    (- width  (- (frame-outer-width  frame) width))
                    (- height (- (frame-outer-height frame) height))
                    t))
  (setq frame-inhibit-implied-resize t)
  (test-set-frame-outer-size nil 500 500)
  ;;; sample ~/.emacs.d/init.el end

But the function does not work well inside init.el.
After emacs started, the size is:
  (list (frame-outer-width) (frame-outer-height))
  =>(500 502)
When user input is allowed, evaluating
  (test-set-frame-outer-size nil 500 500)
works as expected.

About another point.
If the frame has no menu-bar, tool-bar, scroll-bar nor fringes,
frame-pixel-width and frame-pixel-height can be set by set-frame-size.
But if the frame is undecorated, the outer size is as large as the size
of non-undecorated frame regardless of the value of
frame-inhibit-implied-resize. 
The inner size is enlarged to the outer size after redisplay.
The size can not be set as expected.
  (let ((width 500) (height 500)
        (params '((undecorated . t)
                  (menu-bar-lines . 0)
                  (tool-bar-lines . 0)
                  (horizontal-scroll-bars . nil)
                  (vertical-scroll-bars . nil)
                  (left-fringe . 0)
                  (right-fringe . 0)))
        (f (lambda () (list (list (frame-outer-width)
                                  (frame-inner-width))
                            (list (frame-outer-height)
                                  (frame-inner-height))))))
    (setq frame-inhibit-implied-resize t)
    (modify-frame-parameters nil params)
    (set-frame-size nil width height t)
    (list (funcall f)
          (progn (redisplay) (funcall f))))
  =>(((516 500) (539 500)) ((516 516) (539 539)))

If the form above is evaluated twice, the frame outer size stays
516x539 pixels and the inner size shrinks to 500x500 pixels.
The inner text area is displayed at the top-left,
and there are blank areas at the right and the bottom.





  reply	other threads:[~2019-12-24 13:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-22 12:36 bug#38705: 26.3; set-frame-size pixelwise makes frame larger ynyaaa
2019-12-23 10:08 ` martin rudalics
2019-12-24 13:49   ` ynyaaa [this message]
2019-12-25  9:49     ` martin rudalics
2020-01-02  8:52       ` 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=86lfr1al4s.fsf@gmail.com \
    --to=ynyaaa@gmail.com \
    --cc=38705@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /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).