unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: eenliu@gmail.com, 14326@debbugs.gnu.org
Subject: bug#14326: 24.3; Conflict of w32-send-sys-command and set-default-font
Date: Wed, 01 May 2013 18:02:01 +0300	[thread overview]
Message-ID: <83a9oepwuu.fsf@gnu.org> (raw)
In-Reply-To: <5180DD2B.3080407@gmx.at>

> Date: Wed, 01 May 2013 11:15:23 +0200
> From: martin rudalics <rudalics@gmx.at>
> Cc: 14326@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.





  reply	other threads:[~2013-05-01 15:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01  1:34 bug#14326: 24.3; Conflict of w32-send-sys-command and set-default-font Eric Liu
2013-05-01  9:15 ` martin rudalics
2013-05-01 15:02   ` Eli Zaretskii [this message]
2013-05-01 17:33     ` Eric Liu
2013-05-01 17:37       ` Eli Zaretskii
2013-05-02  9:23     ` martin rudalics
2013-05-02 17:08       ` Eli Zaretskii
2013-05-02 18:32         ` martin rudalics
2013-05-02 18:55           ` Eli Zaretskii
2013-05-02 19:08             ` martin rudalics
2013-05-02 19:38               ` Eli Zaretskii
2013-05-03  6:48                 ` martin rudalics
2013-05-03  7:12                   ` Eli Zaretskii
2013-05-03  7:28                     ` martin rudalics
2013-05-03 14:59                   ` Drew Adams
2013-05-03 15:48                     ` Eli Zaretskii
2013-05-03 15:54                       ` Eli Zaretskii
2013-05-03 16:26                       ` Drew Adams
2013-05-03 18:04                         ` Eli Zaretskii
2013-05-03 18:19                           ` Drew Adams
2013-05-03 19:25                             ` Eli Zaretskii
2013-05-03 18:59                       ` martin rudalics
2013-05-03 20:06                         ` Drew Adams
2013-05-03 20:18                           ` Eli Zaretskii
2013-05-03 20:31                             ` Drew Adams
2013-05-04  6:37                               ` Eli Zaretskii
2013-05-04  7:50                                 ` martin rudalics
2013-05-04 14:17                                 ` Drew Adams

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83a9oepwuu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=14326@debbugs.gnu.org \
    --cc=eenliu@gmail.com \
    --cc=rudalics@gmx.at \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).