hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
11.1k stars 665 forks source link

a game with ebiten.SetRunnableOnUnfocused(false) doesn't show a window on ChromeOS Linux environment #3091

Closed divVerent closed 2 months ago

divVerent commented 2 months ago

Ebitengine Version

813e3b28afb154a66bd8d7ffd91aadbd11545a6b

Operating System

Go Version (go version)

go version go1.23.0 linux/amd64

What steps will reproduce the problem?

Apply this change:

diff --git a/examples/keyboard/main.go b/examples/keyboard/main.go
index 3f5b00206..612bf5865 100644
--- a/examples/keyboard/main.go
+++ b/examples/keyboard/main.go
@@ -102,6 +102,7 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
 }

 func main() {
+       ebiten.SetRunnableOnUnfocused(false)
        ebiten.SetWindowSize(screenWidth*2, screenHeight*2)
        ebiten.SetWindowTitle("Keyboard (Ebitengine Demo)")
        if err := ebiten.RunGame(&Game{}); err != nil {

Then run the "keyboard" example.

What is the expected result?

Keyboard window comes up.

What happens instead?

Program hangs "forever".

Anything else you feel useful to add?

Issue is specific to ChromeOS. It happens neither on Linux/X.org nor on Linux/Wayland/XWayland.

I have not tested, but it might be reproducible if one finds a way to run ChromeOS's "sommelier" server on desktop Linux too.

hajimehoshi commented 2 months ago

Confirmed.

hajimehoshi commented 2 months ago

Another reproducible case is

go run ./examples/windowsize/ -runnableonunfocused=false
hajimehoshi commented 2 months ago

99ffe09b63e0d906cc1f502c24f4d2325e6cc09d should fix the issue.

divVerent commented 2 months ago

Thank you!

hajimehoshi commented 2 months ago

@divVerent Do you want me to cherry-pick this fix to the stable branch?

divVerent commented 2 months ago

Not needed for me in particular - if it'll be in the next major release, this change seems self contained enough that I can keep cherrpicking it on top of the stable releases.

Having said that - it's probably a good idea to merge it into Ebitengine stable, simply because it makes Chrome OS support more reliable in general. Not sure if this also fixes operation with some specific X11 window managers.

hajimehoshi commented 2 months ago

Well, then I will not merge the fix, since I cannot say that any changes are 100% safe and the fix itself might cause another issue. Thanks!