From 167f8b0b47aaecfa347c1c358397e20c5b0a5872 Mon Sep 17 00:00:00 2001 From: Bedirhan Yenilmez <76536654+beyenilmez@users.noreply.github.com> Date: Sat, 2 Dec 2023 17:32:03 +0300 Subject: [PATCH 1/2] Fixed screen scale bug Resolved widget sizing problem on systems using non-100% scale settings --- Components/Widget.Component.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Components/Widget.Component.cs b/Components/Widget.Component.cs index 30f7795..0aed4b7 100644 --- a/Components/Widget.Component.cs +++ b/Components/Widget.Component.cs @@ -1,5 +1,6 @@ using CefSharp; using CefSharp.WinForms; +using Microsoft.Win32; using Models; using Modules; using Newtonsoft.Json; @@ -72,14 +73,16 @@ public override void AppendWidget(Form window, string path) POINT mousePos; GetCursorPos(out mousePos); + double scale = Int32.Parse((string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager", "LastLoadedDPI", "96")) / 96.0; + string sizeString = this.htmlDocService.GetMetaTagValue("windowSize", htmlPath); string radiusString = this.htmlDocService.GetMetaTagValue("windowBorderRadius", htmlPath); string locationString = this.htmlDocService.GetMetaTagValue("windowLocation", htmlPath); string topMostString = this.htmlDocService.GetMetaTagValue("topMost", htmlPath); string opacityString = this.htmlDocService.GetMetaTagValue("windowOpacity", htmlPath); - int roundess = radiusString != null ? int.Parse(radiusString) : 0; - this.width = sizeString != null ? int.Parse(sizeString.Split(' ')[0]) : width; - this.height = sizeString != null ? int.Parse(sizeString.Split(' ')[1]) : height; + int roundess = radiusString != null ? (int)(int.Parse(radiusString) * scale) : 0; + this.width = sizeString != null ? (int)(int.Parse(sizeString.Split(' ')[0]) * scale) : (int)(width * scale); + this.height = sizeString != null ? (int)(int.Parse(sizeString.Split(' ')[1]) * scale) : (int)(height * scale); int locationX = locationString != null ? int.Parse(locationString.Split(' ')[0]) : mousePos.X; int locationY = locationString != null ? int.Parse(locationString.Split(' ')[1]) : mousePos.Y; byte opacity = (byte)(opacityString != null ? byte.Parse(opacityString.Split(' ')[0]) : 255); From a8260d51d895505f576379187c5732f296f7fac3 Mon Sep 17 00:00:00 2001 From: Bedirhan Yenilmez <76536654+beyenilmez@users.noreply.github.com> Date: Sat, 2 Dec 2023 17:35:10 +0300 Subject: [PATCH 2/2] add contributor --- CONTRIBUTORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 8f4fa4e..1517702 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -9,3 +9,4 @@ Beyluta | - - EPICTROLLTOAST | Yopai | +beyenilmez |