mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
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:
parent
6b7a55aa3d
commit
3994762ae0
8 changed files with 123 additions and 20 deletions
|
|
@ -132,14 +132,10 @@ static void get_size(const struct roots_view *view, struct wlr_box *box) {
|
|||
assert(view->type == ROOTS_XDG_SHELL_VIEW);
|
||||
struct wlr_xdg_surface *surface = view->xdg_surface;
|
||||
|
||||
if (surface->geometry.width > 0 && surface->geometry.height > 0) {
|
||||
box->width = surface->geometry.width;
|
||||
box->height = surface->geometry.height;
|
||||
} else {
|
||||
assert(surface->surface);
|
||||
box->width = surface->surface->current->width;
|
||||
box->height = surface->surface->current->height;
|
||||
}
|
||||
struct wlr_box geo_box;
|
||||
wlr_xdg_surface_get_geometry(surface, &geo_box);
|
||||
box->width = geo_box.width;
|
||||
box->height = geo_box.height;
|
||||
}
|
||||
|
||||
static void activate(struct roots_view *view, bool active) {
|
||||
|
|
|
|||
|
|
@ -133,14 +133,10 @@ static void get_size(const struct roots_view *view, struct wlr_box *box) {
|
|||
assert(view->type == ROOTS_XDG_SHELL_V6_VIEW);
|
||||
struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6;
|
||||
|
||||
if (surface->geometry.width > 0 && surface->geometry.height > 0) {
|
||||
box->width = surface->geometry.width;
|
||||
box->height = surface->geometry.height;
|
||||
} else {
|
||||
assert(surface->surface);
|
||||
box->width = surface->surface->current->width;
|
||||
box->height = surface->surface->current->height;
|
||||
}
|
||||
struct wlr_box geo_box;
|
||||
wlr_xdg_surface_v6_get_geometry(surface, &geo_box);
|
||||
box->width = geo_box.width;
|
||||
box->height = geo_box.height;
|
||||
}
|
||||
|
||||
static void activate(struct roots_view *view, bool active) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue