start work on implementing libdecor for csd #1349
No reviewers
Labels
No labels
CI
all
basisu
blog
bug
build
contributor-friendly
core
correctness
deferred
dev
direct3d-headers
docs
driver-os-issue
duplicate
dxcompiler
editor
examples
experiment
feature-idea
feedback
flac
freetype
gamemode
gkurve
glfw
gpu
gpu-dawn
harfbuzz
help welcome
in-progress
infrastructure
invalid
libmach
linux-audio-headers
long-term
mach
mach.gfx
mach.math
mach.physics
mach.testing
model3d
needs-triage
object
opengl-headers
opus
os/linux
os/macos
os/wasm
os/windows
package-manager
priority
proposal
proposal-accepted
question
roadmap
slipped
stability
sysaudio
sysgpu
sysjs
validating-fix
vulkan-zig-generated
wayland-headers
website
wontfix
wrench
www
x11-headers
xcode-frameworks
zig-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
hexops/mach!1349
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "shailpatels/start_libdecor_implementation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR introduces libdecor to the wayland backend to help render client side decorations. See this issue for more context: https://github.com/hexops/mach/issues/1298
This is a screenshot of the core-triangle example running with client side decorations,

I'm testing on nixos with gnome mutter which does not support server side decorations, from the logs, the error:
No longer shows!
Here is an example of falling back to ssd rendering if libdecor is not available:

This PR is a bit incomplete however, things like resizing are still wonky: (updated added back the code that attempts to recreate the swapchain but causes a segfault for me, if this is removed the behavior looks like the attached video: )
Screencast From 2025-02-18 11-45-01.webm
Other things I'm not sure about
Introduced an issue where a keyboard press causes a crash inThis might of been an issue before my changes, it looks like the keyboard listener was not getting called before the core window would be written with null values for the xkb variables, causing a crash becauselibxkbcommon's interfacewl.xkb_statewas null whenkeyboardHandleKeywas called, this appears to be fixed with anotherwl_display_roundtripcall which doesn't feel like a great solution, but no sure how else to handle this :/This is also my first PR to mach so additional feedback / guidance is appreciated :)
Feel free to push changes to the fork as well!
CC: @RonaldZielaznicki
Alright, finally got a time to sit down and look this over. Thank you again for getting this in place. Cause this does follow the logic we laid out in #1298.
As an aside, I'm wondering if we can't do something to shift all the conditions choosing between libdecor and ssd into one place, but I'm ok for some repetition as long as it works. We can clean anything too bothersome up later on.
@ -176,2 +207,4 @@core_ptr.windows.setValue(window_id, core_window);}// Wait for events to get pushed_ = libwaylandclient.?.wl_display_roundtrip(wl.display);Was there a reason to move this condition here?
Why not put it in the condition at line 190? Then it could be:
and we'll not do any additional setup unnecessarily.
@ -176,2 +207,4 @@core_ptr.windows.setValue(window_id, core_window);}// Wait for events to get pushed_ = libwaylandclient.?.wl_display_roundtrip(wl.display);Oh good point, moved it up to ln 190!
I thought about how we could move all the logic thats conditionally selecting behavior between libdecor and wayland but couldn't organize it in a great way :/
I did move the conditional out of the while loop and had both options casted to a wrapper function which is a bit gross but I think doing something similar for the rest of the file would make a lot harder to read.
You didn't need to worry much about getting everything switched around. As I was happy with the movement of the conditional we discussed here.
Otherwise, thank you for the changes!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.