Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
outpaddling opened this issue Jan 5, 2022 · 6 comments
Open

Comments

@outpaddling
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Member

q5sys commented Oct 19, 2023

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

@outpaddling
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants