Skip to content

[Cocoa] Deprecated OS constants #3214

@HeikoKlare

Description

@HeikoKlare

Analysis of Deprecated macOS Constants in OS.java

The constants defined in OS.java (lines 2177–2365) are replications of constants from macOS SDK header files. An analysis against the macOS 15.4 SDK revealed 53 deprecated constants across 14 headers, most deprecated since macOS 10.12 or 10.14.

The tables below list each deprecated constant alongside its replacement. The OpenGL constants are a special case since the entire OpenGL API was deprecated in favor of Metal/MetalKit.


  • Window Style Masks (NSWindow.h) — deprecated macOS 10.0–10.12
Current Constant Replacement
NSBorderlessWindowMask NSWindowStyleMaskBorderless
NSTitledWindowMask NSWindowStyleMaskTitled
NSClosableWindowMask NSWindowStyleMaskClosable
NSMiniaturizableWindowMask NSWindowStyleMaskMiniaturizable
NSResizableWindowMask NSWindowStyleMaskResizable
NSFullScreenWindowMask NSWindowStyleMaskFullScreen
NSUtilityWindowMask NSWindowStyleMaskUtilityWindow
NSDocModalWindowMask NSWindowStyleMaskDocModalWindow
NSNonactivatingPanelMask NSWindowStyleMaskNonactivatingPanel

  • Compositing Operations (NSGraphics.h) — deprecated macOS 10.0–10.12
Current Constant Replacement
NSCompositeClear NSCompositingOperationClear
NSCompositeCopy NSCompositingOperationCopy
NSCompositeSourceOver NSCompositingOperationSourceOver
NSCompositeSourceAtop NSCompositingOperationSourceAtop

  • Alert Styles (NSAlert.h) — deprecated macOS 10.3–10.12
Current Constant Replacement
NSWarningAlertStyle NSAlertStyleWarning
NSInformationalAlertStyle NSAlertStyleInformational
NSCriticalAlertStyle NSAlertStyleCritical

  • Button Types (NSButtonCell.h) — deprecated macOS 10.0–10.14
Current Constant Replacement
NSMomentaryLightButton NSButtonTypeMomentaryLight
NSPushOnPushOffButton NSButtonTypePushOnPushOff
NSSwitchButton NSButtonTypeSwitch
NSRadioButton NSButtonTypeRadio

  • Bezel Styles (NSButtonCell.h) — deprecated macOS 10.0–10.14
Current Constant Replacement
NSRoundedBezelStyle NSBezelStylePush
NSRegularSquareBezelStyle NSBezelStyleFlexiblePush
NSShadowlessSquareBezelStyle NSBezelStyleShadowlessSquare (itself further deprecated → NSBezelStyleSmallSquare)
NSRoundedDisclosureBezelStyle NSBezelStylePushDisclosure

  • Event Modifier Flags (NSEvent.h) — deprecated macOS 10.0–10.12
Current Constant Replacement
NSShiftKeyMask NSEventModifierFlagShift
NSControlKeyMask NSEventModifierFlagControl
NSCommandKeyMask NSEventModifierFlagCommand
NSHelpKeyMask NSEventModifierFlagHelp

  • OpenGL Pixel Format Attributes (NSOpenGL.h) — deprecated macOS 10.0–10.14, replace with Metal/MetalKit
Current Constant Replacement
NSOpenGLPFADoubleBuffer Use Metal
NSOpenGLPFAColorSize Use Metal
NSOpenGLPFAAlphaSize Use Metal
NSOpenGLPFADepthSize Use Metal
NSOpenGLPFAStencilSize Use Metal
NSOpenGLPFAAccumSize Use Metal
NSOpenGLPFASampleBuffers Use Metal
NSOpenGLPFASamples Use Metal
NSOpenGLPFAStereo deprecated 10.0–10.12, no direct replacement
NSOpenGLCPSurfaceOrder NSOpenGLContextParameterSurfaceOrder

  • Scroller Parts (NSScroller.h) — deprecated macOS 10.0–10.14
Current Constant Replacement
NSScrollerDecrementLine None — "Scroller arrows are not used anymore"
NSScrollerIncrementLine None — "Scroller arrows are not used anymore"

  • Control Sizes (NSCell.h) — deprecated macOS 10.0–10.12
Current Constant Replacement
NSRegularControlSize NSControlSizeRegular
NSSmallControlSize NSControlSizeSmall
NSMiniControlSize NSControlSizeMini

  • Control States (NSCell.h) — deprecated macOS 10.0–10.14
Current Constant Replacement
NSOffState NSControlStateValueOff
NSOnState NSControlStateValueOn
NSMixedState NSControlStateValueMixed

  • Image Scaling (NSCell.h) — deprecated macOS 10.0–10.10
Current Constant Replacement
NSScaleNone NSImageScaleNone

  • Font Panel Mode Masks (NSFontPanel.h) — deprecated (no version range specified)
Current Constant Replacement
NSFontPanelAllEffectsModeMask NSFontPanelModeMaskAllEffects
NSFontPanelAllModesMask NSFontPanelModeMaskAllModes

  • Progress Indicator (NSProgressIndicator.h) — deprecated macOS 10.0–10.14
Current Constant Replacement
NSProgressIndicatorPreferredThickness Use controlSize + sizeToFit

  • Color Space (NSColorSpace.h) — deprecated macOS 10.0–10.14
Current Constant Replacement
NSRGBColorSpaceModel NSColorSpaceModelRGB

  • Date Picker Styles (NSDatePickerCell.h) — deprecated macOS 10.0–11.0
Current Constant Replacement
NSTextFieldAndStepperDatePickerStyle NSDatePickerStyleTextFieldAndStepper
NSClockAndCalendarDatePickerStyle NSDatePickerStyleClockAndCalendar
NSTextFieldDatePickerStyle NSDatePickerStyleTextField

  • Panel (NSPanel.h) — deprecated macOS 10.0–10.10
Current Constant Replacement
NSCancelButton NSModalResponseCancel

Not Deprecated

The following constants in that range have no deprecation annotation in the macOS 15.4 SDK and require no action:
NSBezelBorder, NSBottomTabsBezelBorder, NSBoxCustom, NSBoxSeparator, NSBackingStoreBuffered, NSNoBorder, NSEventTypeGesture, NSEventTypeBeginGesture, NSEventTypeEndGesture, NSScrollerDecrementPage, NSScrollerIncrementPage, NSScrollerKnob, NSScrollerKnobSlot, NSBoldFontMask, NSItalicFontMask, NSBackgroundStyleRaised, NSImageCacheNever, NSTableColumnNoResizing, NSTableColumnUserResizingMask, NSTableViewNoColumnAutoresizing, NSStringDrawingUsesLineFragmentOrigin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions