term: only scale using DPI if *all* monitors have a scaling factor or one

With dpi-aware=auto (the default), scale fonts using DPI *only*
if *all* available monitors have a scaling factor of one.

The idea is this: if a user, with multiple monitors, have enabled
scaling on *at least* one monitor, he/she has most likely done so to
match the size of his/hers other monitors.

For example, if the user has one monitor with a scaling factor of one,
and another one with a scaling factor of two, he/she expects things to
be twice as large on the second monitor.

If we (foot) scale using DPI on the first monitor, and using the
scaling factor on the second monitor, foot will *not* look twice as
big on the second monitor (this was the old behavior of
dpi-aware=auto).

Part of #714
This commit is contained in:
Daniel Eklöf 2021-09-19 11:58:34 +02:00
parent 2934a4e96c
commit fb77637eb9
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 59 additions and 27 deletions

View file

@ -329,6 +329,7 @@ struct terminal {
struct config_font *font_sizes[4];
struct pt_or_px font_line_height;
float font_dpi;
bool font_is_sized_by_dpi;
int16_t font_x_ofs;
int16_t font_y_ofs;
enum fcft_subpixel font_subpixel;
@ -660,8 +661,6 @@ bool term_font_size_reset(struct terminal *term);
bool term_font_dpi_changed(struct terminal *term, int old_scale);
void term_font_subpixel_changed(struct terminal *term);
bool term_font_sized_by_dpi(const struct terminal *term, int scale);
bool term_font_sized_by_scale(const struct terminal *term, int scale);
int term_pt_or_px_as_pixels(
const struct terminal *term, const struct pt_or_px *pt_or_px);