From da94f3c2cb803d0fb89fe27eaabfa1a6677c760a Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 18 Sep 2020 00:18:17 +0900 Subject: [PATCH] devicescale: Bug fix: Base-scale should be multiplied on Cinnamon Updates #1307 --- internal/devicescale/cinnamon_unix.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/internal/devicescale/cinnamon_unix.go b/internal/devicescale/cinnamon_unix.go index 5e8008575..84c7c8cb6 100644 --- a/internal/devicescale/cinnamon_unix.go +++ b/internal/devicescale/cinnamon_unix.go @@ -41,7 +41,7 @@ func cinnamonScaleFromXML() (float64, error) { type cinnamonMonitors struct { XMLName xml.Name `xml:"monitors"` Version string `xml:"version,attr"` - Configuration struct { + Configuration []struct { BaseScale float64 `xml:"base_scale"` Output []struct { Scale float64 `xml:"scale"` @@ -67,17 +67,15 @@ func cinnamonScaleFromXML() (float64, error) { return 0, err } - scale := monitors.Configuration.BaseScale - for _, v := range monitors.Configuration.Output { + // TODO: Choose the correct configuration. + c := monitors.Configuration[0] + for _, v := range c.Output { // TODO: Get the monitor at the specified position. - if v.Primary { - if v.Scale != 0.0 { - scale = v.Scale - } - break + if v.Primary && v.Scale != 0.0 { + return c.BaseScale * v.Scale, nil } } - return scale, nil + return c.BaseScale, nil } func cinnamonScale() float64 {