Code Monkey home page Code Monkey logo

Comments (11)

Hjdskes avatar Hjdskes commented on August 28, 2024

I found out that Firefox Nightly (version 66) works just fine if it isn't the first application that is started in Cage. That is, if you run ./cage epiphany from one terminal and from another run GDK_BACKEND=wayland WAYLAND_DISPLAY=wayland-1 firefox-nightly, Firefox Nightly should start and work just fine. (Or, maybe easier, is to run ./cage termite and from termite run GDK_BACKEND=wayland firefox-nightly.)

If Cage is compiled without XWayland, Firefox Nightly should also start with ./cage firefox-nightly. If you compile Cage with XWayland and try to run Firefox Nightly like that, you'll get the following:

(EE) failed to read Wayland events: Broken pipe
ExceptionHandler::GenerateDump cloned child 6050
ExceptionHandler::SendContinueSignalToChild sent continue signal to child
ExceptionHandler::WaitForContinueSignal waiting for continue signal...

To summarize:

  1. Cage compiled with XWayland, Firefox Nightly works only if another application is started first (i.e., if Cage is properly done starting up).
  2. If Cage is compiled without XWayland, Firefox Nightly works as start application as well as if another application is started first.

I'm not sure why this is the case. That is, I'm not sure why Firefox Nightly doesn't work as startup application when XWayland support is enabled. This is what we'll need to figure out to get Firefox Nightly to work properly in all conditions. This works just fine in rootston, so if we can figure out what is different between rootston and Cage we should be good to go.

(Note: the above doesn't work the same for Firefox (stable, i.e. version 64 and not Nightly), but I haven't dug into this more yet since Firefox Nightly is really the version you'll want to use on Wayland.)

from cage.

Hjdskes avatar Hjdskes commented on August 28, 2024

Confirmed this has to do with how we spawn applications: if I disable all application spawning code in Cage and execute ./build/cage & GDK_BACKEND=wayland WAYLAND_DISPLAY=wayland-1 firefox-nightly with XWayland support enabled, Firefox Nightly spawns as it should.

from cage.

Hjdskes avatar Hjdskes commented on August 28, 2024

I found the issue. It's completely unrelated to how Cage spawns processes or handles XWayland.

Apparently, when XWayland support is enabled, Firefox first creates an XWayland surface, closes this and then opens an XDG toplevel surface. Cage tries to manage the first XWayland surface, but when it closes, Cage has no surfaces left and hence closes as well. This is Cage specific behavior: it closes when there are no views left. Hence, Cage terminates before it picks up on Firefox's XDG toplevel, and Firefox (rightly) prints it cannot read the Wayland pipe.

So, now we need to figure out why Firefox spawns an XWayland surface with GDK_BACKEND=wayland, or change the way we handle windows. According to @emersion on IRC, GTK is known to open an X11 connection when XWayland is available. Let's see if we can find out why...

from cage.

emersion avatar emersion commented on August 28, 2024

Is the Xwayland window mapped?

from cage.

Hjdskes avatar Hjdskes commented on August 28, 2024

Is the Xwayland window mapped?

No, it doesn't get mapped.

By the way, I looked at other GTK applications. They do not spawn XWayland surfaces (with XWayland available), so it seems to be specific to Firefox. Do you happen to know a developer working on Firefox on Wayland?

from cage.

emersion avatar emersion commented on August 28, 2024

No, it doesn't get mapped.

Maybe you could wait for a window to get mapped before exiting.

They do not spawn XWayland surfaces (with XWayland available), so it seems to be specific to Firefox.

Ah, so they connect and don't spawn anything. Interesting.

Do you happen to know a developer working on Firefox on Wayland?

I think stransky does a lot to port Firefox to Wayland.

from cage.

Hjdskes avatar Hjdskes commented on August 28, 2024

@stransky, do you know why Firefox Nightly spawns an XWayland surface when XWayland is available, only to (almost?) immediately close it and use xdg-shell after? I have no problem with adding a workaround in Cage, but it seems like this is something you might want to fix in Firefox so I'm pursuing that option first.

from cage.

Hjdskes avatar Hjdskes commented on August 28, 2024

I have an initial workaround going in the branch firefox-workaround. I'm not yet sure if this is the best way to go about it and if I should generalize this approach to make for example xdg-shell handling more robust as well. It hasn't yet seemed to be needed for xdg-shell...

from cage.

Hjdskes avatar Hjdskes commented on August 28, 2024

I went ahead and merged the (cleaned up) workaround, since it is also required for Google Chrome/Chromium.

from cage.

stransky avatar stransky commented on August 28, 2024

@stransky, do you know why Firefox Nightly spawns an XWayland surface when XWayland is available, only to (almost?) immediately close it and use xdg-shell after? I have no problem with adding a workaround in Cage, but it seems like this is something you might want to fix in Firefox so I'm pursuing that option first.

Can you please file a bug at http://bugzilla.mozilla.org/ and also provide a backtrace when the XWayland surface is created? I'm not aware about it. Maybe that comes from Gtk+ itself or from some library.

from cage.

Hjdskes avatar Hjdskes commented on August 28, 2024

@stransky I submitted a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1523889.

I wasn't sure what you meant with a backtrace, so I didn't include one. Note that nothing crashes, not in Firefox nor in Cage. Firefox just exits because there is no Wayland socket left.

from cage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.