[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65025: Possible race in make-frame
From: |
Eli Zaretskii |
Subject: |
bug#65025: Possible race in make-frame |
Date: |
Wed, 02 Aug 2023 20:51:51 +0300 |
> Date: Wed, 2 Aug 2023 16:02:06 +0200
> From: Anders Blomdell via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> When running
>
> /usr/bin/emacsclient --eval '(make-frame)'
>
> it sometimes (often) opens up a small window (10x21) instead of the expected
> 40x80 window.
>
> Setting a hook for after-make-frame-functions like this:
>
> (progn
> (setq after-make-frame-functions nil)
> (add-hook
> 'after-make-frame-functions
> (lambda (frame)
> (let ((width 80)
> (height 40)
> (start-width (frame-width frame))
> (start-height (frame-height frame))
> (visible (frame-visible-p frame)))
> (print (format "Start %dx%d %S"
> start-height start-width visible))
> (if (not visible)
> (progn
> (while
> (not (frame-visible-p frame))
> (progn
> (sleep-for 0.001)
> (print (format "X %dx%d"
> (frame-height frame)
> (frame-width frame)))
> ))
> (sleep-for 0.001)
> (print (format "Resetting %dx%d -> %dx%d"
> (frame-height frame) (frame-width frame)
> height width))
> (set-frame-width frame width)
> (set-frame-height frame height)
> (sleep-for 0.1)
> (print (format "Resetting %dx%d -> %dx%d"
> (frame-height frame) (frame-width frame)
> height width))
> (set-frame-width frame width)
> (set-frame-height frame height)
> )
> )
> )
> (print (format "Done %dx%d"
> (frame-height frame)
> (frame-width frame)))
> )
> )
> )
>
>
>
> usually has two different outcomes:
>
> "Start 10x38 t"
> "Done 10x38"
>
> or
>
> "Start 40x80 nil"
> "X 40x80"
> "X 40x80"
> "X 40x80"
> "X 10x21"
> "Resetting 10x21 -> 40x80"
> "Resetting 40x80 -> 40x80"
> "Done 40x80"
Isn't this because we wait fro X to resize the frame after we ask for
it?