2020-09-16 14:25:00 +00:00
|
|
|
From 50b53194f7caea602e04df663358617c280f299c Mon Sep 17 00:00:00 2001
|
2017-11-14 15:05:26 +00:00
|
|
|
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
|
Date: Tue, 25 Feb 2014 22:40:01 +0100
|
2018-08-31 17:06:06 +00:00
|
|
|
Subject: [PATCH] MdeModulePkg: TerminalDxe: set xterm resolution on mode
|
2018-05-29 21:06:35 +00:00
|
|
|
change (RH only)
|
2017-11-14 15:05:26 +00:00
|
|
|
|
|
|
|
The
|
|
|
|
|
|
|
|
CSI Ps ; Ps ; Ps t
|
|
|
|
|
|
|
|
escape sequence serves for window manipulation. We can use the
|
|
|
|
|
|
|
|
CSI 8 ; <rows> ; <columns> t
|
|
|
|
|
|
|
|
sequence to adapt eg. the xterm window size to the selected console mode.
|
|
|
|
|
|
|
|
Notes about the 20160608b-988715a -> 20170228-c325e41585e3 rebase:
|
|
|
|
|
|
|
|
- refresh commit 519b9751573e against various context changes
|
|
|
|
|
|
|
|
Notes about the 20170228-c325e41585e3 -> 20171011-92d07e48907f rebase:
|
|
|
|
|
|
|
|
- Refresh downstream-only commit 2909e025db68 against "MdeModulePkg.dec"
|
|
|
|
context change from upstream commits e043f7895b83 ("MdeModulePkg: Add
|
|
|
|
PCD PcdPteMemoryEncryptionAddressOrMask", 2017-02-27) and 76081dfcc5b2
|
|
|
|
("MdeModulePkg: Add PROMPT&HELP string of pcd to UNI file", 2017-03-03).
|
|
|
|
|
|
|
|
Reference: <http://rtfm.etla.org/xterm/ctlseq.html>
|
|
|
|
Contributed-under: TianoCore Contribution Agreement 1.0
|
|
|
|
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
|
(cherry picked from commit 2909e025db6878723b49644a8a0cf160d07e6444)
|
2018-05-29 21:06:35 +00:00
|
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
2017-11-14 15:05:26 +00:00
|
|
|
---
|
2018-05-29 21:06:35 +00:00
|
|
|
MdeModulePkg/MdeModulePkg.dec | 4 +++
|
|
|
|
.../Console/TerminalDxe/TerminalConOut.c | 30 +++++++++++++++++++
|
|
|
|
.../Console/TerminalDxe/TerminalDxe.inf | 2 ++
|
2017-11-14 15:05:26 +00:00
|
|
|
3 files changed, 36 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
|
2020-09-16 14:25:00 +00:00
|
|
|
index cb30a79758..e562bed57e 100644
|
2017-11-14 15:05:26 +00:00
|
|
|
--- a/MdeModulePkg/MdeModulePkg.dec
|
|
|
|
+++ b/MdeModulePkg/MdeModulePkg.dec
|
2020-09-16 14:25:00 +00:00
|
|
|
@@ -2013,6 +2013,10 @@
|
|
|
|
# @Prompt Enable StatusCode via memory.
|
|
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|FALSE|BOOLEAN|0x00010023
|
2017-11-14 15:05:26 +00:00
|
|
|
|
|
|
|
+ ## Controls whether TerminalDxe outputs an XTerm resize sequence on terminal
|
|
|
|
+ # mode change.
|
|
|
|
+ gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE|BOOLEAN|0x00010080
|
|
|
|
+
|
|
|
|
[PcdsPatchableInModule]
|
|
|
|
## Specify memory size with page number for PEI code when
|
|
|
|
# Loading Module at Fixed Address feature is enabled.
|
|
|
|
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
|
2020-04-13 22:29:55 +00:00
|
|
|
index aae470e956..26156857aa 100644
|
2017-11-14 15:05:26 +00:00
|
|
|
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
|
|
|
|
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
|
2019-07-11 23:42:10 +00:00
|
|
|
@@ -7,6 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
2017-11-14 15:05:26 +00:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
+#include <Library/PrintLib.h>
|
|
|
|
+
|
|
|
|
#include "Terminal.h"
|
|
|
|
|
|
|
|
//
|
2019-07-11 23:42:10 +00:00
|
|
|
@@ -80,6 +82,16 @@ CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0
|
2018-05-29 21:06:35 +00:00
|
|
|
CHAR16 mCursorForwardString[] = { ESC, '[', '0', '0', 'C', 0 };
|
2017-11-14 15:05:26 +00:00
|
|
|
CHAR16 mCursorBackwardString[] = { ESC, '[', '0', '0', 'D', 0 };
|
|
|
|
|
2018-05-29 21:06:35 +00:00
|
|
|
+//
|
2017-11-14 15:05:26 +00:00
|
|
|
+// Note that this is an ASCII format string, taking two INT32 arguments:
|
|
|
|
+// rows, columns.
|
|
|
|
+//
|
|
|
|
+// A %d (INT32) format specification can expand to at most 11 characters.
|
|
|
|
+//
|
|
|
|
+CHAR8 mResizeTextAreaFormatString[] = "\x1B[8;%d;%dt";
|
|
|
|
+#define RESIZE_SEQ_SIZE (sizeof mResizeTextAreaFormatString + 2 * (11 - 2))
|
|
|
|
+
|
|
|
|
+
|
2018-05-29 21:06:35 +00:00
|
|
|
//
|
2017-11-14 15:05:26 +00:00
|
|
|
// Body of the ConOut functions
|
|
|
|
//
|
2020-04-13 22:29:55 +00:00
|
|
|
@@ -506,6 +518,24 @@ TerminalConOutSetMode (
|
2017-11-14 15:05:26 +00:00
|
|
|
return EFI_DEVICE_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (PcdGetBool (PcdResizeXterm)) {
|
|
|
|
+ CHAR16 ResizeSequence[RESIZE_SEQ_SIZE];
|
|
|
|
+
|
|
|
|
+ UnicodeSPrintAsciiFormat (
|
|
|
|
+ ResizeSequence,
|
|
|
|
+ sizeof ResizeSequence,
|
|
|
|
+ mResizeTextAreaFormatString,
|
|
|
|
+ (INT32) TerminalDevice->TerminalConsoleModeData[ModeNumber].Rows,
|
|
|
|
+ (INT32) TerminalDevice->TerminalConsoleModeData[ModeNumber].Columns
|
|
|
|
+ );
|
|
|
|
+ TerminalDevice->OutputEscChar = TRUE;
|
|
|
|
+ Status = This->OutputString (This, ResizeSequence);
|
|
|
|
+ TerminalDevice->OutputEscChar = FALSE;
|
|
|
|
+ if (EFI_ERROR (Status)) {
|
|
|
|
+ return EFI_DEVICE_ERROR;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
This->Mode->Mode = (INT32) ModeNumber;
|
|
|
|
|
|
|
|
Status = This->ClearScreen (This);
|
|
|
|
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
2020-04-13 22:29:55 +00:00
|
|
|
index b2a8aeba85..eff6253465 100644
|
2017-11-14 15:05:26 +00:00
|
|
|
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
|
|
|
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
2019-07-11 23:42:10 +00:00
|
|
|
@@ -55,6 +55,7 @@
|
2017-11-14 15:05:26 +00:00
|
|
|
DebugLib
|
|
|
|
PcdLib
|
|
|
|
BaseLib
|
|
|
|
+ PrintLib
|
|
|
|
|
|
|
|
[Guids]
|
|
|
|
## SOMETIMES_PRODUCES ## Variable:L"ConInDev"
|
2020-04-13 22:29:55 +00:00
|
|
|
@@ -87,6 +88,7 @@
|
2017-11-14 15:05:26 +00:00
|
|
|
[Pcd]
|
|
|
|
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType ## SOMETIMES_CONSUMES
|
|
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable ## CONSUMES
|
|
|
|
+ gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm ## CONSUMES
|
|
|
|
|
|
|
|
# [Event]
|
|
|
|
# # Relative timer event set by UnicodeToEfiKey(), used to be one 2 seconds input timeout.
|