From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: Frame size changes Date: Fri, 03 Oct 2008 09:08:21 +0200 Message-ID: <48E5C4E5.9040400@swipnet.se> References: <877i8qvq5k.fsf@cyd.mit.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: Quoted-Printable X-Trace: ger.gmane.org 1223017740 8717 80.91.229.12 (3 Oct 2008 07:09:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Oct 2008 07:09:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 03 09:09:55 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KlenS-000774-4p for ged-emacs-devel@m.gmane.org; Fri, 03 Oct 2008 09:09:54 +0200 Original-Received: from localhost ([127.0.0.1]:60829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KlemK-0006r7-Lb for ged-emacs-devel@m.gmane.org; Fri, 03 Oct 2008 03:08:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KlemF-0006qN-P9 for emacs-devel@gnu.org; Fri, 03 Oct 2008 03:08:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KlemD-0006o2-RX for emacs-devel@gnu.org; Fri, 03 Oct 2008 03:08:39 -0400 Original-Received: from [199.232.76.173] (port=39039 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KlemD-0006nw-OQ for emacs-devel@gnu.org; Fri, 03 Oct 2008 03:08:37 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:44735) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KlemD-0002AO-J8 for emacs-devel@gnu.org; Fri, 03 Oct 2008 03:08:37 -0400 Original-Received: from proxy2.bredband.net ([195.54.101.72]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KlemB-0004ss-Ns for emacs-devel@gnu.org; Fri, 03 Oct 2008 03:08:35 -0400 Original-Received: from ironport.bredband.com (195.54.101.120) by proxy2.bredband.net (7.3.127) id 48DC49FD002159C7 for emacs-devel@gnu.org; Fri, 3 Oct 2008 09:08:33 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuEtAE1h5UhV4S2yPGdsb2JhbACBcZFmAQEBATWnSoFo Original-Received: from c-b22de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO husetbladh.homeip.net) ([85.225.45.178]) by ironport1.bredband.com with ESMTP; 03 Oct 2008 09:08:32 +0200 User-Agent: Thunderbird 2.0.0.17 (X11/20080925) In-Reply-To: <877i8qvq5k.fsf@cyd.mit.edu> X-detected-kernel: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:104320 Archived-At: Chong Yidong skrev: > For a while, there's been a bug regarding erratic frame sizing: see > bug#598, possibly also bug#708. >=20 > I've been able to reproduce this using the Terminus font (for those > using Debian or Ubuntu, this is from the xfonts-terminus package). Whe= n > this font is used, the initial frame size is unpredictable. >=20 > This seems to arise from ConfigureNotify events that Emacs receives, > which causes its frame size in rows/columns to change (because of the > ConfigureNotify event, handle_one_xevent (xterm.c:6774) calls > xg_frame_resized (gtkutil.c:642), which changes the frame size. >=20 > I don't know why these ConfigureNotify events are issued. It's strange= , > because none of the changes during the startup process ought to change > the number or rows/columns in the initial frame. Another strange thing > is that this happens with the Terminus font, but not other fonts I've > tried. >=20 > Does anyone have ideas about what's causing this? If this only happens for the first frame but not for frames created later= , I think it is the interraction between Emacs and the window manager and the= fact that Emacs adjust frame size a lot during startup. Something like this: Emacs calculates the frame size based on some initial font, and sets wm manager hints based on that (i.e. restricts width/height to a multiple of= the font width/height). Then Emacs reads .emacs and that changes the font, thus a new size and a = new wm hints is calculated and a new frame size is set. To complicate things further, either the tool bar and/or the menu bar may= be added/removed, thus the frame size is changed again. The window manager applies the size hints and sends configure notify to E= macs when it does. But if Emacs has read the second font size before the ConfigureNotify for the first font size changes arrives, things get stran= ge. The window manager bases the size on the first font, but Emacs bases it o= n the second. So when Emacs tries to cope, it probably does a resize again (be= cause the fonts sizes differ and we want the frame to be a multiple of the font size). This may lead to another ConfigureNotify, which may be based on t= he first or second font size (resize from Emacs and setting of wm hints does= not go the same way and can be seen out of order by the WM), there is a race there. And the same thing happens again. This should not happen on frames created after the first one, because at = that point we know the font to use, so no font changes (and wm hint changes) n= eeds to take place. This is tricky. I=E4ve tried many solutions but they all fail in some ca= se or another, or with some WM (this is WM dependent also). I think the only p= roper solution to this is to make Emacs read .emacs before it maps the first fr= ame. Jan D.