]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: don't try to restore to very small width/height on unmaximize
authortokyo4j <hrak1529@gmail.com>
Wed, 19 Jun 2024 02:48:39 +0000 (11:48 +0900)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Fri, 28 Jun 2024 12:07:26 +0000 (14:07 +0200)
Thonny (Python IDE made with Tk) may set the window geometry to 1x1 and
maximizes the window before mapping. This set `view->natural_geometry`
to 1x1, so labwc tried to restore the window geometry to it on
unmaximize, causing validation errors in `ssd_update_geometry()` as its
width and height are smaller than `LAB_MIN_VIEW_{WIDTH,HEIGHT}`.

This commit fixes it by not allowing geometries smaller than
`LAB_MIN_VIEW_{WIDTH,HEIGHT}` in `view->natural_geometry`.

src/view.c

index 5c98a935e7ff1eb5a0e2e2284c3b9dafbfb90568..1646decd90e79e497b576accc7adea3476520c96 100644 (file)
@@ -841,10 +841,12 @@ view_store_natural_geometry(struct view *view)
 
        /**
         * If an application was started maximized or fullscreened, its
-        * natural_geometry width/height may still be zero in which case we set
-        * some fallback values. This is the case with foot and Qt applications.
+        * natural_geometry width/height may still be zero (or very small
+        * values) in which case we set some fallback values. This is the case
+        * with foot and some Qt/Tk applications.
         */
-       if (wlr_box_empty(&view->pending)) {
+       if (view->pending.width < LAB_MIN_VIEW_WIDTH
+                       || view->pending.height < LAB_MIN_VIEW_HEIGHT) {
                set_fallback_geometry(view);
        } else {
                view->natural_geometry = view->pending;