Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal view is always refreshing only by moving the mouse. #2954

Closed
BDisp opened this issue Nov 4, 2023 · 0 comments
Closed

Modal view is always refreshing only by moving the mouse. #2954

BDisp opened this issue Nov 4, 2023 · 0 comments
Labels
bug v2 For discussions, issues, etc... relavant for v2

Comments

@BDisp
Copy link
Collaborator

BDisp commented Nov 4, 2023

This code really decrease the performance a lot because will force always a refresh even if NeedsDisplay, SubViewNeedsDisplay or LayoutNeeded are false.

} else if (Current.SuperView == null && Current?.Modal == true) {
Refresh ();
}

The follow test will fail:

	[Fact]
	public void Run_Toplevel_With_Modal_View_Does_Not_Refresh_If_Not_Dirty ()
	{
		Init ();
		var count = 0;
		Dialog d = null;
		var top = Application.Top;
		top.DrawContent += (s, a) => count++;
		var iteration = -1;
		Application.Iteration += (s, a) => {
			iteration++;
			if (iteration == 0) {
				d = new Dialog ();
				d.DrawContent += (s, a) => count++;
				Application.Run (d);
			} else if (iteration < 3) {
				Application.OnMouseEvent (new (new () { X = 0, Y = 0, Flags = MouseFlags.ReportMousePosition }));
				Assert.False (top.NeedsDisplay);
				Assert.False (top.SubViewNeedsDisplay);
				Assert.False (top.LayoutNeeded);
				Assert.False (d.NeedsDisplay);
				Assert.False (d.SubViewNeedsDisplay);
				Assert.False (d.LayoutNeeded);
			} else {
				Application.RequestStop ();
			}
		};
		Application.Run ();
		Application.Shutdown ();
		// 1 - First top load, 1 - Dialog load, 1 - Dialog unload, Total - 3.
		Assert.Equal(3, count);
	}
BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Nov 5, 2023
@tig tig added bug v2 For discussions, issues, etc... relavant for v2 labels Nov 6, 2023
tig pushed a commit that referenced this issue Nov 7, 2023
#2958)

* Fixes #2954. Modal view is always refreshing only by moving the mouse.

* Fixes invisible topLevel to be cleaned up which should be a drawing task.

* Forcing Shutdown.
@tig tig closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v2 For discussions, issues, etc... relavant for v2
Projects
None yet
Development

No branches or pull requests

2 participants