Skip to content

Commit 2d99844

Browse files
authored
Use an exponential backoff for the window float delay (#1766)
1 parent 9ce7992 commit 2d99844

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Amethyst/Managers/WindowManager.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ extension WindowManager {
374374
markAllScreensForReflow(withChange: .none)
375375
}
376376

377-
private func add(window: Window, retries: Int = 5) {
377+
private func add(window: Window, retries: Int = 5, delay: TimeInterval = 0.01) {
378378
guard window.shouldBeManaged() else {
379379
return
380380
}
@@ -394,8 +394,8 @@ extension WindowManager {
394394

395395
switch application.defaultFloatForWindow(window) {
396396
case .unreliable where retries > 0:
397-
return DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
398-
self.add(window: window, retries: retries - 1)
397+
return DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
398+
self.add(window: window, retries: retries - 1, delay: delay * 2)
399399
}
400400
case .reliable(.floating), .unreliable(.floating):
401401
windows.setFloating(true, forWindow: window)

0 commit comments

Comments
 (0)