Gtk4 + broadway: cannot open display :0

When using broadway as suggested in the docs:

gtk4-broadwayd &
GDK_BACKEND=broadway gtk4-demo

It works ok, but when I try to start my own gtk4 app it fails with a ‘cannot open display: :0’:

gtk4-broadwayd &
GDK_BACKEND=broadway target/debug/fviewer
(fviewer:337577): Gtk-WARNING **: 10:32:57.590: cannot open display: :0

As a desktop app target/debug/fviewer works ok.

Any ideas of what can be happening?
Thanks!

Are you sure the copy of GTK used by your application is the same as the one used by gtk4-demo?

You’re starting the broadway daemon twice; are you sure that the original instance isn’t running any more by the time you launch your application?

What happens if you follow the documentation and do:

gtk4-broadway :5
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 target/debug/fviewer

and then connect to 127.0.0.1:8085?

Yep! That was it! I was linking with gtk3 when I was supposed to be linking with gtk4.
The conexion was made by the fact that gtk4-demo worked and gnome-calculator didn’t…
I’ve got installed gnome-calculator 41.0 but an ldd showed me that gnome-calculator was using gtk3.

So thank’s Emmanuele!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.