mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
fix #30
This commit is contained in:
@@ -485,8 +485,15 @@ class WindowPlacement {
|
||||
}
|
||||
}
|
||||
|
||||
static Rect? lastValidRect;
|
||||
|
||||
static Future<WindowPlacement> get current async {
|
||||
var rect = await windowManager.getBounds();
|
||||
if(validate(rect)) {
|
||||
lastValidRect = rect;
|
||||
} else {
|
||||
rect = lastValidRect ?? defaultPlacement.rect;
|
||||
}
|
||||
var isMaximized = await windowManager.isMaximized();
|
||||
return WindowPlacement(rect, isMaximized);
|
||||
}
|
||||
@@ -501,9 +508,6 @@ class WindowPlacement {
|
||||
static void loop() async {
|
||||
timer ??= Timer.periodic(const Duration(milliseconds: 100), (timer) async {
|
||||
var placement = await WindowPlacement.current;
|
||||
if (!validate(placement.rect)) {
|
||||
return;
|
||||
}
|
||||
if (placement.rect != cache.rect ||
|
||||
placement.isMaximized != cache.isMaximized) {
|
||||
cache = placement;
|
||||
|
Reference in New Issue
Block a user