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:
Diffstat (limited to 'main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs')
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs36
1 files changed, 31 insertions, 5 deletions
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs
index 73fdfd2306..43bfd4e04b 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs
@@ -489,13 +489,32 @@ namespace Mono.TextEditor
public static void ShowContextMenu (Gtk.Menu menu, Gtk.Widget parent, Gdk.EventButton evt, Gdk.Rectangle caret)
{
int x, y;
- var window = evt.Window;
+ uint time, button;
+
+ var window = evt != null ? evt.Window : parent.GdkWindow;
+
+ if (window == null)
+ return;
window.GetOrigin (out x, out y);
- x += (int)evt.X;
- y += (int)evt.Y;
- ShowContextMenuInternal (menu, parent, x, y, caret, window, evt.Time, evt.Button);
+ if (evt == null) {
+ evt = Global.CurrentEvent as Gdk.EventButton;
+ }
+
+ if (evt != null) {
+ button = evt.Button;
+ time = evt.Time;
+ x += (int)evt.X;
+ y += (int)evt.Y;
+ } else {
+ button = 3;
+ time = 0;
+ x += caret.X;
+ y += caret.Y;
+ }
+
+ ShowContextMenuInternal (menu, parent, x, y, caret, window, time, button);
}
public static void ShowContextMenu (Gtk.Menu menu, Gtk.Widget parent, int ix, int iy, Gdk.Rectangle caret)
@@ -1023,7 +1042,7 @@ namespace Mono.TextEditor
}
}
- static bool canSetOverlayScrollbarPolicy = true;
+ static bool canSetOverlayScrollbarPolicy = Platform.IsMac;
[DllImport (PangoUtil.LIBQUARTZ)]
static extern void gtk_scrolled_window_set_overlay_policy (IntPtr sw, Gtk.PolicyType hpolicy, Gtk.PolicyType vpolicy);
@@ -1190,6 +1209,13 @@ namespace Mono.TextEditor
else
return 1d;
}
+
+ public static int ConvertToPixelScale (int size)
+ {
+ double scale = GetPixelScale ();
+
+ return (int)(size * scale);
+ }
public static Gdk.Pixbuf RenderIcon (this Gtk.IconSet iconset, Gtk.Style style, Gtk.TextDirection direction, Gtk.StateType state, Gtk.IconSize size, Gtk.Widget widget, string detail, double scale)
{