mirror of
https://github.com/labwc/labwc.git
synced 2026-03-17 05:33:47 -04:00
view: Enable/disable decorations explicitly
`view_set_decorations()` now calls `ssd_create()` and `ssd_destroy()` explicitly to enable/disable decorations. As a result, the implicit enable/disable logic in `ssd_update_geometry()` is no longer needed.
This commit is contained in:
parent
4906d1833a
commit
b150e11cd3
2 changed files with 6 additions and 17 deletions
|
|
@ -150,8 +150,6 @@ ssd_create(struct view *view)
|
||||||
bool is_active = view->server->focused_view == view;
|
bool is_active = view->server->focused_view == view;
|
||||||
|
|
||||||
if (view->ssd.tree) {
|
if (view->ssd.tree) {
|
||||||
/* SSD was hidden. Just enable it */
|
|
||||||
wlr_scene_node_set_enabled(&view->ssd.tree->node, true);
|
|
||||||
ssd_set_active(view, is_active);
|
ssd_set_active(view, is_active);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -168,23 +166,10 @@ ssd_create(struct view *view)
|
||||||
void
|
void
|
||||||
ssd_update_geometry(struct view *view)
|
ssd_update_geometry(struct view *view)
|
||||||
{
|
{
|
||||||
if (!view->scene_node) {
|
if (!view->ssd.tree) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!view->ssd_enabled) {
|
|
||||||
if (view->ssd.tree && view->ssd.tree->node.enabled) {
|
|
||||||
wlr_scene_node_set_enabled(&view->ssd.tree->node, false);
|
|
||||||
view->ssd.margin = ssd_thickness(view);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} else if (!view->ssd.tree) {
|
|
||||||
ssd_create(view);
|
|
||||||
} else if (!view->ssd.tree->node.enabled) {
|
|
||||||
wlr_scene_node_set_enabled(&view->ssd.tree->node, true);
|
|
||||||
view->ssd.margin = ssd_thickness(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
int width = view->w;
|
int width = view->w;
|
||||||
int height = view->h;
|
int height = view->h;
|
||||||
if (width == view->ssd.state.width && height == view->ssd.state.height) {
|
if (width == view->ssd.state.width && height == view->ssd.state.height) {
|
||||||
|
|
|
||||||
|
|
@ -556,8 +556,12 @@ view_set_decorations(struct view *view, bool decorations)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
if (view->ssd_enabled != decorations && !view->fullscreen) {
|
if (view->ssd_enabled != decorations && !view->fullscreen) {
|
||||||
|
if (decorations) {
|
||||||
|
ssd_create(view);
|
||||||
|
} else {
|
||||||
|
ssd_destroy(view);
|
||||||
|
}
|
||||||
view->ssd_enabled = decorations;
|
view->ssd_enabled = decorations;
|
||||||
ssd_update_geometry(view);
|
|
||||||
if (view->maximized) {
|
if (view->maximized) {
|
||||||
view_apply_maximized_geometry(view);
|
view_apply_maximized_geometry(view);
|
||||||
} else if (view->tiled) {
|
} else if (view->tiled) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue