[wip] Add ToggleSnapToEdge

This allows to replace the usual maximize behavior that does not
respect gaps with SnapToEdge direction="center" which does respect
gaps. It can be bound to the SSD Maximize button and Title double
click handlers in rc.xml.

Missing:
- [ ] docs
- [ ] some enum for `<snapping topMaximize="yes|no">`
      like `yes|no|respect_gaps`

Ref: https://www.reddit.com/r/labwc/comments/1brvsj8/
This commit is contained in:
Consolatis 2024-03-31 04:52:30 +02:00
parent d68376f2ac
commit c2ddb1530d
3 changed files with 29 additions and 2 deletions

View file

@ -1840,6 +1840,20 @@ view_edge_parse(const char *direction)
}
}
void
view_toggle_snap_to_edge(struct view *view, enum view_edge edge)
{
assert(view);
if (view->tiled != edge) {
view_snap_to_edge(view, edge, /*across_outputs*/ true,
/*store_natural_geometry*/ true);
} else {
view_restore_to(view, view->natural_geometry);
view_set_untiled(view);
}
}
void
view_snap_to_edge(struct view *view, enum view_edge edge,
bool across_outputs, bool store_natural_geometry)