mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
This commit is contained in:
@@ -531,7 +531,7 @@ namespace Terminal.Gui {
|
||||
return;
|
||||
}
|
||||
|
||||
var chain = toplevels.ToList ();
|
||||
var chain = toplevels.Where (t => t.Visible).ToList ();
|
||||
foreach (var topLevel in chain) {
|
||||
if (topLevel.ProcessHotKey (ke)) {
|
||||
EnsuresMdiTopOnFrontIfMdiTopMostFocused ();
|
||||
|
||||
@@ -692,5 +692,48 @@ namespace Terminal.Gui.TopLevelTests {
|
||||
|
||||
Assert.Empty (Application.MdiChildes);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
public void MdiChild_Set_Visible_False_Does_Not_Process_Keys ()
|
||||
{
|
||||
var count = 0;
|
||||
var mdi = new Mdi ();
|
||||
var button = new Button ();
|
||||
button.Clicked += () => count++;
|
||||
var child = new Window ();
|
||||
child.Add (button);
|
||||
var iterations = -1;
|
||||
Application.Iteration += () => {
|
||||
iterations++;
|
||||
if (iterations == 0) {
|
||||
Application.Run (child);
|
||||
} else if (iterations == 1) {
|
||||
Assert.Equal (child, Application.Current);
|
||||
ReflectionTools.InvokePrivate (
|
||||
typeof (Application),
|
||||
"ProcessKeyEvent",
|
||||
new KeyEvent (Key.Enter, new KeyModifiers ()));
|
||||
} else if (iterations == 2) {
|
||||
Assert.Equal (child, Application.Current);
|
||||
Assert.True (child.Visible);
|
||||
child.Visible = false;
|
||||
} else if (iterations == 3) {
|
||||
Assert.Equal (mdi, Application.Current);
|
||||
ReflectionTools.InvokePrivate (
|
||||
typeof (Application),
|
||||
"ProcessKeyEvent",
|
||||
new KeyEvent (Key.Enter, new KeyModifiers ()));
|
||||
} else if (iterations == 4) {
|
||||
ReflectionTools.InvokePrivate (
|
||||
typeof (Application),
|
||||
"ProcessKeyEvent",
|
||||
new KeyEvent (Application.QuitKey, new KeyModifiers ()));
|
||||
}
|
||||
};
|
||||
Application.Run (mdi);
|
||||
Assert.Equal (4, iterations);
|
||||
Assert.Equal (1, count);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user