Decorations: respect earlier decoration negotiation results

Before this patch, setting `<decoration>` to `client` would cause applications
which prefer server side decorations to not have any decorations at all. This
patch fixes it by respecting the result of earlier negotiations via the
xdg-decoration-unstable-v1 protocol.

Fixes #297
Fixes #831
This commit is contained in:
Consolatis 2023-03-20 22:36:35 +01:00 committed by Johan Malm
parent f5c4651c67
commit 4e75125995

View file

@ -48,7 +48,16 @@ handle_new_xdg_popup(struct wl_listener *listener, void *data)
static bool static bool
has_ssd(struct view *view) has_ssd(struct view *view)
{ {
if (view->ssd_enabled) {
/* View prefers server side decorations */
return true;
}
if (!rc.xdg_shell_server_side_deco) { if (!rc.xdg_shell_server_side_deco) {
/*
* User prefers client side decorations and
* the view didn't negotiate server side ones.
*/
return false; return false;
} }
@ -56,6 +65,10 @@ has_ssd(struct view *view)
* Some XDG shells refuse to disable CSD in which case their * Some XDG shells refuse to disable CSD in which case their
* geometry.{x,y} seems to be greater than zero. We filter on that * geometry.{x,y} seems to be greater than zero. We filter on that
* on the assumption that this will remain true. * on the assumption that this will remain true.
*
* TODO: Replace this with a proper implementation of
* the KDE decoration variant as can be seen at
* https://github.com/swaywm/sway/blob/master/sway/decoration.c
*/ */
struct wlr_xdg_surface_state *current = struct wlr_xdg_surface_state *current =
&xdg_surface_from_view(view)->current; &xdg_surface_from_view(view)->current;