Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 818709 - x11-libs/gtk+-2 ca't find its display under Xwayland anymore
Summary: x11-libs/gtk+-2 ca't find its display under Xwayland anymore
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-17 16:06 UTC by brankob
Modified: 2021-10-22 07:33 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (my_emerge_info.txt,7.03 KB, text/plain)
2021-10-17 16:07 UTC, brankob
Details
hello-world GTK2 test (hello.c,709 bytes, text/x-csrc)
2021-10-17 16:08 UTC, brankob
Details

Note You need to log in before you can comment on or make changes to this bug.
Description brankob 2021-10-17 16:06:33 UTC
This used to work for me some time ago.
Now anything, based on gtk+:2 fails with "Gtk-WARNING **: 15:39:36.909: cannot open display: :0"

Since I run sway with XWayland on, I have custom function, set up in .bashrc to set the environment. So by using go_wl or go_x11 i can preset environment vars to enter either wayaland-based or xorg-based wm.

This works for me fine, except for GTK+:2-based apps.

I tried it with simple "hello world" GTK2 example. It fails in exact same way.

I tried debugging it and it fails during initialization phase.
During gtk_init, flow enters gtk_init_check, where gdk_display_open_default_libgtk_only fails and errors out.


****************
function go_wl()        {
export DISPLAY=":0"
# unset DISPLAY
TERM=alacritty
export WAYLAND_DISPLAY="wayland-1"
# unset WAYLAND_DISPLAY
WLR_BACKENDS="drm,libinput"
export WAYLAND_DEBUG=1
export WLR_BACKENDS
export XDG_RUNTIME_DIR=/run/user/1000
export XDG_SESSION_TYPE=wayland
export SDL_VIDEODRIVER=wayland
# export QT_QPA_PLATFORM=wayland-eg
# export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export ELM_DISPLAY=wl
export ECORE_EVAS_ENGINE=wayland_egl
export ELM_ENGINE=wayland_egl
# export ELM_ACCEL=opengl
export GDK_BACKEND=wayland
export GTK_BACKEND=wayland
# unset GDK_BACKEND
export DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_PID
export MOZ_ENABLE_WAYLAND=1
# unset WAYLAND_DISPLAY
# MOZ_ENABLE_WAYLAND=1
export _JAVA_AWT_WM_NONREPARENTING=1
# export JAVA_HOME="/usr/lib/jvm/openjdk-8"
}
***********************
Comment 1 brankob 2021-10-17 16:07:31 UTC
Created attachment 745500 [details]
emerge --info
Comment 2 brankob 2021-10-17 16:08:47 UTC
Created attachment 745503 [details]
hello-world GTK2 test
Comment 3 brankob 2021-10-17 16:12:26 UTC
If it matters, I'm using:

gui-libs/wlroots-9999
gui-wm/sway-9999-r4 ( 9999 failed to build, so I tweaked it)
dev-libs/wayland-9999
dev-libs/wayland-protocols-9999
Comment 4 Mart Raudsepp gentoo-dev 2021-10-20 08:49:32 UTC
fwiw, it works fine for me with gtk2 apps still under GNOME.

Your GDK_BACKEND settings are a bit excessive there - if a gtk3 app disables wayland usage, because it still has required X specific code in there, it won't start for you. However, this is unrelated to gtk2 woes, as gtk2 doesn't have GDK_BACKEND.
GTK_BACKEND isn't a thing.

I feel it's probably some environment issue, but I can't spot what it could be.
Does it work in a fuller wayland DE without such big environment overrides? Or even with sway without this go_wl stuff?
Comment 5 brankob 2021-10-22 05:53:23 UTC
it behaves the same way even if I erase most of the settings except XDG_RUNTIME_DIR ( it needs that to start).

And it behaves the same way under Weston or Enlightenment ( v0.24.2-r2 ).

WRT GDK_BACKEND setting, it behaves the same way without it.
Comment 6 brankob 2021-10-22 07:33:30 UTC
I've just debugged it up to a point where gtk2 goes trough XOpenDisplay and xcb_connect to _xcb_open_abstract, where it tries to connect to Xorg/XWayland server through the unix socket"/tmp/.X11-unix/X0" and fails.

After sway starts, map "/tmp/X11-unix" exists, but it's empty.