You are not logged in.

#1 2017-07-26 18:40:09

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 399
Website

High DPI support in tint2 ?

Hello everyone.

As the title says, this question came up and I'd like to hear some opinions about it.

Current situation: tint2 uses pixels as unit for all dimensions specified in the config file, except fonts (which use points). This means that if you move your config from a normal display to a high DPI display, everything will look smaller except the fonts (actually I'm not sure, since I don't have such a display, so correct me if I'm wrong).

The desired situation is that the objects would scale accordingly. So for example, if the panel size is 30 pixels on a 96 DPI display, on a 120 DPI display the panel would actually use 120/96*30 = 37 pixels, with the config unchanged. The two panels would look the same, i.e. they would have the same width in inch if measured with a ruler.

96 DPI would be used as a reference for scaling since it's the most common value for older displays, and also the factor used by CSS to scale "pixels" to screen dots.

The questions for you are:

1. Should scaling be toggled by a config option?

2. Should scaling be enabled by default in the next tint2 versions?

3. Any other ideas?

Thanks.

Last edited by o9000 (2017-07-26 18:42:00)

Offline

#2 2017-07-26 18:56:02

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,816
Website

Re: High DPI support in tint2 ?

o9000 wrote:

The desired situation is that the objects would scale accordingly. So for example, if the panel size is 30 pixels on a 96 DPI display, on a 120 DPI display the panel would actually use 120/96*30 = 37 pixels,

Everything defined in pixels with some user set multiplier or/and dpi option, (assuming fonts can be defined in pixels).
So if
font=30px
mult=1
dpi=1000
one would get: 1000 dpi / 96 dpi * 300 pixels * 1 = 312.5 px

How is that?

p.s. mac with 5k retina would be 68px (218 dpi).

p.s. Actually the term is probably ppi.

btw: override option could be: fonts defined as ratios of icons and or size of of other fields in tint, like font 1/3*some.height.in.tint2.

Last edited by brontosaurusrex (2017-07-26 19:06:29)

Offline

#3 2017-07-26 19:10:30

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 399
Website

Re: High DPI support in tint2 ?

I think fonts are already scaled, because the unit is typographic points unless the user writes explicitly "px" in the config. So "sans 10" means "sans 10pt", which is scaled to px according to the DPI by the font rendering library. Let's leave them for now.

You think a user set multiplier is useful? What I had in mind is to compute it automatically; read the screen DPI via RandR, then set the multiplier to DPI/96. A config option would just turn this off.

(and yes, the term is PPI, but all tools use DPI so I'll stick to that)

Offline

#4 2017-07-26 19:36:51

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,816
Website

Re: High DPI support in tint2 ?

o9000 wrote:

You think a user set multiplier is useful?

Yes, unless every single app/thing/bar uses dpi the same exact way wink. p.s. Also it would be useful to copy/paste the same config from computer to computer, just changing that multiplier would be enough in many cases imho.

Last edited by brontosaurusrex (2017-07-26 19:39:18)

Offline

#5 2017-07-27 02:15:43

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: High DPI support in tint2 ?

I loathe when a version increment breaks existing functionality (looking at you conky 1.10, GTK3). A ppi/dpi feature should be optional and not the default. If it becomes the "only way" I see a "soft fork" with a community sticking to the current tint version like the conky 1.9.0 adherents forming "conky-legacy".

While the 96 ppi standard is arguably a reasonable choice, it doesn't match a single one of my displays. Furthermore, less than one third of devices (w3school browser statistics) are larger than FHD (1920x1080). Setting a default likely to break most systems seems a really poor choice simply to accommodate HDPI.

Optional: yes, default: no, required: no.

Offline

#6 2017-07-27 05:14:42

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 399
Website

Re: High DPI support in tint2 ?

> While the 96 ppi standard is arguably a reasonable choice, it doesn't match a single one of my displays.

What's your `xdpyinfo | grep resolution`?

> I loathe when a version increment breaks existing functionality

Me too, but currently geometry is not scaled while fonts are scaled in tint2, so functionality is already broken for anyone who uses two monitors with different DPIs, or syncs his config between different computers with monitors having different DPIs.

Firefox scales content by DPI already by default (like all the major browsers do) and it appears to work seamlessly, so implementing this without affecting low DPI users shouldn't be an impossible task.

Last edited by o9000 (2017-07-27 05:20:29)

Offline

#7 2017-07-27 06:44:32

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: High DPI support in tint2 ?

o9000 wrote:

tint2 uses pixels as unit for all dimensions specified in the config file

This is incorrect.

tint2 configuration wrote:

width and height can be specified without units (e.g. 123) as pixels, or followed by % as percentages of the monitor size (e.g. 50%).

https://gitlab.com/o9000/tint2/blob/mas … 2.md#panel

The latter case would cover the many-monitor situation, surely?

Also, the X server sets the DPI to 96 by default and misreported screen sizes (via the EDID block) are very common.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#8 2017-07-27 15:35:30

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: High DPI support in tint2 ?

o9000 wrote:

> While the 96 ppi standard is arguably a reasonable choice, it doesn't match a single one of my displays.

What's your `xdpyinfo | grep resolution`?

> I loathe when a version increment breaks existing functionality

Me too, but currently geometry is not scaled while fonts are scaled in tint2, so functionality is already broken for anyone who uses two monitors with different DPIs, or syncs his config between different computers with monitors having different DPIs.

Firefox scales content by DPI already by default (like all the major browsers do) and it appears to work seamlessly, so implementing this without affecting low DPI users shouldn't be an impossible task.

Xdpyinfo resolution: I think I understand your point. On my devices, xdpyinfo always reports 96x96 dpi with the default Xserver configuration. The Xserver could calculate the actual ppi (from the EDID physical dimensions and pixel count), but it doesn't. My actual ppi varies from 108 to 141, but X always defaults to 96 unless I alter it.

Misuse of terminology is part of the problem. The Xserver dots-per-inch "screen resolution" is a misnomer; it is actually a utilized as a scaling value and can vary widely from the actual resolution. In fact, it is rarely set to the actual ppi, but user configured to a "round" figure (96, 120, 144, 168, 192) to reduce scaling artifacts in GTK and qt. As GTK, pango, and the font system (tint2 dependencies) seem to assume 96 dpi corresponds to 1:1 scaling, I understand why tint2 would make the same assumption (for consistency, not because 96 is typical to older displays or some CSS standard).

Breaking things: I am all for fixing broken things. I am simply against breaking old things in favor of new, especially when there are more old than new. I appreciate your sensible and conservative approach so far in modifying tint2, I simply argue for conservative feature changes. The "old way" should not disappear to be immediately replaced by the new but deprecated. This puts users on notice it will be disappearing but doesn't break anything when the version changes. Remove it further down the road if it is a maintenance headache (or simply leave the option open - openbox still allows the majority of its deprecated config options).

Offline

#9 2017-07-27 15:37:31

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: High DPI support in tint2 ?

Head_on_a_Stick wrote:

...and misreported screen sizes (via the EDID block) are very common.

I have encountered one (a hair-pulling experience); didn't realize they were common.

Offline

#10 2017-07-27 19:12:36

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: High DPI support in tint2 ?

^ Reading that back, "very common" should probably be replaced with "not uncommon" — I've experienced the issue myself and it has popped up a few times in various support threads.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#11 2017-07-27 20:33:49

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 399
Website

Re: High DPI support in tint2 ?

Don't worry, if I can't get it to work seamlessly, I won't enable it by default.

Offline

#12 2017-08-08 22:35:57

tmoney
Member
Registered: 2016-06-01
Posts: 7

Re: High DPI support in tint2 ?

I use a 1440p 12.5inch thinkpad and I would really like an option for high DPI. It doesn't need to be default as we (high dpi users) are a small fraction of the community, as pointed out, but it would be very useful.

Offline

#13 2017-08-09 11:12:25

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 399
Website

Re: High DPI support in tint2 ?

Thanks for your reply, tmoney.

I think I will start working on this this fall, I will reply to this thread if I get anything functional. It might take me a while, as I would like first to study what the other toolkits have done, see what works well and what doesn't, and then decide how to implement and configure this. It is not an easy problem.

Offline

#14 2018-01-17 06:01:52

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 399
Website

Re: High DPI support in tint2 ?

Implemented a prototype. It works as follows.

Each panel is visible on a different monitor. Thus each panel has a specific scaling factor.

The scaling factor is computed as the ratio between the monitor DPI (obtained from the dimensions in pixels and millimeters from RandR) and a configured reference DPI - this is the DPI for which previous user configs looked normal, for backward compatibility.

There is thus just one new config option: scale_relative_to_dpi. If it is missing or zero, no scaling is performed.

Only text size, icon size, panel dimensions and paddings are scaled. I did not scale borders, since they looked a little strange when upscaled.

You can find your monitor's DPI and the computed scaling factor in the tint2 output in blue.

Example:

Say you have 1 monitors with 100 DPI. You configure tint2 to look right. Then you plug in another monitor with 125 DPI. On this one, the panel looks too small. Then you add to your config:

scale_relative_to_dpi = 100

and the first panel should look unchanged (scale 1.0), and the second panel should use scale 1.25, now having the same physical dimensions as the first.

If RandR doesn't report the right monitor size for you, don't use this.

Offline

Board footer

Powered by FluxBB