unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Sebastien Vauban <sva-news@mygooglest.com>, 15336@debbugs.gnu.org
Subject: bug#15336: Bad computation of window height
Date: Thu, 26 Sep 2019 14:44:00 +0200	[thread overview]
Message-ID: <CADwFkmm4MX=YoF1HUbMnDJntze=mnaaRqvkoGpb5TkF+uDUmqg@mail.gmail.com> (raw)
In-Reply-To: <86bo3za8af.fsf@somewhere.org>

tags 15336 notabug
close 15336
quit

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Sebastien Vauban <sva-news@mygooglest.com>
>> Date: Fri, 24 Oct 2014 16:16:27 +0200
>>
>> One side note though: I have 2 screens, and they are set up one above
>> the other (physically and logically).
>>
>>   |----------------------|
>>   | screen #2 (external) |  <-- 1680 x 1050
>>   |----------------------|
>>   | screen #1 (laptop)   |  <-- 1920 x 1080 (Full HD)
>>   |----------------------|
>>
>> That may impact what I see on Emacs 25.0.50.1.
>>
>> With the following code:
>>
>> --8<---------------cut here---------------start------------->8---
>>   (when (display-graphic-p)
>>
>>     ;; put Emacs exactly where you want it, every time it starts up
>>     (setq initial-frame-alist '((top . 0) (left . 0)))
>>
>>     ;; auto-detect the screen dimensions and compute the height of Emacs
>>     (add-to-list 'default-frame-alist
>>                  (cons 'height
>>                        (/ (- (x-display-pixel-height) 106)
>>                           (frame-char-height))))
>>
>>     ;; maximize Emacs by default
>>     (modify-all-frames-parameters '((fullscreen . maximized))))
>> --8<---------------cut here---------------end--------------->8---
>>
>> I'm expecting to have Emacs maximized at startup, on the main screen,
>> that is occupying the full space of screen #1: 1920 x 1080.
>>
>> What I get, instead, is an Emacs frame of (1680 + 1920) x 1080... whose
>> top-right corner is located at the top-right corner of screen #1 (hence,
>> I don't even see its full height, without minimizing and re-maximizing
>> it first).
>
> I'm guessing that the coordinates (0, 0) are on screen #1, in which
> case you are getting what you asked for: a frame whose top-left corner
> is on screen #1.
>
> When using several monitors connected to the same machine, you
> shouldn't assume that the top-left corner of the virtual screen has
> the coordinates (0, 0).

martin rudalics <rudalics@gmx.at> writes:

>>      ;; auto-detect the screen dimensions and compute the height of Emacs
>>      (add-to-list 'default-frame-alist
>>                   (cons 'height
>>                         (/ (- (x-display-pixel-height) 106)
>
> x-display-pixel-height is a built-in function in `C source code'.
> [...]
> On "multi-monitor" setups this refers to the pixel height for all
> physical monitors associated with DISPLAY.  To get information for
> each physical monitor, use `display-monitor-attributes-list'.
>
> And since you are (presumably) on Windows this coincides with the
> documentation of SM_CYVIRTUALSCREEN:
>
> The height of the virtual screen, in pixels. The virtual screen is the
> bounding rectangle of all display monitors. The SM_YVIRTUALSCREEN metric
> is the coordinates for the top of the virtual screen.

I think that makes sense, which means there is no bug here.  Everything
works as advertised.  I'm therefore closing this as notabug.  If that is
incorrect, please reopen.

Best regards,
Stefan Kangas





      parent reply	other threads:[~2019-09-26 12:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 11:48 bug#15336: 24.3.50; Bad computation of window height Sebastien Vauban
     [not found] ` <86bo3za8af.fsf-oHC15RC7JGTNLxjTenLetw@public.gmane.org>
2014-10-24 14:16   ` bug#15336: " Sebastien Vauban
2014-10-24 14:31     ` Eli Zaretskii
     [not found]       ` <83y4s55ykr.fsf-mXXj517/zsQ@public.gmane.org>
2014-10-24 14:35         ` Sebastien Vauban
2014-10-24 15:07           ` Eli Zaretskii
2014-10-24 17:52     ` martin rudalics
2019-09-26 12:44 ` Stefan Kangas [this message]

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='CADwFkmm4MX=YoF1HUbMnDJntze=mnaaRqvkoGpb5TkF+uDUmqg@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=15336@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=sva-news@mygooglest.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).