bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.16k stars 3.57k forks source link

bug: cannot create an unfocused window on Mac for dev #15025

Open swarnimarun opened 2 months ago

swarnimarun commented 2 months ago

Bevy version

v0.14.1

[Optional] Relevant system information

On, MacOS 14.2.1

SystemInfo { os: "MacOS 14.2.1 ", kernel: "23.2.0", cpu: "Apple M1 Pro", core_count: "8", memory: "16.0 GiB" }

What you did

Setting focused false doesn't work when running app from terminal.

        .add_plugins(DefaultPlugins.set(WindowPlugin {
            primary_window: Some(Window {
                present_mode: bevy::window::PresentMode::Immediate,
                // ignore this two, set as I am using multiple monitors
                position: WindowPosition::Centered(MonitorSelection::Index(0)),
                focused: false, // here!
                ..default()
            }),
            ..default()
        }))

What went wrong

Ideally the window should not grab focus when set to focused false or so I understand from the docs, I might be wrong. In that case I would like an set_active false flag. And maybe we can reword the docs a bit better.

Additional information

You can fix it if you build the event loop directly by setting, with_activate_ignoring_other_apps to false, but I am not sure how to do this with bevy. (better described here, https://github.com/rust-windowing/winit/issues/3072)

I can't seem to be able to access the event loop in any way. So it might not be a bug, just a skill issue on my part. But I think even if we could, it's at best a workaround.

It's nice to be able to do it, as I can set cargo watch -x run and see my changes instantly. Especially for game jam projects which are small and require quick tweaks/iteration.

Aside: Awesome work on the project, appreciate the effort from all the bevy folks, I lack time to write my own libs for my hobby indie game dev projects in Rust. So it's awesome to have such a impressive go-to-ish library in Rust for it. :)

TheOddler commented 1 month ago

I'm having this problem now too on Linux. Did you ever find a working workaround?