Skip to content
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

start work on implementing libdecor for csd #1349

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

shailpatels
Copy link

@shailpatels shailpatels commented Feb 18, 2025

  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.

This PR introduces libdecor to the wayland backend to help render client side decorations. See this issue for more context: #1298

This is a screenshot of the core-triangle example running with client side decorations,
image

I'm testing on nixos with gnome mutter which does not support server side decorations, from the logs, the error:

error(mach): Server Side Decorations aren't supported

Falling back to X11

No longer shows!

Here is an example off falling back to ssd rendering if libdecor is not available:
image

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

  • libdecor has a couple of plugins implemented for rendering decorations for different backends, it appears these are packaged with the library but I'm not sure if I need to dynamically load them for cross compilation or if there should be a way to select which plugin is used.
  • Need to test server side rendering to make sure I didn't break that functionality
  • Introduced an issue where a keyboard press causes a crash in libxkbcommon's interface This 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 because wl.xkb_state was null when keyboardHandleKey was called, this appears to be fixed with another wl_display_roundtrip call which doesn't feel like a great solution, but no sure how else to handle this :/
  • Currently client side decorations are always used if possible, need to implement a way for a user to request which mode, potentially through: https://wayland.app/protocols/xdg-decoration-unstable-v1#zxdg_toplevel_decoration_v1:event:configure?

This is also my first PR to mach so additional feedback / guidance is appreciated :)
Feel free to push changes to the fork as well!

this change dynamically loads the libdecor library to render
client side decorations, this is useful for compositors that
do not support server side decorations on wayland.
not a great solution but if the core_window is set before
the keyboard listener sets the values for libxkbcommon they
are null for the rest of the window initialization
@shailpatels shailpatels marked this pull request as ready for review February 23, 2025 00:07
@shailpatels
Copy link
Author

CC: @RonaldZielaznicki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant