mirror of
https://github.com/cage-kiosk/cage.git
synced 2025-10-29 05:40:19 -04:00
view: position using the output's usable area
This commit is contained in:
parent
dc090aa517
commit
fc5cc401b7
3 changed files with 12 additions and 12 deletions
8
output.c
8
output.c
|
|
@ -115,7 +115,7 @@ handle_output_commit(struct wl_listener *listener, void *data)
|
|||
if (event->committed & WLR_OUTPUT_STATE_TRANSFORM) {
|
||||
struct cg_view *view;
|
||||
wl_list_for_each (view, &output->server->views, link) {
|
||||
view_position(view);
|
||||
view_position(view, &output->usable_area);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ handle_output_mode(struct wl_listener *listener, void *data)
|
|||
|
||||
struct cg_view *view;
|
||||
wl_list_for_each (view, &output->server->views, link) {
|
||||
view_position(view);
|
||||
view_position(view, &output->usable_area);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ output_destroy(struct cg_output *output)
|
|||
|
||||
struct cg_view *view;
|
||||
wl_list_for_each (view, &server->views, link) {
|
||||
view_position(view);
|
||||
view_position(view, &output->usable_area);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -245,7 +245,7 @@ handle_new_output(struct wl_listener *listener, void *data)
|
|||
|
||||
struct cg_view *view;
|
||||
wl_list_for_each (view, &output->server->views, link) {
|
||||
view_position(view);
|
||||
view_position(view, &output->usable_area);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
14
view.c
14
view.c
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Cage: A Wayland kiosk.
|
||||
*
|
||||
* Copyright (C) 2018-2020 Jente Hidskes
|
||||
* Copyright (C) 2018-2021 Jente Hidskes
|
||||
*
|
||||
* See the LICENSE file accompanying this file.
|
||||
*/
|
||||
|
|
@ -85,14 +85,13 @@ view_center(struct cg_view *view, struct wlr_box *layout_box)
|
|||
}
|
||||
|
||||
void
|
||||
view_position(struct cg_view *view)
|
||||
view_position(struct cg_view *view, struct wlr_box *geometry)
|
||||
{
|
||||
struct wlr_box *layout_box = wlr_output_layout_get_box(view->server->output_layout, NULL);
|
||||
|
||||
if (view_is_primary(view) || view_extends_output_layout(view, layout_box)) {
|
||||
view_maximize(view, layout_box);
|
||||
if (view_is_primary(view) || view_extends_output_layout(view, geometry)) {
|
||||
view_maximize(view, geometry);
|
||||
} else {
|
||||
view_center(view, layout_box);
|
||||
view_center(view, geometry);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +123,8 @@ view_map(struct cg_view *view, struct wlr_surface *surface)
|
|||
if (view->type != CAGE_XWAYLAND_VIEW || xwayland_view_should_manage(view))
|
||||
#endif
|
||||
{
|
||||
view_position(view);
|
||||
struct wlr_box usable_area = {0};
|
||||
view_position(view, &usable_area);
|
||||
}
|
||||
|
||||
wl_list_insert(&view->server->views, &view->link);
|
||||
|
|
|
|||
2
view.h
2
view.h
|
|
@ -48,7 +48,7 @@ char *view_get_title(struct cg_view *view);
|
|||
bool view_is_primary(struct cg_view *view);
|
||||
bool view_is_transient_for(struct cg_view *child, struct cg_view *parent);
|
||||
void view_activate(struct cg_view *view, bool activate);
|
||||
void view_position(struct cg_view *view);
|
||||
void view_position(struct cg_view *view, struct wlr_box *geometry);
|
||||
void view_unmap(struct cg_view *view);
|
||||
void view_map(struct cg_view *view, struct wlr_surface *surface);
|
||||
void view_destroy(struct cg_view *view);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue