IBBoard / cawbird

A fork of the Corebird GTK Twitter client that continues to work with Twitter
https://ibboard.co.uk/cawbird/
GNU General Public License v3.0
310 stars 37 forks source link

Non-integral HiDPI display scaling factors not working right (in KDE?) #389

Open rivimey opened 3 years ago

rivimey commented 3 years ago

Describe the bug I have a 28" 4K screen using KDE Plasma on Ubuntu 21.04, using display scaling 175%. In this setup, cawbird displays all except the tweet area as tiny, while the tweets are the expected size. In the screenshot, I have placed cawbird between a Konsole window and Firefox; you can see window decorations and icon sizes are very different.

Screenshot_20210623_111359

It was suggested I try with combinations of GDK scaling env-vars; I did so but then the tweet text comes out massive. So,

export GDK_SCALE=2; export GDK_DPI_SCALE=2; export CLUTTER_SCALE=2; cawbird

looks like this:

Screenshot_20210623_113153

and on the individual tweet page like/reply etc:

Screenshot_20210623_114005

while:

export GDK_SCALE=2; export GDK_DPI_SCALE=1; export CLUTTER_SCALE=1; cawbird

looks like this:

Screenshot_20210623_112150

that is, much larger than it was, and for me unusably so. I have tried changing various combinations of the 3 vars but couldn't find a version that did better. I have also tried setting all vars to '1' just in case there was a difference between unset and set to 1, but there isn't: '1' is the same as unset.

Trying with non-integral scaling, e.g. GDK_SCALE=1.75, is equivalent to the rounded down version, i.e. GDK_SCALE=1

System details:

Additional context Running G_MESSAGES_DEBUG=cawbird cawbird doesn't help.

IBBoard commented 3 years ago

What are your default settings for those variables?

Looking at the top bar, it uses BadgeRadioButton which uses Gtk.IconSize.BUTTON for the buttons. That should scale according to GTK's rules. I can't see anything special that we're doing, and in general I'd try to avoid scale-specific rendering because the toolkits can take care of all the corner cases far better than we can.

This Arch wiki article suggests that GDK will scale text but not icons.

I've never seen any benefit of going about 1440p at 1:1 scaling, so I don't know how people normally handle this.

rivimey commented 3 years ago

I don't think you're right about IconSize.BUTTON - look in

https://github.com/IBBoard/cawbird/blob/4b2536eac84fd623810c2343f0fc80de1193ff5e/src/widgets/BadgeRadioButton.vala#L64

where BADGE_SIZE is set to 10 and then used to draw the icon.

rivimey commented 3 years ago

As I'm using KDE I don't normally have any env-vars named GDK_* set.

I don't understand what you mean by the comment about 1440 and 1:1 scale, as I'm using a 3840 screen with 7:4 scale...

IBBoard commented 3 years ago

I don't think you're right about IconSize.BUTTON - look in

https://github.com/IBBoard/cawbird/blob/4b2536eac84fd623810c2343f0fc80de1193ff5e/src/widgets/BadgeRadioButton.vala#L64

where BADGE_SIZE is set to 10 and then used to draw the icon.

But at line 54 it bails early if we're not showing the "unread" badge. So the core drawing of the icon is done at line 53 by GTK/GDK and that should be the drawing of the unread badge.

https://github.com/IBBoard/cawbird/blob/4b2536eac84fd623810c2343f0fc80de1193ff5e/src/widgets/BadgeRadioButton.vala#L54

As I'm using KDE I don't normally have any env-vars named GDK_* set.

Okay, I'll have to see what it defaults to.

I don't understand what you mean by the comment about 1440 and 1:1 scale, as I'm using a 3840 screen with 7:4 scale...

I've got a 1440p monitor. I use it at 100% scaling (1:1) because it gives me more screen estate without wasting pixels. So I have no experience with other scaling beyond "let the toolkits do the right thing".

One other question: how do other GTK apps behave? How do they scale their icons?

IBBoard commented 2 years ago

Which display server are you using? (X11 or Wayland)

According to Phoronix this was fixed several years ago and KDE sets the "right" values for GTK. However GTK only supports integer amounts.

I'd still be interested to know what happens with other GTK apps.