bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65217: 29.1; set-frame-size gets confused and drops calls


From: martin rudalics
Subject: bug#65217: 29.1; set-frame-size gets confused and drops calls
Date: Mon, 21 Aug 2023 19:31:12 +0200

> I'm not sure what you mean by "works correctly".  That exact recipe
> (with emacs -Q -l file.el) produces either a 10x10 frame or a 20x20
> frame, randomly but apparently equally distributed.  Adding a (sit-for
> 0) after the first call to set-frame-size does not help.

Can you check whether input is pending before the 'sit-for' call?

> But adding a
> (redisplay t) after the first call to set-frame-size helps: the result
> is then always a 20x20 frame.

Here it works with FORCE nil too.  'redisplay' with non-nil FORCE means
don't process pending input.  Maybe any such redisplay just takes long
enough so that in the meantime the 10x10 sizes get processed by GTK and
the second 'set-frame-size' is recognized by GTK as something that wants
to change the size.  (sleep-for 0.001) works here too.  I see problems
with (sleep-for 0.00000000000000000000000000000000000000000000000001).

> One problem remains, however: the message is still either "10 10" or "20 20".

Always 10x10 wouldn't be that bad.  The "either" means that some race
condition persists.  Here I get always "20x20" with the redisplay call.

> I just tried your "my-twiddle.diff" patch, and with your recipe above
> it doesn't help: it still produces either a 10x10 frame or a 20x20
> frame. I'm don't know you mean by "the problem above with normal
> top-level frames".

My "recipe above" was for normal top-level frames. The patch was for
child frames exclusively.  To avoid confusions: The scenario for child
frames is

(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)
  (sit-for 0)
  (message (format "%s %s" (frame-width my/frame) (frame-height my/frame))))

(my/twiddle 20 20)

and my patch fixed that here.  The scenario for normal top-level frames
is

(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)

and my patch doesn't do anything about it.

martin






reply via email to

[Prev in Thread] Current Thread [Next in Thread]