Fixes #3333. Application.UnGrabbedMouse event doesn't allow grab another view after exit.

This commit is contained in:
BDisp
2024-03-17 20:06:03 +00:00
parent f9332fd8d5
commit 0120a3648f
4 changed files with 62 additions and 39 deletions

View File

@@ -316,8 +316,9 @@ public class MouseTests
View grabView = null;
var count = 0;
var view1 = new View ();
var view2 = new View ();
var view1 = new View { Id = "view1" };
var view2 = new View { Id = "view2" };
var view3 = new View { Id = "view3" };
Application.GrabbedMouse += Application_GrabbedMouse;
Application.UnGrabbedMouse += Application_UnGrabbedMouse;
@@ -343,6 +344,8 @@ public class MouseTests
Application.UngrabMouse ();
Assert.Equal (2, count);
Assert.Equal (grabView, view2);
Assert.Equal (view3, Application.MouseGrabView);
Application.UngrabMouse ();
Assert.Null (Application.MouseGrabView);
void Application_GrabbedMouse (object sender, ViewEventArgs e)
@@ -376,6 +379,12 @@ public class MouseTests
count++;
if (count > 1)
{
// It's possible to grab another view after the previous was ungrabbed
Application.GrabMouse (view3);
}
Application.UnGrabbedMouse -= Application_UnGrabbedMouse;
}
}