Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/d16-7' into backport-pr-8819-to-…
Browse files Browse the repository at this point in the history
…d16-7
  • Loading branch information
rolfbjarne committed Jun 11, 2020
2 parents 6362202 + 3b2cf2c commit 4c91ac4
Show file tree
Hide file tree
Showing 134 changed files with 98 additions and 3,242 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/mk @rolfbjarne

/msbuild @kzu @jstedfast @emaf @rolfbjarne @VincentDondain @chamons
/msbuild @jstedfast @emaf @rolfbjarne @VincentDondain @chamons

/runtime @rolfbjarne

Expand Down
39 changes: 0 additions & 39 deletions src/Foundation/NSObject.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ public partial class NSObject : INativeObject
public readonly static Assembly MonoTouchAssembly = typeof (NSObject).Assembly;
#endif

#if !XAMCORE_2_0
const string selAccessibilityDecrement = "accessibilityDecrement";
const string selAccessibilityIncrement = "accessibilityIncrement";
const string selAccessibilityScroll = "accessibilityScroll";
#endif
public static NSObject Alloc (Class kls) {
var h = Messaging.IntPtr_objc_msgSend (kls.Handle, Selector.GetHandle (Selector.Alloc));
return new NSObject (h, true);
Expand All @@ -53,40 +48,6 @@ public static void InvokeInBackground (Action action)
IsBackground = true,
}.Start (action);
}

#if !XAMCORE_2_0
[Export ("accessibilityDecrement")]
public virtual void AccessibilityDecrement () {
if (IsDirectBinding) {
Messaging.void_objc_msgSend (this.Handle, Selector.GetHandle (selAccessibilityDecrement));
} else {
Messaging.void_objc_msgSendSuper (this.SuperHandle, Selector.GetHandle (selAccessibilityDecrement));
}
}

[Export ("accessibilityIncrement")]
public virtual void AccessibilityIncrement () {
if (IsDirectBinding) {
Messaging.void_objc_msgSend (this.Handle, Selector.GetHandle (selAccessibilityIncrement));
} else {
Messaging.void_objc_msgSendSuper (this.SuperHandle, Selector.GetHandle (selAccessibilityIncrement));
}
}

[Export ("accessibilityScroll:")]
public virtual bool AccessibilityScroll (UIAccessibilityScrollDirection direction) {
if (IsDirectBinding) {
return Messaging.bool_objc_msgSend_int (this.Handle, Selector.GetHandle (selAccessibilityScroll), (int) direction);
} else {
return Messaging.bool_objc_msgSendSuper_int (this.SuperHandle, Selector.GetHandle (selAccessibilityScroll), (int) direction);
}
}

public virtual void PerformSelector (Selector sel, NSObject obj, float delay)
{
PerformSelector (sel, obj, (double) delay);
}
#endif
#endif // !COREBUILD
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/Foundation/NSObject.mac.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public partial class NSObject : INativeObject
static IntPtr ma = Dlfcn.dlopen (Constants.MediaAccessibilityLibrary, 1);
static IntPtr mi = Dlfcn.dlopen (Constants.CoreMidiLibrary, 1);
static IntPtr ic = Dlfcn.dlopen (Constants.ImageCaptureCoreLibrary, 1);
#if XAMCORE_2_0 && ARCH_64
static IntPtr it = Dlfcn.dlopen (Constants.IntentsLibrary, 1);
static IntPtr me = Dlfcn.dlopen (Constants.MediaLibraryLibrary, 1);
static IntPtr gl = Dlfcn.dlopen (Constants.GLKitLibrary, 1);
Expand Down Expand Up @@ -110,7 +109,6 @@ public partial class NSObject : INativeObject
static IntPtr vs = Dlfcn.dlopen (Constants.VideoSubscriberAccountLibrary, 1);
static IntPtr un = Dlfcn.dlopen (Constants.UserNotificationsLibrary, 1);
static IntPtr il = Dlfcn.dlopen (Constants.iTunesLibraryLibrary, 1);
#endif
// ** IF YOU ADD ITEMS HERE PLEASE UPDATE linker/ObjCExtensions.cs and mmp/linker/MonoMac.Tuner/MonoMacNamespaces.cs

