all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: Frame size changes
Date: Sat, 04 Oct 2008 09:19:59 +0200	[thread overview]
Message-ID: <48E7191F.7060407@swipnet.se> (raw)
In-Reply-To: <873ajdtuhz.fsf@cyd.mit.edu>



Chong Yidong skrev:
> Jan Djärv <jan.h.d@swipnet.se> writes:
> 
>> 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.
> 
> Thanks for the explanation.  I think this is indeed the problem.
> 
> 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 guaranteed
> 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 
hints while resizing, but that only lead to more problems (i.e. we are not 
guaranteed that the wm gets the off message before the resize, and so on...).


> 
> 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 
must have a reasonable timeout.  I don't know exactly, but around one second? 
  The thing is when I use Emacs over a slow line, a second is too fast, but 
for normal local uses it will be OK.


> 
>> 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.
> 
> 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 Emacs 
variants out there doing this already (Aquaemacs perhaps?).

	Jan D.




  reply	other threads:[~2008-10-04  7:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02 17:54 Frame size changes Chong Yidong
2008-10-03  7:08 ` Jan Djärv
2008-10-03 18:15   ` Chong Yidong
2008-10-04  7:19     ` Jan Djärv [this message]
2008-10-04 15:06       ` Stefan Monnier
2008-10-06  4:16         ` Miles Bader
2008-10-06  7:19           ` Juanma Barranquero
2008-10-06 13:59             ` Miles Bader
2008-10-06 14:08               ` Juanma Barranquero
2008-10-06 14:14                 ` Miles Bader
2008-10-06 14:20                   ` Juanma Barranquero
2008-10-05 18:35       ` Chong Yidong
2008-10-05 19:43         ` Eli Zaretskii
2008-10-05 21:11           ` Chong Yidong
2008-10-05 21:23             ` Eli Zaretskii
2008-10-05 21:50               ` Chong Yidong
2008-10-05 21:37             ` Lennart Borgman (gmail)
2008-10-05 20:08         ` Jan Djärv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48E7191F.7060407@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.