bool store_natural_geometry);
void view_set_fullscreen(struct view *view, bool fullscreen);
void view_toggle_maximize(struct view *view, enum view_axis axis);
+bool view_wants_decorations(struct view *view);
void view_toggle_decorations(struct view *view);
bool view_is_always_on_top(struct view *view);
}
}
+bool
+view_wants_decorations(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;
+ }
+}
+
void
view_toggle_decorations(struct view *view)
{
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)
{
init_foreign_toplevel(view);
- if (has_ssd(view)) {
+ if (view_wants_decorations(view)) {
view_set_ssd_mode(view, LAB_SSD_MODE_FULL);
} else {
view_set_ssd_mode(view, LAB_SSD_MODE_NONE);