GNU bug report logs - #14326
24.3; Conflict of w32-send-sys-command and set-default-font

Previous Next

Packages: w32, emacs;

Reported by: Eric Liu <eenliu <at> gmail.com>

Date: Wed, 1 May 2013 01:37:02 UTC

Severity: normal

Found in version 24.3

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 14326 <at> debbugs.gnu.org (full text, mbox):

From: Eric Liu <eenliu <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: martin rudalics <rudalics <at> gmx.at>, 14326 <at> debbugs.gnu.org
Subject: Re: bug#14326: 24.3;
	Conflict of w32-send-sys-command and set-default-font
Date: Wed, 1 May 2013 10:33:19 -0700
[Message part 1 (text/plain, inline)]
Yes, swapping the two lines does work. Thank you guys!


On Wed, May 1, 2013 at 8:02 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:

> > Date: Wed, 01 May 2013 11:15:23 +0200
> > From: martin rudalics <rudalics <at> gmx.at>
> > Cc: 14326 <at> debbugs.gnu.org
> >
> >  > I am running Emacs 24.3 on Windows 7, with only two commands in my
> Emacs
> >  > init file:
> >  >     (w32-send-sys-command 61488) ;; maximize frame at startup
> >  >     (set-default-font "Monaco-10")
> >  > The first command works well alone, but it stops to maximize frame
> after
> >  > the second one is
> >  > added to init file. However, if eval them after Emacs starts up by M-x
> >  > eval-expression, then  (w32-send-sys-command 61488) still works.
> >
> > Does interchanging the order of these two lines change anything?
>
> I'd be surprised if it didn't.  It does here.  See below.
>
> > and what happens when you do
> >
> > (progn
> >    (w32-send-sys-command 61488) ;; maximize frame at startup
> >    (sit-for 1)
> >    (set-default-font "Monaco-10"))
> >
> > instead?
>
> Doesn't work, either.  Triggering redisplay doesn't help here.
>
> > Conceptually: Does anyone know whether sending a 61488 request to
> > Windows has Windows call us back with a maximize request?
>
> Of course, it does.  (And the 61488 request is not sent to Windows, it
> is sent to our own window procedure.)  Since we don't process the
> 61488 (a.k.a. WM_SYSCOMMAND) message, we get WM_SIZE as its result.
> Until we get that WM_SIZE message, our frame is not really maximized,
> and its dimensions are not reflected in the frame object's internals.
> So set-default-font uses the previous dimensions, and effectively
> resets or countermands the effect of w32-send-sys-command.
>
> Invoking the commands in the reverse order doesn't have this problem,
> because the effect of set-default-font is immediate.
>
> Moreover, I submit that the OP does not _want_ to invoke
> set-default-font after maximizing the frame, even if it did work.
> That's because changing the font of a maximized frame will either make
> it not maximized (if the new font is smaller) or make some of its
> parts, such as the minibuffer, invisible (if the font is larger).  The
> machinery that maximizes the frame takes the font into account, so
> changing the font afterwards defeats what it does by invalidating all
> the pixel calculations Windows does using the previous font.
>
> IOW, this is not a bug, but rather a cockpit error.  The correct way
> is to swap the order of these two lines.
>
[Message part 2 (text/html, inline)]

This bug report was last modified 12 years and 16 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.