all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: emacs-devel@gnu.org
Subject: Re: Frame size changes
Date: Fri, 03 Oct 2008 14:15:52 -0400	[thread overview]
Message-ID: <873ajdtuhz.fsf@cyd.mit.edu> (raw)
In-Reply-To: <48E5C4E5.9040400@swipnet.se> ("Jan Djärv"'s message of "Fri, 03 Oct 2008 09:08:21 +0200")

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.

If so, how about changing flush_and_sync to be more aggressive, and
demanding a ConfigureNotify before proceeding?

> 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.




  reply	other threads:[~2008-10-03 18:15 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 [this message]
2008-10-04  7:19     ` Jan Djärv
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=873ajdtuhz.fsf@cyd.mit.edu \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.se \
    /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.