From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: master 57d2f24: * lisp/frame.el (make-frame-on-monitor): New command. (Bug#34516) Date: Fri, 01 Mar 2019 14:40:37 +0100 Message-ID: References: <20190225211142.21954.14993@vcs0.savannah.gnu.org> <20190225211144.0DD23206A2@vcs0.savannah.gnu.org> <83ef7umv4v.fsf@gnu.org> <877edluew8.fsf@mail.linkov.net> <87k1hjk5ow.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="149332"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 01 14:40:56 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gziPI-000cju-BD for ged-emacs-devel@m.gmane.org; Fri, 01 Mar 2019 14:40:56 +0100 Original-Received: from localhost ([127.0.0.1]:38015 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gziPH-0000kq-9b for ged-emacs-devel@m.gmane.org; Fri, 01 Mar 2019 08:40:55 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gziPA-0000k9-C8 for emacs-devel@gnu.org; Fri, 01 Mar 2019 08:40:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gziP9-0005Px-56 for emacs-devel@gnu.org; Fri, 01 Mar 2019 08:40:48 -0500 Original-Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:35259) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gziP8-0005JC-P4 for emacs-devel@gnu.org; Fri, 01 Mar 2019 08:40:47 -0500 Original-Received: by mail-wm1-x334.google.com with SMTP id y15so12312755wma.0 for ; Fri, 01 Mar 2019 05:40:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-followup-to:mail-copies-to :gmane-reply-to-list:date:message-id:mime-version :content-transfer-encoding; bh=flvO5tSykE55hOpGiU4bTDehaTCELQlVfH//bR8CufA=; b=QLbmijMz1gnJbJE+R+b/ufHZmgSFfPQUGMnbrCAt5lzxFNDUmL79zNdUF6F3bkymmp 3FtCueBlqBaBV9KaKHA17mOwcd9rsVX7RSjO94S6TzSy/3hdeYot4gtMV90vxMBOKLjo Hw+Bs9OUjtrA76El3Y2nZ+fJWV7Z5qavoMNE3IGR2nQvHvl3Elh9N6deB94RfB+djMAo PpQxSlQ/rbkgZOcXi51y3tOY19fZWNeTLX8+5YZxkbOKlj1egNJ0kWxsAAkBQ1tAVExl eT8JczQAu7CaaWoYJ/+QMpPXf9zKP1nYgvVmml30r5+FQqhJlGSEHJ2CLLIPNcgzh7VV nmVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-followup-to :mail-copies-to:gmane-reply-to-list:date:message-id:mime-version :content-transfer-encoding; bh=flvO5tSykE55hOpGiU4bTDehaTCELQlVfH//bR8CufA=; b=g5T8s3NIrOcZ+goURGHH+28954FBY4tlKNGXlw7Y++G68bjzbFGULzHm7KJYykK6RR kOg2AelzT9uz0K0XnQGzpDMLi/JSQBznqpXOsG8QeAPouVtWkGAl2DyTaYov077BpTnC JcD+MV4VjajuZl1aEG7BqO8DEEet/c8SyDr1QPxm56JECRSA9tXuvUfx/The84AIaVMZ /RZTpTZqwX7GrnXGkSi8RTXLrejdjDjbuld6okKZk8CJh0rJzh6oi0NnCE4P8Lip7aw4 icRGnsgAxq5hnfBlKN+wwGyS8nLQLTFEBEVlFAlfYkWnPVAaAcywu8fke7dgxENJb0FQ AoGw== X-Gm-Message-State: APjAAAUKDtbpTcAslACvX45OzAKrMHObi9vTqOtrtsGy/1/UNrVnr2ie hkx+25RX1UT56M49HosryB9bNl3xft0= X-Google-Smtp-Source: APXvYqyCRtx10vrs0cUJKTXwL68O9kcQ/XxjcNv5QIMTaCkypHNwHvlxGim7ySZoSPQrrjcU/vvU7A== X-Received: by 2002:a1c:a6c9:: with SMTP id p192mr3304414wme.58.1551447639488; Fri, 01 Mar 2019 05:40:39 -0800 (PST) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id i16sm18643276wru.16.2019.03.01.05.40.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 01 Mar 2019 05:40:38 -0800 (PST) Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never Gmane-Reply-To-List: yes X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233725 Archived-At: Juri Linkov writes: >> If I=CA=BCve understood correctly, you want to create a frame that covers >> the entire workarea of the chosen monitor. Would it not work to >> specify the x,y of the top corner plus (fullscreen . maximized) rather >> than specifying the width and height explicitly? That will do the >> toolbar/titlebar/scrollbar subtractions for you (I haven't tested this). Now that I=CA=BCve tested this, it works for my primary display, but not the secondary, which is because the secondary is to my left, and ns-parse-geometry has an issue with negative offsets. In any case, I think using x-parse-geometry is not necessary. The workarea already contains the relevant co=C3=B6rdinates, and you can just pass (fullscreen . maximized) to get the right size. Sample patch below (which I=CA=BCve tested only on macOS, not under X). > I already have this for personal customization in ~/.emacs: > > (add-hook 'after-make-frame-functions 'toggle-frame-maximized) > (advice-add 'make-frame-on-monitor :around > (lambda (orig-fun monitor &optional display parameters) > (funcall orig-fun monitor display '((undecorated . t)))) > '((name . make-frame-on-monitor-undecorated))) > > But my intention was to implement a general command that would make > a new frame according to the physical monitor attributes returned by > display-monitor-attributes-list. > > I have no idea why display-monitor-attributes-list returns > workarea that doesn't fit into the created frame on macOS. It does that because that=CA=BCs what it=CA=BCs supposed to do, it=CA=BCs d= escribing the characteristics of the monitor. The issue is with make-frame. From (elisp) Frame Size: The text size of any frame can be set and retrieved with the help of the =E2=80=98height=E2=80=99 and =E2=80=98width=E2=80=99 frame parameters (= *note Size Parameters::). Note it says 'text size', which means you have to account for scrollbars, toolbars, etc. > While testing it without customization in GDK on GNU/Linux, > I see that the created frames cover the whole physical monitor, > including toolbar/titlebar/scrollbar. That I suspect is window-manager dependent: there are window managers that won't let you create a frame bigger than the monitor, or maybe x-parse-geometry is performing clipping. > Maybe there is still an issue in ns-display-monitor-attributes-list? Not that I can see. Sample implementation using (fullscreen . maximized): diff --git a/lisp/frame.el b/lisp/frame.el index 8a4a0b6639..f8e9a1ff1a 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -666,19 +666,19 @@ make-frame-on-monitor (when (equal (cdr (assq 'name a)) monit= or) (cdr (assq 'workarea a)))) (display-monitor-attributes-list display)= )))) - (frame-geometry - (when monitor-geometry - (x-parse-geometry (format "%dx%d+%d+%d" - (nth 2 monitor-geometry) - (nth 3 monitor-geometry) - (nth 0 monitor-geometry) - (nth 1 monitor-geometry))))) (frame-geometry-in-pixels - (when frame-geometry - `((top . ,(cdr (assq 'top frame-geometry))) - (left . ,(cdr (assq 'left frame-geometry))) - (height . (text-pixels . ,(cdr (assq 'height frame-geometry)= ))) - (width . (text-pixels . ,(cdr (assq 'width frame-geometry)))= ))))) + (when monitor-geometry + (let* ((top (nth 1 monitor-geometry)) + (left (nth 0 monitor-geometry)) + (top (if (< top 0) + `(- ,(abs top)) + top)) + (left (if (< left 0) + `(- ,(abs left)) + left))) + `((top . ,top) + (left . ,left) + (fullscreen . maximized)))))) (make-frame (append frame-geometry-in-pixels parameters))))