From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#30074: 26.0; Add function(s) for current monitor info Date: Wed, 10 Jan 2018 15:08:27 -0800 (PST) Message-ID: <17da2391-a30c-4d5f-9ffd-1758b18c34f3@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1515626039 19956 195.159.176.226 (10 Jan 2018 23:13:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 10 Jan 2018 23:13:59 +0000 (UTC) To: 30074@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 11 00:13:55 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZPZ5-0004Nz-9P for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Jan 2018 00:13:47 +0100 Original-Received: from localhost ([::1]:48288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZPb4-00045F-Kq for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Jan 2018 18:15:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZPYR-00028o-M6 for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2018 18:13:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZPYM-00012T-JO for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2018 18:13:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43596) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eZPYM-00011a-5P for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2018 18:13:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eZPYL-0007Pi-MJ for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2018 18:13:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jan 2018 23:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30074 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.151562597628485 (code B ref -1); Wed, 10 Jan 2018 23:13:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Jan 2018 23:12:56 +0000 Original-Received: from localhost ([127.0.0.1]:51493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZPYG-0007PM-3S for submit@debbugs.gnu.org; Wed, 10 Jan 2018 18:12:56 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:33571) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZPYE-0007PA-Kr for submit@debbugs.gnu.org; Wed, 10 Jan 2018 18:12:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZPY8-0000rL-Fa for submit@debbugs.gnu.org; Wed, 10 Jan 2018 18:12:49 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49087) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eZPY8-0000rD-2h for submit@debbugs.gnu.org; Wed, 10 Jan 2018 18:12:48 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZPY6-0001mF-R0 for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2018 18:12:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZPY1-0000lC-O2 for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2018 18:12:46 -0500 Original-Received: from aserp2130.oracle.com ([141.146.126.79]:43798) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eZPY1-0000kK-CU for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2018 18:12:41 -0500 Original-Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w0ANCQ0j008488 for ; Wed, 10 Jan 2018 23:12:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=x2n+ZyRQG/C9gJHPhqXoxdpVvnKpD5h5EWxxCVJxcRw=; b=PBJEQnWbG0jBG3xnaWp2AN/EH0ywZTsBZ0gvIHdlWVanDlevBfTcrsDRi5M6hyvGUTh3 5ed8DTLaWXS3qww7SytkpQVjSYGOi3MDH3fp5QWESY7QALGqW83SJwNulGYvDjgKwBlZ RNm+5t1wrLih50NfF6mbe6S0Sf551PxoCH6VJhkYQ5pVclzBewph7VJK2OwK8+aGSKsk h3kB2O1s/9JFshnGIQqIYUzRyV9fOAP8afux6MmicrlixWe5k9RpyDLksVA8rBGaGBgp i9m79hC8HXfw7qeTpCe7CK81pCRbvMKo+3pzGWnyiAjZ07pk746RMinQgQ6YzZwmb9kh ng== Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2fdukar4ar-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Jan 2018 23:12:31 +0000 Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w0AN8T0I008936 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 10 Jan 2018 23:08:29 GMT Original-Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w0AN8SYd004127 for ; Wed, 10 Jan 2018 23:08:29 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4627.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8770 signatures=668652 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=909 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801100318 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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: 208.118.235.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:142013 Archived-At: Please consider adding a function that returns the info describing the monitor that dominates a frame (default: selected frame). In particular, the size of the monitor. This can be useful, for example, for positioning a frame when there are multiple monitors. I've been using this, but you might have a better implementation in mind: (defun current-monitor (&optional frame) "Attributes of monitor that dominates FRAME (default: `selected-frame')." (catch 'current-monitor (dolist (atts (display-monitor-attributes-list frame)) (when (member (or frame (selected-frame)) (cdr (assq 'frames atts))) (throw 'current-monitor atts))) nil)) ; Should never happen (?) (defun current-monitor-size (&optional frame workarea-p) "Size of the monitor that dominates FRAME (default: `selected-frame'). This is a cons (WIDTH . HEIGHT) where WIDTH and HEIGHT are in pixels. Uses the full area of the monitor (attribute `geometry' of `display-monitor-attributes-list') by default. Non-nil optional arg WORKAREA-P means use only the available work area (attribute `workarea') instead." (let* ((att (if workarea-p 'workarea 'geometry)) (mon (assq att (current-monitor frame)))) (cons (nth 3 mon) (nth 4 mon)))) Dunno whether the fallback value of nil is needed. I haven't come across a frame that is not listed in attribute `frames' of `display-monitor-attributes-list'. Even invisible frames are listed. Dunno about deleted frames. Whether it would also be useful to have functions corresponding to attributes such as `mm-size' and `name' is another question. In GNU Emacs 26.0.90 (build 3, x86_64-w64-mingw32) of 2017-10-13 Repository revision: 906224eba147bdfc0514090064e8e8f53160f1d4 Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --without-dbus --host=3Dx86_64-w64-mingw32 --without-compress-install 'CFLAGS=3D-O2 -static -g3''