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

From: martin rudalics <[email-masked]>
Date: Sun, 18 Oct 2020 09:56:38 +0200

> 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;

Even without emacsclient?

 > 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.

But it eventually does get focus if you insist by executing
'select-frame-set-input-focus' twice.  Right?

 > 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.

Earlier you said:

   It works correctly in emacsclient; not correctly when I run Emacs as a
   standalone process, either with -Q flag or without.

So shouldn't you try with a standalone Emacs?

 > I have attached a simplified test file:

If setting the parent in 'make-frame' works, then we can warn about
reparenting later possibly causing problems with focus transfer.  But if
the problematic behavior occurs when you want to pop up an (already
existing but invisible) child menu frame on a different parent and give
the menu focus, I have no idea what to do.  So does the latter work for
you?

martin