diff options
author | therzok <marius.ungureanu@xamarin.com> | 2016-04-18 13:33:06 +0300 |
---|---|---|
committer | therzok <marius.ungureanu@xamarin.com> | 2016-04-18 13:33:22 +0300 |
commit | 22652b4e4cf5db7fcbcfb1758fa59d42cac42eaf (patch) | |
tree | 5e7b681ac500e9b80f7d72ab9f18af9ed2ae0b37 /main | |
parent | e217d83452e5d97312bfec2474e26fbd72f4303e (diff) |
[Mac] Use the correct selector to init the image that's used in the dock.
This allows for a sharp icon on retina screens.
Diffstat (limited to 'main')
-rw-r--r-- | main/src/addins/MacPlatform/MacPlatform.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/main/src/addins/MacPlatform/MacPlatform.cs b/main/src/addins/MacPlatform/MacPlatform.cs index 2e3339dbfc..b56e4f65c8 100644 --- a/main/src/addins/MacPlatform/MacPlatform.cs +++ b/main/src/addins/MacPlatform/MacPlatform.cs @@ -50,6 +50,8 @@ using MonoDevelop.Components; using MonoDevelop.Components.MainToolbar; using MonoDevelop.MacIntegration.MacMenu; using MonoDevelop.Components.Extensions; +using System.Runtime.InteropServices; +using ObjCRuntime; namespace MonoDevelop.MacIntegration { @@ -283,7 +285,7 @@ namespace MonoDevelop.MacIntegration } PatchGtkTheme (); - NSNotificationCenter.DefaultCenter.AddObserver (NSCell.ControlTintChangedNotification, notif => Runtime.RunInMainThread ( + NSNotificationCenter.DefaultCenter.AddObserver (NSCell.ControlTintChangedNotification, notif => Core.Runtime.RunInMainThread ( delegate { Styles.LoadStyle(); PatchGtkTheme(); @@ -447,6 +449,9 @@ namespace MonoDevelop.MacIntegration } } + [DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")] + public extern static IntPtr IntPtr_objc_msgSend_IntPtr (IntPtr receiver, IntPtr selector, IntPtr arg1); + static void SetupDockIcon () { NSObject initialBundleIconFileValue; @@ -470,7 +475,11 @@ namespace MonoDevelop.MacIntegration } if (File.Exists (iconFile)) { - NSApplication.SharedApplication.ApplicationIconImage = new NSImage (iconFile); + var image = new NSImage (); + var imageFile = new NSString (iconFile); + + IntPtr p = IntPtr_objc_msgSend_IntPtr (image.Handle, Selector.GetHandle ("initByReferencingFile:"), imageFile.Handle); + NSApplication.SharedApplication.ApplicationIconImage = ObjCRuntime.Runtime.GetNSObject<NSImage> (p); } } |