From 167e50bf7c4af84a6793326e39b0d3e41d4eb8bf Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Mon, 7 Sep 2015 09:08:12 +0200 Subject: [PATCH] Focus improvments: New function (checkHoverWidget) to check most inner control under the mouse, than bubble onMouseMove through the parents --- MonoDevelop.GOLib/src/GOLibGtkHost.cs | 9 +++++---- Tests/GOLIBTest_4.cs | 6 +++++- Tests/Interfaces/test4.goml | 5 +++-- Tests/Interfaces/testWindow.goml | 3 ++- src/GraphicObjects/GraphicObject.cs | 23 +++++++++++++---------- src/GraphicObjects/Group.cs | 16 ++++++++-------- src/GraphicObjects/PrivateContainer.cs | 8 +++----- src/GraphicObjects/Scroller.cs | 4 ++-- src/OpenTKGameWindow.cs | 8 ++++---- 9 files changed, 45 insertions(+), 37 deletions(-) diff --git a/MonoDevelop.GOLib/src/GOLibGtkHost.cs b/MonoDevelop.GOLib/src/GOLibGtkHost.cs index 03c96220..c8dcecda 100644 --- a/MonoDevelop.GOLib/src/GOLibGtkHost.cs +++ b/MonoDevelop.GOLib/src/GOLibGtkHost.cs @@ -309,13 +309,13 @@ namespace MonoDevelop.GOLib { if (_activeWidget != null) { //send move evt even if mouse move outside bounds - _activeWidget.onMouseMove (this, e); + _activeWidget.checkHoverWidget (e); return; } if (_hoverWidget != null) { if (_hoverWidget.MouseIsIn (e.Position)) { - _hoverWidget.onMouseMove (this, e); + _hoverWidget.checkHoverWidget (e); return; } else { _hoverWidget.onMouseLeave (this, e); @@ -323,7 +323,7 @@ namespace MonoDevelop.GOLib while (_hoverWidget.Parent as GraphicObject!=null) { _hoverWidget = _hoverWidget.Parent as GraphicObject; if (_hoverWidget.MouseIsIn (e.Position)) { - _hoverWidget.onMouseMove (this, e); + _hoverWidget.checkHoverWidget (e); return; } else _hoverWidget.onMouseLeave (this, e); @@ -335,12 +335,13 @@ namespace MonoDevelop.GOLib for (int i = 0; i < GraphicObjects.Count; i++) { GraphicObject g = GraphicObjects[i]; if (g.MouseIsIn (e.Position)) { - g.onMouseMove (this, e); + g.checkHoverWidget (e); PutOnTop (g); return; } } _hoverWidget = null; + MouseMove.Raise (this, e); } void Mouse_ButtonUp(object sender, MouseButtonEventArgs e) { diff --git a/Tests/GOLIBTest_4.cs b/Tests/GOLIBTest_4.cs index 24cffc98..8b1c7cd2 100644 --- a/Tests/GOLIBTest_4.cs +++ b/Tests/GOLIBTest_4.cs @@ -13,6 +13,7 @@ using System.Diagnostics; using go; using System.Threading; using System.Collections.Generic; +using System.IO; namespace test @@ -82,6 +83,9 @@ namespace test { base.OnLoad (e); + this.Cursor = XCursor.NE; + + LoadInterface("Interfaces/test4.goml", out c); //LoadInterface("golibtests/test4.xml", out c2); //c2.HorizontalAlignment = HorizontalAlignment.Left; @@ -142,7 +146,7 @@ namespace test } void pFps_mousemove(object sender, MouseMoveEventArgs e) { - if (!e.Mouse.IsButtonDown (MouseButton.Left)) + if (!e.Mouse.IsButtonDown (MouseButton.Left)||sender!=c) return; redrawClip.AddRectangle (c.ScreenCoordinates(c.Slot)); c.Left += e.XDelta; diff --git a/Tests/Interfaces/test4.goml b/Tests/Interfaces/test4.goml index 0cdc2545..02dadec8 100755 --- a/Tests/Interfaces/test4.goml +++ b/Tests/Interfaces/test4.goml @@ -1,9 +1,10 @@  - - + diff --git a/Tests/Interfaces/testWindow.goml b/Tests/Interfaces/testWindow.goml index 68759d9e..32c64401 100755 --- a/Tests/Interfaces/testWindow.goml +++ b/Tests/Interfaces/testWindow.goml @@ -1,6 +1,7 @@  - +