macOS: fix crosshair verticalText and contextMenu pointerStyles

This commit is contained in:
monsterkodi
2025-02-22 20:34:30 +01:00
parent 726ac36612
commit c7425ad967
2 changed files with 10 additions and 6 deletions

View File

@ -360,14 +360,14 @@ extension Ghostty {
pointerStyle = .resizeLeftRight pointerStyle = .resizeLeftRight
case GHOSTTY_MOUSE_SHAPE_VERTICAL_TEXT: case GHOSTTY_MOUSE_SHAPE_VERTICAL_TEXT:
pointerStyle = .default pointerStyle = .verticalText
// These are not yet supported. We should support them by constructing a
// PointerStyle from an NSCursor.
case GHOSTTY_MOUSE_SHAPE_CONTEXT_MENU:
fallthrough
case GHOSTTY_MOUSE_SHAPE_CROSSHAIR: case GHOSTTY_MOUSE_SHAPE_CROSSHAIR:
fallthrough pointerStyle = .crosshair
case GHOSTTY_MOUSE_SHAPE_CONTEXT_MENU:
pointerStyle = .contextMenu
case GHOSTTY_MOUSE_SHAPE_NOT_ALLOWED: case GHOSTTY_MOUSE_SHAPE_NOT_ALLOWED:
pointerStyle = .default pointerStyle = .default

View File

@ -61,6 +61,8 @@ enum BackportVisibility {
enum BackportPointerStyle { enum BackportPointerStyle {
case `default` case `default`
case contextMenu
case crosshair
case grabIdle case grabIdle
case grabActive case grabActive
case horizontalText case horizontalText
@ -78,6 +80,8 @@ enum BackportPointerStyle {
var official: PointerStyle { var official: PointerStyle {
switch self { switch self {
case .default: return .default case .default: return .default
case .contextMenu: return .image(Image(nsImage: NSCursor.contextualMenu.image), hotSpot: UnitPoint(x: 0, y: 0))
case .crosshair: return .rectSelection
case .grabIdle: return .grabIdle case .grabIdle: return .grabIdle
case .grabActive: return .grabActive case .grabActive: return .grabActive
case .horizontalText: return .horizontalText case .horizontalText: return .horizontalText