diff --git a/include/ssd.h b/include/ssd.h index c0ed37bd..048dcb78 100644 --- a/include/ssd.h +++ b/include/ssd.h @@ -87,6 +87,7 @@ bool ssd_is_button(enum ssd_part_type type); bool ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate); /* TODO: clean up / update */ +bool has_ssd(struct view *view); struct border ssd_thickness(struct view *view); struct wlr_box ssd_max_extents(struct view *view); diff --git a/src/ssd/ssd.c b/src/ssd/ssd.c index b910ae74..f3448c01 100644 --- a/src/ssd/ssd.c +++ b/src/ssd/ssd.c @@ -13,6 +13,38 @@ #include "ssd-internal.h" #include "theme.h" #include "view.h" +#include "window-rules.h" + +bool +has_ssd(struct view *view) +{ + /* Window-rules take priority if they exist for this view */ + switch (window_rules_get_property(view, "serverDecoration")) { + case LAB_PROP_TRUE: + return true; + case LAB_PROP_FALSE: + return false; + default: + break; + } + + /* + * view->ssd_preference may be set by the decoration implementation + * e.g. src/decorations/xdg-deco.c or src/decorations/kde-deco.c. + */ + switch (view->ssd_preference) { + case LAB_SSD_PREF_SERVER: + return true; + case LAB_SSD_PREF_CLIENT: + return false; + default: + /* + * We don't know anything about the client preference + * so fall back to core.decoration settings in rc.xml + */ + return rc.xdg_shell_server_side_deco; + } +} struct border ssd_thickness(struct view *view) diff --git a/src/xdg.c b/src/xdg.c index 7de3bb64..e700c8bf 100644 --- a/src/xdg.c +++ b/src/xdg.c @@ -53,37 +53,6 @@ handle_new_popup(struct wl_listener *listener, void *data) xdg_popup_create(view, wlr_popup); } -static bool -has_ssd(struct view *view) -{ - /* Window-rules take priority if they exist for this view */ - switch (window_rules_get_property(view, "serverDecoration")) { - case LAB_PROP_TRUE: - return true; - case LAB_PROP_FALSE: - return false; - default: - break; - } - - /* - * view->ssd_preference may be set by the decoration implementation - * e.g. src/decorations/xdg-deco.c or src/decorations/kde-deco.c. - */ - switch (view->ssd_preference) { - case LAB_SSD_PREF_SERVER: - return true; - case LAB_SSD_PREF_CLIENT: - return false; - default: - /* - * We don't know anything about the client preference - * so fall back to core.decoration settings in rc.xml - */ - return rc.xdg_shell_server_side_deco; - } -} - static void handle_commit(struct wl_listener *listener, void *data) {