                     return
                 }
 
-                // Do a more in-depth check; make sure the window being dragged is being managed
                 guard let screenManager = windowManager.focusedScreenManager(),
                     let layout = screenManager.currentLayout,
                     let screen = movedWindow.screen(),
                     layout.windowHasAssignedFrame(movedWindow, of: windowManager.activeWindowsForScreenManager(screenManager), on: screen) else {
-                    mouseState = .pointing
+                        self.mouse.state = .pointing
                     return
                 }
 

                    windowManager.markScreenForReflow(screen, withChange: .focusChanged(window: focusedWindow))
                }
            }
            application.observeNotification(kAXApplicationActivatedNotification as CFString!, with: application) { _ in
                NSObject.cancelPreviousPerformRequests(
                    withTarget: windowManager,

    case doneDragging(atTime: NSDate)
}

class MouseStateKeeper {
    public var state: MouseState
    init() {
        state = .pointing
    }
}

private class ObserveApplicationNotifications {
    enum Error: Swift.Error {
        case failed
    }

    fileprivate let application: SIApplication
    fileprivate let windowManager: WindowManager
    fileprivate let mouse: MouseStateKeeper

    init(application app: SIApplication, windowManager wm: WindowManager) {
        application = app
        windowManager = wm
        mouse = wm.mouseStateKeeper
    }

    fileprivate func addObservers() -> Observable<Bool> {
        return _addObservers().retry(.exponentialDelayed(maxCount: 4, initial: 0.1, multiplier: 2))
