From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?SmFuIERqw6Rydg==?= Newsgroups: gmane.emacs.devel Subject: Re: Frame size changes Date: Sat, 04 Oct 2008 09:19:59 +0200 Message-ID: <48E7191F.7060407@swipnet.se> References: <877i8qvq5k.fsf@cyd.mit.edu> <48E5C4E5.9040400@swipnet.se> <873ajdtuhz.fsf@cyd.mit.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: Quoted-Printable X-Trace: ger.gmane.org 1223104925 25263 80.91.229.12 (4 Oct 2008 07:22:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 4 Oct 2008 07:22:05 +0000 (UTC) Cc: emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 04 09:23:02 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 1Km1Th-00030O-26 for ged-emacs-devel@m.gmane.org; Sat, 04 Oct 2008 09:23:01 +0200 Original-Received: from localhost ([127.0.0.1]:45227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Km1Sd-0006qg-RE for ged-emacs-devel@m.gmane.org; Sat, 04 Oct 2008 03:21:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Km1Rd-0006hv-HP for emacs-devel@gnu.org; Sat, 04 Oct 2008 03:20:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Km1Rc-0006hN-Ah for emacs-devel@gnu.org; Sat, 04 Oct 2008 03:20:53 -0400 Original-Received: from [199.232.76.173] (port=47642 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Km1Rc-0006hI-6X for emacs-devel@gnu.org; Sat, 04 Oct 2008 03:20:52 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:36370) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Km1Rb-0006Rc-S6 for emacs-devel@gnu.org; Sat, 04 Oct 2008 03:20:52 -0400 Original-Received: from proxy3.bredband.net ([195.54.101.73]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Km1RZ-0000qx-NN for emacs-devel@gnu.org; Sat, 04 Oct 2008 03:20:49 -0400 Original-Received: from ironport.bredband.com (195.54.101.120) by proxy3.bredband.net (7.3.127) id 48DC49FD0025E5A7 for emacs-devel@gnu.org; Sat, 4 Oct 2008 09:20:38 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuEtADu25khV4S2yPGdsb2JhbACBcZFmAQEBATWmEoFo 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; 04 Oct 2008 09:20:37 +0200 User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) In-Reply-To: <873ajdtuhz.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:104340 Archived-At: Chong Yidong skrev: > Jan Dj=C3=A4rv writes: >=20 >> 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. >> >> The window manager applies the size hints and sends configure notify >> to Emacs when it does. But if Emacs has read the second font size >> before the ConfigureNotify for the first font size changes arrives, >> things get strange. The window manager bases the size on the first >> font, but Emacs bases it on the second. So when Emacs tries to cope, >> it probably does a resize again (because 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 the 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. >=20 > Thanks for the explanation. I think this is indeed the problem. >=20 > The straightforward fix is for Emacs to wait until the window manager > gets back with the ConfigureNotify before proceeding. From looking at > gtkutil.c, it seems like you use the function flush_and_sync for a > similar reason. The problem, I'm guessing, is that we aren't guarantee= d > that the window manager will have a response ready during the > flush_and_sync. Yes, it is an attempt to make things better. I also tried turning off wm= =20 hints while resizing, but that only lead to more problems (i.e. we are no= t=20 guaranteed that the wm gets the off message before the resize, and so on.= ..). >=20 > If so, how about changing flush_and_sync to be more aggressive, and > demanding a ConfigureNotify before proceeding? In some cases there will be no ConfigureNotify. If we go down this path,= we=20 must have a reasonable timeout. I don't know exactly, but around one sec= ond?=20 The thing is when I use Emacs over a slow line, a second is too fast, b= ut=20 for normal local uses it will be OK. >=20 >> I've tried many solutions but they all fail in some case or another.. >> I think the only proper solution to this is to make Emacs read .emacs >> before it maps the first frame. >=20 > This would be a big incompatible change, and at this point in the > release cycle we must exhaust all other workarounds before considering > it. Yes I know. I only mentioned it because I seem to recall some of those E= macs=20 variants out there doing this already (Aquaemacs perhaps?). Jan D.