mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-30 11:10:23 -04:00
wayland: add viewport object to sub-surface struct
This commit is contained in:
parent
0a5073f570
commit
c5d533ec71
2 changed files with 28 additions and 2 deletions
27
wayland.c
27
wayland.c
|
|
@ -1543,7 +1543,6 @@ wayl_win_init(struct terminal *term, const char *token)
|
||||||
|
|
||||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||||
if (wayl->fractional_scale_manager != NULL && wayl->viewporter != NULL) {
|
if (wayl->fractional_scale_manager != NULL && wayl->viewporter != NULL) {
|
||||||
LOG_ERR("LDKJFLDF");
|
|
||||||
win->viewport = wp_viewporter_get_viewport(wayl->viewporter, win->surface);
|
win->viewport = wp_viewporter_get_viewport(wayl->viewporter, win->surface);
|
||||||
|
|
||||||
win->fractional_scale =
|
win->fractional_scale =
|
||||||
|
|
@ -1965,17 +1964,33 @@ wayl_win_subsurface_new_with_custom_parent(
|
||||||
struct wl_surface *main_surface
|
struct wl_surface *main_surface
|
||||||
= wl_compositor_create_surface(wayl->compositor);
|
= wl_compositor_create_surface(wayl->compositor);
|
||||||
|
|
||||||
if (main_surface == NULL)
|
if (main_surface == NULL) {
|
||||||
|
LOG_ERR("failed to instantiate surface for sub-surface");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
struct wl_subsurface *sub = wl_subcompositor_get_subsurface(
|
struct wl_subsurface *sub = wl_subcompositor_get_subsurface(
|
||||||
wayl->sub_compositor, main_surface, parent);
|
wayl->sub_compositor, main_surface, parent);
|
||||||
|
|
||||||
if (sub == NULL) {
|
if (sub == NULL) {
|
||||||
|
LOG_ERR("failed to instantiate sub-surface");
|
||||||
wl_surface_destroy(main_surface);
|
wl_surface_destroy(main_surface);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||||
|
struct wp_viewport *viewport = NULL;
|
||||||
|
if (wayl->fractional_scale_manager != NULL && wayl->viewporter != NULL) {
|
||||||
|
viewport = wp_viewporter_get_viewport(wayl->viewporter, main_surface);
|
||||||
|
if (viewport == NULL) {
|
||||||
|
LOG_ERR("failed to instantiate viewport for sub-surface");
|
||||||
|
wl_subsurface_destroy(sub);
|
||||||
|
wl_surface_destroy(main_surface);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wl_surface_set_user_data(main_surface, win);
|
wl_surface_set_user_data(main_surface, win);
|
||||||
wl_subsurface_set_sync(sub);
|
wl_subsurface_set_sync(sub);
|
||||||
|
|
||||||
|
|
@ -1989,6 +2004,9 @@ wayl_win_subsurface_new_with_custom_parent(
|
||||||
|
|
||||||
surf->surf = main_surface;
|
surf->surf = main_surface;
|
||||||
surf->sub = sub;
|
surf->sub = sub;
|
||||||
|
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||||
|
surf->viewport = viewport;
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2005,6 +2023,11 @@ wayl_win_subsurface_destroy(struct wl_surf_subsurf *surf)
|
||||||
{
|
{
|
||||||
if (surf == NULL)
|
if (surf == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||||
|
if (surf->viewport != NULL)
|
||||||
|
wp_viewport_destroy(surf->viewport);
|
||||||
|
#endif
|
||||||
if (surf->sub != NULL)
|
if (surf->sub != NULL)
|
||||||
wl_subsurface_destroy(surf->sub);
|
wl_subsurface_destroy(surf->sub);
|
||||||
if (surf->surf != NULL)
|
if (surf->surf != NULL)
|
||||||
|
|
|
||||||
|
|
@ -297,6 +297,9 @@ struct monitor {
|
||||||
struct wl_surf_subsurf {
|
struct wl_surf_subsurf {
|
||||||
struct wl_surface *surf;
|
struct wl_surface *surf;
|
||||||
struct wl_subsurface *sub;
|
struct wl_subsurface *sub;
|
||||||
|
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||||
|
struct wp_viewport *viewport;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wl_url {
|
struct wl_url {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue