From: "Daniel P. Berrangé" <berrange@redhat.com>
To: marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [PATCH 44/67] ui/vc: change the argument for QemuTextConsole
Date: Fri, 1 Sep 2023 18:15:25 +0100 [thread overview]
Message-ID: <ZPIcLeg9gDj4G93p@redhat.com> (raw)
In-Reply-To: <20230830093843.3531473-45-marcandre.lureau@redhat.com>
On Wed, Aug 30, 2023 at 01:38:18PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Those functions are specifc to text/vc console, make that explicit from
> the argument type.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> include/ui/console.h | 6 +++---
> ui/console.c | 14 ++++++--------
> ui/gtk.c | 2 +-
> ui/sdl2-input.c | 5 +++--
> ui/sdl2.c | 5 ++---
> 5 files changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/include/ui/console.h b/include/ui/console.h
> index 91d8bbc9dc..1ccd432b4d 100644
> --- a/include/ui/console.h
> +++ b/include/ui/console.h
> @@ -112,9 +112,9 @@ bool qemu_mouse_set(int index, Error **errp);
> #define QEMU_KEY_CTRL_PAGEUP 0xe406
> #define QEMU_KEY_CTRL_PAGEDOWN 0xe407
>
> -void kbd_put_keysym_console(QemuConsole *s, int keysym);
> -bool kbd_put_qcode_console(QemuConsole *s, int qcode, bool ctrl);
> -void kbd_put_string_console(QemuConsole *s, const char *str, int len);
> +void kbd_put_keysym_console(QemuTextConsole *s, int keysym);
> +bool kbd_put_qcode_console(QemuTextConsole *s, int qcode, bool ctrl);
> +void kbd_put_string_console(QemuTextConsole *s, const char *str, int len);
> void kbd_put_keysym(int keysym);
>
> /* Touch devices */
> diff --git a/ui/console.c b/ui/console.c
> index 9fccecafd7..a98adbb1b2 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -1135,16 +1135,12 @@ static void kbd_send_chars(QemuTextConsole *s)
> }
>
> /* called when an ascii key is pressed */
> -void kbd_put_keysym_console(QemuConsole *con, int keysym)
> +void kbd_put_keysym_console(QemuTextConsole *s, int keysym)
> {
> - QemuTextConsole *s = (QemuTextConsole *)object_dynamic_cast(OBJECT(con), TYPE_QEMU_TEXT_CONSOLE);
> uint8_t buf[16], *q;
> int c;
> uint32_t num_free;
>
> - if (!s)
> - return;
> -
> switch(keysym) {
> case QEMU_KEY_CTRL_UP:
> console_scroll(s, -1);
> @@ -1214,7 +1210,7 @@ static const int ctrl_qcode_to_keysym[Q_KEY_CODE__MAX] = {
> [Q_KEY_CODE_PGDN] = QEMU_KEY_CTRL_PAGEDOWN,
> };
>
> -bool kbd_put_qcode_console(QemuConsole *s, int qcode, bool ctrl)
> +bool kbd_put_qcode_console(QemuTextConsole *s, int qcode, bool ctrl)
> {
> int keysym;
>
> @@ -1226,7 +1222,7 @@ bool kbd_put_qcode_console(QemuConsole *s, int qcode, bool ctrl)
> return true;
> }
>
> -void kbd_put_string_console(QemuConsole *s, const char *str, int len)
> +void kbd_put_string_console(QemuTextConsole *s, const char *str, int len)
> {
> int i;
>
> @@ -1237,7 +1233,9 @@ void kbd_put_string_console(QemuConsole *s, const char *str, int len)
>
> void kbd_put_keysym(int keysym)
> {
> - kbd_put_keysym_console(active_console, keysym);
> + if (QEMU_IS_TEXT_CONSOLE(active_console)) {
> + kbd_put_keysym_console(QEMU_TEXT_CONSOLE(active_console), keysym);
> + }
> }
>
> static void text_console_invalidate(void *opaque)
> diff --git a/ui/gtk.c b/ui/gtk.c
> index ef98bb0648..c34c133550 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -1187,7 +1187,7 @@ static gboolean gd_text_key_down(GtkWidget *widget,
> GdkEventKey *key, void *opaque)
> {
> VirtualConsole *vc = opaque;
> - QemuConsole *con = vc->gfx.dcl.con;
> + QemuTextConsole *con = QEMU_TEXT_CONSOLE(vc->gfx.dcl.con);
>
> if (key->keyval == GDK_KEY_Delete) {
> kbd_put_qcode_console(con, Q_KEY_CODE_DELETE, false);
> diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c
> index f068382209..efc0e76e8c 100644
> --- a/ui/sdl2-input.c
> +++ b/ui/sdl2-input.c
> @@ -44,14 +44,15 @@ void sdl2_process_key(struct sdl2_console *scon,
> qkbd_state_key_event(scon->kbd, qcode, ev->type == SDL_KEYDOWN);
>
> if (!qemu_console_is_graphic(con)) {
If i'm nit-picking I'd say change to be
"if (QEMU_IS_TEXT_CONSOLE(con)) {"
as you did in the other places in this patch
> + QemuTextConsole *s = QEMU_TEXT_CONSOLE(con);
> bool ctrl = qkbd_state_modifier_get(scon->kbd, QKBD_MOD_CTRL);
> if (ev->type == SDL_KEYDOWN) {
> switch (qcode) {
> case Q_KEY_CODE_RET:
> - kbd_put_keysym_console(con, '\n');
> + kbd_put_keysym_console(s, '\n');
> break;
> default:
> - kbd_put_qcode_console(con, qcode, ctrl);
> + kbd_put_qcode_console(s, qcode, ctrl);
> break;
> }
> }
> diff --git a/ui/sdl2.c b/ui/sdl2.c
> index 0d91b555e3..16b515fcf9 100644
> --- a/ui/sdl2.c
> +++ b/ui/sdl2.c
> @@ -483,10 +483,9 @@ static void handle_textinput(SDL_Event *ev)
> return;
> }
>
> - if (qemu_console_is_graphic(con)) {
> - return;
> + if (QEMU_IS_TEXT_CONSOLE(con)) {
> + kbd_put_string_console(QEMU_TEXT_CONSOLE(con), ev->text.text, strlen(ev->text.text));
> }
> - kbd_put_string_console(con, ev->text.text, strlen(ev->text.text));
> }
>
> static void handle_mousemotion(SDL_Event *ev)
With or without my suggestion:
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2023-09-01 17:15 UTC|newest]
Thread overview: 157+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 9:37 [PATCH 00/67] Make pixman an optional dependency marcandre.lureau
2023-08-30 9:37 ` [PATCH 01/67] ui: remove qemu_pixman_color() helper marcandre.lureau
2023-08-30 10:03 ` Philippe Mathieu-Daudé
2023-08-30 10:59 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 02/67] ui: remove qemu_pixman_linebuf_copy() marcandre.lureau
2023-08-30 10:59 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 03/67] ui/qmp: move screendump to ui-qmp-cmds.c marcandre.lureau
2023-08-30 11:00 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 04/67] ui/vc: replace vc_chr_write() with generic qemu_chr_write() marcandre.lureau
2023-08-30 10:04 ` Philippe Mathieu-Daudé
2023-08-30 11:01 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 05/67] ui/vc: drop have_text marcandre.lureau
2023-08-30 11:03 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 06/67] ui/console: console_select() regardless of have_gfx marcandre.lureau
2023-08-30 11:05 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 07/67] ui/console: call dpy_gfx_update() " marcandre.lureau
2023-08-30 11:06 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 08/67] ui/console: drop have_gfx marcandre.lureau
2023-08-30 11:06 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 09/67] ui/console: get the DisplayState from new_console() marcandre.lureau
2023-08-30 12:39 ` BALATON Zoltan
2023-09-01 14:10 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 10/67] ui/console: new_console() cannot fail marcandre.lureau
2023-08-30 11:07 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 11/67] ui/vc: VC always has a DisplayState now marcandre.lureau
2023-09-01 13:44 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 12/67] ui/vc: move VCChardev declaration at the top marcandre.lureau
2023-08-30 11:07 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 13/67] ui/vc: replace variable with static text attributes default marcandre.lureau
2023-09-01 13:45 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 14/67] ui/vc: fold text_update_xy() marcandre.lureau
2023-08-30 11:08 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 15/67] ui/vc: pass VCCharDev to VC-specific functions marcandre.lureau
2023-09-01 14:15 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 16/67] ui/vc: move VCCharDev specific fields out of QemuConsole marcandre.lureau
2023-09-01 14:16 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 17/67] ui/console: use OBJECT_DEFINE_TYPE for QemuConsole marcandre.lureau
2023-08-30 11:09 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 18/67] ui/console: change new_console() to use object initialization marcandre.lureau
2023-09-01 14:19 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 19/67] ui/console: introduce different console objects marcandre.lureau
2023-09-01 14:20 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 20/67] ui/console: instantiate a specific console type marcandre.lureau
2023-09-01 14:21 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 21/67] ui/console: register the console from qemu_console_init() marcandre.lureau
2023-09-01 14:21 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 22/67] ui/console: remove new_console() marcandre.lureau
2023-09-01 14:22 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 23/67] ui/console: specialize console_lookup_unused() marcandre.lureau
2023-09-01 14:23 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 24/67] ui/console: update the head from unused QemuConsole marcandre.lureau
2023-09-01 14:23 ` Daniel P. Berrangé
2023-08-30 9:37 ` [PATCH 25/67] ui/console: allocate ui_timer in QemuConsole marcandre.lureau
2023-09-01 14:24 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 26/67] ui/vc: move cursor_timer initialization to QemuTextConsole class marcandre.lureau
2023-09-01 14:27 ` Daniel P. Berrangé
2023-09-04 9:55 ` Marc-André Lureau
2023-08-30 9:38 ` [PATCH 27/67] ui/console: free more QemuConsole resources marcandre.lureau
2023-09-01 14:29 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 28/67] ui/vc: move text fields to QemuTextConsole marcandre.lureau
2023-09-01 14:30 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 29/67] ui/console: move graphic fields to QemuGraphicConsole marcandre.lureau
2023-09-01 14:31 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 30/67] ui/vc: fold text_console_do_init() in vc_chr_open() marcandre.lureau
2023-09-01 14:34 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 31/67] ui/vc: move some text console initialization to qom handlers marcandre.lureau
2023-09-01 14:36 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 32/67] ui/console: simplify getting active_console size marcandre.lureau
2023-09-01 14:37 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 33/67] ui/console: remove need for g_width/g_height marcandre.lureau
2023-09-01 14:37 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 34/67] ui/vc: use common text console surface creation marcandre.lureau
2023-09-01 14:38 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 35/67] ui/console: declare console types in console.h marcandre.lureau
2023-09-01 14:39 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 36/67] ui/console: use QEMU_PIXMAN_COLOR helpers marcandre.lureau
2023-08-30 15:13 ` Philippe Mathieu-Daudé
2023-08-30 9:38 ` [PATCH 37/67] ui/console: rename vga_ functions → qemu_console_ marcandre.lureau
2023-08-30 11:11 ` Daniel P. Berrangé
2023-08-30 12:44 ` BALATON Zoltan
2023-08-30 15:13 ` Philippe Mathieu-Daudé
2023-08-30 9:38 ` [PATCH 38/67] ui/console: assert(surface) where appropriate marcandre.lureau
2023-09-01 14:39 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 39/67] ui/console: fold text_console_update_cursor_timer marcandre.lureau
2023-08-30 15:15 ` Philippe Mathieu-Daudé
2023-09-01 16:51 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 40/67] ui/vc: skip text console resize when possible marcandre.lureau
2023-09-01 16:52 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 41/67] ui/console: minor stylistic changes marcandre.lureau
2023-09-01 16:52 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 42/67] ui/vc: move text console invalidate in helper marcandre.lureau
2023-09-01 16:54 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 43/67] ui/vc: do not parse VC-specific options in Spice and GTK marcandre.lureau
2023-09-01 17:13 ` Daniel P. Berrangé
2023-09-04 10:56 ` Marc-André Lureau
2023-08-30 9:38 ` [PATCH 44/67] ui/vc: change the argument for QemuTextConsole marcandre.lureau
2023-09-01 17:15 ` Daniel P. Berrangé [this message]
2023-08-30 9:38 ` [PATCH 45/67] ui/vc: remove kby_put_keysym() and update function calls marcandre.lureau
2023-08-30 20:59 ` Akihiko Odaki
2023-09-04 12:42 ` Marc-André Lureau
2023-09-04 12:47 ` Akihiko Odaki
2023-08-30 9:38 ` [PATCH 46/67] ui/vc: rename kbd_put → qemu_text_console functions marcandre.lureau
2023-08-30 15:41 ` Philippe Mathieu-Daudé
2023-09-01 17:17 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 47/67] ui/console: remove redundant format field marcandre.lureau
2023-09-01 17:18 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 48/67] ui/vc: preliminary QemuTextConsole changes before split marcandre.lureau
2023-09-01 17:19 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 49/67] ui/vc: split off the VC part from console.c marcandre.lureau
2023-09-01 17:23 ` Daniel P. Berrangé
2023-09-04 12:57 ` Marc-André Lureau
2023-09-04 13:05 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 50/67] ui/console: move DisplaySurface to its own header marcandre.lureau
2023-09-01 17:24 ` Daniel P. Berrangé
2023-09-04 12:59 ` Marc-André Lureau
2023-09-04 13:05 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 51/67] build-sys: add optional "pixman" feature marcandre.lureau
2023-08-30 15:48 ` Philippe Mathieu-Daudé
2023-08-30 15:55 ` Philippe Mathieu-Daudé
2023-09-01 17:25 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 52/67] ui: compile out some qemu-pixman functions when !PIXMAN marcandre.lureau
2023-08-30 9:38 ` [PATCH 53/67] ui: add pixman-compat.h marcandre.lureau
2023-08-30 11:17 ` Daniel P. Berrangé
2023-08-30 11:23 ` Marc-André Lureau
2023-08-30 9:38 ` [PATCH 54/67] ui/vc: console-vc requires PIXMAN marcandre.lureau
2023-09-01 17:28 ` Daniel P. Berrangé
2023-09-04 13:41 ` Marc-André Lureau
2023-09-04 13:44 ` Daniel P. Berrangé
2023-08-30 9:38 ` [PATCH 55/67] qmp/hmp: disable screendump if PIXMAN is missing marcandre.lureau
2023-08-30 15:18 ` Philippe Mathieu-Daudé
2023-08-30 9:38 ` [PATCH 56/67] virtio-gpu: replace PIXMAN for region/rect test marcandre.lureau
2023-08-30 9:38 ` [PATCH 57/67] ui/console: when PIXMAN is unavailable, don't draw placeholder msg marcandre.lureau
2023-08-30 9:38 ` [PATCH 58/67] vhost-user-gpu: skip VHOST_USER_GPU_UPDATE when !PIXMAN marcandre.lureau
2023-08-30 9:38 ` [PATCH 59/67] ui/gl: opengl doesn't require PIXMAN marcandre.lureau
2023-08-30 9:38 ` [PATCH 60/67] ui/vnc: VNC requires PIXMAN marcandre.lureau
2023-09-04 14:01 ` Paolo Bonzini
2023-08-30 9:38 ` [PATCH 61/67] ui/spice: SPICE/QXL " marcandre.lureau
2023-08-30 15:21 ` Philippe Mathieu-Daudé
2023-09-04 14:42 ` Paolo Bonzini
2023-09-04 14:03 ` Paolo Bonzini
2023-08-30 9:38 ` [PATCH 62/67] ui/gtk: -display gtk " marcandre.lureau
2023-08-30 9:38 ` [PATCH 63/67] ui/dbus: do not require PIXMAN marcandre.lureau
2023-08-30 9:38 ` [PATCH 64/67] arm/kconfig: XLNX_ZYNQMP_ARM depends on PIXMAN marcandre.lureau
2023-08-30 15:25 ` Philippe Mathieu-Daudé
2023-08-30 9:38 ` [PATCH 65/67] ppc/kconfig: make SAM460EX depend on PPC & PIXMAN marcandre.lureau
2023-08-30 12:34 ` BALATON Zoltan
2023-09-04 16:24 ` Paolo Bonzini
2023-09-05 20:07 ` Marc-André Lureau
2023-09-06 11:00 ` Paolo Bonzini
2023-09-04 14:05 ` Paolo Bonzini
2023-08-30 9:38 ` [PATCH 66/67] sh4/kconfig: make R2D depend on SH4 " marcandre.lureau
2023-08-30 9:38 ` [PATCH 67/67] display/kconfig: make SM501 depend on PIXMAN marcandre.lureau
2023-08-30 15:27 ` Philippe Mathieu-Daudé
2023-08-30 10:52 ` [PATCH 00/67] Make pixman an optional dependency Thomas Huth
2023-08-30 11:01 ` Marc-André Lureau
2023-08-30 11:21 ` Daniel P. Berrangé
2023-08-30 11:32 ` Marc-André Lureau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZPIcLeg9gDj4G93p@redhat.com \
--to=berrange@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.