-
Notifications
You must be signed in to change notification settings - Fork 14
Consistent GLFW backend detection on hybrid Wayland/X11 systems #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mortacious
wants to merge
4
commits into
pygfx:main
Choose a base branch
from
mortacious:glfw_wayland_fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a53e2fc
improved wayland detection at runtime on hybrid systems
1910446
removed import-time checks
e4a428e
use SYSTEM_IS_WAYLAND again to determine if wayland or x11 is expected
3af6322
removed glfw x11 workaround in coreutils and modified gflw backend de…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change means that with default
glfwPython lib installed, on Wayland, the window has no decorations, which would be a regression.You mentioned the
libglfw3system package. How do you tell pyGLFW to use that system libary, or does that happen automatically?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The glfw package should choose the appropriate library automatically according to its documentation, although you can force it by setting
PYGLFW_LIBRARY_VARIANT. It will also automatically determine which specific .so file to load upon import (on my system, it actually prefers the system library over the locally installed one for some reason). You can also optionally force a specific .so withPYGLFW_LIBRARY.I've just tested it on my system again, and the window shows the correct decorations in both cases. For safety, I forced the .so to the bundled one in
site-packages/glfw/<wayland/x11>/libglfw.so.Wayland:

X11:

The missing decoration might be an underlying issue with your Wayland compositor. Decorations on Wayland are a frustrating mess at the moment because windows are responsible for drawing their own decorations (server-side decorations like on X11 are not available unless you force the applications into Xwayland), and each implementation does it differently, especially GNOME. This is also the reason why my Wayland window has a different decoration in the screenshot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did
apt install libglfw3, but glfw prefers the packaged lib, because it's a newer version (3.4 vs 3.3.10 for libglfw.so.3).When I force it to use the system glfw, the decorations are ok, but with the packaged glfw the decorations are not there. This is on Ubuntu 24.04 LTS. I think we'll need to force x11 until the lib from glfw itself works properly on Wayland.
My proposal would be to bring back the setting of PYGLFW_LIBRARY_VARIANT, but only if it's not already set and if PYGLFW_LIBRARY is not set. That way we still fall back, but make it easier for users to disable the fallback.