Bug 489046 - Cannot resize window height to less than 150px on Wayland
Summary: Cannot resize window height to less than 150px on Wayland
Status: RESOLVED INTENTIONAL
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 6.1.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-23 12:38 UTC by Benjamin Robin
Modified: 2024-06-26 14:13 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Robin 2024-06-23 12:38:54 UTC
SUMMARY

Cannot resize Qt window height to less than 150px on Wayland even if the content of the Window is smaller.

STEPS TO REPRODUCE
1. Build a very basic Qt application

```
#include <QApplication>
#include <QWidget>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QWidget w;
    w.resize(300, 50);
    w.setMinimumSize(300, 50);
    w.show();
    return a.exec();
}
```

2. Launch it.
3. Resize the window to increase height, then try to reduce height to original size

OBSERVED RESULT

The application when initially launched as the proper size (300x50).
Then when trying to increase height a bit, the application size jump to 300x150.
The application can be resized to something bigger than 300x150, but it cannot be resize back to an height of 50.

It's as if the minimum window height was hard coded at 150.

EXPECTED RESULT

Declared minimum size in application code should be respected. The user should be able to reduce height up to the minimum declared size (in this case 50).

SOFTWARE/OS VERSIONS

Operating System: Arch Linux 
KDE Plasma Version: 6.1.0
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1
Kernel Version: 6.9.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Graphics Processor: Mesa Intel® UHD Graphics
Scaling: 100% ; Screen resolution: 1920x1080

ADDITIONAL INFORMATION

If the application is launched under Weston, it can be resized correctly. But for the record, the minimum size is not respected (as if the minimum size were 0).
If the application is run under Xorg, it can be resized correctly, and the minimum size is properly enforced.
Comment 1 Vlad Zahorodnii 2024-06-24 08:07:43 UTC
> It's as if the minimum window height was hard coded at 150.

It is, it's the minimum size enforced by kwin.
Comment 2 Benjamin Robin 2024-06-26 07:57:16 UTC
Could you explain why kwin enforces this minimum size (why 150px)?
Why do not trust the minimum size declared by the application?
Comment 3 Nate Graham 2024-06-26 13:06:48 UTC
Because some windows have broken minimum sizes and can be resized to just a single pixel in width and height, making them not only unusable, but also invisible and un-findable when launched. That's a showstopper for a regular user.
Comment 4 Benjamin Robin 2024-06-26 14:13:15 UTC
Maybe a minimum height of 100px instead of 150px is acceptable?
If an user wants a minimum size greater than that for a particular application, it can still use rules.