Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

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

Open
rivimey opened this issue Jun 23, 2021 · 5 comments
Open
Labels
enhancement New feature or request info required This doesn't seem right or more details are required

Comments

@rivimey
Copy link

rivimey commented Jun 23, 2021

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:

  • OS: Ubuntu 21.04 /KDE
  • Version: 1.4.1
  • Package type: official DEB

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

@IBBoard
Copy link
Owner

IBBoard commented Jun 23, 2021

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.

@IBBoard IBBoard added the enhancement New feature or request label Jun 23, 2021
@rivimey
Copy link
Author

rivimey commented Jun 23, 2021

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

int x = allocation.x - child_allocation.x + child_allocation.width - BADGE_SIZE;

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

@rivimey
Copy link
Author

rivimey commented Jun 23, 2021

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
Copy link
Owner

IBBoard commented Jun 24, 2021

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

int x = allocation.x - child_allocation.x + child_allocation.width - BADGE_SIZE;

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.

if (!show_badge || this.get_child () == null)

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 IBBoard added the info required This doesn't seem right or more details are required label Oct 2, 2021
@IBBoard
Copy link
Owner

IBBoard commented Oct 24, 2021

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request info required This doesn't seem right or more details are required
Projects
None yet
Development

No branches or pull requests

2 participants