[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 2/8] ui/gtk: vte: fix sending multiple characeters
From: |
Gerd Hoffmann |
Subject: |
[PULL 2/8] ui/gtk: vte: fix sending multiple characeters |
Date: |
Thu, 4 Mar 2021 09:36:59 +0100 |
From: Zack Marvel <zpmarvel@gmail.com>
When using the GTK UI with libvte, multicharacter keystrokes are not
sent correctly (such as arrow keys). gd_vc_in should check the
CharBackend's can_receive instead of assuming multiple characters can be
received. This is not an issue for e.g. the SDL UI because
qemu_chr_be_write is called with len=1 for each character (SDL sends
more than once keystroke).
Modify gd_vc_in to call qemu_chr_be_write multiple times if necessary.
Buglink: https://bugs.launchpad.net/qemu/+bug/1407808
Signed-off-by: Zack Marvel <zpmarvel@gmail.com>
Message-Id: <20210221170613.13183-2-zpmarvel@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 79dc2401203a..bad716f136ea 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1786,7 +1786,16 @@ static gboolean gd_vc_in(VteTerminal *terminal, gchar
*text, guint size,
}
}
- qemu_chr_be_write(vc->vte.chr, (uint8_t *)text, (unsigned int)size);
+ int remaining = size;
+ uint8_t* p = (uint8_t *)text;
+ while (remaining > 0) {
+ int can_write = qemu_chr_be_can_write(vc->vte.chr);
+ int written = MIN(remaining, can_write);
+ qemu_chr_be_write(vc->vte.chr, p, written);
+
+ remaining -= written;
+ p += written;
+ }
return TRUE;
}
--
2.29.2
- [PULL 0/8] Ui 20210304 patches, Gerd Hoffmann, 2021/03/04
- [PULL 1/8] ui/cocoa: Remove the uses of full screen APIs, Gerd Hoffmann, 2021/03/04
- [PULL 2/8] ui/gtk: vte: fix sending multiple characeters,
Gerd Hoffmann <=
- [PULL 6/8] ui/console: Add placeholder flag to message surface, Gerd Hoffmann, 2021/03/04
- [PULL 3/8] ui/cocoa: Fix stride resolution of pixman image, Gerd Hoffmann, 2021/03/04
- [PULL 4/8] configure: Improve OpenGL dependency detections, Gerd Hoffmann, 2021/03/04
- [PULL 5/8] ui/cocoa: Replace fprintf with error_report, Gerd Hoffmann, 2021/03/04
- [PULL 7/8] ui/console: Pass placeholder surface to displays, Gerd Hoffmann, 2021/03/04
- [PULL 8/8] virtio-gpu: Do not distinguish the primary console, Gerd Hoffmann, 2021/03/04
- Re: [PULL 0/8] Ui 20210304 patches, Peter Maydell, 2021/03/05