diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-30 10:22:35 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-01 23:14:58 +1000 |
commit | 9119f876552a47716bd317524bf5d786f909e5e5 (patch) | |
tree | 43c14f317a4e971e0f76cbbaf446a91179505cc2 /sway/desktop/xdg_shell_v6.c | |
parent | Adjust move command to account for changed coordinate system (diff) | |
download | sway-9119f876552a47716bd317524bf5d786f909e5e5.tar.gz sway-9119f876552a47716bd317524bf5d786f909e5e5.tar.zst sway-9119f876552a47716bd317524bf5d786f909e5e5.zip |
Fix floating position when view is floated when mapped
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index b1b8091b..6cb489db 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -172,17 +172,13 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
172 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | 172 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = |
173 | wl_container_of(listener, xdg_shell_v6_view, commit); | 173 | wl_container_of(listener, xdg_shell_v6_view, commit); |
174 | struct sway_view *view = &xdg_shell_v6_view->view; | 174 | struct sway_view *view = &xdg_shell_v6_view->view; |
175 | int width = view->wlr_xdg_surface_v6->geometry.width; | ||
176 | int height = view->wlr_xdg_surface_v6->geometry.height; | ||
177 | if (!width && !height) { | ||
178 | width = view->wlr_xdg_surface_v6->surface->current->width; | ||
179 | height = view->wlr_xdg_surface_v6->surface->current->height; | ||
180 | } | ||
181 | if (!view->natural_width && !view->natural_height) { | ||
182 | view->natural_width = width; | ||
183 | view->natural_height = height; | ||
184 | } | ||
185 | if (view->swayc && container_is_floating(view->swayc)) { | 175 | if (view->swayc && container_is_floating(view->swayc)) { |
176 | int width = view->wlr_xdg_surface_v6->geometry.width; | ||
177 | int height = view->wlr_xdg_surface_v6->geometry.height; | ||
178 | if (!width && !height) { | ||
179 | width = view->wlr_xdg_surface_v6->surface->current->width; | ||
180 | height = view->wlr_xdg_surface_v6->surface->current->height; | ||
181 | } | ||
186 | view_update_size(view, width, height); | 182 | view_update_size(view, width, height); |
187 | } else { | 183 | } else { |
188 | view_update_size(view, xdg_shell_v6_view->pending_width, | 184 | view_update_size(view, xdg_shell_v6_view->pending_width, |
@@ -215,6 +211,12 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
215 | struct sway_view *view = &xdg_shell_v6_view->view; | 211 | struct sway_view *view = &xdg_shell_v6_view->view; |
216 | struct wlr_xdg_surface_v6 *xdg_surface = view->wlr_xdg_surface_v6; | 212 | struct wlr_xdg_surface_v6 *xdg_surface = view->wlr_xdg_surface_v6; |
217 | 213 | ||
214 | view->natural_width = view->wlr_xdg_surface_v6->geometry.width; | ||
215 | view->natural_height = view->wlr_xdg_surface_v6->geometry.height; | ||
216 | if (!view->natural_width && !view->natural_height) { | ||
217 | view->natural_width = view->wlr_xdg_surface_v6->surface->current->width; | ||
218 | view->natural_height = view->wlr_xdg_surface_v6->surface->current->height; | ||
219 | } | ||
218 | view_map(view, view->wlr_xdg_surface_v6->surface); | 220 | view_map(view, view->wlr_xdg_surface_v6->surface); |
219 | 221 | ||
220 | xdg_shell_v6_view->commit.notify = handle_commit; | 222 | xdg_shell_v6_view->commit.notify = handle_commit; |