fixed OnMouseClick logic

This commit is contained in:
Tig
2024-04-01 09:19:03 -06:00
parent b980f07688
commit ca7b8bb0ee
3 changed files with 19 additions and 3 deletions

View File

@@ -120,7 +120,7 @@ public partial class View
|| mouseEvent.Flags.HasFlag (MouseFlags.Button3Clicked)
|| mouseEvent.Flags.HasFlag (MouseFlags.Button4Clicked))
{
return OnMouseClick (args);
OnMouseClick (args);
}
if (mouseEvent.Flags.HasFlag (MouseFlags.Button1DoubleClicked)
@@ -128,10 +128,13 @@ public partial class View
|| mouseEvent.Flags.HasFlag (MouseFlags.Button3DoubleClicked)
|| mouseEvent.Flags.HasFlag (MouseFlags.Button4DoubleClicked))
{
return OnMouseClick (args);
OnMouseClick (args);
}
MouseEvent?.Invoke (this, args);
if (args.Handled != true)
{
MouseEvent?.Invoke (this, args);
}
return args.Handled == true;
}
@@ -147,6 +150,7 @@ public partial class View
{
if (!Enabled)
{
args.Handled = true;
return true;
}
@@ -158,6 +162,7 @@ public partial class View
if (!HasFocus && CanFocus)
{
args.Handled = true;
SetFocus ();
}

View File

@@ -67,6 +67,16 @@ public class Button : View
private void Button_MouseEvent (object sender, MouseEventEventArgs e)
{
if (e.MouseEvent.Flags.HasFlag(MouseFlags.Button1Clicked))
{
if (Application.MouseGrabView != this)
{
e.Handled = InvokeCommand (Command.HotKey) == true;
return;
}
}
if (e.MouseEvent.Flags == MouseFlags.Button1Pressed)
{
if (Application.MouseGrabView == this)

View File

@@ -74,6 +74,7 @@ public class AutoInitShutdownAttribute : BeforeAfterTestAttribute
if (AutoInit)
{
// TODO: This Dispose call is here until all unit tests that don't correctly dispose Toplevel's they create are fixed.
Application.Top?.Dispose ();
Application.Shutdown ();
#if DEBUG_IDISPOSABLE