#if !XAMCORE_4_0
Expand Down
67 changes: 4 additions & 63 deletions src/Foundation/NSObject2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class NSObjectFlag {

[StructLayout (LayoutKind.Sequential)]
public partial class NSObject
#if !COREBUILD && XAMCORE_2_0
#if !COREBUILD
: IEquatable<NSObject>
#endif
{
Expand Down Expand Up @@ -92,14 +92,11 @@ internal bool IsRegisteredToggleRef {
get { return ((flags & Flags.RegisteredToggleRef) == Flags.RegisteredToggleRef); }
set { flags = value ? (flags | Flags.RegisteredToggleRef) : (flags & ~Flags.RegisteredToggleRef); }
}
#if XAMCORE_2_0

protected internal bool IsDirectBinding {
get { return ((flags & Flags.IsDirectBinding) == Flags.IsDirectBinding); }
set { flags = value ? (flags | Flags.IsDirectBinding) : (flags & ~Flags.IsDirectBinding); }
}
#else
protected internal bool IsDirectBinding;
#endif

internal bool InFinalizerQueue {
get { return ((flags & Flags.InFinalizerQueue) == Flags.InFinalizerQueue); }
Expand Down Expand Up @@ -194,10 +191,10 @@ private void InitializeObject (bool alloced) {
if (alloced && handle == IntPtr.Zero && Class.ThrowOnInitFailure) {
if (ClassHandle == IntPtr.Zero)
throw new Exception (string.Format ("Could not create an native instance of the type '{0}': the native class hasn't been loaded.\n" +
"It is possible to ignore this condition by setting " + (Runtime.IsUnifiedBuild ? "" : (Runtime.CompatNamespace + ".")) + "ObjCRuntime.Class.ThrowOnInitFailure to false.",
"It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.",
GetType ().FullName));
throw new Exception (string.Format ("Failed to create a instance of the native type '{0}'.\n" +
"It is possible to ignore this condition by setting " + (Runtime.IsUnifiedBuild ? "" : (Runtime.CompatNamespace + ".")) + "ObjCRuntime.Class.ThrowOnInitFailure to false.",
"It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.",
new Class (ClassHandle).Name));
}

Expand Down Expand Up @@ -235,31 +232,6 @@ void ReleaseManagedRef ()
xamarin_release_managed_ref (handle, this);
}

#if !XAMCORE_2_0
[Export ("encodeWithCoder:")]
public virtual void EncodeTo (NSCoder coder)
{
if (coder == null)
throw new ArgumentNullException ("coder");

if (!(this is INSCoding))
throw new InvalidOperationException ("Type does not conform to NSCoding");

#if MONOMAC
if (IsDirectBinding) {
Messaging.void_objc_msgSend_intptr (this.Handle, selEncodeWithCoderHandle, coder.Handle);
} else {
Messaging.void_objc_msgSendSuper_intptr (this.SuperHandle, selEncodeWithCoderHandle, coder.Handle);
}
#else
if (IsDirectBinding) {
Messaging.void_objc_msgSend_intptr (this.Handle, Selector.GetHandle (selEncodeWithCoder), coder.Handle);
} else {
Messaging.void_objc_msgSendSuper_intptr (this.SuperHandle, Selector.GetHandle (selEncodeWithCoder), coder.Handle);
}
#endif
}
#endif
static bool IsProtocol (Type type, IntPtr protocol)
{
while (type != typeof (NSObject) && type != null) {
Expand Down Expand Up @@ -356,15 +328,6 @@ public virtual bool ConformsToProtocol (IntPtr protocol)

return false;
}

#if !XAMCORE_2_0
[Obsolete ("Low-level API warning: Use at your own risk: this calls the Release method on the underlying object; Use DangerousRelease to avoid this warning.")]
[EditorBrowsable (EditorBrowsableState.Advanced)]
public void Release ()
{
DangerousRelease ();
}
#endif

[EditorBrowsable (EditorBrowsableState.Advanced)]
public void DangerousRelease ()
Expand Down Expand Up @@ -403,15 +366,6 @@ internal static void DangerousAutorelease (IntPtr handle)
#endif
}

#if !XAMCORE_2_0
[Obsolete ("Low-level API warning: Use at your own risk: this calls the Retain method on the underlying object; Use DangerousRetain to avoid this warning.")]
[EditorBrowsable (EditorBrowsableState.Advanced)]
public NSObject Retain ()
{
return DangerousRetain ();
}
#endif

[EditorBrowsable (EditorBrowsableState.Advanced)]
public NSObject DangerousRetain ()
{
Expand All @@ -423,15 +377,6 @@ public NSObject DangerousRetain ()
return this;
}

#if !XAMCORE_2_0
[Obsolete ("Low-level API warning: Use at your own risk: this calls the Retain method on the underlying object; Use DangerousAutorelease to avoid this warning.")]
[EditorBrowsable (EditorBrowsableState.Advanced)]
public NSObject Autorelease ()
{
return DangerousAutorelease ();
}
#endif

[EditorBrowsable (EditorBrowsableState.Advanced)]
public NSObject DangerousAutorelease ()
{
Expand Down Expand Up @@ -667,7 +612,6 @@ public static NSObject FromObject (object obj)
else if (t == typeof (PointF))
return NSValue.FromPointF ((PointF) obj);
#endif
#if XAMCORE_2_0
if (t == typeof (nint))
return NSNumber.FromNInt ((nint) obj);
else if (t == typeof (nuint))
Expand All @@ -680,7 +624,6 @@ public static NSObject FromObject (object obj)
return NSValue.FromCGRect ((CGRect) obj);
else if (t == typeof (CGPoint))
return NSValue.FromCGPoint ((CGPoint) obj);
#endif

#if !MONOMAC
if (t == typeof (CGAffineTransform))
Expand Down Expand Up @@ -720,7 +663,6 @@ public void SetValueForKeyPath (IntPtr handle, NSString keyPath)
#endif
}

#if XAMCORE_2_0
// if IsDirectBinding is false then we _likely_ have managed state and it's up to the subclass to provide
// a correct implementation of GetHashCode / Equals. We default to Object.GetHashCode (like classic)

Expand Down Expand Up @@ -749,7 +691,6 @@ public override bool Equals (object obj)

// IEquatable<T>
public bool Equals (NSObject obj) => Equals ((object) obj);
#endif

public override string ToString ()
{
Expand Down
5 changes: 1 addition & 4 deletions src/ObjCRuntime/AdoptsAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@
namespace ObjCRuntime {

[AttributeUsage(AttributeTargets.Class, AllowMultiple=true)]
#if XAMCORE_2_0
sealed
#endif
public class AdoptsAttribute : Attribute {
public sealed class AdoptsAttribute : Attribute {
#if !COREBUILD
IntPtr handle;

Expand Down
14 changes: 0 additions & 14 deletions src/ObjCRuntime/AlphaAttribute.cs

This file was deleted.

5 changes: 1 addition & 4 deletions src/ObjCRuntime/BlockProxyAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

namespace ObjCRuntime {
[AttributeUsage (AttributeTargets.Parameter, AllowMultiple=false)]
#if XAMCORE_2_0
sealed
#endif
public class BlockProxyAttribute : Attribute {
public sealed class BlockProxyAttribute : Attribute {
public BlockProxyAttribute (Type t) { Type = t; }
public Type Type { get; set; }
}
Expand Down
13 changes: 0 additions & 13 deletions src/ObjCRuntime/Blocks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ namespace ObjCRuntime {

#pragma warning disable 649 // Field 'XamarinBlockDescriptor.ref_count' is never assigned to, and will always have its default value 0
[StructLayout (LayoutKind.Sequential)]
#if !XAMCORE_2_0
public
#endif
struct BlockDescriptor {
public IntPtr reserved;
public IntPtr size;
Expand All @@ -63,23 +60,13 @@ struct XamarinBlockDescriptor {
[StructLayout (LayoutKind.Sequential)]
public unsafe struct BlockLiteral {
#pragma warning disable 169
#if XAMCORE_2_0
IntPtr isa;
BlockFlags flags;
int reserved;
IntPtr invoke;
IntPtr block_descriptor;
IntPtr local_handle;
IntPtr global_handle;
#else
public IntPtr isa;
public BlockFlags flags;
public int reserved;
public IntPtr invoke;
public IntPtr block_descriptor;
public IntPtr local_handle;
public IntPtr global_handle;
#endif
#pragma warning restore 169
#if !COREBUILD
static IntPtr block_class;
Expand Down
7 changes: 1 addition & 6 deletions src/ObjCRuntime/Class.cs
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,7 @@ static unsafe uint GetFullTokenReference (string assembly_name, int module_token
Type must have been previously registered.
*/
[BindingImpl (BindingImplOptions.Optimizable)] // To inline the Runtime.DynamicRegistrationSupported code if possible.
#if !XAMCORE_2_0 && !MONOTOUCH // Accidently exposed this to public, can't break API
public
#else
internal
#endif
static bool IsCustomType (Type type)
internal static bool IsCustomType (Type type)
{
bool is_custom_type;
var @class = GetClassHandle (type, false, out is_custom_type);
Expand Down
41 changes: 0 additions & 41 deletions src/ObjCRuntime/CompileFlagsAttribute.cs

This file was deleted.

4 changes: 0 additions & 4 deletions src/ObjCRuntime/DelayedRegistrationAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@
using System.Runtime.InteropServices;
using System.IO;

#if XAMCORE_2_0
namespace ObjCRuntime {
#else
namespace MonoMac {
#endif
[AttributeUsage (AttributeTargets.Assembly)]
public abstract class DelayedRegistrationAttribute : Attribute
{
Expand Down
Loading

0 comments on commit 4c91ac4

Please sign in to comment.