mirror of
https://github.com/swaywm/sway.git
synced 2024-11-21 23:41:27 +00:00
xdg-shell: chase xdg_surface geometry updates
This commit is contained in:
parent
c3279944fb
commit
c30c451907
|
@ -299,18 +299,17 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box new_geo;
|
struct wlr_box *new_geo = &xdg_surface->geometry;
|
||||||
wlr_xdg_surface_get_geometry(xdg_surface, &new_geo);
|
bool new_size = new_geo->width != view->geometry.width ||
|
||||||
bool new_size = new_geo.width != view->geometry.width ||
|
new_geo->height != view->geometry.height ||
|
||||||
new_geo.height != view->geometry.height ||
|
new_geo->x != view->geometry.x ||
|
||||||
new_geo.x != view->geometry.x ||
|
new_geo->y != view->geometry.y;
|
||||||
new_geo.y != view->geometry.y;
|
|
||||||
|
|
||||||
if (new_size) {
|
if (new_size) {
|
||||||
// The client changed its surface size in this commit. For floating
|
// The client changed its surface size in this commit. For floating
|
||||||
// containers, we resize the container to match. For tiling containers,
|
// containers, we resize the container to match. For tiling containers,
|
||||||
// we only recenter the surface.
|
// we only recenter the surface.
|
||||||
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
|
memcpy(&view->geometry, new_geo, sizeof(struct wlr_box));
|
||||||
if (container_is_floating(view->container)) {
|
if (container_is_floating(view->container)) {
|
||||||
view_update_size(view);
|
view_update_size(view);
|
||||||
// Only set the toplevel size the current container actually has a size.
|
// Only set the toplevel size the current container actually has a size.
|
||||||
|
@ -463,12 +462,8 @@ static void handle_map(struct wl_listener *listener, void *data) {
|
||||||
struct sway_view *view = &xdg_shell_view->view;
|
struct sway_view *view = &xdg_shell_view->view;
|
||||||
struct wlr_xdg_toplevel *toplevel = view->wlr_xdg_toplevel;
|
struct wlr_xdg_toplevel *toplevel = view->wlr_xdg_toplevel;
|
||||||
|
|
||||||
view->natural_width = toplevel->base->current.geometry.width;
|
view->natural_width = toplevel->base->geometry.width;
|
||||||
view->natural_height = toplevel->base->current.geometry.height;
|
view->natural_height = toplevel->base->geometry.height;
|
||||||
if (!view->natural_width && !view->natural_height) {
|
|
||||||
view->natural_width = toplevel->base->surface->current.width;
|
|
||||||
view->natural_height = toplevel->base->surface->current.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool csd = false;
|
bool csd = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue