mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: show clickable mouse pointer when hovering over secure input
This only works on macOS 15 because it uses the new `pointerStyle` API. I don't have the interest to backport this to older macOS versions but I'm happy to accept a PR if someone else wants to do it.
This commit is contained in:
@ -39,6 +39,7 @@ struct SecureInputOverlay: View {
|
|||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
isPopover = true
|
isPopover = true
|
||||||
}
|
}
|
||||||
|
.backport.pointerStyle(.link)
|
||||||
.padding(.top, 10)
|
.padding(.top, 10)
|
||||||
.padding(.trailing, 10)
|
.padding(.trailing, 10)
|
||||||
.popover(isPresented: $isPopover, arrowEdge: .bottom) {
|
.popover(isPresented: $isPopover, arrowEdge: .bottom) {
|
||||||
|
@ -23,3 +23,28 @@ extension Backport where Content: Scene {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension Backport where Content: View {
|
||||||
|
func pointerStyle(_ style: BackportPointerStyle) -> some View {
|
||||||
|
if #available(macOS 15, *) {
|
||||||
|
return content.pointerStyle(style.official)
|
||||||
|
} else {
|
||||||
|
return content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum BackportPointerStyle {
|
||||||
|
case grabIdle
|
||||||
|
case grabActive
|
||||||
|
case link
|
||||||
|
|
||||||
|
@available(macOS 15, *)
|
||||||
|
var official: PointerStyle {
|
||||||
|
switch self {
|
||||||
|
case .grabIdle: return .grabIdle
|
||||||
|
case .grabActive: return .grabActive
|
||||||
|
case .link: return .link
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user