mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
wayland/xdg-shell: Intersect set geometry with subsurface tree geometry
Currently xdg-shell applies a geometry set with set_window_geometry unconditionally. But the specification requires: > When applied, the effective window geometry will be > the set window geometry clamped to the bounding rectangle of the > combined geometry of the surface of the xdg_surface and the > associated subsurfaces. This is especially important to implement viewporter and transformation.
This commit is contained in:
parent
db22c13c4f
commit
c7db234c11
@ -1304,8 +1304,9 @@ meta_wayland_zxdg_surface_v6_commit (MetaWaylandSurfaceRole *surface_role,
|
|||||||
|
|
||||||
if (pending->has_new_geometry)
|
if (pending->has_new_geometry)
|
||||||
{
|
{
|
||||||
/* If we have new geometry, use it. */
|
meta_wayland_shell_surface_determine_geometry (shell_surface,
|
||||||
priv->geometry = pending->new_geometry;
|
&pending->new_geometry,
|
||||||
|
&priv->geometry);
|
||||||
priv->has_set_geometry = TRUE;
|
priv->has_set_geometry = TRUE;
|
||||||
}
|
}
|
||||||
else if (!priv->has_set_geometry)
|
else if (!priv->has_set_geometry)
|
||||||
|
@ -64,6 +64,23 @@ meta_wayland_shell_surface_calculate_geometry (MetaWaylandShellSurface *shell_su
|
|||||||
*out_geometry = geometry;
|
*out_geometry = geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_wayland_shell_surface_determine_geometry (MetaWaylandShellSurface *shell_surface,
|
||||||
|
MetaRectangle *set_geometry,
|
||||||
|
MetaRectangle *out_geometry)
|
||||||
|
{
|
||||||
|
MetaRectangle bounding_geometry = { 0 };
|
||||||
|
MetaRectangle intersected_geometry = { 0 };
|
||||||
|
|
||||||
|
meta_wayland_shell_surface_calculate_geometry (shell_surface,
|
||||||
|
&bounding_geometry);
|
||||||
|
|
||||||
|
meta_rectangle_intersect (set_geometry, &bounding_geometry,
|
||||||
|
&intersected_geometry);
|
||||||
|
|
||||||
|
*out_geometry = intersected_geometry;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
|
meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
|
||||||
MetaWindow *window)
|
MetaWindow *window)
|
||||||
|
@ -64,6 +64,10 @@ void meta_wayland_shell_surface_managed (MetaWaylandShellSurface *shell_surface,
|
|||||||
void meta_wayland_shell_surface_calculate_geometry (MetaWaylandShellSurface *shell_surface,
|
void meta_wayland_shell_surface_calculate_geometry (MetaWaylandShellSurface *shell_surface,
|
||||||
MetaRectangle *out_geometry);
|
MetaRectangle *out_geometry);
|
||||||
|
|
||||||
|
void meta_wayland_shell_surface_determine_geometry (MetaWaylandShellSurface *shell_surface,
|
||||||
|
MetaRectangle *set_geometry,
|
||||||
|
MetaRectangle *out_geometry);
|
||||||
|
|
||||||
void meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
|
void meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
|
||||||
MetaWindow *window);
|
MetaWindow *window);
|
||||||
|
|
||||||
|
@ -1369,8 +1369,9 @@ meta_wayland_xdg_surface_commit (MetaWaylandSurfaceRole *surface_role,
|
|||||||
|
|
||||||
if (pending->has_new_geometry)
|
if (pending->has_new_geometry)
|
||||||
{
|
{
|
||||||
/* If we have new geometry, use it. */
|
meta_wayland_shell_surface_determine_geometry (shell_surface,
|
||||||
priv->geometry = pending->new_geometry;
|
&pending->new_geometry,
|
||||||
|
&priv->geometry);
|
||||||
priv->has_set_geometry = TRUE;
|
priv->has_set_geometry = TRUE;
|
||||||
}
|
}
|
||||||
else if (!priv->has_set_geometry)
|
else if (!priv->has_set_geometry)
|
||||||
|
Loading…
Reference in New Issue
Block a user