diff options
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/render.c | 9 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 20 | ||||
-rw-r--r-- | sway/desktop/xdg_shell.c | 7 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 7 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 7 |
5 files changed, 33 insertions, 17 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index fa27500e..9102dc34 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -204,9 +204,9 @@ static void render_view_toplevels(struct sway_view *view, .alpha = alpha, }; // Render all toplevels without descending into popups - double ox = view->container->current.content_x - + double ox = view->container->surface_x - output->wlr_output->lx - view->geometry.x; - double oy = view->container->current.content_y - + double oy = view->container->surface_y - output->wlr_output->ly - view->geometry.y; output_surface_for_each_surface(output, view->surface, ox, oy, render_surface_iterator, &data); @@ -240,9 +240,9 @@ static void render_saved_view(struct sway_view *view, return; } struct wlr_box box = { - .x = view->container->current.content_x - output->wlr_output->lx - + .x = view->container->surface_x - output->wlr_output->lx - view->saved_geometry.x, - .y = view->container->current.content_y - output->wlr_output->ly - + .y = view->container->surface_y - output->wlr_output->ly - view->saved_geometry.y, .width = view->saved_buffer_width, .height = view->saved_buffer_height, @@ -1004,7 +1004,6 @@ void output_render(struct sway_output *output, struct timespec *when, wlr_renderer_clear(renderer, clear_color); } - // TODO: handle views smaller than the output if (fullscreen_con->view) { if (fullscreen_con->view->saved_buffer) { render_saved_view(fullscreen_con->view, output, damage, 1.0f); diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 9155f0a1..e0c3a5d1 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -249,6 +249,26 @@ static void apply_container_state(struct sway_container *container, desktop_damage_box(&box); } + // If the view hasn't responded to the configure, center it within + // the container. This is important for fullscreen views which + // refuse to resize to the size of the output. + if (view && view->surface) { + if (view->surface->current.width < container->width) { + container->surface_x = container->content_x + + (container->content_width - view->surface->current.width) / 2; + } else { + container->surface_x = container->content_x; + } + if (view->surface->current.height < container->height) { + container->surface_y = container->content_y + + (container->content_height - view->surface->current.height) / 2; + } else { + container->surface_y = container->content_y; + } + container->surface_width = view->surface->current.width; + container->surface_height = view->surface->current.height; + } + if (!container->node.destroying) { container_discover_outputs(container); } diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 007b0a94..b5dcfb0f 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -291,10 +291,9 @@ static void handle_commit(struct wl_listener *listener, void *data) { wlr_xdg_surface_get_geometry(xdg_surface, &new_geo); struct sway_container *con = view->container; - if ((new_geo.width != con->content_width || - new_geo.height != con->content_height) && - container_is_floating(con)) { - // A floating view has unexpectedly sent a new size + if ((new_geo.width != con->surface_width || + new_geo.height != con->surface_height)) { + // The view has unexpectedly sent a new size desktop_damage_view(view); view_update_size(view, new_geo.width, new_geo.height); memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 386e350e..a7ea163f 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -284,10 +284,9 @@ static void handle_commit(struct wl_listener *listener, void *data) { wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &new_geo); struct sway_container *con = view->container; - if ((new_geo.width != con->content_width || - new_geo.height != con->content_height) && - container_is_floating(con)) { - // A floating view has unexpectedly sent a new size + if ((new_geo.width != con->surface_width || + new_geo.height != con->surface_height)) { + // The view has unexpectedly sent a new size desktop_damage_view(view); view_update_size(view, new_geo.width, new_geo.height); memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index d9e1b0a9..e0d307e8 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -333,10 +333,9 @@ static void handle_commit(struct wl_listener *listener, void *data) { get_geometry(view, &new_geo); struct sway_container *con = view->container; - if ((new_geo.width != con->content_width || - new_geo.height != con->content_height) && - container_is_floating(con)) { - // A floating view has unexpectedly sent a new size + if ((new_geo.width != con->surface_width || + new_geo.height != con->surface_height)) { + // The view has unexpectedly sent a new size // eg. The Firefox "Save As" dialog when downloading a file desktop_damage_view(view); view_update_size(view, new_geo.width, new_geo.height); |