diff --git a/src/Bar.ahk b/src/Bar.ahk index 159b205..6db23dc 100644 --- a/src/Bar.ahk +++ b/src/Bar.ahk @@ -29,6 +29,13 @@ Bar_init(m) } Else wndWidth := Config_barWidth + + wndWidth := Round(wndWidth * Config_scalingFactor) + If (Config_verticalBarPos = "tray" And m = Manager_taskBarMonitor) { + Bar_ctrlHeight := Round(Bar_ctrlHeight * Config_scalingFactor) + Bar_height := Round(Bar_height * Config_scalingFactor) + } + Monitor_#%m%_barWidth := wndWidth titleWidth := wndWidth h1 := Bar_ctrlHeight @@ -140,15 +147,16 @@ Bar_init(m) If (Config_horizontalBarPos = "left") x1 := 0 Else If (Config_horizontalBarPos = "right") - x1 := Monitor_#%m%_width - wndWidth + x1 := Monitor_#%m%_width - wndWidth / Config_scalingFactor Else If (Config_horizontalBarPos = "center") - x1 := (Monitor_#%m%_width - wndWidth) / 2 - Else If (Config_horizontalBarPos => 0) + x1 := (Monitor_#%m%_width - wndWidth / Config_scalingFactor) / 2 + Else If (Config_horizontalBarPos >= 0) x1 := Config_horizontalBarPos Else If (Config_horizontalBarPos < 0) - x1 := Monitor_#%m%_width - wndWidth + Config_horizontalBarPos + x1 := Monitor_#%m%_width - wndWidth / Config_scalingFactor + Config_horizontalBarPos If Not (Config_verticalBarPos = "tray" And m = Manager_taskBarMonitor) x1 += Monitor_#%m%_x + x1 := Round(x1) Bar_#%m%_titleWidth := titleWidth Monitor_#%m%_barX := x1 diff --git a/src/Config.ahk b/src/Config.ahk index 0d587d4..aa425f3 100644 --- a/src/Config.ahk +++ b/src/Config.ahk @@ -55,6 +55,9 @@ Config_init() Config_showTaskBar := False Config_showBorder := True Config_selBorderColor := "" + Config_scalingFactor := 1 ;; Undocumented. The value is retrieved by `Config_getSystemSettings()` from the registry. + ;; It should not be set manually by the user, + ;; but is dependant on the setting in the `Display control panel` of Windows under `Appearance and Personalization`. ;; Window arrangement Config_viewNames := "1;2;3;4;5;6;7;8;9" @@ -156,7 +159,7 @@ Config_convertSystemColor(systemColor) Config_getSystemSettings() { - Global Config_fontName, Config_fontSize, Config_normBgColor, Config_normFgColor, Config_selBgColor, Config_selFgColor + Global Config_fontName, Config_fontSize, Config_normBgColor, Config_normFgColor, Config_selBgColor, Config_selFgColor, Config_scalingFactor If Not Config_fontName { @@ -218,6 +221,10 @@ Config_getSystemSettings() Config_selFgColor .= ";" Config_convertSystemColor(DllCall("GetSysColor", "Int", 2)) ;; COLOR_ACTIVECAPTION } SetFormat, Integer, d + + RegRead, appliedDPI, HKEY_CURRENT_USER, Control Panel\Desktop\WindowMetrics, AppliedDPI + If (ErrorLevel = 0) + Config_scalingFactor := 96 / appliedDPI } Config_hotkeyLabel: diff --git a/src/Monitor.ahk b/src/Monitor.ahk index aee91eb..4774bce 100644 --- a/src/Monitor.ahk +++ b/src/Monitor.ahk @@ -136,7 +136,7 @@ Monitor_get(x, y) Monitor_getWorkArea(m) { - Local bTop, x, y + Local bHeight, bTop, x, y Local monitor, monitorBottom, monitorLeft, monitorRight, monitorTop Local wndClasses, wndHeight, wndId, wndWidth, wndX, wndY @@ -190,18 +190,19 @@ Monitor_getWorkArea(m) } } } + bHeight := Round(Bar_height / Config_scalingFactor) bTop := 0 If Monitor_#%m%_showBar { If (Config_verticalBarPos = "top" Or (Config_verticalBarPos = "tray" And Not m = Manager_taskBarMonitor)) { bTop := monitorTop - monitorTop += Bar_height + monitorTop += bHeight } Else If (Config_verticalBarPos = "bottom") { - bTop := monitorBottom - Bar_height - monitorBottom -= Bar_height + bTop := monitorBottom - bHeight + monitorBottom -= bHeight } }