From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#15336: Bad computation of window height Date: Thu, 26 Sep 2019 14:44:00 +0200 Message-ID: References: <86bo3za8af.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="145466"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Sebastien Vauban , 15336@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 26 14:45:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iDT91-000bhh-8r for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Sep 2019 14:45:15 +0200 Original-Received: from localhost ([::1]:35462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDT8z-00074O-Ih for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Sep 2019 08:45:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41209) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDT8r-000744-V7 for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 08:45:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDT8o-0004ND-Fg for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 08:45:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34077) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDT8o-0004Mz-CC for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 08:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iDT8o-0004kl-6j for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 08:45:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <86bo3za8af.fsf@somewhere.org> Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Sep 2019 12:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15336 X-GNU-PR-Package: emacs Original-Received: via spool by 15336-submit@debbugs.gnu.org id=B15336.156950186218207 (code B ref 15336); Thu, 26 Sep 2019 12:45:02 +0000 Original-Received: (at 15336) by debbugs.gnu.org; 26 Sep 2019 12:44:22 +0000 Original-Received: from localhost ([127.0.0.1]:42898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDT89-0004jW-P4 for submit@debbugs.gnu.org; Thu, 26 Sep 2019 08:44:22 -0400 Original-Received: from mail-pl1-f181.google.com ([209.85.214.181]:40683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDT86-0004j7-Oz for 15336@debbugs.gnu.org; Thu, 26 Sep 2019 08:44:20 -0400 Original-Received: by mail-pl1-f181.google.com with SMTP id d22so1281099pll.7 for <15336@debbugs.gnu.org>; Thu, 26 Sep 2019 05:44:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=EdIWPbfVgFOb5yCAUv1INyu2fe+hkiwmxyd42VWthEc=; b=NztU6zklUPIxHKxwd7a1csLnWbtj4BPdGCpp0K8vq7HrREzkH2TvEC4dvBu7HxvTog 4GEohTMlZeguHL1zvxdVA+Npjh+W6GbEnsaibjNCMAb9BEhbro261nhN5MqRgEwE2PKj tVm63GXsF5shYoRrz45pPGB9qjnMp3qcB6o0FfsAFFVfxJjsgJbCia+lmEg/WgeYAUsH 7E228MqBZNYuny7LV5YNYEv5kRpwD3hagYdXPKyvkWnBWnpVkVwKNiQSVYf94Oo42Z58 cloQ16TuTo/A3imQpPjxBdAusBETEFCvWXJwamqwTS83BDWDxQvowZVikLKqFYL7VtmY OKeA== X-Gm-Message-State: APjAAAU+qo2j1zFc2ZatPYFKB38gtg18T5M8YHcX/kUFiHqpS+QFwI+f pD83sXUf9ZVYTLgO+Z6ow9SQVsZlkOTVFXNj5HU= X-Google-Smtp-Source: APXvYqztEo/v61I/UhCf2eK3EicuOZmSvilVUfAtHk+d755TejwNdeMcvYihuFHTLhR0D0fCRLNwDplcR7JPpqWk5nk= X-Received: by 2002:a17:902:d88f:: with SMTP id b15mr3486213plz.251.1569501851124; Thu, 26 Sep 2019 05:44:11 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:167239 Archived-At: tags 15336 notabug close 15336 quit Eli Zaretskii writes: >> From: Sebastien Vauban >> 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 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