unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>, Ash <ext0l@catgirl.ai>
Cc: 65217@debbugs.gnu.org
Subject: bug#65217: 29.1; set-frame-size gets confused and drops calls
Date: Thu, 17 Aug 2023 18:44:32 +0200	[thread overview]
Message-ID: <47724cb8-8448-e210-621f-9c3883bdc0ca@gmx.at> (raw)
In-Reply-To: <83sf8i578j.fsf@gnu.org>

 >> (setq my/frame
 >>
 >>         (make-frame `((left . 500)
 >>                   (top . 5)
 >>                   (width . 20)
 >>                   (height . 20)
 >>                       (parent-frame . ,(selected-frame)))))
 >>
 >> (defun my/twiddle (width height)
 >>     (set-frame-size my/frame 10 10)
 >>     (set-frame-size my/frame width height)
 >>     (message (format "%s %s" (frame-width my/frame) (frame-height
 >> my/frame))))
 >>
 >>
 >> Then (my/twiddle 20 20).
 >
 > Martin, any comments or ideas?

Many.  Basically it's a bad idea to do the above.  Setting up one size,
changing it to another one and then back to the initial one ...  But
both 'set-frame-size' calls might be hidden in larger functions and so
the above can be seen as some kind of abstraction of a larger idea.

What happens is that the (set-frame-size my/frame 10 10) has not been
yet processed by us at the time we run (set-frame-size my/frame 20 20):
Obviously so, since we run Lisp and do not process any configure events
in between.  This means that the

       if (outer_width != gwidth || outer_height != gheight)

check in gtkutil.c's xg_frame_set_char_size will tell that the window
already has the desired size and we do not send a second
gtk_window_resize request.  In fact, when replacing the above line by

       if (true) // outer_width != gwidth || outer_height != gheight)

the second request is processed and everything looks OK.  Now that check
is not utterly necessary but omitting it might, if child frames should
be hidden during resizing, provoke flickering.  Such flickering can be
already seen here with a Lucid build when running my/twiddle (otherwise
Lucid handles everything as expected).  In the case at hand it's normal,
but if the frame should not change size, it should be ideally avoided.

Unfortunately, the story does not end here.  Suppose I do

(setq my/frame
       (make-frame `((left . 500)
                     (top . 5)
                     (width . 20)
                     (height . 20))))

(defun my/twiddle (width height)
   (set-frame-size my/frame 10 10)
   (set-frame-size my/frame width height)
   (sit-for 0)
   (message (format "%s %s" (frame-width my/frame) (frame-height my/frame))))

(my/twiddle 20 20)

instead, that is my/frame is shown in a completely normal top-level
window.  In this case, the second resize request apparently gets ignored
(likely in gtk_window_move_resize but the real cause might be nested
somewhere else in the depths of GTK) and I get 10 as final width and
height which are also reported as such.  Again, Lucid has no problem
processing this scenario as expected.

As a final note, putting a (sit-for 0) in between the two
'set-frame-size' calls so that the configure event gets processed in
between, fixes both scenarios on GTK builds here.

Hence, many comments but few good ideas.  It would be interesting,
however, whether others can observe different behaviors with these
set-ups.

Thanks for your attention, martin





  reply	other threads:[~2023-08-17 16:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 23:07 bug#65217: 29.1; set-frame-size gets confused and drops calls Ash
     [not found] ` <handler.65217.B.169170885617684.ack@debbugs.gnu.org>
2023-08-10 23:16   ` Ash
2023-08-17  9:49     ` Eli Zaretskii
2023-08-17 16:44       ` martin rudalics [this message]
2023-08-18  1:13         ` Ash
2023-08-18  5:56           ` Eli Zaretskii
2023-08-18  6:04             ` Ash
2023-08-18  6:37               ` Eli Zaretskii
2023-08-18  7:23                 ` Ash
2023-08-18  8:25                 ` martin rudalics
2023-08-18 12:12                   ` Eli Zaretskii
2023-08-18  8:34                 ` Gregory Heytings
2023-08-18 12:14                   ` Eli Zaretskii
2023-08-18 12:26                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-19  8:04                   ` martin rudalics
2023-08-19 10:18                     ` Gregory Heytings
2023-08-20  6:32                       ` martin rudalics
2023-08-20  7:55                         ` Gregory Heytings
2023-08-21  6:19                           ` martin rudalics
2023-08-21  8:30                             ` Gregory Heytings
2023-08-21 13:39                               ` martin rudalics
2023-08-21 14:12                                 ` Gregory Heytings
2023-08-21 17:31                                   ` martin rudalics
2023-08-21 18:26                                     ` Gregory Heytings
2023-08-22  8:53                                       ` martin rudalics
2023-08-18 13:26     ` Gregory Heytings

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=47724cb8-8448-e210-621f-9c3883bdc0ca@gmx.at \
    --to=rudalics@gmx.at \
    --cc=65217@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=ext0l@catgirl.ai \
    /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).