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

Close, maximize and minimize buttons are very small in gtk apps with CSDs since Plasma 5.20 #22

Closed
mthw0 opened this issue Sep 19, 2020 · 11 comments

Comments

@mthw0
Copy link

mthw0 commented Sep 19, 2020

In Plasma 5.20, close, maximize, and minimize buttons now try to use the same look as buttons in SSDs resulting in very small buttons when your window decorations are used. Is this an issue on your side or is there something wrong on the Plasma side?
This is a screenshot from Firefox with CSDs enabled:

Screenshot_20200918_083041

It looks the same in gtk3-demo. This issue was also reported on the KDE bug tracker: https://bugs.kde.org/show_bug.cgi?id=426670 Could you look into this?

@Zren
Copy link
Owner

Zren commented Sep 19, 2020

I can reproduce in Gnome Chess. My Firefox has a userChrome.css that swapped the Breeze for Window's like buttons, so I'll test that later.

2020-09-19___09-27-35

CSD should be controlled by the GTK theme. Atm I can't even find the "Gtk Theme" module in System Settings however. Or the Qt theme module (which should be the same module now). Weird.

@Zren
Copy link
Owner

Zren commented Sep 19, 2020

Wow, neat. It appears changing Windows Decorations will now "paint" the decorations as .svg in ~/.config/gtk-3.0/assets/. So cool!

@Zren
Copy link
Owner

Zren commented Sep 19, 2020

It's drawing a 50x50 icon. However my icon is only 10x10.

Normally my buttons are 32x24. With the icon 11x11.

image

Since my Gtk theme only has a 39px tall headerbar, the icon is even smaller. 39/50 * 10 = 7.8px.

There must be padding above/below the icon button however, as the icon looks like it's only 6x6 in the CSD. Perhaps the button is only 32x32? 32/50 * 10 = 6.4px

@Zren
Copy link
Owner

Zren commented Sep 19, 2020

I don't appear to scale the buttons in Qt apps. VeryLarge = 34px tall, Medium = 24px tall, Tiny = 20px tall. Icons are always 11x11.

Hmm, do I even scale the buttons for HiDPI?

I need to scale the 10x10 rect in Button::paint.

@Zren
Copy link
Owner

Zren commented Sep 19, 2020

If I scale the icon by buttonRect.height() * 10/24, I get:

  • Tiny: 8x8 icon 2020-09-19___10-10-14
  • Small: 9x9 icon 2020-09-19___10-09-53
  • Medium: 10x10 icon 2020-09-19___10-12-13
  • Large: 12x12 icon 2020-09-19___10-10-51
  • Very Large: 14x14 icon 2020-09-19___10-11-13

Unfortunately, it doesn't appear to affect the gtk theme in ~/.config/gtk-3.0/assets/*.svg. I event switched to Breeze then back to Material.

Button.cc Code:

    const QRectF buttonRect = geometry();
    int iconSize = qRound(buttonRect.height() * 10/24);
    QRectF iconRect = QRectF(0, 0, iconSize, iconSize);
    qCDebug(category) << "Button::paint" << buttonRect << (buttonRect.height() * 10/24) << iconSize << iconRect;
    iconRect.moveCenter(buttonRect.center().toPoint());

@Zren
Copy link
Owner

Zren commented Sep 19, 2020

There's a cache of some sort I think. I added an extra line the maximize icon, but it was not reflected in the gtk assets.

2020-09-19___10-34-06

@Zren
Copy link
Owner

Zren commented Sep 19, 2020

@Zren
Copy link
Owner

Zren commented Sep 19, 2020

I needed to reboot for changes to take effect. So whatever process uses kde-gtk-config is loaded in needs to be restarted, just like I need to restart kwin_x11 to test changes to the normal window decorations.

2020-09-19___15-47-56

@Zren
Copy link
Owner

Zren commented Sep 20, 2020

Had to also scale the line thickness. It's a bit blurry still since we're scaling the icon by 50/18 = 2.777 so it's a pain to get sharp lines for the minimize and maximize lines.

"Very Large" KWin buttons on top, with Chess Gtk CSD below:

2020-09-19___21-29-34

@Zren
Copy link
Owner

Zren commented Sep 20, 2020

In 65fe6f5, I check if the process is kded5, and use a smaller padding around the icon. I can't easily get the button to use sharp lines, but at least the icons are visible now.

@mthw0
Copy link
Author

mthw0 commented Sep 20, 2020

It looks good now, thanks.

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