mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
wayland: take rotation into account when calculating the logical PPI
This commit is contained in:
parent
547b91e42b
commit
1df78932d7
2 changed files with 21 additions and 0 deletions
20
wayland.c
20
wayland.c
|
|
@ -331,6 +331,25 @@ output_update_ppi(struct monitor *mon)
|
|||
mon->ppi.real.x = mon->dim.px_real.width / x_inches;
|
||||
mon->ppi.real.y = mon->dim.px_real.height / y_inches;
|
||||
|
||||
/* The *logical* size is affected by the transform */
|
||||
switch (mon->transform) {
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270: {
|
||||
int swap = x_inches;
|
||||
x_inches = y_inches;
|
||||
y_inches = swap;
|
||||
break;
|
||||
}
|
||||
|
||||
case WL_OUTPUT_TRANSFORM_NORMAL:
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
break;
|
||||
}
|
||||
|
||||
mon->ppi.scaled.x = mon->dim.px_scaled.width / x_inches;
|
||||
mon->ppi.scaled.y = mon->dim.px_scaled.height / y_inches;
|
||||
|
||||
|
|
@ -354,6 +373,7 @@ output_geometry(void *data, struct wl_output *wl_output, int32_t x, int32_t y,
|
|||
mon->make = make != NULL ? xstrdup(make) : NULL;
|
||||
mon->model = model != NULL ? xstrdup(model) : NULL;
|
||||
mon->subpixel = subpixel;
|
||||
mon->transform = transform;
|
||||
output_update_ppi(mon);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -321,6 +321,7 @@ struct monitor {
|
|||
int scale;
|
||||
float refresh;
|
||||
enum wl_output_subpixel subpixel;
|
||||
enum wl_output_transform transform;
|
||||
|
||||
/* From wl_output */
|
||||
char *make;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue