Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2013-03-05 20:18:14 +0400
committerDuncan Mak <duncan@a-chinaman.com>2013-03-08 10:47:15 +0400
commit2be11af94af70712cf550d12870275274b1ad399 (patch)
tree23bae4984308be2ffe45cb915373a4d9e8cb2691
parent31d2e20bafe695cb1355d7ff1acf738529605fb1 (diff)
[SourceEditor] Added another work around for the cut&paste issue.monodevelop-4.0.2.19monodevelop-4.0.2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs26
1 files changed, 23 insertions, 3 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
index fa348769d3..b23a89599a 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
@@ -159,13 +159,33 @@ namespace MonoDevelop.SourceEditor
public bool SearchWidgetHasFocus {
get {
- if (searchAndReplaceWidget != null && searchAndReplaceWidget.FocusChild != null && searchAndReplaceWidget.FocusChild.HasFocus)
- return true;
- if (gotoLineNumberWidget != null && gotoLineNumberWidget.FocusChild != null && gotoLineNumberWidget.FocusChild.HasFocus)
+ if (HasAnyFocusedChild (searchAndReplaceWidget) || HasAnyFocusedChild (gotoLineNumberWidget))
return true;
return false;
}
}
+
+ static bool HasAnyFocusedChild (Widget widget)
+ {
+ // Seems that this is the only reliable way doing it on os x and linux :/
+ if (widget == null)
+ return false;
+ var stack = new Stack<Widget> ();
+ stack.Push (widget);
+ while (stack.Count > 0) {
+ var cur = stack.Pop ();
+ if (cur.HasFocus) {
+ return true;
+ }
+ var c = cur as Gtk.Container;
+ if (c!= null) {
+ foreach (var child in c.Children) {
+ stack.Push (child);
+ }
+ }
+ }
+ return false;
+ }
public class Border : Gtk.DrawingArea
{