Zren / material-decoration

Material-ish window decoration theme for KWin, with LIM, based on zzag's original design.
GNU General Public License v2.0
200 stars 17 forks source link

HiDPI scaling is not respected for menu icons and padding #39

Open paulmcauley opened 3 years ago

paulmcauley commented 3 years ago

I have a HiDPI display at 250% scaling.

Here is a screenshot of how the Material menu looks: konsole_Material_menu

Here is a screenshot of how a normal menu looks: konsole_normal_menu

As you can see, the menu's icon size and padding are too small when scaling is used.

Zren commented 3 years ago

Was planning to refactor the TextButton::horzPadding from a hardcoded 4px anyways, so I just made it use smallSpacing.

As for why the QMenu doesn't scale, I'm not sure.

Here's what 200% scaling looks like for me to confirm the bug.

2021-03-15___19-07-33

Zren commented 3 years ago

Hmm, if I uncomment the code to display the normal "Application Menu" icon button that tells KWin to display the menu, it draws the entire menu at 100%. Even the text is at 100% scaling.

2021-03-15___19-17-57

Even breeze seems to have this bug. Can you confirm this @paulmcauley?

2021-03-15___19-20-14

paulmcauley commented 3 years ago

No, I don't have the problem with a normal application menu in Breeze (Plasma 5.21.2). Here is what 250% with a normal application menu looks like for me: breeze_application_menu_250

SeptemberHX commented 3 years ago

It is possible to fix the small icon with QProxyStyle.

    int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const override {
        qCDebug(category) << metric;
        if (metric == QStyle::PM_ButtonIconSize) {
            return QProxyStyle::pixelMetric(metric, option, widget) * pixelRatio;
        }
        return QProxyStyle::pixelMetric(metric, option, widget);
    }

Then appMenu->setStyle(xxx) should works. But I don't know how to get the pixelRatio in a decoration.