aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authorMarkus Ongyerth <ongy@ongy.net>2018-06-01 13:27:10 +0200
committerMarkus Ongyerth <ongy@ongy.net>2018-06-01 15:21:18 +0200
commit3994762ae05d18f2ec0fe9509e4dd41224cde56e (patch)
tree3a090551a15d3052ce59ba35b3f1a762a4b632d1 /rootston
parent6b7a55aa3d548e29917027e68181412897a01b1a (diff)
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.
Diffstat (limited to 'rootston')
-rw-r--r--rootston/xdg_shell.c12
-rw-r--r--rootston/xdg_shell_v6.c12
2 files changed, 8 insertions, 16 deletions
diff --git a/rootston/xdg_shell.c b/rootston/xdg_shell.c
index 03ae1dc6..805fb874 100644
--- a/rootston/xdg_shell.c
+++ b/rootston/xdg_shell.c
@@ -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) {
diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c
index 90b11690..02ad867d 100644
--- a/rootston/xdg_shell_v6.c
+++ b/rootston/xdg_shell_v6.c
@@ -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) {