Subject: Re: bug#43672: 28.0.50; select-frame-set-input-focus does not set focus first time called

From: Arthur Miller <[email-masked]>
Date: Sat, 17 Oct 2020 23:51:16 +0200

martin rudalics <[email-masked]> writes:

>> I am sorry för the confusion, I was just to fast typing. Yes, you
>> understand me correctly. It works correctly in emacsclient; not
>> correctly when I run Emacs as a standalone process, either with -Q
>> flag or without.
>
> Then please with emacs -Q try the simpler
>
> (defvar child-frame nil)
>
> (defun make-child-frame ()
>   (interactive)
>   (setq child-frame
>     (make-frame `((parent-frame . ,(selected-frame))
>               (left . 10)
>               (top . 10)
>               (width . 20)
>               (height . 10))))
>   (select-frame-set-input-focus child-frame))
>
> (defun delete-child-frame ()
>   (interactive)
>   (delete-frame child-frame))
>
> and tell us whether the child frame gets focus.
>
> martin
Hello Martin,

sorry for being a bit late with this. I have tested and it was very
strange, so I realized I need more time to play with it.

Here is how I got it:

If I pass parent in the frame-params list to make-frame, then all is
grandy-dandy; but if I don't then the behaviour is as following:

If parent is set after creation; the frame will be reparented correctly
and appear at correct place on the screen, but it won't switch focus.

If parent is not set after the creation; the frame will switch focus,
buf it will of course appear somewhere at the screen (absolute
coordinates I guess).

I have tested only emacsclient. I hope it helps.

I have attached a simplified test file: