From 5a4a7bc0dad1bb07312f41d6cce9b5a6fc8d884d Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Wed, 3 Jun 2020 14:39:12 +0200 Subject: [PATCH] container: Remove useless surface dimensions The adjustments to resize logic left them unnecessary. --- include/sway/tree/container.h | 1 - sway/desktop/output.c | 8 ++++---- sway/desktop/transaction.c | 2 -- sway/desktop/xdg_shell.c | 5 ++--- sway/desktop/xwayland.c | 5 ++--- sway/tree/view.c | 2 -- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 2c94c772..8d2d8827 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -105,7 +105,6 @@ struct sway_container { // refuses to resize to the content dimensions then it can be smaller. // These are in layout coordinates. double surface_x, surface_y; - double surface_width, surface_height; enum sway_fullscreen_mode fullscreen_mode; diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 18250ae6..2a2e332a 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -171,8 +171,8 @@ void output_view_for_each_surface(struct sway_output *output, - view->geometry.x, .oy = view->container->surface_y - output->ly - view->geometry.y, - .width = view->container->surface_width, - .height = view->container->surface_height, + .width = view->container->current.content_width, + .height = view->container->current.content_height, .rotation = 0, // TODO }; @@ -191,8 +191,8 @@ void output_view_for_each_popup(struct sway_output *output, - view->geometry.x, .oy = view->container->surface_y - output->ly - view->geometry.y, - .width = view->container->surface_width, - .height = view->container->surface_height, + .width = view->container->current.content_width, + .height = view->container->current.content_height, .rotation = 0, // TODO }; diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 053312a5..7b9ab586 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -267,8 +267,6 @@ static void apply_container_state(struct sway_container *container, } else { container->surface_y = container->current.content_y; } - container->surface_width = container->current.content_width; - container->surface_height = container->current.content_height; } if (!container->node.destroying) { diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 01574577..7775f660 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -282,10 +282,9 @@ static void handle_commit(struct wl_listener *listener, void *data) { } else { struct wlr_box new_geo; wlr_xdg_surface_get_geometry(xdg_surface, &new_geo); - struct sway_container *con = view->container; - if ((new_geo.width != con->surface_width || - new_geo.height != con->surface_height)) { + if ((new_geo.width != view->geometry.width || + new_geo.height != view->geometry.height)) { // The view has unexpectedly sent a new size desktop_damage_view(view); view_update_size(view, new_geo.width, new_geo.height); diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 4bf5b6b8..b51bbb74 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -371,10 +371,9 @@ static void handle_commit(struct wl_listener *listener, void *data) { } else { struct wlr_box new_geo; get_geometry(view, &new_geo); - struct sway_container *con = view->container; - if ((new_geo.width != con->surface_width || - new_geo.height != con->surface_height)) { + if ((new_geo.width != view->geometry.width || + new_geo.height != view->geometry.height)) { // The view has unexpectedly sent a new size // eg. The Firefox "Save As" dialog when downloading a file desktop_damage_view(view); diff --git a/sway/tree/view.c b/sway/tree/view.c index 711ab7aa..a9034637 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -737,8 +737,6 @@ void view_update_size(struct sway_view *view, int width, int height) { con->surface_x = fmax(con->surface_x, con->content_x); con->surface_y = fmax(con->surface_y, con->content_y); } - con->surface_width = width; - con->surface_height = height; } static const struct sway_view_child_impl subsurface_impl;