gdk_x11_get_default_xdisplay returns garbage data when both Wayland and Xorg are available
Steps to reproduce
- Set env
WAYLAND_DISPLAY
to a valid Wayland display - Set env
DISPLAY
to a valid X11 display - Create
main.c
with the following contents
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
#include <stdio.h>
int main(void) {
Display *dpl = gdk_x11_get_default_xdisplay();
int screen_count = XScreenCount(dpl);
printf("screen count: %d\n", screen_count);
}
- Build it against
gdk-x11-3.0
( e.g.clang $(pkg-config --cflags gdk-x11-3.0 x11) main.c $(pkg-config --libs gdk-x11-3.0 x11)
)
Current behavior
gdk_display_get_default
returns the Wayland display, which in turn gets its non-existent property xdisplay
returned as an Xlib Display*
Expected outcome
gdk_x11_get_default_xdisplay
either queries explicitly for an X11 display, or fails when gdk_display_get_default
returns a Wayland display
Version information
- GTK version: 3.24.41
- OS: Alpine Linux edge