Skip to content

[AppKit] Remove all !NET code. #22739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions src/AppKit/Compat.cs

This file was deleted.

150 changes: 0 additions & 150 deletions src/AppKit/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,6 @@ public enum NSApplicationPrintReply : ulong {
ReplyLater,
}

#if !NET
[NoMacCatalyst]
[Native]
public enum NSApplicationLayoutDirection : long {
LeftToRight = 0,
RightToLeft = 1,
}
#endif

[NoMacCatalyst]
[Native]
public enum NSImageInterpolation : ulong {
Expand Down Expand Up @@ -376,21 +367,6 @@ public enum NSLineBreakMode : ulong {

#region NSCell Defines

#if !NET
[NoMacCatalyst]
[Native]
[Deprecated (PlatformName.MacOSX, 10, 10, message: "Use formatters instead.")]
public enum NSType : ulong {
Any = 0,
Int = 1,
PositiveInt = 2,
Float = 3,
PositiveFloat = 4,
Double = 6,
PositiveDouble = 7,
}
#endif

[NoMacCatalyst]
[Native]
public enum NSCellType : ulong {
Expand Down Expand Up @@ -834,12 +810,7 @@ public enum NSEventButtonMask : ulong {
// This enum is defined as an untyped enum in MacOSX.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h
// It represents values that may be returned by NSEvent.KeyCode (which isn't typed as 'NSKey' because it may be many other values as well).
[NoMacCatalyst]
#if NET
public enum NSKey {
#else
[Native]
public enum NSKey : ulong {
#endif
/// <summary>To be added.</summary>
A = 0x00,
/// <summary>To be added.</summary>
Expand Down Expand Up @@ -1080,12 +1051,7 @@ public enum NSKey : ulong {

// This is an untyped enum in AppKit's NSEvent.h
[NoMacCatalyst]
#if !NET
[Native]
public enum NSFunctionKey : ulong {
#else
public enum NSFunctionKey : int {
#endif
/// <summary>To be added.</summary>
UpArrow = 0xF700,
/// <summary>To be added.</summary>
Expand Down Expand Up @@ -1233,12 +1199,7 @@ public enum NSFunctionKey : int {
}

[NoMacCatalyst]
#if !NET
[Native]
public enum NSEventSubtype : ulong {
#else
public enum NSEventSubtype : short {
#endif
/* event subtypes for NSEventTypeAppKitDefined events */
/// <summary>To be added.</summary>
WindowExposed = 0,
Expand All @@ -1250,10 +1211,6 @@ public enum NSEventSubtype : short {
WindowMoved = 4,
/// <summary>To be added.</summary>
ScreenChanged = 8,
#if !NET
[Obsolete ("This API is not available on this platform.")]
AWT = 16,
#endif
/* event subtypes for NSEventTypeSystemDefined events */
/* the value is repeated from above */
PowerOff = 1,
Expand All @@ -1266,30 +1223,6 @@ public enum NSEventSubtype : short {
Touch = 3, /* NX_SUBTYPE_MOUSE_TOUCH */
}

#if !NET
[NoMacCatalyst]
[Native]
public enum NSSystemDefinedEvents : ulong {
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use 'NSEventSubtype.PowerOff' instead.")]
NSPowerOffEventType = 1,
}
#endif // !NET

#if !NET
[NoMacCatalyst]
[Native]
public enum NSEventMouseSubtype : ulong {
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use 'NSEventSubtype.MouseEvent' instead.")]
Mouse,
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use 'NSEventSubtype.TabletPoint' instead.")]
TablePoint,
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use 'NSEventSubtype.TabletProximity' instead.")]
TabletProximity,
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use 'NSEventSubtype.Touch' instead.")]
Touch,
}
#endif // !NET

#endregion

#region NSView
Expand Down Expand Up @@ -1404,10 +1337,6 @@ public enum NSWindowStyle : ulong {
/// <summary>To be added.</summary>
[Deprecated (PlatformName.MacOSX, 11, 0, message: "Don't use 'TexturedBackground' anymore.")]
TexturedBackground = 1 << 8,
#if !NET
[Deprecated (PlatformName.MacOSX, 10, 9, message: "Don't use, this value has no effect.")]
Unscaled = 1 << 11,
#endif
/// <summary>To be added.</summary>
UnifiedTitleAndToolbar = 1 << 12,
/// <summary>To be added.</summary>
Expand Down Expand Up @@ -2015,10 +1944,6 @@ public enum NSUserInterfaceLayoutOrientation : long {
public enum NSStackViewVisibilityPriority : int {
/// <summary>To be added.</summary>
MustHold = 1000,
#if !NET
[Obsolete ("Use 'MustHold' instead.")]
Musthold = MustHold,
#endif
/// <summary>To be added.</summary>
DetachOnlyIfNecessary = 900,
/// <summary>To be added.</summary>
Expand Down Expand Up @@ -2097,20 +2022,6 @@ public enum NSTextAlignment : ulong {
Natural = 4,
}

#if !NET && MONOMAC
// Use Foundation.NSWritingDirection in .NET.
// see: https://github.com/dotnet/macios/issues/6573
[Flags]
[Native]
public enum NSWritingDirection : long {
Natural = -1, LeftToRight, RightToLeft,
[Obsolete ("Use 'LeftToRight' instead.")]
Embedding = 0,
[Obsolete ("This API is not available on this platform.")]
Override = 2,
}
#endif // !NET && MONOMAC

[NoMacCatalyst]
[Native]
public enum NSTextMovement : long {
Expand Down Expand Up @@ -2370,29 +2281,6 @@ public enum NSPrintingPaginationMode : ulong {
Clip,
}

#if !NET
[NoMacCatalyst]
[Flags]
[Native]
[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSGlyphProperty' instead.")]
public enum NSGlyphStorageOptions : ulong {
ShowControlGlyphs = 1,
ShowInvisibleGlyphs = 2,
WantsBidiLevels = 4,
}
#endif // !NET

#if !NET
[NoMacCatalyst]
[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use NSTextStorageEditActions instead.")]
[Flags]
[Native]
public enum NSTextStorageEditedFlags : ulong {
EditedAttributed = 1,
EditedCharacters = 2,
}
#endif

[NoMacCatalyst]
[Native]
public enum NSPrinterTableStatus : ulong {
Expand Down Expand Up @@ -2666,28 +2554,6 @@ public enum NSToolbarSizeMode : ulong {
Small,
}

#if !NET
[NoMacCatalyst]
[Deprecated (PlatformName.MacOSX, 10, 10, message: "Use NSAlertButtonReturn instead.")]
[Native]
public enum NSAlertType : long {
ErrorReturn = -2,
OtherReturn,
AlternateReturn,
DefaultReturn,
}
#endif // !NET

#if !NET
[NoMacCatalyst]
[Deprecated (PlatformName.MacOSX, 10, 10, message: "Use NSModalResponse instead.")]
[Native]
public enum NSPanelButtonType : long {
Cancel,
Ok,
}
#endif

[NoMacCatalyst]
[Native]
public enum NSTableViewColumnAutoresizingStyle : ulong {
Expand Down Expand Up @@ -2819,10 +2685,6 @@ public enum NSImageFrameStyle : ulong {
public enum NSSpeechBoundary : ulong {
/// <summary>To be added.</summary>
Immediate = 0,
#if !NET
[Obsolete ("Use 'Word' instead.")]
hWord,
#endif
/// <summary>To be added.</summary>
Word = 1,
/// <summary>To be added.</summary>
Expand Down Expand Up @@ -3265,10 +3127,6 @@ public enum NSOpenGLPixelFormatAttribute : uint { // uint32_t NSOpenGLPixelForma
DoubleBuffer = 5,
/// <summary>To be added.</summary>
TripleBuffer = 3,
#if !NET
[Obsolete ("Use 'TripleBuffer' instead.")]
TrippleBuffer = TripleBuffer,
#endif
/// <summary>To be added.</summary>
Stereo = 6,
/// <summary>To be added.</summary>
Expand Down Expand Up @@ -3515,10 +3373,6 @@ public enum HfsTypeCode : uint {
GenericPreferencesIcon = 0x70726566, //'pref'
GenericQueryDocumentIcon = 0x71657279, //'qery'
GenericRamDiskIcon = 0x72616D64, //'ramd'
#if !NET
[Obsolete ("Use 'GenericSharedLibraryIcon' instead.")]
GenericSharedLibaryIcon = 0x73686C62, //'shlb'
#endif
GenericSharedLibraryIcon = 0x73686C62, //'shlb'
GenericStationeryIcon = 0x73646F63, //'sdoc'
GenericSuitcaseIcon = 0x73756974, //'suit'
Expand Down Expand Up @@ -4132,10 +3986,6 @@ public enum NSWindowTitleVisibility : long {
Visible = 0,
/// <summary>To be added.</summary>
Hidden = 1,
#if !NET
[Obsolete ("This API is not available on this platform.")]
HiddenWhenActive = 2,
#endif
}

[NoMacCatalyst]
Expand Down
4 changes: 0 additions & 4 deletions src/AppKit/NSAccessibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@

#nullable enable

#if !NET
using NativeHandle = System.IntPtr;
#endif

namespace AppKit {
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
Expand Down
15 changes: 0 additions & 15 deletions src/AppKit/NSApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ public partial class NSApplication : NSResponder {
/// <remarks>To be added.</remarks>
public static bool CheckForEventAndDelegateMismatches = true;

#if !NET
public static bool IgnoreMissingAssembliesDuringRegistration = false;
#endif

private static Thread? mainThread;

[DllImport (Constants.AppKitLibrary)]
Expand All @@ -68,12 +64,8 @@ public static void Init ()

initialized = true;

#if NET
if (Runtime.DynamicRegistrationSupported)
Runtime.RegisterAssemblies ();
#else
Runtime.RegisterAssemblies ();
#endif

// Runtime hosts embedding MonoMac may use a different sync context
// and call NSApplicationMain externally prior to this Init, so only
Expand Down Expand Up @@ -177,13 +169,6 @@ public void DiscardEvents (NSEventMask mask, NSEvent lastEvent)
DiscardEvents ((nuint) (ulong) mask, lastEvent);
}

#if !NET
[Obsolete ("This method does nothing.")]
public static void RestoreWindow (string identifier, Foundation.NSCoder state, NSWindowCompletionHandler onCompletion)
{
}
#endif

// note: if needed override the protected Get|Set methods
/// <summary>To be added.</summary>
/// <value>To be added.</value>
Expand Down
20 changes: 0 additions & 20 deletions src/AppKit/NSBezierPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,26 +123,6 @@ public unsafe void Append (CGPoint [] points)
_AppendPathWithPoints ((IntPtr) ptr, points.Length);
}

#if !NET
[Obsolete ("Use 'Append (CGPoint[])' instead.")]
public unsafe void AppendPathWithPoints (CGPoint [] points)
{
Append (points);
}

[Obsolete ("Use 'Append (uint[], NSFont)' instead.")]
public unsafe void AppendPathWithGlyphs (uint [] glyphs, NSFont font)
{
if (glyphs is null)
throw new ArgumentNullException ("glyphs");
if (glyphs.Length < 1)
throw new ArgumentException ("glyphs array is empty");

fixed (uint* ptr = glyphs)
_AppendPathWithGlyphs ((IntPtr) ptr, glyphs.Length, font);
}
#endif

/// <param name="glyphs">To be added.</param>
/// <param name="font">To be added.</param>
/// <summary>To be added.</summary>
Expand Down
Loading