https://bugs.kde.org/show_bug.cgi?id=391956

--- Comment #25 from Jin Liu <ad.liu....@gmail.com> ---
I did some debugging on https://bugs.kde.org/show_bug.cgi?id=445741, which
might be relevant here. But I don't know much about kwin, so it's only wild
guesses:

In X11, kwin seems to force window size to be rounded to the "resize increment"
in WM_SIZE_HINTS, in various places.
The code is in  X11Window::constrainClientSize:
https://invent.kde.org/plasma/kwin/-/blob/68f6734d5cf758004c3328777dbf66fe9113b4d6/src/x11window.cpp#L3551
>    int width_inc = m_geometryHints.resizeIncrements().width();
>    int height_inc = m_geometryHints.resizeIncrements().height();
>    int basew_inc = m_geometryHints.baseSize().width();
>    int baseh_inc = m_geometryHints.baseSize().height();
>    if (!m_geometryHints.hasBaseSize()) {
>        basew_inc = m_geometryHints.minSize().width();
>        baseh_inc = m_geometryHints.minSize().height();
>    }
>    w = int((w - basew_inc) / width_inc) * width_inc + basew_inc;
>    h = int((h - baseh_inc) / height_inc) * height_inc + baseh_inc;

In my laptop, the screen size is 3200x2000, KDE's global scaling set to 250%.
Then all KDE apps have "resize increment"=3 in WM_SIZE_HINTS, where all Gnome
apps seem to have "resize increment"=2, and other apps (e.g. vscode) don't have
it at all.

This causes the "fullscreen" window menu in all KDE apps grayed out, because of
this check in X11Window::isFullScreenable:
https://invent.kde.org/plasma/kwin/-/blob/68f6734d5cf758004c3328777dbf66fe9113b4d6/src/x11window.cpp#L1284
>    if (rules()->checkStrictGeometry(true)) {
>        // check geometry constraints (rule to obey is set)
>        const QRect fullScreenArea = workspace()->clientArea(FullScreenArea, 
> this);
>        const QSize constrainedClientSize = 
> constrainClientSize(fullScreenArea.size());
>        if (rules()->checkSize(constrainedClientSize) != 
> fullScreenArea.size()) {
>            return false; // the app wouldn't fit exactly fullscreen geometry 
> due to its strict geometry requirements
>        }
>    }
Since my screen resolution is not multiple of 3, KDE apps are not allowed to
fullscreen.

And for this bug, in my laptop, all KDE apps, when launched maximized, the
window won't cover the top-right pixel. Clicking on that pixel closes the
window behind. However, if I restore that window then maximize again, it works
OK.
My guess is X11Window::manage also calls X11Window::constrainClientSize:
https://invent.kde.org/plasma/kwin/-/blob/68f6734d5cf758004c3328777dbf66fe9113b4d6/src/x11window.cpp#L694
So if the desktop area (fullscreen excluding panel) is not multiple of 3, KDE
apps won't exactly cover the whole desktop area when launched maximized.

In my case, both problems can be worked around by creating a window rule: "for
all windows, force disable Strict Geometry", which bypasses
constrainClientSize.

This also explains why Wayland doesn't have these problems, because it uses the
generic Window::constrainClientSize, which doesn't do rounding at all.

Hope this helps.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to