mirror of
https://github.com/swaywm/sway.git
synced 2026-04-20 06:47:03 -04:00
shells: Only center tiled views on size change
The size of a tiled container cannot change in response to new buffer sizes, so there is no need to commit a new transaction. Instead, simply recenter the view with the new geometry, leaving the full transaction flow for floating containers.
This commit is contained in:
parent
50205ade9d
commit
90fa6953ea
3 changed files with 23 additions and 25 deletions
|
|
@ -874,17 +874,9 @@ void view_unmap(struct sway_view *view) {
|
|||
|
||||
void view_update_size(struct sway_view *view, int width, int height) {
|
||||
struct sway_container *con = view->container;
|
||||
|
||||
if (container_is_floating(con)) {
|
||||
con->content_width = width;
|
||||
con->content_height = height;
|
||||
container_set_geometry_from_content(con);
|
||||
} else {
|
||||
con->surface_x = con->content_x + (con->content_width - width) / 2;
|
||||
con->surface_y = con->content_y + (con->content_height - height) / 2;
|
||||
con->surface_x = fmax(con->surface_x, con->content_x);
|
||||
con->surface_y = fmax(con->surface_y, con->content_y);
|
||||
}
|
||||
con->content_width = width;
|
||||
con->content_height = height;
|
||||
container_set_geometry_from_content(con);
|
||||
}
|
||||
|
||||
void view_center_surface(struct sway_view *view) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue