Browse Source

Added F11 and F12 keys #220. Changed keyDownHandler to before keyHandler.

BDisp 5 years ago
parent
commit
f7e9ccc766

+ 2 - 0
Terminal.Gui/Drivers/CursesDriver.cs

@@ -136,6 +136,8 @@ namespace Terminal.Gui {
 			case Curses.KeyF8: return Key.F8;
 			case Curses.KeyF9: return Key.F9;
 			case Curses.KeyF10: return Key.F10;
+			case Curses.KeyF11: return Key.F11;
+			case Curses.KeyF12: return Key.F12;
 			case Curses.KeyUp: return Key.CursorUp;
 			case Curses.KeyDown: return Key.CursorDown;
 			case Curses.KeyLeft: return Key.CursorLeft;

+ 2 - 2
Terminal.Gui/Drivers/WindowsDriver.cs

@@ -685,8 +685,8 @@ namespace Terminal.Gui {
 				} else {
 					if (inputEvent.KeyEvent.bKeyDown) {
 						// Key Down - Fire KeyDown Event and KeyStroke (ProcessKey) Event
-						keyHandler (new KeyEvent (map));
 						keyDownHandler (new KeyEvent (map));
+						keyHandler (new KeyEvent (map));
 					} else {
 						keyUpHandler (new KeyEvent (map));
 					}
@@ -1016,7 +1016,7 @@ namespace Terminal.Gui {
 
 				return (Key)((uint)keyInfo.KeyChar);
 			}
-			if (key >= ConsoleKey.F1 && key <= ConsoleKey.F10) {
+			if (key >= ConsoleKey.F1 && key <= ConsoleKey.F12) {
 				var delta = key - ConsoleKey.F1;
 
 				return (Key)((int)Key.F1 + delta);

+ 8 - 0
Terminal.Gui/Event.cs

@@ -272,6 +272,14 @@ namespace Terminal.Gui {
 		/// </summary>
 		F10,
 		/// <summary>
+		/// F11 key.
+		/// </summary>
+		F11,
+		/// <summary>
+		/// F12 key.
+		/// </summary>
+		F12,
+		/// <summary>
 		/// The key code for the user pressing the tab key (forwards tab key).
 		/// </summary>
 		Tab,

+ 2 - 0
Terminal.Gui/MonoCurses/constants.cs

@@ -112,6 +112,8 @@ namespace Unix.Terminal {
 		public const int KeyF8 = unchecked((int)0x110);
 		public const int KeyF9 = unchecked((int)0x111);
 		public const int KeyF10 = unchecked((int)0x112);
+		public const int KeyF11 = unchecked((int)0x113);
+		public const int KeyF12 = unchecked((int)0x114);
 		public const int KeyResize = unchecked((int)0x19a);
 		public const int ShiftKeyUp = unchecked((int)0x151);
 		public const int ShiftKeyDown = unchecked((int)0x150);