Skip to content

Commit

Permalink
Merge pull request #57 from beyenilmez/bug/ScreenScaleBug
Browse files Browse the repository at this point in the history
Bug/screen scale bug
  • Loading branch information
beyluta committed Dec 6, 2023
2 parents 2f2ea9e + a8260d5 commit 842e38e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Beyluta | <beyluta1@gmail.com> - <https://pedroribeiro.site> - <https://github.c
mateuszstalmach | <https://github.com/mateuszstalmach>
EPICTROLLTOAST | <https://github.com/EPICTROLLTOAST>
Yopai | <https://github.com/Yopai>
beyenilmez | <https://github.com/beyenilmez>
9 changes: 6 additions & 3 deletions Components/Widget.Component.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CefSharp;
using CefSharp.WinForms;
using Microsoft.Win32;
using Models;
using Modules;
using Newtonsoft.Json;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 842e38e

Please sign in to comment.