Skip to content

Commit

Permalink
Merge pull request #2072 from cwensley/curtis/xammac-support-older-ve…
Browse files Browse the repository at this point in the history
…rsions

Only use newer api's for .NET 6 or later
  • Loading branch information
cwensley committed Nov 19, 2021
2 parents c38147b + 64e5bc3 commit 9ff738d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Eto.Mac/Drawing/FontFamilyHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public string LocalizedName
// faceName cannot be null. Use this when it is fixed in xammac/monomac:
// return NSFontManager.SharedFontManager.LocalizedNameForFamily(MacName, null);
var facePtr = IntPtr.Zero;
#if XAMMAC
#if XAMMAC && NET6_0_OR_GREATER
var familyPtr = CFString.CreateNative(MacName);
var result = CFString.FromHandle(Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(NSFontManager.SharedFontManager.Handle, sel_LocalizedNameForFamilyFace, familyPtr, facePtr));
CFString.ReleaseNative(familyPtr);
Expand Down
2 changes: 1 addition & 1 deletion src/Eto.Mac/Forms/Controls/NumericStepperHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ public bool GetObjectValue(IntPtr obj, IntPtr strPtr, IntPtr errorDescription)
if (h != null && h.NeedsFormat)
{
double result;
#if XAMMAC2
#if XAMMAC && NET6_0_OR_GREATER
var str = CFString.FromHandle(strPtr);
#else
var str = NSString.FromHandle(strPtr);
Expand Down
2 changes: 1 addition & 1 deletion src/Eto.Mac/MacExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void Release(IntPtr handle)
// replacementString should allow nulls
public static bool ShouldChangeTextNew(this NSTextView textView, NSRange affectedCharRange, string replacementString)
{
#if XAMMAC2
#if XAMMAC && NET6_0_OR_GREATER
IntPtr intPtr = replacementString != null ? CFString.CreateNative(replacementString) : IntPtr.Zero;
bool result;
result = Messaging.bool_objc_msgSend_NSRange_IntPtr(textView.Handle, selShouldChangeTextInRangeReplacementString_Handle, affectedCharRange, intPtr);
Expand Down

0 comments on commit 9ff738d

Please sign in to comment.