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
path: root/main/src
diff options
context:
space:
mode:
authoriain <iain.holmes@xamarin.com>2017-07-27 17:17:17 +0300
committerGitHub <noreply@github.com>2017-07-27 17:17:17 +0300
commit44800cf0b8417bb3b3b011bfbba454a7d6d9b80f (patch)
tree7aa8591882944ff4f4917be8391a1d08687b6227 /main/src
parent4dce054a9ed6649eeff8a8a39043ab758cb04614 (diff)
parentd3616cbb6548316f6f1f6122c12694e067763389 (diff)
Merge pull request #2810 from mono/Fix-53775
Fixes BXC #53775
Diffstat (limited to 'main/src')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/EventBoxTooltip.cs37
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs36
2 files changed, 66 insertions, 7 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/EventBoxTooltip.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/EventBoxTooltip.cs
index ad48d0c426..3d6e6223f9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/EventBoxTooltip.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/EventBoxTooltip.cs
@@ -29,22 +29,27 @@ using Gtk;
using System;
using MonoDevelop.Components.AtkCocoaHelper;
using MonoDevelop.Ide.Tasks;
+using MonoDevelop.Ide;
+using Gdk;
namespace MonoDevelop.Components
-{
+{
public class EventBoxTooltip : IDisposable
{
EventBox eventBox;
- string tip;
- TooltipPopoverWindow tooltipWindow;
+ TooltipPopoverWindow tooltipWindow;
+ ImageView image;
+ Pixbuf normalPixbuf;
+ Pixbuf activePixbuf;
+ string tip;
bool mouseOver;
public Atk.Object Accessible {
get {
return eventBox.Accessible;
}
- }
-
+ }
+
/// <summary>
/// The EventBox should have Visible set to false otherwise the tooltip pop window
/// will have the wrong location.
@@ -52,15 +57,33 @@ namespace MonoDevelop.Components
public EventBoxTooltip (EventBox eventBox)
{
this.eventBox = eventBox;
+ eventBox.CanFocus = true;
eventBox.EnterNotifyEvent += HandleEnterNotifyEvent;
eventBox.LeaveNotifyEvent += HandleLeaveNotifyEvent;
eventBox.FocusInEvent += HandleFocusInEvent;
eventBox.FocusOutEvent += HandleFocusOutEvent;
+ image = eventBox.Child as ImageView;
+
+ if (image != null) {
+ normalPixbuf = image.Image.ToPixbuf ();
+ activePixbuf = normalPixbuf.ColorShiftPixbuf ();
+ }
+
+ eventBox.FocusGrabbed += (sender, e) => {
+ if (image != null)
+ image.Image = activePixbuf.ToXwtImage ();
+ };
+
+ eventBox.Focused += (o, args) => {
+ if (image != null)
+ image.Image = normalPixbuf.ToXwtImage ();
+ };
+
Position = PopupPosition.TopLeft;
- // Accessibility: Disguise this eventbox as a label
+ // Accessibility: Disguise this eventbox as a label
eventBox.Accessible.SetRole (AtkCocoa.Roles.AXStaticText);
eventBox.CanFocus = true;
}
@@ -89,7 +112,7 @@ namespace MonoDevelop.Components
[GLib.ConnectBefore]
void HandleFocusInEvent (object sender, EventArgs e)
{
- mouseOver = true;
+ mouseOver = true;
ShowTooltip ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
index e277d65b7c..2b7a3da97f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
@@ -39,6 +39,7 @@ using System.Threading.Tasks;
using System.Net;
using Xwt.Backends;
using Gtk;
+using Gdk;
namespace MonoDevelop.Ide
{
@@ -837,6 +838,41 @@ namespace MonoDevelop.Ide
image.Pixbuf = gravatar.Image.ToPixbuf ();
};
}
+
+ public static Pixbuf ColorShiftPixbuf (this Pixbuf src, byte shift = 120)
+ {
+ var dest = new Gdk.Pixbuf (src.Colorspace, src.HasAlpha, src.BitsPerSample, src.Width, src.Height);
+
+ unsafe
+ {
+
+ byte* src_pixels_orig = (byte*)src.Pixels;
+ byte* dest_pixels_orig = (byte*)dest.Pixels;
+
+ for (int i = 0; i < src.Height; i++) {
+ byte* src_pixels = src_pixels_orig + i * src.Rowstride;
+ byte* dest_pixels = dest_pixels_orig + i * dest.Rowstride;
+
+ for (int j = 0; j < src.Width; j++) {
+ *(dest_pixels++) = PixelClamp (*(src_pixels++) + shift);
+ *(dest_pixels++) = PixelClamp (*(src_pixels++) + shift);
+ *(dest_pixels++) = PixelClamp (*(src_pixels++) + shift);
+
+ if (src.HasAlpha) {
+ *(dest_pixels++) = *(src_pixels++);
+ }
+ }
+ }
+ }
+ return dest;
+ }
+
+ static byte PixelClamp (int val)
+ {
+ return (byte)System.Math.Max (0, System.Math.Min (255, val));
+ }
+
+
}
class CustomImageLoader : Xwt.Drawing.IImageLoader