From 48f8f69556807b1146806313c3fce6838c127d38 Mon Sep 17 00:00:00 2001 From: Jente Hidskes Date: Mon, 31 Dec 2018 20:44:20 +0100 Subject: [PATCH] view_get_geometry: only out width and height This is the only thing we need, as we don't use a view's x and y coordinates for placing windows. --- view.c | 8 ++++---- view.h | 2 +- xdg_shell.c | 8 ++++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/view.c b/view.c index 04d833f..0b11ae2 100644 --- a/view.c +++ b/view.c @@ -43,11 +43,11 @@ view_center(struct cg_view *view) int output_width, output_height; wlr_output_effective_resolution(output, &output_width, &output_height); - struct wlr_box geom; - view->get_geometry(view, &geom); + int width, height; + view->get_geometry(view, &width, &height); - view->x = (output_width - geom.width) / 2; - view->y = (output_height - geom.height) / 2; + view->x = (output_width - width) / 2; + view->y = (output_height - height) / 2; } bool diff --git a/view.h b/view.h index 5878778..749693c 100644 --- a/view.h +++ b/view.h @@ -32,7 +32,7 @@ struct cg_view { void (*activate)(struct cg_view *view, bool activate); void (*maximize)(struct cg_view *view, int output_width, int output_height); - void (*get_geometry)(struct cg_view *view, struct wlr_box *geom); + void (*get_geometry)(struct cg_view *view, int *width_out, int *height_out); bool (*is_primary)(struct cg_view *view); }; diff --git a/xdg_shell.c b/xdg_shell.c index c36980d..7babb2c 100644 --- a/xdg_shell.c +++ b/xdg_shell.c @@ -28,9 +28,13 @@ maximize(struct cg_view *view, int output_width, int output_height) } static void -get_geometry(struct cg_view *view, struct wlr_box *geom) +get_geometry(struct cg_view *view, int *width_out, int *height_out) { - wlr_xdg_surface_get_geometry(view->xdg_surface, geom); + struct wlr_box geom; + + wlr_xdg_surface_get_geometry(view->xdg_surface, &geom); + *width_out = geom.width; + *height_out = geom.height; } static bool