Display (Linux): fixes scale factor of rotated outputs on Wayland
The scale factor is computed from the wl_output mode width and the zxdg_output_v1 logical width. The logical size is already transformed, but the mode is only swapped later in ffWaylandHandleRotation(), so a monitor rotated by 90 or 270 degrees compared its width with its logical height. A 1920x1200 monitor in portrait at scale 1 was reported as 1920 * 96 / 1200 = 153 dpi, shown as `@ 1.59x`. Compare with the mode height for 90 / 270 degree transforms instead.
This commit is contained in:
1 parent
c3ec79737f
commit
492bef51ab
2 files changed
+5
-2
No files matched your search
@@ -13,6 +13,7 @@ Changes:
|
||||
Bugfixes:
|
||||
* Fixed libc version detection on FreeBSD without binutils installed, and on DragonFly BSD. (Libc, FreeBSD / DragonFly)
|
||||
* Fixed CPU cache detection failing entirely when any CPU is offline. (#2736, CPUCache, Linux)
|
||||
* Fixed the scale factor of rotated monitors on Wayland, e.g. a 1920x1200 monitor rotated by 90 degrees at scale 1 being reported as `@ 1.59x`. (Display, Linux)
|
||||
|
||||
# 2.71.0
|
||||
|
||||
|
||||
@@ -48,9 +48,11 @@ static void waylandOutputGeometryListener(void* data,
|
||||
|
||||
static void handleXdgLogicalSize(void* data, [[maybe_unused]] struct zxdg_output_v1* _, int32_t width, [[maybe_unused]] int32_t height) {
|
||||
WaylandDisplay* display = data;
|
||||
// The logical size is already transformed, but the mode is not swapped until ffWaylandHandleRotation()
|
||||
int32_t modeWidth = display->transform & WL_OUTPUT_TRANSFORM_90 ? display->height : display->width;
|
||||
// Seems the values are only useful when ractional scale is enabled
|
||||
if (width < display->width) {
|
||||
display->dpi = (uint32_t) (display->width * 96 / width);
|
||||
if (width < modeWidth) {
|
||||
display->dpi = (uint32_t) (modeWidth * 96 / width);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user