aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2024-08-14 21:57:47 +0300
committerFurkan Sahin <furkan-dev@proton.me>2024-08-14 21:57:47 +0300
commit8abf6b832cf5662bd6cc572c400e44ec96a6bfc0 (patch)
tree00793650717674607a06ccc5ed1fa520561a2de8
parent41ac8a3c8faccd46e6367650a961e06784b33546 (diff)
xdg-shell: chase xdg_surface geometry updates
-rw-r--r--sway/desktop/xdg_shell.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index fdfa7b65..3aed4ec7 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -299,18 +299,17 @@ static void handle_commit(struct wl_listener *listener, void *data) {
return;
}
- struct wlr_box new_geo;
- wlr_xdg_surface_get_geometry(xdg_surface, &new_geo);
- bool new_size = new_geo.width != view->geometry.width ||
- new_geo.height != view->geometry.height ||
- new_geo.x != view->geometry.x ||
- new_geo.y != view->geometry.y;
+ struct wlr_box *new_geo = &xdg_surface->geometry;
+ bool new_size = new_geo->width != view->geometry.width ||
+ new_geo->height != view->geometry.height ||
+ new_geo->x != view->geometry.x ||
+ new_geo->y != view->geometry.y;
if (new_size) {
// The client changed its surface size in this commit. For floating
// containers, we resize the container to match. For tiling containers,
// we only recenter the surface.
- memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
+ memcpy(&view->geometry, new_geo, sizeof(struct wlr_box));
if (container_is_floating(view->container)) {
view_update_size(view);
// Only set the toplevel size the current container actually has a size.
@@ -463,12 +462,8 @@ static void handle_map(struct wl_listener *listener, void *data) {
struct sway_view *view = &xdg_shell_view->view;
struct wlr_xdg_toplevel *toplevel = view->wlr_xdg_toplevel;
- view->natural_width = toplevel->base->current.geometry.width;
- view->natural_height = toplevel->base->current.geometry.height;
- if (!view->natural_width && !view->natural_height) {
- view->natural_width = toplevel->base->surface->current.width;
- view->natural_height = toplevel->base->surface->current.height;
- }
+ view->natural_width = toplevel->base->geometry.width;
+ view->natural_height = toplevel->base->geometry.height;
bool csd = false;