|
|
bdb79c |
From b7f6115b745de8cbc5214b6ede33c9a8558beb90 Mon Sep 17 00:00:00 2001
|
|
|
bdb79c |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
bdb79c |
Date: Tue, 25 Feb 2014 22:40:01 +0100
|
|
|
bdb79c |
Subject: MdeModulePkg: TerminalDxe: set xterm resolution on mode change (RH
|
|
|
bdb79c |
only)
|
|
|
bdb79c |
|
|
|
bdb79c |
The
|
|
|
bdb79c |
|
|
|
bdb79c |
CSI Ps ; Ps ; Ps t
|
|
|
bdb79c |
|
|
|
bdb79c |
escape sequence serves for window manipulation. We can use the
|
|
|
bdb79c |
|
|
|
bdb79c |
CSI 8 ; <rows> ; <columns> t
|
|
|
bdb79c |
|
|
|
bdb79c |
sequence to adapt eg. the xterm window size to the selected console mode.
|
|
|
bdb79c |
|
|
|
bdb79c |
Notes about the 20160608b-988715a -> 20170228-c325e41585e3 rebase:
|
|
|
bdb79c |
|
|
|
bdb79c |
- refresh commit 519b9751573e against various context changes
|
|
|
bdb79c |
|
|
|
bdb79c |
Notes about the 20170228-c325e41585e3 -> 20171011-92d07e48907f rebase:
|
|
|
bdb79c |
|
|
|
bdb79c |
- Refresh downstream-only commit 2909e025db68 against "MdeModulePkg.dec"
|
|
|
bdb79c |
context change from upstream commits e043f7895b83 ("MdeModulePkg: Add
|
|
|
bdb79c |
PCD PcdPteMemoryEncryptionAddressOrMask", 2017-02-27) and 76081dfcc5b2
|
|
|
bdb79c |
("MdeModulePkg: Add PROMPT&HELP string of pcd to UNI file", 2017-03-03).
|
|
|
bdb79c |
|
|
|
bdb79c |
Notes about the 20171011-92d07e48907f -> 20180508-ee3198e672e2 rebase:
|
|
|
bdb79c |
|
|
|
bdb79c |
- no change
|
|
|
bdb79c |
|
|
|
bdb79c |
Reference: <http://rtfm.etla.org/xterm/ctlseq.html>
|
|
|
bdb79c |
Contributed-under: TianoCore Contribution Agreement 1.0
|
|
|
bdb79c |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
bdb79c |
(cherry picked from commit 2909e025db6878723b49644a8a0cf160d07e6444)
|
|
|
bdb79c |
(cherry picked from commit b9c5c901f25e48d68eef6e78a4abca00e153f574)
|
|
|
bdb79c |
---
|
|
|
bdb79c |
MdeModulePkg/MdeModulePkg.dec | 4 +++
|
|
|
bdb79c |
.../Universal/Console/TerminalDxe/TerminalConOut.c | 30 ++++++++++++++++++++++
|
|
|
bdb79c |
.../Universal/Console/TerminalDxe/TerminalDxe.inf | 2 ++
|
|
|
bdb79c |
3 files changed, 36 insertions(+)
|
|
|
bdb79c |
|
|
|
bdb79c |
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
|
|
|
bdb79c |
index cc39718..384d901 100644
|
|
|
bdb79c |
--- a/MdeModulePkg/MdeModulePkg.dec
|
|
|
bdb79c |
+++ b/MdeModulePkg/MdeModulePkg.dec
|
|
|
bdb79c |
@@ -1914,6 +1914,10 @@
|
|
|
bdb79c |
# @Prompt The address mask when memory encryption is enabled.
|
|
|
bdb79c |
gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0|UINT64|0x30001047
|
|
|
bdb79c |
|
|
|
bdb79c |
+ ## Controls whether TerminalDxe outputs an XTerm resize sequence on terminal
|
|
|
bdb79c |
+ # mode change.
|
|
|
bdb79c |
+ gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE|BOOLEAN|0x00010080
|
|
|
bdb79c |
+
|
|
|
bdb79c |
[PcdsPatchableInModule]
|
|
|
bdb79c |
## Specify memory size with page number for PEI code when
|
|
|
bdb79c |
# Loading Module at Fixed Address feature is enabled.
|
|
|
bdb79c |
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
|
|
|
bdb79c |
index 5a83431..fbc1e0a 100644
|
|
|
bdb79c |
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
|
|
|
bdb79c |
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
|
|
|
bdb79c |
@@ -13,6 +13,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
bdb79c |
|
|
|
bdb79c |
**/
|
|
|
bdb79c |
|
|
|
bdb79c |
+#include <Library/PrintLib.h>
|
|
|
bdb79c |
+
|
|
|
bdb79c |
#include "Terminal.h"
|
|
|
bdb79c |
|
|
|
bdb79c |
//
|
|
|
bdb79c |
@@ -87,6 +89,16 @@ CHAR16 mCursorForwardString[] = { ESC, '[', '0', '0', 'C', 0 };
|
|
|
bdb79c |
CHAR16 mCursorBackwardString[] = { ESC, '[', '0', '0', 'D', 0 };
|
|
|
bdb79c |
|
|
|
bdb79c |
//
|
|
|
bdb79c |
+// Note that this is an ASCII format string, taking two INT32 arguments:
|
|
|
bdb79c |
+// rows, columns.
|
|
|
bdb79c |
+//
|
|
|
bdb79c |
+// A %d (INT32) format specification can expand to at most 11 characters.
|
|
|
bdb79c |
+//
|
|
|
bdb79c |
+CHAR8 mResizeTextAreaFormatString[] = "\x1B[8;%d;%dt";
|
|
|
bdb79c |
+#define RESIZE_SEQ_SIZE (sizeof mResizeTextAreaFormatString + 2 * (11 - 2))
|
|
|
bdb79c |
+
|
|
|
bdb79c |
+
|
|
|
bdb79c |
+//
|
|
|
bdb79c |
// Body of the ConOut functions
|
|
|
bdb79c |
//
|
|
|
bdb79c |
|
|
|
bdb79c |
@@ -508,6 +520,24 @@ TerminalConOutSetMode (
|
|
|
bdb79c |
return EFI_DEVICE_ERROR;
|
|
|
bdb79c |
}
|
|
|
bdb79c |
|
|
|
bdb79c |
+ if (PcdGetBool (PcdResizeXterm)) {
|
|
|
bdb79c |
+ CHAR16 ResizeSequence[RESIZE_SEQ_SIZE];
|
|
|
bdb79c |
+
|
|
|
bdb79c |
+ UnicodeSPrintAsciiFormat (
|
|
|
bdb79c |
+ ResizeSequence,
|
|
|
bdb79c |
+ sizeof ResizeSequence,
|
|
|
bdb79c |
+ mResizeTextAreaFormatString,
|
|
|
bdb79c |
+ (INT32) TerminalDevice->TerminalConsoleModeData[ModeNumber].Rows,
|
|
|
bdb79c |
+ (INT32) TerminalDevice->TerminalConsoleModeData[ModeNumber].Columns
|
|
|
bdb79c |
+ );
|
|
|
bdb79c |
+ TerminalDevice->OutputEscChar = TRUE;
|
|
|
bdb79c |
+ Status = This->OutputString (This, ResizeSequence);
|
|
|
bdb79c |
+ TerminalDevice->OutputEscChar = FALSE;
|
|
|
bdb79c |
+ if (EFI_ERROR (Status)) {
|
|
|
bdb79c |
+ return EFI_DEVICE_ERROR;
|
|
|
bdb79c |
+ }
|
|
|
bdb79c |
+ }
|
|
|
bdb79c |
+
|
|
|
bdb79c |
This->Mode->Mode = (INT32) ModeNumber;
|
|
|
bdb79c |
|
|
|
bdb79c |
Status = This->ClearScreen (This);
|
|
|
bdb79c |
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
|
|
bdb79c |
index 0780296..bd2ba82 100644
|
|
|
bdb79c |
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
|
|
bdb79c |
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
|
|
bdb79c |
@@ -60,6 +60,7 @@
|
|
|
bdb79c |
DebugLib
|
|
|
bdb79c |
PcdLib
|
|
|
bdb79c |
BaseLib
|
|
|
bdb79c |
+ PrintLib
|
|
|
bdb79c |
|
|
|
bdb79c |
[Guids]
|
|
|
bdb79c |
## SOMETIMES_PRODUCES ## Variable:L"ConInDev"
|
|
|
bdb79c |
@@ -88,6 +89,7 @@
|
|
|
bdb79c |
[Pcd]
|
|
|
bdb79c |
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType ## SOMETIMES_CONSUMES
|
|
|
bdb79c |
gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable ## CONSUMES
|
|
|
bdb79c |
+ gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm ## CONSUMES
|
|
|
bdb79c |
|
|
|
bdb79c |
# [Event]
|
|
|
bdb79c |
# # Relative timer event set by UnicodeToEfiKey(), used to be one 2 seconds input timeout.
|
|
|
bdb79c |
--
|
|
|
bdb79c |
1.8.3.1
|
|
|
bdb79c |
|