Skip to content

Commit f6b4de8

Browse files
committed
Generalise window resize event
1 parent ba86ba2 commit f6b4de8

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

Amethyst/Layout/Layouts/BinarySpacePartitioningLayout.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class BinarySpacePartitioningLayout<Window: WindowType>: StatefulLayout<Window>
245245

246246
windowNode.windowID = otherWindowID
247247
otherWindowNode.windowID = windowID
248-
case .applicationDeactivate, .applicationActivate, .spaceChange, .layoutChange, .tabChange, .none, .unknown:
248+
case .resize, .applicationDeactivate, .applicationActivate, .spaceChange, .layoutChange, .tabChange, .none, .unknown:
249249
break
250250
}
251251
}

Amethyst/Layout/Layouts/CustomLayout.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ class CustomLayout<Window: WindowType>: StatefulLayout<Window>, PanedLayout {
302302
case .remove(window: let window):
303303
jsChange["change"] = "remove"
304304
jsChange["windowID"] = idHash(forWindowID: window.id())
305+
case .resize(window: let window):
306+
jsChange["change"] = "resize"
307+
jsChange["windowID"] = idHash(forWindowID: window.id())
305308
case .focusChanged(window: let window):
306309
jsChange["change"] = "focus_changed"
307310
jsChange["windowID"] = idHash(forWindowID: window.id())

Amethyst/Managers/ScreenManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ final class ScreenManager<Delegate: ScreenManagerDelegate>: NSObject, Codable {
168168
if lastFocusedWindow == window {
169169
lastFocusedWindow = nil
170170
}
171-
case .windowSwap, .applicationActivate, .applicationDeactivate, .spaceChange, .layoutChange, .tabChange, .none, .unknown:
171+
case .resize, .windowSwap, .applicationActivate, .applicationDeactivate, .spaceChange, .layoutChange, .tabChange, .none, .unknown:
172172
break
173173
}
174174

Amethyst/Managers/WindowManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ extension WindowManager: ApplicationObservationDelegate {
611611
case let .doneDragging(lmbUpMoment):
612612

613613
if let screenManager = focusedScreenManager(), screenManager.currentLayout is FloatingGridLayout {
614-
screenManager.setNeedsReflow(withWindowChange: .layoutChange)
614+
screenManager.setNeedsReflow(withWindowChange: .resize(window: window))
615615
}
616616

617617
mouseStateKeeper.state = .pointing // flip state first to prevent race condition
@@ -644,7 +644,7 @@ extension WindowManager: ApplicationObservationDelegate {
644644

645645
guard layout is PanedLayout else {
646646
if layout is FloatingGridLayout, case .doneDragging = mouseStateKeeper.state {
647-
screenManager.setNeedsReflow(withWindowChange: .layoutChange)
647+
screenManager.setNeedsReflow(withWindowChange: .resize(window: window))
648648
}
649649
return
650650
}

Amethyst/Model/Change.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Foundation
1111
enum Change<Window: WindowType> {
1212
case add(window: Window)
1313
case remove(window: Window)
14+
case resize(window: Window)
1415
case focusChanged(window: Window)
1516
case windowSwap(window: Window, otherWindow: Window)
1617
case applicationActivate

0 commit comments

Comments
 (0)