glfw: Certain applications crash on wlroots compositors with: XDG surface must not have a buffer at creation
Hello,
When trying to run kitty as a native Wayland application, I ran into the following error: https://github.com/kovidgoyal/kitty/issues/157#issuecomment-389390996 , namely
wl_surface@13: error 3: xdg_surface must not have a buffer at creation
[135 23:29:00.699834] [glfw error 65544]: Wayland: Focusing a window requires user interaction
[135 23:29:00.699870] [glfw error 65544]: Wayland: Window position retrieval not supported
It seems that kitty and perhaps other apps using glfw for rendering allow the creation of a surface which already has a buffer attached, which is not allowed. For example, the sway window manager throws an error when launching kitty (https://github.com/swaywm/sway/issues/1992). Although kitty uses a patched version of glfw, the changes only pertain to some keyboard handling and I don’t believe that is the source of the issue. I would appreciate any help - this is far from my area of expertise, so let me know if there is any other information I can provide that would be useful.
Thank you!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 33 (27 by maintainers)
Commits related to this issue
- Wayland: Fix mapping failure on wlroots compositor When showing a window that had already been shown once (and so already had its shell objects), GLFW would attach a new buffer and commit it before w... — committed to glfw/glfw by elmindreda 2 years ago
- Wayland: Fix mapping failure on wlroots compositor When showing a window that had already been shown once (and so already had its shell objects), GLFW would attach a new buffer and commit it before w... — committed to glfw/glfw by elmindreda 2 years ago
- Merged all glfw changes Squashed commit of the following: commit cf29ff2b9d5f2b66f8fc714e14b86989a7aa388d Author: Camilla Löwy <elmindreda@elmindreda.org> Date: Mon Jan 15 00:28:00 2024 +0100 ... — committed to RoBaertschi/glfw by RoBaertschi 6 months ago
@aenda Here is a workaround in kitty for this bug: https://github.com/kovidgoyal/kitty/commit/567cd163d9e66c383b659aee0e359a08f37fa1b0
With it, kitty works with wlrootston. Note that it is against the refactor branch not master.
Yup, this bug is nothing kitty specific, withthe follwoing two line patch to examples/simple.c it fails with glfw/master.
Let me emphasize that this fails on unmodified glfw. And it means that the glfw wayland backend makes it impossible to create windows without showing them simulataneously.
So this is a downstream error, please get in touch with the Kitty developers and ask them to update their internal fork of GLFW. The focusing warning is expected, it isn’t possible on Wayland to force-focus a window.
@kovidgoyal, there is only one
glfwCreateWindow()function, and it must always do the correct thing.Just for completeness, here is a diff of the wl_* files in glfw master vs kitty, as you can see the only changes are related to keyboard handling and so cannot have a bearing on this issue.
Diff of upstream vs kitty GLFW