From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Liu Newsgroups: gmane.emacs.bugs Subject: bug#14326: 24.3; Conflict of w32-send-sys-command and set-default-font Date: Wed, 1 May 2013 10:33:19 -0700 Message-ID: References: <5180DD2B.3080407@gmx.at> <83a9oepwuu.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01493c8a86652a04dbab8329 X-Trace: ger.gmane.org 1367429627 3553 80.91.229.3 (1 May 2013 17:33:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 May 2013 17:33:47 +0000 (UTC) Cc: 14326@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 01 19:33:44 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UXauU-0008Fn-1X for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 May 2013 19:33:42 +0200 Original-Received: from localhost ([::1]:51413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXauT-0000lk-IZ for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 May 2013 13:33:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXauN-0000lU-QN for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 13:33:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXauK-0001jf-Md for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 13:33:35 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXauK-0001ij-JE for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 13:33:32 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UXaun-0003HN-Rl for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 13:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Liu Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 May 2013 17:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14326 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: Original-Received: via spool by 14326-submit@debbugs.gnu.org id=B14326.136742963712594 (code B ref 14326); Wed, 01 May 2013 17:34:01 +0000 Original-Received: (at 14326) by debbugs.gnu.org; 1 May 2013 17:33:57 +0000 Original-Received: from localhost ([127.0.0.1]:54127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UXaui-0003H5-MM for submit@debbugs.gnu.org; Wed, 01 May 2013 13:33:57 -0400 Original-Received: from mail-la0-f49.google.com ([209.85.215.49]:52388) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UXauf-0003Go-E8 for 14326@debbugs.gnu.org; Wed, 01 May 2013 13:33:55 -0400 Original-Received: by mail-la0-f49.google.com with SMTP id fp13so1489551lab.8 for <14326@debbugs.gnu.org>; Wed, 01 May 2013 10:33:22 -0700 (PDT) X-Received: by 10.152.115.173 with SMTP id jp13mr1250110lab.49.1367429601887; Wed, 01 May 2013 10:33:21 -0700 (PDT) Original-Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com [2a00:1450:4010:c03::22a]) by mx.google.com with ESMTPSA id sl5sm1548291lbb.10.2013.05.01.10.33.20 for <14326@debbugs.gnu.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 May 2013 10:33:20 -0700 (PDT) Original-Received: by mail-la0-f42.google.com with SMTP id eb20so1518038lab.29 for <14326@debbugs.gnu.org>; Wed, 01 May 2013 10:33:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=cK1ChTQ6SatT6sboNLfSHS/jntdCWdV4MC+cBfuK3K4=; b=aqK300aLsK0DK4JIEvCy1LGsm3glpvyet6CM+P75+1vU6inxDwvzYIkAAIjpLaxWge Idwy17AaEo/2bOoi7hrIzFsLjZwJpK83C3Qe/4Z3Dy/8G56yFmVuIJ0wZ2Fm6Z43Wzng 3vwlspIbPJjzlMfl3ybubs+MiJmbXOufZvrpgFldMR+qU2Kfc4fkucww47zOxgmzwpFS P/E9OdO8bXzQDthvhhk6KRidsLk1dm4ltZqpDupV47Yf2S8VGWVm4NhuiTA0+s5ADCi0 Jd4s1kzSyNn8UVCanR/81uML0/d/rTHq1cp9sgUYktBnGaiLzQ1cXagfeWh1FJLOUEsA Ijqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=cK1ChTQ6SatT6sboNLfSHS/jntdCWdV4MC+cBfuK3K4=; b=dfEJ7DqP+5SuUJ1LIkbpy0tFOmj5OE/A+x0B0MyHBy0eTo4T87zdMxkoOn9XBF8rd3 HxUx1B19jPIFn0C/kZW6S7hRYM6xJpS3eSg1zaEjzd/kOOYUt5WyDRPP3PFJw9CMHt5X bpva9F08+v+kTsInjg3X9tHqSZA6b70Bt2gVoBNJcKhv65bV6pews4artbY4LYGqXVKF DLeCL8jwL48Fj93EA0TC8lujxpiVaRuRNWls0Z3vU5T6z4cpSlVWdh5528t4DIeIVZls sj7qMNizK69YU75EwKtvGdd3ODbJkAMs6eCoSpDw4Dz6jzF6bTndWhfbQsxw65Shs/OO 3fiw== X-Received: by 10.152.37.196 with SMTP id a4mr1245531lak.55.1367429599349; Wed, 01 May 2013 10:33:19 -0700 (PDT) Original-Received: by 10.112.170.101 with HTTP; Wed, 1 May 2013 10:33:19 -0700 (PDT) In-Reply-To: <83a9oepwuu.fsf@gnu.org> X-Gm-Message-State: ALoCoQmr5EBkYj8jkOF62P09ZViqT++ZnIkRe0CZyEe4//mq1+scWIMJLmBm4zS8ohp1quZ1IKtz X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:73872 Archived-At: --089e01493c8a86652a04dbab8329 Content-Type: text/plain; charset=UTF-8 Yes, swapping the two lines does work. Thank you guys! On Wed, May 1, 2013 at 8:02 AM, Eli Zaretskii wrote: > > Date: Wed, 01 May 2013 11:15:23 +0200 > > From: martin rudalics > > 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. > --089e01493c8a86652a04dbab8329 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Yes, swapping the two lines does work. Thank you guys!
=


On Wed,= May 1, 2013 at 8:02 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> Date: Wed, 01 May 2013 11:15:23 +0200 > From: martin rudalics <rudalics@= gmx.at>
> Cc: 14326@debbugs.gnu.org=
>
> =C2=A0> I am running Emacs 24.3 on Windows 7, with only two command= s in my Emacs
> =C2=A0> init file:
> =C2=A0> =C2=A0 =C2=A0 (w32-send-sys-command 61488) ;; maximize fram= e at startup
> =C2=A0> =C2=A0 =C2=A0 (set-default-font "Monaco-10")
> =C2=A0> The first command works well alone, but it stops to maximiz= e frame after
> =C2=A0> the second one is
> =C2=A0> added to init file. However, if eval them after Emacs start= s up by M-x
> =C2=A0> eval-expression, then =C2=A0(w32-send-sys-command 61488) st= ill works.
>
> Does interchanging the order of these two lines change anything?

I'd be surprised if it didn't. =C2=A0It does here. =C2=A0See = below.

> and what happens when you do
>
> (progn
> =C2=A0 =C2=A0(w32-send-sys-command 61488) ;; maximize frame at startup=
> =C2=A0 =C2=A0(sit-for 1)
> =C2=A0 =C2=A0(set-default-font "Monaco-10"))
>
> instead?

Doesn't work, either. =C2=A0Triggering 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. =C2=A0(And the 61488 request is not sent to Windo= ws, it
is sent to our own window procedure.) =C2=A0Since we don't process the<= br> 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<= br> 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). =C2=A0The=
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. =C2=A0The correct way is to swap the order of these two lines.

--089e01493c8a86652a04dbab8329--