diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2018-11-29 20:41:00 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@microsoft.com> | 2018-11-29 20:41:00 +0300 |
commit | 8519ba08905009dc9f6593072ed2a2970b163990 (patch) | |
tree | 6ced67681b8e54c9bee393f286a32b6f4b865de6 /main/src/addins/MacPlatform/MacPlatform.cs | |
parent | 74c2888df1b4efa5fbaad00bdf4dd64338d6c2c0 (diff) |
[Ide] Add DesktopService.FocusWindow
Given a Components.Window the platform implementation
will focus it in a native way.
Diffstat (limited to 'main/src/addins/MacPlatform/MacPlatform.cs')
-rw-r--r-- | main/src/addins/MacPlatform/MacPlatform.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/main/src/addins/MacPlatform/MacPlatform.cs b/main/src/addins/MacPlatform/MacPlatform.cs index 80aea56333..df999638a0 100644 --- a/main/src/addins/MacPlatform/MacPlatform.cs +++ b/main/src/addins/MacPlatform/MacPlatform.cs @@ -943,6 +943,20 @@ namespace MonoDevelop.MacIntegration NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); } + public override void FocusWindow (Window window) + { + try { + NSWindow nswindow = window; // will also get an NSWindow from a Gtk.Window + if (nswindow != null) { + nswindow.MakeKeyAndOrderFront (nswindow); + return; + } + } catch (Exception ex) { + LoggingService.LogError ("Focusing window failed: not an NSWindow", ex); + } + base.FocusWindow (window); + } + static Cairo.Color ConvertColor (NSColor color) { nfloat r, g, b, a; |