Skip to content

便签窗口完全无法拖动(标题条也不行) #1

Description

@homerhzfeng92

环境:macOS 27.0,Perch 2.2.0

窗口设置了 isMovableByWindowBackground = true,但整个窗口任何位置(包括顶部标题条)都拖不动。

原因:窗口内容是 SwiftUI(NSHostingView),它会吞掉所有 mouseDown 事件,isMovableByWindowBackground 对 SwiftUI 内容无效(AppKit 老坑)。已用最小复现验证:同配置纯 NSWindow 可拖,加 NSHostingController 后不可拖。Noticky 同样有此问题。

建议修法:在 StickyPanel(NSWindow 子类)里 override sendEvent,leftMouseDown 且点击位置在顶部条区域(contentView.bounds.height - collapsedHeight 以上)时手动记录偏移、mouseDragged 时 setFrameOrigin 跟随并 return 不派发;或把标题条换成 AppKit 层。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions