If I understand correctly, as Wayland has no support for SSD, GLFW uses libdecor to draw a pretty window.
Every plugin defines a priority and then the plugin with the highest priority is loaded. On the current master (libdecor / libdecor · GitLab) the GTK plugin takes precedence over the cairo plugin. Hence, the GTK plugin will be loaded by default when available. This does not depend on the desktop shell yet.
So for someone using Gnome on Wayland, a default GLFW window should draw the GTK window instead of Cairo, but that isn’t the case for me. I would appreciate some help on how I could get it to use GTK, thank you.
Just for reference, this is the small code: pastemyst | (untitled)
I’ve solved this, and it’s not an issue of GLFW.
-
Install libdecor-0-plugin-1-gtk (I had to compile it from source)
-
Run with the LIBDECOR_PLUGIN_DIR
variable set, which I needed for some reason. (LIBDECOR_PLUGIN_DIR
is where your libdecor plugins are installed, for example, mine was /usr/local/lib/x86_64-linux-gnu/libdecor/plugins-1
as I had manually compiled it).
Cheers, and thank you for the amazing library!
Edit: Another workaround is to enforce X11. Forcing X11 on Gnome makes the server use xWayland which has proper Server Side Decorations as opposed to Wayland.
// Forcing X11 on Gnome makes the server use xWayland which has proper Server Side Decorations as opposed to Wayland.
if (strcmp(getenv("XDG_CURRENT_DESKTOP"), "GNOME") == 0)
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
else
glfwInitHint(GLFW_PLATFORM, GLFW_ANY_PLATFORM);
1 Like