Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Sources/App/CmuxMainWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ final class MainWindowHostingView<Content: View>: NSHostingView<Content> {

@MainActor
func configureCmuxMainWindowDragBehavior(_ window: NSWindow) {
// Keep the window movable so macOS Accessibility-based window managers
// (notably Swish) can identify cmux as a normal movable window and attach
// titlebar gestures. Content/background drags are still opt-in: cmux only
// starts AppKit window drags from explicit titlebar drag handles, and tab /
// folder drag interactions temporarily suppress movability while active.
window.isMovableByWindowBackground = false
window.isMovable = false
window.isMovable = true
}

@MainActor
Expand Down
19 changes: 11 additions & 8 deletions cmuxTests/WindowAndDragTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1862,33 +1862,36 @@ final class TitlebarLeadingInsetPassthroughViewTests: XCTestCase {
)
}

func testMainWindowDragBehaviorRequiresExplicitDragZones() {
func testMainWindowDragBehaviorKeepsWindowManagerCompatibility() {
let window = CmuxMainWindow(
contentRect: NSRect(x: 0, y: 0, width: 320, height: 180),
styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
backing: .buffered,
defer: false
)
defer { window.orderOut(nil) }
window.isMovable = true
window.isMovable = false
window.isMovableByWindowBackground = true

configureCmuxMainWindowDragBehavior(window)

XCTAssertFalse(
XCTAssertTrue(
window.isMovable,
"Main windows must not use native AppKit titlebar dragging because pane tabs live in the titlebar band"
"Main windows must remain movable so Accessibility-based window managers such as Swish can attach titlebar gestures"
)
XCTAssertFalse(
window.isMovableByWindowBackground,
"Main content must not become an implicit AppKit background-drag region; explicit titlebar chrome owns app-window dragging"
)
XCTAssertFalse(window.isMovableByWindowBackground)

let previous = withTemporaryWindowMovableEnabled(window: window) {
XCTAssertTrue(window.isMovable)
}

XCTAssertEqual(previous, false)
XCTAssertFalse(
XCTAssertEqual(previous, true)
XCTAssertTrue(
window.isMovable,
"Explicit chrome drag zones may temporarily enable movement, but the main window must return to pane-tab-safe immovable state"
"Explicit chrome drag zones should preserve the window-manager-compatible movable state"
)
}
}
Expand Down