pyGLFW: Cannot create Window on Wayland
Tried this on Ubuntu 18.04, with Wayland (before logging in, select Wayland via the little menu next to the unlock button), and installing the glfw lib via sudo apt install libglfw-wayland.
This simple example fails:
import glfw
glfw.init()
# glfw.ERROR_REPORTING = False
w = glfw.create_window(640, 480, "glfw window", None, None)
Traceback:
Traceback (most recent call last):
File "<tmp 1>", line 4, in <module>
w = glfw.create_window(640, 480, "glfw window", None, None)
File "/home/almar/.local/lib/python3.6/site-packages/glfw/__init__.py", line 1141, in create_window
monitor, share)
File "/home/almar/.local/lib/python3.6/site-packages/glfw/__init__.py", line 609, in errcheck
_reraise(exc[1], exc[2])
File "/home/almar/.local/lib/python3.6/site-packages/glfw/__init__.py", line 45, in _reraise
raise exception.with_traceback(traceback)
File "/home/almar/.local/lib/python3.6/site-packages/glfw/__init__.py", line 588, in callback_wrapper
return func(*args, **kwargs)
File "/home/almar/.local/lib/python3.6/site-packages/glfw/__init__.py", line 800, in _raise_glfw_errors_as_exceptions
raise GLFWError(message)
glfw.GLFWError: (65544) b'Wayland: Focusing a window requires user interaction'
If I uncomment the line to ignore errors, it works, except the window is undecorated.
Some context: https://github.com/glfw/glfw/issues/1121 seems to suggest that the error is more of a warning? See also these.
It looks like PyGLFW checks if there are errors and raises them as Python exceptions. Perhaps there should be a filter to ignore specific exceptions like this one?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 27 (17 by maintainers)
Yes, that keeps backwards compatibility and gives users plenty of options. I’ve added more
ERROR_REPORTINGoptions in 8904cbf64e5fe656c898525fc2442a7385609dab:True,'raise'or'exception': raise an exception'warn'or'warning': issue a warning'log': log to the ‘glfw’ logger on debug level'ignore'orFalse: do nothingValueErrorabout the invalid value ofERROR_REPORTING, including the GLFW error in the message.@FlorianRhiem deserves a medal or something. It’s the truth.
The develop branch may contain some issues, but given that it also fixes the one that’s been troubling you, it’s definitely the way to go. This should work fine.
After some time setting up the latest glfw from my apt store and figuring out how the linker for gcc works on the command line i was able to compile and run the code in that link (minus the glClear function call). I am met with the exact same window as when I run it through the python lib, that is the one with no buttons.
I will now attempt to compile latest glfw and report back