aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-30 10:22:35 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-01 23:14:58 +1000
commit9119f876552a47716bd317524bf5d786f909e5e5 (patch)
tree43c14f317a4e971e0f76cbbaf446a91179505cc2 /sway/desktop/xdg_shell.c
parentAdjust move command to account for changed coordinate system (diff)
downloadsway-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.c')
-rw-r--r--sway/desktop/xdg_shell.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 7a39a84c..32d1e3ca 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -173,17 +173,13 @@ static void handle_commit(struct wl_listener *listener, void *data) {
173 struct sway_xdg_shell_view *xdg_shell_view = 173 struct sway_xdg_shell_view *xdg_shell_view =
174 wl_container_of(listener, xdg_shell_view, commit); 174 wl_container_of(listener, xdg_shell_view, commit);
175 struct sway_view *view = &xdg_shell_view->view; 175 struct sway_view *view = &xdg_shell_view->view;
176 int width = view->wlr_xdg_surface->geometry.width;
177 int height = view->wlr_xdg_surface->geometry.height;
178 if (!width && !height) {
179 width = view->wlr_xdg_surface->surface->current->width;
180 height = view->wlr_xdg_surface->surface->current->height;
181 }
182 if (!view->natural_width && !view->natural_height) {
183 view->natural_width = width;
184 view->natural_height = height;
185 }
186 if (view->swayc && container_is_floating(view->swayc)) { 176 if (view->swayc && container_is_floating(view->swayc)) {
177 int width = view->wlr_xdg_surface->geometry.width;
178 int height = view->wlr_xdg_surface->geometry.height;
179 if (!width && !height) {
180 width = view->wlr_xdg_surface->surface->current->width;
181 height = view->wlr_xdg_surface->surface->current->height;
182 }
187 view_update_size(view, width, height); 183 view_update_size(view, width, height);
188 } else { 184 } else {
189 view_update_size(view, xdg_shell_view->pending_width, 185 view_update_size(view, xdg_shell_view->pending_width,
@@ -216,6 +212,12 @@ static void handle_map(struct wl_listener *listener, void *data) {
216 struct sway_view *view = &xdg_shell_view->view; 212 struct sway_view *view = &xdg_shell_view->view;
217 struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_surface; 213 struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_surface;
218 214
215 view->natural_width = view->wlr_xdg_surface->geometry.width;
216 view->natural_height = view->wlr_xdg_surface->geometry.height;
217 if (!view->natural_width && !view->natural_height) {
218 view->natural_width = view->wlr_xdg_surface->surface->current->width;
219 view->natural_height = view->wlr_xdg_surface->surface->current->height;
220 }
219 view_map(view, view->wlr_xdg_surface->surface); 221 view_map(view, view->wlr_xdg_surface->surface);
220 222
221 xdg_shell_view->commit.notify = handle_commit; 223 xdg_shell_view->commit.notify = handle_commit;