diff --git a/Gtk/Perspex.Gtk/PopupImpl.cs b/Gtk/Perspex.Gtk/PopupImpl.cs index a582458c87..50c147cbd3 100644 --- a/Gtk/Perspex.Gtk/PopupImpl.cs +++ b/Gtk/Perspex.Gtk/PopupImpl.cs @@ -14,13 +14,9 @@ namespace Perspex.Gtk { public PopupImpl() : base(WindowType.Popup) - { - this.DefaultSize = new Gdk.Size(640, 480); - this.Events = Gdk.EventMask.PointerMotionMask | - Gdk.EventMask.ButtonPressMask | - Gdk.EventMask.ButtonReleaseMask; + { } - + public void SetPosition(Point p) { this.Move((int)p.X, (int)p.Y); diff --git a/Gtk/Perspex.Gtk/WindowImpl.cs b/Gtk/Perspex.Gtk/WindowImpl.cs index 6d67d248cc..c5c3422701 100644 --- a/Gtk/Perspex.Gtk/WindowImpl.cs +++ b/Gtk/Perspex.Gtk/WindowImpl.cs @@ -35,13 +35,12 @@ namespace Perspex.Gtk public WindowImpl(Gtk.WindowType type) : base(type) { - this.DefaultSize = new Gdk.Size(640, 480); this.Events = Gdk.EventMask.PointerMotionMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask; this.windowHandle = new PlatformHandle(this.Handle, "GtkWindow"); } - + public Size ClientSize { get; @@ -79,8 +78,10 @@ namespace Perspex.Gtk public Point PointToScreen(Point point) { - // TODO: Implement. - return new Point(); + int x, y; + this.GdkWindow.GetDeskrelativeOrigin(out x, out y); + + return new Point(point.X + x, point.Y + y); } public void SetOwner(TopLevel owner) diff --git a/Perspex.Controls/ToolTip.cs b/Perspex.Controls/ToolTip.cs index 3dccb0a974..7cc596c782 100644 --- a/Perspex.Controls/ToolTip.cs +++ b/Perspex.Controls/ToolTip.cs @@ -116,8 +116,8 @@ namespace Perspex.Controls ((ISetLogicalParent)popup).SetParent(control); } - var cp = MouseDevice.Instance.GetPosition(control); - var position = control.PointToScreen(cp) + new Vector(0, 22); + var cp = MouseDevice.Instance?.GetPosition(control); + var position = control.PointToScreen(cp.HasValue ? cp.Value : new Point(0, 0)) + new Vector(0, 22); ((ToolTip)popup.Content).Content = GetTip(control); popup.SetPosition(position);