From 6a1af5f1ae0db6919cbacf0c24a36fcf0ac3b7c5 Mon Sep 17 00:00:00 2001 From: tiosgz Date: Sat, 9 Oct 2021 17:28:35 +0000 Subject: [PATCH] view_get_size: access view::geom directly --- include/desktop/view.h | 2 -- kiwmi/desktop/view.c | 5 ++--- kiwmi/desktop/xdg_shell.c | 14 -------------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/include/desktop/view.h b/include/desktop/view.h index d9f937a..2fdb074 100644 --- a/include/desktop/view.h +++ b/include/desktop/view.h @@ -76,8 +76,6 @@ struct kiwmi_view_impl { wlr_surface_iterator_func_t callback, void *user_data); pid_t (*get_pid)(struct kiwmi_view *view); - void ( - *get_size)(struct kiwmi_view *view, uint32_t *width, uint32_t *height); void (*set_activated)(struct kiwmi_view *view, bool activated); void (*set_size)(struct kiwmi_view *view, uint32_t width, uint32_t height); const char *( diff --git a/kiwmi/desktop/view.c b/kiwmi/desktop/view.c index aa5459c..15b690b 100644 --- a/kiwmi/desktop/view.c +++ b/kiwmi/desktop/view.c @@ -47,9 +47,8 @@ view_get_pid(struct kiwmi_view *view) void view_get_size(struct kiwmi_view *view, uint32_t *width, uint32_t *height) { - if (view->impl->get_size) { - view->impl->get_size(view, width, height); - } + *width = view->geom.width; + *height = view->geom.height; } const char * diff --git a/kiwmi/desktop/xdg_shell.c b/kiwmi/desktop/xdg_shell.c index 107675f..3d79420 100644 --- a/kiwmi/desktop/xdg_shell.c +++ b/kiwmi/desktop/xdg_shell.c @@ -382,19 +382,6 @@ xdg_shell_view_get_pid(struct kiwmi_view *view) return pid; } -static void -xdg_shell_view_get_size( - struct kiwmi_view *view, - uint32_t *width, - uint32_t *height) -{ - struct wlr_box geom; - wlr_xdg_surface_get_geometry(view->xdg_surface, &geom); - - *width = geom.width; - *height = geom.height; -} - static const char * xdg_shell_view_get_string_prop( struct kiwmi_view *view, @@ -446,7 +433,6 @@ static const struct kiwmi_view_impl xdg_shell_view_impl = { .close = xdg_shell_view_close, .for_each_mapped_surface = xdg_shell_view_for_each_mapped_surface, .get_pid = xdg_shell_view_get_pid, - .get_size = xdg_shell_view_get_size, .get_string_prop = xdg_shell_view_get_string_prop, .set_activated = xdg_shell_view_set_activated, .set_size = xdg_shell_view_set_size,