lumina-desktop / lumina

Lumina Desktop Environment
http://lumina-desktop.org
BSD 3-Clause "New" or "Revised" License
530 stars 115 forks source link

Windows sometimes shrunk during open (minor annoyance, low priority) #803

Open outpaddling opened 2 years ago

outpaddling commented 2 years ago

Window placement appears to be sometimes random but eventually progresses toward the bottom of the screen on successive opens. When a window is opened too close to the bottom, it is automatically resized to fit. This has the effect of making initial window size gradually smaller over time if the window size it remembered. My coreterminal settings fix the initial window size at 80x30, but this is occasionally shrunk to 80x28, and not perfectly. This makes TUI applications with borders not fit quite right.

outpaddling commented 2 years ago

This problem got worse with 1.6.2. The logic for placing new windows apparently changed and now most of my new terminal windows are placed near the bottom of the screen and auto-shrunk. Tried to work around it by changing "New Window Placement" in the Window Manager settings to "Underneath Mouse", but changing this setting has no effect. Window placement behaves the same regardless of the setting. This is likely a separate issue.

outpaddling commented 10 months ago

FYI, the problem is in void` LSession::adjustWindowGeom(WId win, bool maximize). Disabling this function (by inserting a return statement at the top) makes the problem go away. The geometry calculations here appear to be a little off. It thinks the window is over the bottom of the screen, when in fact it is perfectly aligned against the bottom panel.

outpaddling commented 10 months ago

Found the specific problem: The code was calling setBottom() (which resizes the window) where it should have used moveBottom(), to move the window up if possible rather than resize it. Calculations still appear to be off, as moveBottom() now creates a large gap between the window and the lower panel. But, at least the windows are not being shrunk in appropriately now.

q5sys commented 10 months ago

Thanks for research into it. I'll have to check on that myself when I get time.

outpaddling commented 10 months ago

Just committed this additional patch to the FreeBSD port. I'll do a pull request in the near future, as the number of patches has become significant with battery icon improvements, etc.

@@ -644,9 +694,12 @@ void LSession::adjustWindowGeom(WId win, bool maximize
       if(DEBUG){ qDebug() << "Y-Diff:" << diff; }
       if(diff < 0){ diff = -diff; } //need a positive value
       if( (fgeom.height()+ diff)< desk.height()){
-        //just move the window - there is room for it above
-       geom.setBottom(desk.bottom()-frame[1]);
-       fgeom.setBottom(desk.bottom());
+        // Just move the window - there is room for it above
+        // FIXME: geom calculations appear to be off
+        // This creates a large gap between the bottom of the new window
+        // and the lower panel
+       geom.moveBottom(desk.bottom()-frame[1]);
+       fgeom.moveBottom(desk.bottom());
outpaddling commented 10 months ago

FYI, the gap looks like the same height as the bottom panel. I just confirmed by resizing the panel and opening more terminal windows. The new gap matched the new panel height instead of the old one.