Merge pull request #2055 - psychon/auto_screen_dpi
This commit is contained in:
commit
c8fac753c4
|
@ -525,6 +525,18 @@ function screen.object.get_dpi(s)
|
||||||
return xft_dpi
|
return xft_dpi
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Try to compute DPI based on outputs (use the minimum)
|
||||||
|
local dpi = nil
|
||||||
|
local geo = s.geometry
|
||||||
|
for _, o in pairs(s.outputs) do
|
||||||
|
local dpix = geo.width * mm_per_inch / o.mm_width
|
||||||
|
local dpiy = geo.height * mm_per_inch / o.mm_height
|
||||||
|
dpi = math.min(dpix, dpiy, dpi or dpix)
|
||||||
|
end
|
||||||
|
if dpi then
|
||||||
|
return dpi
|
||||||
|
end
|
||||||
|
|
||||||
-- We have no outputs, so guess based on the size of the root window.
|
-- We have no outputs, so guess based on the size of the root window.
|
||||||
if root and not fallback_dpi then
|
if root and not fallback_dpi then
|
||||||
local _, h = root.size()
|
local _, h = root.size()
|
||||||
|
|
Loading…
Reference in New Issue