Skip to content

Commit 5f4bdd1

Browse files
github-actions[bot]LocalIdentityLocalIdentity
authored
[pob2-port] Add setting to override Windows scaling from PoB (#9048)
* Apply changes from PathOfBuildingCommunity/PathOfBuilding-PoE2#1512 * Fix merge issues * Fix missing commas --------- Co-authored-by: LocalIdentity <[email protected]> Co-authored-by: LocalIdentity <[email protected]>
1 parent a43735a commit 5f4bdd1

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/Modules/Main.lua

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ function main:Init()
104104
self.decimalSeparator = "."
105105
self.defaultItemAffixQuality = 0.5
106106
self.showTitlebarName = true
107+
self.dpiScaleOverridePercent = GetDPIScaleOverridePercent and GetDPIScaleOverridePercent() or 0
107108
self.showWarnings = true
108109
self.slotOnlyTooltips = true
109110
self.notSupportedModTooltips = true
@@ -638,6 +639,10 @@ function main:LoadSettings(ignoreBuild)
638639
if node.attrib.showPublicBuilds then
639640
self.showPublicBuilds = node.attrib.showPublicBuilds == "true"
640641
end
642+
if node.attrib.dpiScaleOverridePercent then
643+
self.dpiScaleOverridePercent = tonumber(node.attrib.dpiScaleOverridePercent) or 0
644+
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
645+
end
641646
end
642647
end
643648
end
@@ -754,7 +759,8 @@ function main:SaveSettings()
754759
POESESSID = self.POESESSID,
755760
invertSliderScrollDirection = tostring(self.invertSliderScrollDirection),
756761
disableDevAutoSave = tostring(self.disableDevAutoSave),
757-
showPublicBuilds = tostring(self.showPublicBuilds)
762+
showPublicBuilds = tostring(self.showPublicBuilds),
763+
dpiScaleOverridePercent = tostring(self.dpiScaleOverridePercent),
758764
} })
759765
local res, errMsg = common.xml.SaveXMLFile(setXML, self.userPath.."Settings.xml")
760766
if not res then
@@ -862,6 +868,24 @@ function main:OpenOptionsPopup()
862868
controls.proxyURL:SetText(url)
863869
end
864870

871+
nextRow()
872+
controls.dpiScaleOverride = new("DropDownControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 150, 18 }, {
873+
{ label = "Use system default", percent = 0 },
874+
{ label = "100%", percent = 100 },
875+
{ label = "125%", percent = 125 },
876+
{ label = "150%", percent = 150 },
877+
{ label = "175%", percent = 175 },
878+
{ label = "200%", percent = 200 },
879+
{ label = "225%", percent = 225 },
880+
{ label = "250%", percent = 250 },
881+
}, function(index, value)
882+
self.dpiScaleOverridePercent = value.percent
883+
SetDPIScaleOverridePercent(value.percent)
884+
end)
885+
controls.dpiScaleOverrideLabel = new("LabelControl", { "RIGHT", controls.dpiScaleOverride, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7UI scaling override:")
886+
controls.dpiScaleOverride.tooltipText = "Overrides Windows DPI scaling inside Path of Building.\nChoose a percentage between 100% and 250% or revert to the system default."
887+
controls.dpiScaleOverride:SelByValue(self.dpiScaleOverridePercent, "percent")
888+
865889
nextRow()
866890
controls.buildPath = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 290, 18 })
867891
controls.buildPathLabel = new("LabelControl", { "RIGHT", controls.buildPath, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Build save path:")
@@ -1041,6 +1065,7 @@ function main:OpenOptionsPopup()
10411065
local initialInvertSliderScrollDirection = self.invertSliderScrollDirection
10421066
local initialDisableDevAutoSave = self.disableDevAutoSave
10431067
local initialShowPublicBuilds = self.showPublicBuilds
1068+
local initialDpiScaleOverridePercent = self.dpiScaleOverridePercent
10441069

10451070
-- last line with buttons has more spacing
10461071
nextRow(1.5)
@@ -1066,6 +1091,7 @@ function main:OpenOptionsPopup()
10661091
if not launch.devMode then
10671092
main:SetManifestBranch(self.betaTest and "beta" or "master")
10681093
end
1094+
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
10691095
main:ClosePopup()
10701096
main:SaveSettings()
10711097
end)
@@ -1092,6 +1118,8 @@ function main:OpenOptionsPopup()
10921118
self.invertSliderScrollDirection = initialInvertSliderScrollDirection
10931119
self.disableDevAutoSave = initialDisableDevAutoSave
10941120
self.showPublicBuilds = initialShowPublicBuilds
1121+
self.dpiScaleOverridePercent = initialDpiScaleOverridePercent
1122+
+ SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
10951123
main:ClosePopup()
10961124
end)
10971125
nextRow(1.5)

0 commit comments

Comments
 (0)