aboutsummaryrefslogtreecommitdiff
path: root/menubar/panel.swift
diff options
context:
space:
mode:
Diffstat (limited to 'menubar/panel.swift')
-rw-r--r--menubar/panel.swift10
1 files changed, 10 insertions, 0 deletions
diff --git a/menubar/panel.swift b/menubar/panel.swift
index 357ff91..e6ff569 100644
--- a/menubar/panel.swift
+++ b/menubar/panel.swift
@@ -151,6 +151,15 @@ private class ClickView: NSView {
override func acceptsFirstMouse(for event: NSEvent?) -> Bool { true }
+ // Own every click inside, including over labels: a text field would
+ // otherwise take the click (and count as a window-drag background).
+ override func hitTest(_ point: NSPoint) -> NSView? {
+ bounds.contains(convert(point, from: superview)) ? self : nil
+ }
+
+ // Dragging is done here (performDrag), not by the window server.
+ override var mouseDownCanMoveWindow: Bool { false }
+
override func updateTrackingAreas() {
super.updateTrackingAreas()
trackingAreas.forEach(removeTrackingArea)
@@ -170,6 +179,7 @@ private class ClickView: NSView {
}
override func mouseUp(with event: NSEvent) {
+ log("panel: mouse up (dragged: \(dragged))")
if !dragged { onClick() }
}
}