From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Baoqiu Cui Newsgroups: gmane.emacs.bugs Subject: bug#986: x-display-pixel-width does NOT return current display width correctly Date: Tue, 16 Sep 2008 10:03:23 -0700 Organization: at&t http://my.att.net/ Message-ID: References: <7swshc2ke3.fsf@one.dot.net> Reply-To: Baoqiu Cui , 986@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1221622087 1247 80.91.229.12 (17 Sep 2008 03:28:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Sep 2008 03:28:07 +0000 (UTC) To: gnu-emacs-bug@moderators.isc.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 17 05:29:04 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kfniw-0006bk-IF for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Sep 2008 05:29:02 +0200 Original-Received: from localhost ([127.0.0.1]:39297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kfnhv-0002ea-HU for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Sep 2008 23:27:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KfeKx-0005oP-RN for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 13:27:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KfeKu-0005oA-UP for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 13:27:38 -0400 Original-Received: from [199.232.76.173] (port=40893 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KfeKu-0005o7-RT for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 13:27:36 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:59018) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KfeKu-0004NB-93 for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 13:27:36 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8GHRYGD022490; Tue, 16 Sep 2008 10:27:34 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m8GHA5jl015932; Tue, 16 Sep 2008 10:10:05 -0700 X-Loop: don@donarmstrong.com Resent-From: Baoqiu Cui Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 16 Sep 2008 17:10:05 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 986 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.122158464913254 (code B ref -1); Tue, 16 Sep 2008 17:10:05 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 16 Sep 2008 17:04:09 +0000 Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8GH451W013248 for ; Tue, 16 Sep 2008 10:04:06 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kfdy9-0006tP-2g for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 13:04:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kfdy6-0006qH-Ja for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 13:04:04 -0400 Original-Received: from [199.232.76.173] (port=56459 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kfdy6-0006ps-2m for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 13:04:02 -0400 Original-Received: from moderators.individual.net ([130.133.4.7]:57838) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kfdy5-00080T-BT for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 13:04:01 -0400 Original-Received: from mail146.messagelabs.com ([216.82.245.3]) by moderators.individual.net (Exim 4.69) for gnu-emacs-bug@moderators.isc.org with esmtp (envelope-from ) id <1Kfdy3-00088X-Ih>; Tue, 16 Sep 2008 19:03:59 +0200 X-VirusChecked: Checked X-Env-Sender: news@nlpi068.nbdc.sbc.com X-Msg-Ref: server-6.tower-146.messagelabs.com!1221584638!5085403!1 X-StarScan-Version: 5.5.12.14.2; banners=-,-,- X-Originating-IP: [144.160.20.53] Original-Received: (qmail 6766 invoked from network); 16 Sep 2008 17:03:58 -0000 Original-Received: from sbcsmtp6.sbc.com (HELO mlph073.enaf.sfdc.sbc.com) (144.160.20.53) by server-6.tower-146.messagelabs.com with AES256-SHA encrypted SMTP; 16 Sep 2008 17:03:58 -0000 Original-Received: from enaf.sfdc.sbc.com (localhost.localdomain [127.0.0.1]) by mlph073.enaf.sfdc.sbc.com (8.14.0/8.14.0) with ESMTP id m8GH3vAh022810 for ; Tue, 16 Sep 2008 13:03:58 -0400 Original-Received: from mlph070.sfdc.sbc.com (mlph070.sfdc.sbc.com [144.155.224.139]) by mlph073.enaf.sfdc.sbc.com (8.14.0/8.14.0) with ESMTP id m8GH3piA022678 for ; Tue, 16 Sep 2008 13:03:51 -0400 Original-Received: from sfdc.sbc.com (localhost.localdomain [127.0.0.1]) by mlph070.sfdc.sbc.com (8.14.0/8.14.0) with ESMTP id m8GH3pvK027457 for ; Tue, 16 Sep 2008 13:03:51 -0400 Original-Received: from nlpi068.nbdc.sbc.com (nlpi068-int.nbdc.sbc.com [207.115.46.224]) by mlph070.sfdc.sbc.com (8.14.0/8.14.0) with ESMTP id m8GH3iMN026595 for ; Tue, 16 Sep 2008 13:03:44 -0400 Original-Received: from nlpi068.nbdc.sbc.com (nlpi068.nbdc.sbc.com [127.0.0.1]) by nlpi068.nbdc.sbc.com (8.14.0/8.14.0) with ESMTP id m8GH3hbH020328 for ; Tue, 16 Sep 2008 13:03:43 -0400 Original-Received: from localhost (localhost [[UNIX: localhost]]) by nlpi068.nbdc.sbc.com (8.14.0/8.14.0/Submit) id m8GH3gDv020327; Tue, 16 Sep 2008 13:03:42 -0400 Original-Path: 508a9475!not-for-mail Original-Newsgroups: comp.emacs,gnu.emacs.bug User-Agent: Gnus/5.1100000000000003 (Gnus v5.11) Emacs/22.2 (cygwin) Cancel-Lock: sha1:P1jqpq5sbv8GY4vQZIFsSxOr7kQ= Original-Lines: 69 Original-NNTP-Posting-Host: 209.131.62.113 Original-X-Complaints-To: abuse@prodigy.net Original-X-Trace: nlpi068.nbdc.sbc.com 1221584622 ST000 209.131.62.113 (Tue, 16 Sep 2008 13:03:42 EDT) Original-NNTP-Posting-Date: Tue, 16 Sep 2008 13:03:42 EDT X-UserInfo1: Q[R_PJSCTS@WRW\[GBCBNWX@RJ_XPDLMN@GZ_GYO^BSZUSAANVUEAE[YETZPIWWI[FCIZA^NBFXZ_D[BFNTCNVPDTNTKHWXKB@X^B_OCJLPZ@ET_O[G\XSG@E\G[ZKVLBL^CJINM@I_KVIOR\T_M_AW_M[_BWU_HFA_]@A_A^SGFAUDE_DFTMQPFWVW[QPJN X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Tue, 16 Sep 2008 13:27:38 -0400 X-Mailman-Approved-At: Tue, 16 Sep 2008 23:27:55 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:20581 Archived-At: Chris McMahan writes: > Baoqiu Cui writes: > >> Hi, >> >> I wrote some functions a long time ago to automatically adjust the frame >> size based on display resolution, and they worked well in XEmacs but not >> in Emacs. The reason is that function x-display-pixel-width behaves a >> little differently in Emacs. >> >> In XEmacs, (x-display-pixel-width) can recognize the display resolution >> changes after XEmacs is started. For example, if the display resolution >> was originally set to 1400x1050 when XEmacs was started, >> (x-display-pixel-width) would 1400; then, if the display resolution is >> changed to 1280x1024 while XEmacs is still running, >> (x-display-pixel-width) would return 1280. >> >> However, (x-display-pixel-width) on Emacs is NOT able to recognize such >> physical display resolution change (from 1400x1050 to 1280x1024) and >> will still return 1400. >> >> Does anyone know if there is any function in Emacs that works as XEmacs' >> x-display-pixel-width? >> >> Thanks, >> Baoqiu > > I don't know of any function to do this after the resolution changes. I > would almost consider it a bug that x-display-pixel-width does not > reflect the new resolution. Thanks for your reply, Chris. Yes, this seems to be a bug in Emacs (unless the author claims that it is a feature :-). For now, I am using the following piece of code as a workaround (it works pretty well on Linux boxes, but is terribly slow on Cygwin): (with-temp-buffer (call-process "xdpyinfo" nil t) (goto-char (point-min)) (if (re-search-forward "^ dimensions: +\\([0-9]+\\)x" nil t) (string-to-number (match-string 1)) ;; Use 1024 as the default resolution 1024)) > I'd be interested in seeing your frame functions. I have similar > functions that I've built to move the frame from my left monitor to my > right monitor, resize to fit each monitor, and shrink and enlarge each > frame. I did not do many fancy stuffs. All I did was to have different frame configurations for different display resolutions (1024x768, 1280x1024, ..., 1920x1200), and have some key binding(s) to resize the frame in the way I want. The key binding that I use the most is the one that toggles between the normal (default) frame configuration and the "maximized" configuration. Thanks, Baoqiu > > - Chris > > -- > (. .) > =ooO=(_)=Ooo===================================== > Chris McMahan | first_initiallastname@one.dot.net > =================================================