+
+ private func moveWindow() {
+ let screen = NSScreen.screenWithMouse
+ if let currentScreen = self.window?.screen {
+ if currentScreen != screen {
+ let frame = screen?.frame ?? NSZeroRect
+ self.frame = CGRect(origin: NSZeroPoint, size: frame.size)
+ self.bounds = CGRect(origin: NSZeroPoint, size: frame.size)
+ self.updateTrackingAreas()
+
+ if let window = self.window {
+ self.bounds = frame
+ self.button = NSRect(
+ x: frame.maxX - buttonOffset.x, y: frame.maxY - buttonOffset.y, width: buttonSize.width,
+ height: buttonSize.height)
+ window.setFrame(frame, display: true, animate: false)
+ window.makeKeyAndOrderFront(nil)
+ window.orderFrontRegardless()
+ }
+ }
+ }
+ }