mirror of
https://github.com/labwc/labwc.git
synced 2025-11-01 22:58:47 -04:00
GrowToEdge, ShrinkToEdge: Implement actions
This commit is contained in:
parent
81af658c1f
commit
299fb83fcc
3 changed files with 58 additions and 0 deletions
34
src/view.c
34
src/view.c
|
|
@ -1162,6 +1162,40 @@ view_move_to_edge(struct view *view, enum view_edge direction, bool snap_to_wind
|
|||
view_move(view, view->pending.x + dx, view->pending.y + dy);
|
||||
}
|
||||
|
||||
void
|
||||
view_grow_to_edge(struct view *view, enum view_edge direction)
|
||||
{
|
||||
assert(view);
|
||||
if (view->fullscreen || view->maximized) {
|
||||
return;
|
||||
}
|
||||
if (!output_is_usable(view->output)) {
|
||||
wlr_log(WLR_ERROR, "view has no output, not growing view");
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_box geo = view->pending;
|
||||
snap_grow_to_next_edge(view, direction, &geo);
|
||||
view_move_resize(view, geo);
|
||||
}
|
||||
|
||||
void
|
||||
view_shrink_to_edge(struct view *view, enum view_edge direction)
|
||||
{
|
||||
assert(view);
|
||||
if (view->fullscreen || view->maximized) {
|
||||
return;
|
||||
}
|
||||
if (!output_is_usable(view->output)) {
|
||||
wlr_log(WLR_ERROR, "view has no output, not shrinking view");
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_box geo = view->pending;
|
||||
snap_shrink_to_next_edge(view, direction, &geo);
|
||||
view_move_resize(view, geo);
|
||||
}
|
||||
|
||||
enum view_edge
|
||||
view_edge_parse(const char *direction)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue