mirror of
https://github.com/labwc/labwc.git
synced 2026-02-10 04:27:47 -05:00
view: Add view_set_output()
This commit is contained in:
parent
55c6280322
commit
331f62f662
4 changed files with 28 additions and 15 deletions
20
src/view.c
20
src/view.c
|
|
@ -111,6 +111,7 @@ static void
|
|||
view_discover_output(struct view *view)
|
||||
{
|
||||
assert(view);
|
||||
assert(!view->fullscreen);
|
||||
view->output = output_nearest_to(view->server,
|
||||
view->current.x + view->current.width / 2,
|
||||
view->current.y + view->current.height / 2);
|
||||
|
|
@ -144,6 +145,18 @@ view_set_activated(struct view *view)
|
|||
view->server->focused_view = view;
|
||||
}
|
||||
|
||||
void
|
||||
view_set_output(struct view *view, struct output *output)
|
||||
{
|
||||
assert(view);
|
||||
assert(!view->fullscreen);
|
||||
if (!output_is_usable(output)) {
|
||||
wlr_log(WLR_ERROR, "invalid output set for view");
|
||||
return;
|
||||
}
|
||||
view->output = output;
|
||||
}
|
||||
|
||||
void
|
||||
view_close(struct view *view)
|
||||
{
|
||||
|
|
@ -786,6 +799,11 @@ void
|
|||
view_on_output_destroy(struct view *view)
|
||||
{
|
||||
assert(view);
|
||||
/*
|
||||
* This is the only time we modify view->output for a fullscreen
|
||||
* view. We expect view_adjust_for_layout_change() to be called
|
||||
* shortly afterward, which will exit fullscreen.
|
||||
*/
|
||||
view->output = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -938,7 +956,7 @@ view_snap_to_edge(struct view *view, const char *direction,
|
|||
view_store_natural_geometry(view);
|
||||
}
|
||||
view_set_untiled(view);
|
||||
view->output = output;
|
||||
view_set_output(view, output);
|
||||
view->tiled = edge;
|
||||
view_apply_tiled_geometry(view);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue