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:
authorMichael Hutchinson <m.j.hutchinson@gmail.com>2011-11-22 23:05:19 +0400
committerMichael Hutchinson <m.j.hutchinson@gmail.com>2011-11-22 23:05:19 +0400
commit4553a89c7b1620df016d727afa77fb470a6e5564 (patch)
treea1924719fa43a41b8f2d7173cac8e8e2842bca6c
parent3129bd5ef65b8082ceb6f9bf29a342f47d14c15d (diff)
[Gtk] Workaround for Bug 2157 - flaky context menu
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs33
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs8
2 files changed, 32 insertions, 9 deletions
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
index 79b315e6d0..9c6805ff74 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
@@ -931,15 +931,8 @@ namespace Mono.TextEditor
//main context menu
if (DoPopupMenu != null && e.TriggersContextMenu ()) {
- double tmOffset = e.X - textViewMargin.XOffset;
- if (tmOffset >= 0) {
- DocumentLocation loc = PointToLocation (tmOffset, e.Y);
- if (!this.IsSomethingSelected || !this.SelectionRange.Contains (Document.LocationToOffset (loc)))
- Caret.Location = loc;
- DoPopupMenu (e);
- this.ResetMouseState ();
+ if (!workaroundBug2157 && DoClickedPopupMenu (e))
return true;
- }
}
if (lastTime != e.Time) {// filter double clicks
@@ -957,6 +950,23 @@ namespace Mono.TextEditor
return base.OnButtonPressEvent (e);
}
+ //HACK: work around "Bug 2157 - Context menus flaky near left edge of screen" by triggering on ButtonRelease
+ static bool workaroundBug2157 = Platform.IsMac;
+
+ bool DoClickedPopupMenu (Gdk.EventButton e)
+ {
+ double tmOffset = e.X - textViewMargin.XOffset;
+ if (tmOffset >= 0) {
+ DocumentLocation loc = PointToLocation (tmOffset, e.Y);
+ if (!this.IsSomethingSelected || !this.SelectionRange.Contains (Document.LocationToOffset (loc)))
+ Caret.Location = loc;
+ DoPopupMenu (e);
+ this.ResetMouseState ();
+ return true;
+ }
+ return false;
+ }
+
public Action<Gdk.EventButton> DoPopupMenu { get; set; }
protected override bool OnPopupMenu ()
@@ -999,6 +1009,13 @@ namespace Mono.TextEditor
protected override bool OnButtonReleaseEvent (EventButton e)
{
RemoveScrollWindowTimer ();
+
+ //main context menu
+ if (DoPopupMenu != null && e.IsContextMenuButton ()) {
+ if (workaroundBug2157 && DoClickedPopupMenu (e))
+ return true;
+ }
+
double startPos;
Margin margin = GetMarginAtX (e.X, out startPos);
if (margin != null)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs
index 77e3f03e1f..873461db4b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs
@@ -45,6 +45,9 @@ namespace MonoDevelop.Components
public Action<Gdk.EventButton> DoPopupMenu { get; set; }
+ //HACK: work around "Bug 2157 - Context menus flaky near left edge of screen" by triggering on ButtonRelease
+ static bool workaroundBug2157 = MonoDevelop.Core.Platform.IsMac;
+
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
bool res = false;
@@ -57,7 +60,8 @@ namespace MonoDevelop.Components
res = base.OnButtonPressEvent (evnt);
if (DoPopupMenu != null && evnt.TriggersContextMenu ()) {
- DoPopupMenu (evnt);
+ if (!workaroundBug2157)
+ DoPopupMenu (evnt);
return true;
}
@@ -69,6 +73,8 @@ namespace MonoDevelop.Components
bool res = base.OnButtonReleaseEvent (evnt);
if (DoPopupMenu != null && evnt.IsContextMenuButton ()) {
+ if (workaroundBug2157)
+ DoPopupMenu (evnt);
return true;
}