diff options
author | Carlos Alberto Cortez <calberto.cortez@gmail.com> | 2011-07-24 17:54:54 +0400 |
---|---|---|
committer | Carlos Alberto Cortez <calberto.cortez@gmail.com> | 2011-07-30 20:50:25 +0400 |
commit | f18546c0038bd0180a34acd892b3298cb05ecb8e (patch) | |
tree | e29fd4d90fe0bbfb7db874b13587c34b261821e3 /main | |
parent | bd9c5ea071573199c757df263003795f8f9f488e (diff) |
[Windows] Restore focus after using any dialog window.
Also add a reference to atk-sharp, as needed to make use
of the Gtk.Window type.
Diffstat (limited to 'main')
4 files changed, 21 insertions, 8 deletions
diff --git a/main/src/addins/WindowsPlatform/AddFileDialogHandler.cs b/main/src/addins/WindowsPlatform/AddFileDialogHandler.cs index 6c43872baf..70b2c3345f 100644 --- a/main/src/addins/WindowsPlatform/AddFileDialogHandler.cs +++ b/main/src/addins/WindowsPlatform/AddFileDialogHandler.cs @@ -1,6 +1,7 @@ using System;
using System.Collections.Generic;
using System.Text;
+using MonoDevelop.Ide;
using MonoDevelop.Ide.Extensions;
using MonoDevelop.Platform;
using System.Windows.Forms;
@@ -13,6 +14,7 @@ namespace MonoDevelop.Platform {
public bool Run (AddFileDialogData data)
{
+ var parentWindow = data.TransientFor ?? MessageService.RootWindow;
CustomAddFilesDialog adlg = new CustomAddFilesDialog();
adlg.StartLocation = AddonWindowLocation.Bottom;
adlg.BuildActions = data.BuildActions;
@@ -48,7 +50,8 @@ namespace MonoDevelop.Platform t.Enabled = false;
adlg.Dispose();
}
-
+
+ parentWindow.Present ();
return result;
}
}
diff --git a/main/src/addins/WindowsPlatform/OpenFileDialogHandler.cs b/main/src/addins/WindowsPlatform/OpenFileDialogHandler.cs index 6c6ebf85c2..3a5acb31f8 100644 --- a/main/src/addins/WindowsPlatform/OpenFileDialogHandler.cs +++ b/main/src/addins/WindowsPlatform/OpenFileDialogHandler.cs @@ -27,6 +27,7 @@ using System; using System.Windows.Forms;
using CustomControls.Controls;
using MonoDevelop.Core;
+using MonoDevelop.Ide;
using MonoDevelop.Ide.Extensions;
using MonoDevelop.Platform;
@@ -35,7 +36,8 @@ namespace MonoDevelop.Platform public class OpenFileDialogHandler : IOpenFileDialogHandler
{
public bool Run (OpenFileDialogData data)
- {
+ {
+ var parentWindow = data.TransientFor ?? MessageService.RootWindow;
FileDialog fileDlg = null;
if (data.Action == Gtk.FileChooserAction.Open)
fileDlg = new OpenFileDialog ();
@@ -45,11 +47,13 @@ namespace MonoDevelop.Platform var dlg = new CustomOpenFileDialog (fileDlg, data);
SelectFileDialogHandler.SetCommonFormProperties (data, dlg.FileDialog);
-
+
using (dlg) {
WinFormsRoot root = new WinFormsRoot ();
- if (dlg.ShowDialog (root) == DialogResult.Cancel)
+ if (dlg.ShowDialog (root) == DialogResult.Cancel) {
+ parentWindow.Present ();
return false;
+ }
FilePath[] paths = new FilePath [fileDlg.FileNames.Length];
for (int n = 0; n < fileDlg.FileNames.Length; n++)
@@ -63,7 +67,8 @@ namespace MonoDevelop.Platform data.CloseCurrentWorkspace = dlg.CloseCurrentWorkspace;
}
}
-
+
+ parentWindow.Present ();
return true;
}
}
diff --git a/main/src/addins/WindowsPlatform/SelectFileDialogHandler.cs b/main/src/addins/WindowsPlatform/SelectFileDialogHandler.cs index e2628fa4a4..b50515bda8 100644 --- a/main/src/addins/WindowsPlatform/SelectFileDialogHandler.cs +++ b/main/src/addins/WindowsPlatform/SelectFileDialogHandler.cs @@ -4,6 +4,7 @@ using System.Text; using MonoDevelop.Components.Extensions;
using System.Windows.Forms;
using MonoDevelop.Core;
+using MonoDevelop.Ide;
namespace MonoDevelop.Platform
{
@@ -11,6 +12,7 @@ namespace MonoDevelop.Platform {
public bool Run(SelectFileDialogData data)
{
+ var parentWindow = data.TransientFor ?? MessageService.RootWindow;
CommonDialog dlg = null;
if (data.Action == Gtk.FileChooserAction.Open)
dlg = new OpenFileDialog();
@@ -24,11 +26,12 @@ namespace MonoDevelop.Platform else
SetFolderBrowserProperties (data, dlg as FolderBrowserDialog);
-
using (dlg) {
WinFormsRoot root = new WinFormsRoot();
- if (dlg.ShowDialog(root) == DialogResult.Cancel)
+ if (dlg.ShowDialog(root) == DialogResult.Cancel) {
+ parentWindow.Present ();
return false;
+ }
if (dlg is FileDialog) {
var fileDlg = dlg as FileDialog;
@@ -40,7 +43,8 @@ namespace MonoDevelop.Platform var folderDlg = dlg as FolderBrowserDialog;
data.SelectedFiles = new [] { new FilePath (folderDlg.SelectedPath) };
}
-
+
+ parentWindow.Present ();
return true;
}
}
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform.csproj b/main/src/addins/WindowsPlatform/WindowsPlatform.csproj index 91dc57eaef..5fd8354320 100644 --- a/main/src/addins/WindowsPlatform/WindowsPlatform.csproj +++ b/main/src/addins/WindowsPlatform/WindowsPlatform.csproj @@ -33,6 +33,7 @@ <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> |