xdg: try to handle slow un-maximize with empty natural geometry better

In the case of an initially-maximized view which is taking a long time
to un-maximize (seen for example with Thunderbird on slow machines), we
may end up in handle_configure_timeout() with an empty pending geometry.
In that case we have no great options (we can't center the view since we
don't know the un-maximized size yet), so set a fallback position.

v2: check wlr_box_empty() before comparing pending and current

Fixes: #2191
This commit is contained in:
John Lindgren 2024-10-01 10:16:29 -04:00 committed by Johan Malm
parent 915d638f8a
commit 452f45cd3d
3 changed files with 41 additions and 18 deletions

View file

@ -29,9 +29,6 @@
#include <wlr/xwayland.h>
#endif
#define LAB_FALLBACK_WIDTH 640
#define LAB_FALLBACK_HEIGHT 480
struct view *
view_from_wlr_surface(struct wlr_surface *surface)
{
@ -827,8 +824,8 @@ adjust_floating_geometry(struct view *view, struct wlr_box *geometry,
void
view_set_fallback_natural_geometry(struct view *view)
{
view->natural_geometry.width = LAB_FALLBACK_WIDTH;
view->natural_geometry.height = LAB_FALLBACK_HEIGHT;
view->natural_geometry.width = VIEW_FALLBACK_WIDTH;
view->natural_geometry.height = VIEW_FALLBACK_HEIGHT;
view_compute_centered_position(view, NULL,
view->natural_geometry.width,
view->natural_geometry.height,
@ -836,9 +833,6 @@ view_set_fallback_natural_geometry(struct view *view)
&view->natural_geometry.y);
}
#undef LAB_FALLBACK_WIDTH
#undef LAB_FALLBACK_HEIGHT
void
view_store_natural_geometry(struct view *view)
{