diff options
author | 2018-05-26 20:37:04 +1000 | |
---|---|---|
committer | 2018-06-01 23:14:58 +1000 | |
commit | 3b1db30a5e5758ec099b79250681cbf4be5ae0e9 (patch) | |
tree | 5eb165beaf1de016aec2b2fe74c15c9034357ce8 /sway | |
parent | Implement wants_floating for xdg_shell and xdg_shell_v6 (diff) | |
download | sway-3b1db30a5e5758ec099b79250681cbf4be5ae0e9.tar.gz sway-3b1db30a5e5758ec099b79250681cbf4be5ae0e9.tar.zst sway-3b1db30a5e5758ec099b79250681cbf4be5ae0e9.zip |
Use surface size if xdg shell's geometry isn't set
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/xdg_shell.c | 13 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 13 |
2 files changed, 18 insertions, 8 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index ae6945c2..30990f67 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -182,13 +182,18 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
182 | struct sway_xdg_shell_view *xdg_shell_view = | 182 | struct sway_xdg_shell_view *xdg_shell_view = |
183 | wl_container_of(listener, xdg_shell_view, commit); | 183 | wl_container_of(listener, xdg_shell_view, commit); |
184 | struct sway_view *view = &xdg_shell_view->view; | 184 | struct sway_view *view = &xdg_shell_view->view; |
185 | struct wlr_box *geometry = &view->wlr_xdg_surface->geometry; | 185 | int width = view->wlr_xdg_surface->geometry.width; |
186 | int height = view->wlr_xdg_surface->geometry.height; | ||
187 | if (!width && !height) { | ||
188 | width = view->wlr_xdg_surface->surface->current->width; | ||
189 | height = view->wlr_xdg_surface->surface->current->height; | ||
190 | } | ||
186 | if (!view->natural_width && !view->natural_height) { | 191 | if (!view->natural_width && !view->natural_height) { |
187 | view->natural_width = geometry->width; | 192 | view->natural_width = width; |
188 | view->natural_height = geometry->height; | 193 | view->natural_height = height; |
189 | } | 194 | } |
190 | if (view->swayc && container_is_floating(view->swayc)) { | 195 | if (view->swayc && container_is_floating(view->swayc)) { |
191 | view_update_size(view, geometry->width, geometry->height); | 196 | view_update_size(view, width, height); |
192 | } else { | 197 | } else { |
193 | view_update_size(view, xdg_shell_view->pending_width, | 198 | view_update_size(view, xdg_shell_view->pending_width, |
194 | xdg_shell_view->pending_height); | 199 | xdg_shell_view->pending_height); |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index fc0abf56..7cba6e49 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -181,13 +181,18 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
181 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | 181 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = |
182 | wl_container_of(listener, xdg_shell_v6_view, commit); | 182 | wl_container_of(listener, xdg_shell_v6_view, commit); |
183 | struct sway_view *view = &xdg_shell_v6_view->view; | 183 | struct sway_view *view = &xdg_shell_v6_view->view; |
184 | struct wlr_box *geometry = &view->wlr_xdg_surface_v6->geometry; | 184 | int width = view->wlr_xdg_surface_v6->geometry.width; |
185 | int height = view->wlr_xdg_surface_v6->geometry.height; | ||
186 | if (!width && !height) { | ||
187 | width = view->wlr_xdg_surface_v6->surface->current->width; | ||
188 | height = view->wlr_xdg_surface_v6->surface->current->height; | ||
189 | } | ||
185 | if (!view->natural_width && !view->natural_height) { | 190 | if (!view->natural_width && !view->natural_height) { |
186 | view->natural_width = geometry->width; | 191 | view->natural_width = width; |
187 | view->natural_height = geometry->height; | 192 | view->natural_height = height; |
188 | } | 193 | } |
189 | if (view->swayc && container_is_floating(view->swayc)) { | 194 | if (view->swayc && container_is_floating(view->swayc)) { |
190 | view_update_size(view, geometry->width, geometry->height); | 195 | view_update_size(view, width, height); |
191 | } else { | 196 | } else { |
192 | view_update_size(view, xdg_shell_v6_view->pending_width, | 197 | view_update_size(view, xdg_shell_v6_view->pending_width, |
193 | xdg_shell_v6_view->pending_height); | 198 | xdg_shell_v6_view->pending_height); |