[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 3/9] chardev: add qemu_chr_resize()
From: |
Szymon Lukasz |
Subject: |
[PATCH v3 3/9] chardev: add qemu_chr_resize() |
Date: |
Mon, 29 Jun 2020 18:40:35 +0200 |
This function should be called whenever we learn about a new size of
the terminal connected to a chardev.
Signed-off-by: Szymon Lukasz <noh4hss@gmail.com>
---
chardev/char.c | 11 +++++++++++
include/chardev/char.h | 2 ++
2 files changed, 13 insertions(+)
diff --git a/chardev/char.c b/chardev/char.c
index 904f8bf6e3..1dc22aca95 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -354,6 +354,17 @@ int qemu_chr_wait_connected(Chardev *chr, Error **errp)
return 0;
}
+void qemu_chr_resize(Chardev *chr, uint16_t cols, uint16_t rows)
+{
+ if (cols != chr->cols || rows != chr->rows) {
+ chr->cols = cols;
+ chr->rows = rows;
+ if (chr->be_open) {
+ qemu_chr_be_event(chr, CHR_EVENT_RESIZE);
+ }
+ }
+}
+
QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename,
bool permit_mux_mon)
{
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 42203e9fa4..01099121f1 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -230,6 +230,8 @@ int qemu_chr_write(Chardev *s, const uint8_t *buf, int len,
bool write_all);
#define qemu_chr_write_all(s, buf, len) qemu_chr_write(s, buf, len, true)
int qemu_chr_wait_connected(Chardev *chr, Error **errp);
+void qemu_chr_resize(Chardev *chr, uint16_t cols, uint16_t rows);
+
#define TYPE_CHARDEV "chardev"
#define CHARDEV(obj) OBJECT_CHECK(Chardev, (obj), TYPE_CHARDEV)
#define CHARDEV_CLASS(klass) \
--
2.27.0
- [PATCH v3 0/9] virtio-console: notify about the terminal size, Szymon Lukasz, 2020/06/29
- [PATCH v3 2/9] chardev: add CHR_EVENT_RESIZE, Szymon Lukasz, 2020/06/29
- [PATCH v3 1/9] chardev: add cols, rows fields, Szymon Lukasz, 2020/06/29
- [PATCH v3 3/9] chardev: add qemu_chr_resize(),
Szymon Lukasz <=
- [PATCH v3 4/9] char-mux: add support for the terminal size, Szymon Lukasz, 2020/06/29
- [PATCH v3 7/9] qmp: add chardev-resize command, Szymon Lukasz, 2020/06/29
- [PATCH v3 5/9] main-loop: change the handling of SIGWINCH, Szymon Lukasz, 2020/06/29
- [PATCH v3 6/9] char-stdio: add support for the terminal size, Szymon Lukasz, 2020/06/29
- [PATCH v3 8/9] virtio-serial-bus: add terminal resize messages, Szymon Lukasz, 2020/06/29
- [PATCH v3 9/9] virtio-console: notify the guest about terminal resizes, Szymon Lukasz, 2020/06/29