Skip to content

Commit 3830453

Browse files
authored
Merge pull request #2756 from onesounds/240605-Fix-RightTop-Position
Fix Window Positioning with Multiple Montiors
2 parents 79c9d9f + ffdd190 commit 3830453

File tree

5 files changed

+194
-68
lines changed

5 files changed

+194
-68
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
3+
namespace Flow.Launcher.Infrastructure.UserSettings;
4+
5+
public record struct Point2D(double X, double Y)
6+
{
7+
public static implicit operator Point2D((double X, double Y) point)
8+
{
9+
return new Point2D(point.X, point.Y);
10+
}
11+
12+
public static Point2D operator +(Point2D point1, Point2D point2)
13+
{
14+
return new Point2D(point1.X + point2.X, point1.Y + point2.Y);
15+
}
16+
17+
public static Point2D operator -(Point2D point1, Point2D point2)
18+
{
19+
return new Point2D(point1.X - point2.X, point1.Y - point2.Y);
20+
}
21+
22+
public static Point2D operator *(Point2D point, double scalar)
23+
{
24+
return new Point2D(point.X * scalar, point.Y * scalar);
25+
}
26+
27+
public static Point2D operator /(Point2D point, double scalar)
28+
{
29+
return new Point2D(point.X / scalar, point.Y / scalar);
30+
}
31+
32+
public static Point2D operator /(Point2D point1, Point2D point2)
33+
{
34+
return new Point2D(point1.X / point2.X, point1.Y / point2.Y);
35+
}
36+
37+
public static Point2D operator *(Point2D point1, Point2D point2)
38+
{
39+
return new Point2D(point1.X * point2.X, point1.Y * point2.Y);
40+
}
41+
42+
public Point2D Clamp(Point2D min, Point2D max)
43+
{
44+
return new Point2D(Math.Clamp(X, min.X, max.X), Math.Clamp(Y, min.Y, max.Y));
45+
}
46+
}

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,10 @@ public SearchPrecisionScore QuerySearchPrecision
205205

206206
public bool AutoUpdates { get; set; } = false;
207207

208-
public double WindowLeft { get; set; }
209-
public double WindowTop { get; set; }
208+
209+
public Point2D WindowPosition { get; set; }
210+
public Point2D PreviousScreen { get; set; }
211+
public Point2D PreviousDpi { get; set; }
210212

211213
/// <summary>
212214
/// Custom left position on selected monitor

0 commit comments

Comments
 (0)