diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-01-20 19:32:53 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-10-21 18:39:14 +0400 |
commit | f73b2a9990495587d514aa1856919c21170a3940 (patch) | |
tree | 9842411ee8644ead5915a715ee7e53984a601df4 /main/src/addins/MacPlatform/MacPlatform.cs | |
parent | a2046b6331a271e8203df7d3d0f14500d33d60fa (diff) |
Initial drop of the new project model
Diffstat (limited to 'main/src/addins/MacPlatform/MacPlatform.cs')
-rw-r--r-- | main/src/addins/MacPlatform/MacPlatform.cs | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/main/src/addins/MacPlatform/MacPlatform.cs b/main/src/addins/MacPlatform/MacPlatform.cs index 11eb1419ad..c8625333fa 100644 --- a/main/src/addins/MacPlatform/MacPlatform.cs +++ b/main/src/addins/MacPlatform/MacPlatform.cs @@ -349,7 +349,7 @@ namespace MonoDevelop.MacIntegration if (!Int32.TryParse (qs ["column"], out column)) column = 1; - return new FileOpenInformation (fileUri.AbsolutePath, + return new FileOpenInformation (Uri.UnescapeDataString(fileUri.AbsolutePath), line, column, OpenDocumentOptions.DefaultInternal); } catch (Exception ex) { LoggingService.LogError ("Invalid TextMate URI: " + url, ex); @@ -519,7 +519,7 @@ namespace MonoDevelop.MacIntegration return res != null ? res.ToXwtImage () : base.OnGetIconForFile (filename); } - public override IProcessAsyncOperation StartConsoleProcess (string command, string arguments, string workingDirectory, + public override ProcessAsyncOperation StartConsoleProcess (string command, string arguments, string workingDirectory, IDictionary<string, string> environmentVariables, string title, bool pauseWhenFinished) { @@ -736,5 +736,42 @@ namespace MonoDevelop.MacIntegration return toplevels.Any (t => t.Key.IsVisible && (t.Value == null || t.Value.Modal) && !t.Key.DebugDescription.StartsWith ("<NSStatusBarWindow", StringComparison.Ordinal)); } + + public override void AddChildWindow (Gtk.Window parent, Gtk.Window child) + { + NSWindow w = GtkQuartz.GetWindow (parent); + child.Realize (); + NSWindow overlay = GtkQuartz.GetWindow (child); + overlay.SetExcludedFromWindowsMenu (true); + w.AddChildWindow (overlay, NSWindowOrderingMode.Above); + } + + public override void PlaceWindow (Gtk.Window window, int x, int y, int width, int height) + { + NSWindow w = GtkQuartz.GetWindow (window); + var dr = FromDesktopRect (new Gdk.Rectangle (x, y, width, height)); + var r = w.FrameRectFor (dr); + w.SetFrame (r, true); + base.PlaceWindow (window, x, y, width, height); + } + + static CGRect FromDesktopRect (Gdk.Rectangle r) + { + var desktopBounds = CalcDesktopBounds (); + r.Y = desktopBounds.Height - r.Y - r.Height; + if (desktopBounds.Y < 0) + r.Y += desktopBounds.Y; + return new CGRect (desktopBounds.X + r.X, r.Y, r.Width, r.Height); + } + + static Gdk.Rectangle CalcDesktopBounds () + { + var desktopBounds = new Gdk.Rectangle (); + foreach (var s in NSScreen.Screens) { + var r = s.Frame; + desktopBounds = desktopBounds.Union (new Gdk.Rectangle ((int)r.X, (int)r.Y, (int)r.Width, (int)r.Height)); + } + return desktopBounds; + } } } |