I’ve been working on making GtkInspector use a different display connection. This helps isolating it from some of the changes you can trigger from inside the inspector UI. Then I thought, why not use a different backend ?!
We did enough work on GDK backend separation that it could almost work. But since we didn’t add API to actually connect to specific backends (users and applications get some control with GDK_BACKEND and gdk_set_allowed_backends()), nobody has ever used multiple backends in the same process. And things that don’t get used don’t work. So some fixes were necessary.
But now I have gtk3-demo running under X while the inspector is using the Broadway backend and shows up in the web browser:
To my knowledge this is the first time a GTK+ application is using multiple GDK backends at the same time.
Anticipating some questions:
- What is this good for ?
Not that much, really. I consider it mostly a curiosity. It does prove that the GDK backend separation is (almost) working.
For most cases where this could be used with the inspector, it is probably preferable to move the inspector out of process and communicate via D-Bus. There are some people who are interested in this, so it may happen.
- Can I use this in my application ?
No. I haven’t committed that hack that makes the inspector use a different backend . If we wanted to support this, we would need to add a real API to connect to a specific backend.
What I did commit though is the code that makes the inspector always use a separate display connection (with the same backend), so you get the better isolation that can be seen in the video.
- Does this also work with Wayland ?
No. I first tried to make it work with Wayland+X, but the Wayland backend is more complicated than Broadway. I’m still getting crashes fairly soon. Broadway pretty much just worked, after a round of fixes.