mirror of
https://github.com/labwc/labwc.git
synced 2025-11-29 06:59:52 -05:00
xdg: make use of xdg_toplevel_view_get_parent()
This commit is contained in:
parent
5543affe35
commit
9f4178955a
1 changed files with 2 additions and 23 deletions
25
src/xdg.c
25
src/xdg.c
|
|
@ -725,35 +725,14 @@ xdg_toplevel_view_notify_tiled(struct view *view)
|
|||
}
|
||||
}
|
||||
|
||||
static struct view *
|
||||
lookup_view_by_xdg_toplevel(struct server *server,
|
||||
struct wlr_xdg_toplevel *xdg_toplevel)
|
||||
{
|
||||
struct view *view;
|
||||
wl_list_for_each(view, &server->views, link) {
|
||||
if (view->type != LAB_XDG_SHELL_VIEW) {
|
||||
continue;
|
||||
}
|
||||
if (xdg_toplevel_from_view(view) == xdg_toplevel) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_position(struct view *view)
|
||||
{
|
||||
struct wlr_xdg_toplevel *parent_xdg_toplevel =
|
||||
xdg_toplevel_from_view(view)->parent;
|
||||
|
||||
view_constrain_size_to_that_of_usable_area(view);
|
||||
|
||||
if (parent_xdg_toplevel) {
|
||||
struct view *parent = xdg_toplevel_view_get_parent(view);
|
||||
if (parent) {
|
||||
/* Child views are center-aligned relative to their parents */
|
||||
struct view *parent = lookup_view_by_xdg_toplevel(
|
||||
view->server, parent_xdg_toplevel);
|
||||
assert(parent);
|
||||
view_set_output(view, parent->output);
|
||||
view_center(view, &parent->pending);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue