-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Focused issue when creating multiple new windows at once. #1077
Description
I have noticed different behavior of when the WindowEvent::Focused(bool) event is dispatched, depending whether you are on Windows or MacOS.
I've modified the multiwindow example here to illustrate these differences:
On running the example on windows I get the following output:
New window WindowId(WindowId(0x40e7a))
New window WindowId(WindowId(0x30edc))
Lost focus: WindowId(WindowId(0x40e7a))
On macos, I get:
New window WindowId(Id(140494821671056))
New window WindowId(Id(140494818628096))
Got focus: WindowId(Id(140494818628096))
The windows example seems more wrong than the macos example, since we never get an event for the second window that gained focus when the first window lost it.
Depending on your point of view though, the macos example could also be wrong if we're aiming for consistency with the model that each window gains focus when it is created, and loses it when another one is created afterwards.
I'm happy to put together a PR for this issue, but I'd first like to start some discussion around what the correct behavior should be.
As an aside, I also think winit is missing an APIs to programmatically set window focus and to control stacking order of windows. If it's agreed that those pieces of functionality are in scope for winit, then I'll write up issues for them.