mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
view: add move_to_output() function
This commit is contained in:
parent
982df84407
commit
b1d626fbfd
2 changed files with 26 additions and 0 deletions
|
|
@ -445,6 +445,7 @@ void view_shrink_to_edge(struct view *view, enum view_edge direction);
|
|||
void view_snap_to_edge(struct view *view, enum view_edge direction,
|
||||
bool across_outputs, bool store_natural_geometry);
|
||||
void view_snap_to_region(struct view *view, struct region *region, bool store_natural_geometry);
|
||||
void view_move_to_output(struct view *view, struct output *output);
|
||||
|
||||
void view_move_to_front(struct view *view);
|
||||
void view_move_to_back(struct view *view);
|
||||
|
|
|
|||
25
src/view.c
25
src/view.c
|
|
@ -1792,6 +1792,31 @@ view_snap_to_region(struct view *view, struct region *region,
|
|||
view_apply_region_geometry(view);
|
||||
}
|
||||
|
||||
void
|
||||
view_move_to_output(struct view *view, struct output *output)
|
||||
{
|
||||
assert(view);
|
||||
if (view->fullscreen) {
|
||||
return;
|
||||
}
|
||||
|
||||
view_invalidate_last_layout_geometry(view);
|
||||
view_set_output(view, output);
|
||||
if (view_is_floating(view)) {
|
||||
struct wlr_box output_area = output_usable_area_in_layout_coords(output);
|
||||
view->pending.x = output_area.x;
|
||||
view->pending.y = output_area.y;
|
||||
view_place_initial(view, /* allow_cursor */ false);
|
||||
} else if (view->maximized != VIEW_AXIS_NONE) {
|
||||
view_apply_maximized_geometry(view);
|
||||
} else if (view->tiled) {
|
||||
view_apply_tiled_geometry(view);
|
||||
} else if (view->tiled_region) {
|
||||
struct region *region = regions_from_name(view->tiled_region->name, output);
|
||||
view_snap_to_region(view, region, /*store_natural_geometry*/ false);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
for_each_subview(struct view *view, void (*action)(struct view *))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue