Hi,
My app (SmashTunes) can display a floating window with artwork of a music track that is displaying. It does for over a decade in multiple versions of macOS.
I do this by calling window?.isMovableByWindowBackground = true. This stopped working under macOS 27.
I've read some reports of others not being able to move windows. It should supposedly have been fixed in macOS 27.2, but it is not. Has anyone on this forum run into the same problem, or know of a different way to move windows around on the screen?
When I add add a titlebar, I can drag it by the titlebar, but that is not really an option for my use case.
In my testing in macOS 27.0.1, isMovableByWindowBackground still moves a borderless floating window when the drag starts on a view whose mouseDownCanMoveWindow is true. When an NSImageView filled the window, the window didn't move, and that image view's mouseDownCanMoveWindow was false.
The mouseDownCanMoveWindow documentation says it "lets you determine the region by which a window can be moved," and that subclasses can override it. Two approaches moved the window in my test, and neither needs a title bar:
- An
NSImageViewsubclass that returnstruefrommouseDownCanMoveWindow, withisMovableByWindowBackgroundstill set:
final class ArtworkImageView: NSImageView {
override var mouseDownCanMoveWindow: Bool { true }
}
- A view whose
mouseDown(with:)callsperformDrag(with:), which "Starts a window drag based on the specified mouse-down event":
override func mouseDown(with event: NSEvent) {
window?.performDrag(with: event)
}
The performDrag(with:) documentation also notes that the method returns right away, and a mouse-up event may not get sent.
I tested in macOS 27.0.1, not 27.2. Because background dragging worked for you before macOS 27, please file a bug report in Feedback Assistant with a small project that shows the change. Do that even if one of these approaches works for you. Post the Feedback number here, and I'll check its status next time I do a sweep of forums posts where I've suggested bug reports.