mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
foreign: set parent
Tested with wlroots/examples/foreign-toplevel.c Helped-by: @Consolatis
This commit is contained in:
parent
0eab7e082c
commit
23247f29ca
2 changed files with 36 additions and 2 deletions
20
src/xdg.c
20
src/xdg.c
|
|
@ -383,6 +383,22 @@ xdg_toplevel_view_get_string_prop(struct view *view, const char *prop)
|
|||
return "";
|
||||
}
|
||||
|
||||
static void
|
||||
init_foreign_toplevel(struct view *view)
|
||||
{
|
||||
foreign_toplevel_handle_create(view);
|
||||
struct wlr_xdg_toplevel *toplevel = xdg_toplevel_from_view(view);
|
||||
if (!toplevel->parent) {
|
||||
return;
|
||||
}
|
||||
struct wlr_xdg_surface *surface = toplevel->parent->base;
|
||||
struct view *parent = surface->data;
|
||||
if (!parent->toplevel.handle) {
|
||||
return;
|
||||
}
|
||||
wlr_foreign_toplevel_handle_v1_set_parent(view->toplevel.handle, parent->toplevel.handle);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_toplevel_view_map(struct view *view)
|
||||
{
|
||||
|
|
@ -399,7 +415,9 @@ xdg_toplevel_view_map(struct view *view)
|
|||
if (!view->been_mapped) {
|
||||
struct wlr_xdg_toplevel_requested *requested =
|
||||
&xdg_toplevel_from_view(view)->requested;
|
||||
foreign_toplevel_handle_create(view);
|
||||
|
||||
init_foreign_toplevel(view);
|
||||
|
||||
view_set_decorations(view, has_ssd(view));
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -410,6 +410,22 @@ top_left_edge_boundary_check(struct view *view)
|
|||
view->impl->configure(view, view->current);
|
||||
}
|
||||
|
||||
static void
|
||||
init_foreign_toplevel(struct view *view)
|
||||
{
|
||||
foreign_toplevel_handle_create(view);
|
||||
|
||||
struct wlr_xwayland_surface *surface = xwayland_surface_from_view(view);
|
||||
if (!surface->parent) {
|
||||
return;
|
||||
}
|
||||
struct view *parent = (struct view *)surface->parent->data;
|
||||
if (!parent->toplevel.handle) {
|
||||
return;
|
||||
}
|
||||
wlr_foreign_toplevel_handle_v1_set_parent(view->toplevel.handle, parent->toplevel.handle);
|
||||
}
|
||||
|
||||
static void
|
||||
xwayland_view_map(struct view *view)
|
||||
{
|
||||
|
|
@ -447,7 +463,7 @@ xwayland_view_map(struct view *view)
|
|||
}
|
||||
|
||||
if (!view->toplevel.handle) {
|
||||
foreign_toplevel_handle_create(view);
|
||||
init_foreign_toplevel(view);
|
||||
}
|
||||
|
||||
if (!view->been_mapped) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue