From: Jean-Philippe Bruyère Date: Sat, 10 Apr 2021 00:13:37 +0000 (+0200) Subject: DebugLogAnalyzer StickyMouse bug X-Git-Tag: v0.9.5-beta~31 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=ba4e19bd5a09ac02a81db47f804af11ef2821014;p=jp%2Fcrow.git DebugLogAnalyzer StickyMouse bug --- diff --git a/Crow/src/Interface.cs b/Crow/src/Interface.cs index 38a0764f..cd82dee6 100644 --- a/Crow/src/Interface.cs +++ b/Crow/src/Interface.cs @@ -1365,7 +1365,9 @@ namespace Crow HoverWidget = value; } } - + public virtual void ForceMousePosition () { + Glfw3.SetCursorPosition (hWin, MousePosition.X, MousePosition.Y); + } /// Processes mouse move events from the root container, this function /// should be called by the host on mouse move event to forward events to crow interfaces @@ -1386,7 +1388,7 @@ namespace Crow stickedWidget = null; stickyMouseDelta = default; } else { - Glfw3.SetCursorPosition (hWin, MousePosition.X, MousePosition.Y); + ForceMousePosition (); DbgLogger.EndEvent (DbgEvtType.MouseMove); return true; } diff --git a/Samples/DebugLogAnalyzer/src/DebugInterface.cs b/Samples/DebugLogAnalyzer/src/DebugInterface.cs index 8300abb2..26a1eddf 100644 --- a/Samples/DebugLogAnalyzer/src/DebugInterface.cs +++ b/Samples/DebugLogAnalyzer/src/DebugInterface.cs @@ -32,6 +32,7 @@ namespace Crow string source; Action delRegisterForRepaint;//call RegisterForRepaint in the container widget (DebugInterfaceWidget) Action delSetCurrentException; + Func delGetScreenCoordinate; void interfaceThread () { while (!Terminate) { @@ -68,6 +69,7 @@ namespace Crow Type t = w.GetType(); delRegisterForRepaint = (Action)Delegate.CreateDelegate(typeof(Action), w, t.GetMethod("RegisterForRepaint")); delSetCurrentException = (Action)Delegate.CreateDelegate(typeof(Action), w, t.GetProperty("CurrentException").GetSetMethod()); + delGetScreenCoordinate = (Func)Delegate.CreateDelegate(typeof(Func), w, t.GetMethod("GetScreenCoordinates")); } public void ResetDirtyState () { IsDirty = false; @@ -109,6 +111,11 @@ namespace Crow g.RegisterForLayouting (LayoutingType.All); RegisterClip (clientRectangle); } - } + } + public override void ForceMousePosition() + { + Point p = (Point)delGetScreenCoordinate(); + Glfw.Glfw3.SetCursorPosition (WindowHandle, p.X + MousePosition.X, p.Y + MousePosition.Y); + } } } \ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs index ee30d5ed..5432b05e 100644 --- a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs +++ b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs @@ -140,16 +140,19 @@ namespace Crow public bool CrowDebuggerOK => initialized; public bool CrowDebuggerNOK => !initialized; - void notifyCrowDebuggerState () { + public string CrowDebuggerErrorMessage = ""; + void notifyCrowDebuggerState (string errorMsg = null) { NotifyValueChanged("CrowDebuggerOK", CrowDebuggerOK); NotifyValueChanged("CrowDebuggerNOK", CrowDebuggerNOK); + CrowDebuggerErrorMessage = errorMsg; + NotifyValueChanged("CrowDebuggerErrorMessage", CrowDebuggerErrorMessage); } void tryStartDebugInterface () { if (initialized) return; if (!File.Exists (crowDbgAssemblyLocation)) { - notifyCrowDebuggerState(); + notifyCrowDebuggerState($"Crow.dll for debugging file not found"); return; } @@ -161,7 +164,7 @@ namespace Crow Type debuggerType = crowAssembly.GetType("Crow.DbgLogger"); if (!(bool)debuggerType.GetField("IsEnabled").GetValue(null)) { - notifyCrowDebuggerState(); + notifyCrowDebuggerState("Crow.dll must be compiled with CrowDebugLogEnabled='True'"); return; } @@ -201,6 +204,7 @@ namespace Crow dbgIfaceType.GetMethod("Run").Invoke (dbgIFace, null); initialized = true; + notifyCrowDebuggerState(); //Console.WriteLine($"DbgIFace: LoadCtx:{AssemblyLoadContext.GetLoadContext (dbgIFace.GetType().Assembly).Name})"); //} @@ -298,5 +302,7 @@ namespace Crow dla.Events = events; } } + + public virtual object GetScreenCoordinates () => ScreenCoordinates(Slot).TopLeft; } } \ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/src/Extensions.cs b/Samples/DebugLogAnalyzer/src/Extensions.cs index 6086384c..58047aaa 100644 --- a/Samples/DebugLogAnalyzer/src/Extensions.cs +++ b/Samples/DebugLogAnalyzer/src/Extensions.cs @@ -7,7 +7,8 @@ namespace DebugLogAnalyzer { public static CommandGroup GetCommands (this System.IO.DirectoryInfo di) => new CommandGroup( - new Command ("Set as root", ()=> {Program.CurrentProgramInstance.CurrentDir = di.FullName;})); + new Command ("Set as root", ()=> {Program.CurrentProgramInstance.CurrentDir = di.FullName;}) + ); public static CommandGroup GetCommands (this System.IO.FileInfo fi) => new CommandGroup( new Command ("Delete", (sender0) => { diff --git a/Samples/DebugLogAnalyzer/ui/main.crow b/Samples/DebugLogAnalyzer/ui/main.crow index 24a50a2f..913220db 100644 --- a/Samples/DebugLogAnalyzer/ui/main.crow +++ b/Samples/DebugLogAnalyzer/ui/main.crow @@ -67,7 +67,9 @@ - + +