Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DeskFrame/DeskFrame.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<PackageIcon>ico.png</PackageIcon>
<ApplicationIcon>Icon\ico.ico</ApplicationIcon>
<Platforms>AnyCPU;x64</Platforms>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>

<ItemGroup>
Expand Down
17 changes: 13 additions & 4 deletions DeskFrame/DeskFrameWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3520,10 +3520,19 @@ private void Window_MouseMove(object sender, MouseEventArgs e)
{
var cursorPos = System.Windows.Forms.Cursor.Position;
var windowPos = this.PointToScreen(new System.Windows.Point(0, 0));
var windowWidth = this.ActualWidth;
var windowHeight = this.ActualHeight;
if (cursorPos.X - 10 < windowPos.X || cursorPos.X + 10 > windowPos.X + windowWidth ||
cursorPos.Y - 10 < windowPos.Y || cursorPos.Y + 10 > windowPos.Y + windowHeight)

// Set default to 1.0 in case the scale factor is 0
double scale = _windowsScalingFactor > 0 ? _windowsScalingFactor : 1.0;

// Convert logical size (WPF units) to physical size (monitor pixels)
var physicalWidth = this.ActualWidth * scale;
var physicalHeight = this.ActualHeight * scale;

// Use converted physical dimensions for boundary checks
if (cursorPos.X - 10 < windowPos.X ||
cursorPos.X + 10 > windowPos.X + physicalWidth ||
cursorPos.Y - 10 < windowPos.Y ||
cursorPos.Y + 10 > windowPos.Y + physicalHeight)
{
if (!_contextMenuIsOpen)
{
Expand Down
26 changes: 26 additions & 0 deletions DeskFrame/app.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">

<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>

</application>
</compatibility>

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
</windowsSettings>
</application>

</assembly>