From c763c808e3a96c6249260f74f504fa455eeb8e22 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Sat, 6 Jan 2018 23:12:37 -0500 Subject: [PATCH] Better processing of the default handler, still needs to chain to old containers for redraw --- Core.cs | 13 +++++++++---- Views/Dialog.cs | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Core.cs b/Core.cs index 2bbf06be0..1bc6c1ec6 100644 --- a/Core.cs +++ b/Core.cs @@ -787,6 +787,7 @@ namespace Terminal { public class Application { public static ConsoleDriver Driver = new CursesDriver (); public static Toplevel Top { get; private set; } + public static View Current { get; private set; } public static Mono.Terminal.MainLoop MainLoop { get; private set; } static Stack toplevels = new Stack (); @@ -852,6 +853,7 @@ namespace Terminal { MainLoop = new Mono.Terminal.MainLoop (); SynchronizationContext.SetSynchronizationContext (new MainLoopSyncContext (MainLoop)); Top = Toplevel.Create (); + Current = Top; focus = Top; } @@ -879,14 +881,14 @@ namespace Terminal { static void ProcessKeyEvent (KeyEvent ke) { - if (Top.ProcessHotKey (ke)) + if (Current.ProcessHotKey (ke)) return; - if (Top.ProcessKey (ke)) + if (Current.ProcessKey (ke)) return; // Process the key normally - if (Top.ProcessColdKey (ke)) + if (Current.ProcessColdKey (ke)) return; } @@ -899,6 +901,7 @@ namespace Terminal { Init (); toplevels.Push (toplevel); + Current = toplevel; Driver.PrepareToRun (MainLoop, ProcessKeyEvent); toplevel.LayoutSubviews (); toplevel.FocusFirst (); @@ -953,8 +956,10 @@ namespace Terminal { toplevels.Pop (); if (toplevels.Count == 0) Shutdown (); - else + else { + Current = toplevels.Peek (); Refresh (); + } } /// diff --git a/Views/Dialog.cs b/Views/Dialog.cs index 90a431ba2..47b9973e5 100644 --- a/Views/Dialog.cs +++ b/Views/Dialog.cs @@ -16,7 +16,7 @@ namespace Terminal { public class Dialog : Window { List