Add wlr_surface_get_geometry

This function defaults and clips the xdg-surface geometry to the
bounding box of the surface + its subsurfaces, as specified by the
protocol spec.
This commit is contained in:
Markus Ongyerth 2018-06-01 13:27:10 +02:00
parent 6b7a55aa3d
commit 3994762ae0
8 changed files with 123 additions and 20 deletions

View file

@ -159,6 +159,14 @@ void wlr_surface_send_leave(struct wlr_surface *surface,
void wlr_surface_send_frame_done(struct wlr_surface *surface,
const struct timespec *when);
struct wlr_box;
/**
* Get the bounding box that contains the surface and all subsurfaces in
* surface coordinates.
* X and y may be negative, if there are subsurfaces with negative position.
*/
void wlr_surface_get_extends(struct wlr_surface *surface, struct wlr_box *box);
/**
* Set a callback for surface commit that runs before all the other callbacks.
* This is intended for use by the surface role.

View file

@ -341,6 +341,15 @@ bool wlr_surface_is_xdg_surface(struct wlr_surface *surface);
struct wlr_xdg_surface *wlr_xdg_surface_from_wlr_surface(
struct wlr_surface *surface);
/**
* Get the surface geometry.
* This is either the geometry as set by the client, or defaulted to the bounds
* of the surface + the subsurfaces (as specified by the protocol).
*
* The x and y value can be <0
*/
void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface, struct wlr_box *box);
/**
* Call `iterator` on each surface in the xdg-surface tree, with the surface's
* position relative to the root xdg-surface. The function is called from root to

View file

@ -318,6 +318,15 @@ bool wlr_surface_is_xdg_surface_v6(struct wlr_surface *surface);
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_from_wlr_surface(
struct wlr_surface *surface);
/**
* Get the surface geometry.
* This is either the geometry as set by the client, or defaulted to the bounds
* of the surface + the subsurfaces (as specified by the protocol).
*
* The x and y value can be <0
*/
void wlr_xdg_surface_v6_get_geometry(struct wlr_xdg_surface_v6 *surface, struct wlr_box *box);
/**
* Call `iterator` on each surface in the xdg-surface tree, with the surface's
* position relative to the root xdg-surface. The function is called from root to