Bug 453197 - When window maximized vertically it vertical size becomes not maximized after maximize and unmaximize
Summary: When window maximized vertically it vertical size becomes not maximized after...
Status: RESOLVED INTENTIONAL
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: 5.24.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 423620 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-04-29 14:54 UTC by vyacheslav
Modified: 2023-01-18 11:56 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vyacheslav 2022-04-29 14:54:55 UTC
STEPS TO REPRODUCE
1. Run kolourpaint and maximize it vertically
2. Close kolourpaint
3. Start again kolourpaint. Height is equal to height of screen
4. Maximize it to full screen and unmaximize
5. Height of window is not equal to height of screen

When changing vertical size (using mouse) equal to size of screen then after unmaximize size restored as expected. But when window initially vertically maximized then size after unmaximize is lost.

OBSERVED RESULT
After unmaximize size of window always should be same as before maximize.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.93
Qt Version: 5.15.3
Comment 1 Ahmad Samir 2022-07-31 12:24:07 UTC
This happens even without restarting the app:
- open dolphin, note the window size, maximize it vertically
- maximize it (which affects both vertical and horizontal size)
- un-maximize it, it goes back to the initial window size from step 1

Repeat the above but instead of maximizing vertically using kwin shorctus (e.g. middle clicking the maximize button on the title bar), resize the window manually to the same size it would have been changed to; everything works as expected.
Comment 2 Patrick Silva 2022-10-05 13:03:07 UTC
*** Bug 423620 has been marked as a duplicate of this bug. ***
Comment 3 Vlad Zahorodnii 2023-01-17 12:41:22 UTC
> But when window initially vertically maximized then size after unmaximize is lost

when a window is started initially vertically maximized, kwin has no idea what size the window must have after unmaximizing, e.g. whether it should have the same size as the height of the work area or something else. Atm iirc it picks some small size.
Comment 4 vyacheslav 2023-01-17 17:57:53 UTC
(In reply to Vlad Zahorodnii from comment #3)
> > But when window initially vertically maximized then size after unmaximize is lost
> 
> when a window is started initially vertically maximized, kwin has no idea
> what size the window must have after unmaximizing, e.g. whether it should
> have the same size as the height of the work area or something else. Atm
> iirc it picks some small size.

Why kwin does not know previous size? Kwin remember it before maximize and restores it after unmaximize. It works for any size except when height equals to work area size. And further: If vertical size to stretch manually to whole work area using mouse then kwin restores it after unmaximize as expected(!). Restoring does not working, for some reason, only if window height initially equal to work area size.

So:
1. When window height less than work area height kwin restores it after unmaximize - OK
2. When window height equal to work area height and height was changed manually by mouse kwin restores it after unmaximize - OK
3. When window height equal to work area height initially and height WAS NOT changed by mouse kwin does not restore it after unmaximize - FAIL

It is real bug. And it is very annoying restore windows vertical size after unmaximize (using mouse) hundred times per day.
Comment 5 Vlad Zahorodnii 2023-01-18 08:23:58 UTC
> Restoring does not working, for some reason, only if window height initially equal to work area size

I already explained why it doesn't work. kwin has insufficient information to properly restore the window so it picks a size of its own.
Comment 6 vyacheslav 2023-01-18 10:10:20 UTC
> kwin has insufficient information to properly restore the window so it picks a size of its own.

Kwin restores window size correctly if window was manually resized before maximize. So it HAS previous size information. Why it can't restore size without manually resizing?
Comment 7 Vlad Zahorodnii 2023-01-18 11:24:16 UTC
If you manually resize the window, kwin will be aware of that new size. If a window is initially maximized, kwin has no idea what its previous size had been. kwin doesn't know the previous state of apps.

Also, please stop reopening the bug report. Don't abuse the power changing bug report status!
Comment 8 Ahmad Samir 2023-01-18 11:34:09 UTC
So, can KWin, instead of setting the maximize-vertically property (or whatever it's called in XCB/X11 land) on the window, calculate that height and "resize" the window instead? (I am not talking about the app-started-maximized-vertically use-case, rather the one in my previous comment). Of course, it could well be that would cause other issues, e.g. moving the window from one screen to another with a different size, if the maximized-vertically property isn't set, it's going go keep the height... window management is tough. :)
Comment 9 vyacheslav 2023-01-18 11:56:20 UTC
(In reply to Vlad Zahorodnii from comment #7)
> If you manually resize the window, kwin will be aware of that new size. If a
> window is initially maximized, kwin has no idea what its previous size had
> been. kwin doesn't know the previous state of apps.

Kwin should be aware of window size when it initially created not only when it manually resized.