diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/xdg_shell.c | 22 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 22 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 7 |
3 files changed, 27 insertions, 24 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) { struct sway_xdg_shell_view *xdg_shell_view = wl_container_of(listener, xdg_shell_view, commit); struct sway_view *view = &xdg_shell_view->view; - int width = view->wlr_xdg_surface->geometry.width; - int height = view->wlr_xdg_surface->geometry.height; - if (!width && !height) { - width = view->wlr_xdg_surface->surface->current->width; - height = view->wlr_xdg_surface->surface->current->height; - } - if (!view->natural_width && !view->natural_height) { - view->natural_width = width; - view->natural_height = height; - } if (view->swayc && container_is_floating(view->swayc)) { + int width = view->wlr_xdg_surface->geometry.width; + int height = view->wlr_xdg_surface->geometry.height; + if (!width && !height) { + width = view->wlr_xdg_surface->surface->current->width; + height = view->wlr_xdg_surface->surface->current->height; + } view_update_size(view, width, height); } else { view_update_size(view, xdg_shell_view->pending_width, @@ -216,6 +212,12 @@ static void handle_map(struct wl_listener *listener, void *data) { struct sway_view *view = &xdg_shell_view->view; struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_surface; + view->natural_width = view->wlr_xdg_surface->geometry.width; + view->natural_height = view->wlr_xdg_surface->geometry.height; + if (!view->natural_width && !view->natural_height) { + view->natural_width = view->wlr_xdg_surface->surface->current->width; + view->natural_height = view->wlr_xdg_surface->surface->current->height; + } view_map(view, view->wlr_xdg_surface->surface); xdg_shell_view->commit.notify = handle_commit; 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) { struct sway_xdg_shell_v6_view *xdg_shell_v6_view = wl_container_of(listener, xdg_shell_v6_view, commit); struct sway_view *view = &xdg_shell_v6_view->view; - int width = view->wlr_xdg_surface_v6->geometry.width; - int height = view->wlr_xdg_surface_v6->geometry.height; - if (!width && !height) { - width = view->wlr_xdg_surface_v6->surface->current->width; - height = view->wlr_xdg_surface_v6->surface->current->height; - } - if (!view->natural_width && !view->natural_height) { - view->natural_width = width; - view->natural_height = height; - } if (view->swayc && container_is_floating(view->swayc)) { + int width = view->wlr_xdg_surface_v6->geometry.width; + int height = view->wlr_xdg_surface_v6->geometry.height; + if (!width && !height) { + width = view->wlr_xdg_surface_v6->surface->current->width; + height = view->wlr_xdg_surface_v6->surface->current->height; + } view_update_size(view, width, height); } else { view_update_size(view, xdg_shell_v6_view->pending_width, @@ -215,6 +211,12 @@ static void handle_map(struct wl_listener *listener, void *data) { struct sway_view *view = &xdg_shell_v6_view->view; struct wlr_xdg_surface_v6 *xdg_surface = view->wlr_xdg_surface_v6; + view->natural_width = view->wlr_xdg_surface_v6->geometry.width; + view->natural_height = view->wlr_xdg_surface_v6->geometry.height; + if (!view->natural_width && !view->natural_height) { + view->natural_width = view->wlr_xdg_surface_v6->surface->current->width; + view->natural_height = view->wlr_xdg_surface_v6->surface->current->height; + } view_map(view, view->wlr_xdg_surface_v6->surface); xdg_shell_v6_view->commit.notify = handle_commit; diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index d0fbcaeb..76265ea9 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -235,10 +235,6 @@ static void handle_commit(struct wl_listener *listener, void *data) { wl_container_of(listener, xwayland_view, commit); struct sway_view *view = &xwayland_view->view; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; - if (!view->natural_width && !view->natural_height) { - view->natural_width = xsurface->width; - view->natural_height = xsurface->height; - } if (view->swayc && container_is_floating(view->swayc)) { view_update_size(view, xsurface->width, xsurface->height); view_update_position(view, @@ -263,6 +259,9 @@ static void handle_map(struct wl_listener *listener, void *data) { struct wlr_xwayland_surface *xsurface = data; struct sway_view *view = &xwayland_view->view; + view->natural_width = xsurface->width; + view->natural_height = xsurface->height; + // Wire up the commit listener here, because xwayland map/unmap can change // the underlying wlr_surface wl_signal_add(&xsurface->surface->events.commit, &xwayland_view->commit); |