From: Weifeng Liu <weifeng.liu.z@gmail.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: qemu-devel@nongnu.org, hikalium <hikalium@hikalium.com>,
Alexander Orzechowski <orzechowski.alexander@gmail.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [PATCH] ui/gtk: Properly apply x/y scale when rendering GL area
Date: Sun, 11 May 2025 00:05:23 +0800 [thread overview]
Message-ID: <64502a9a9073d919c2524686ba8ef54929a30446.camel@gmail.com> (raw)
In-Reply-To: <CAJ+F1C+jPtvsY0yy9rZJLRLME9cC=p1bRGrXA3G1XQfJUmDXrg@mail.gmail.com>
Hi Marc-André,
I am WIP on a patch set including a successor of this one as well as
other fixes, doc and refactoring regarding scale handling. Hopefully
the patch set would make scale handling into good shape. I will send
the patch set out ASAP.
Best regards,
Weifeng
On Mon, 2025-04-28 at 15:23 +0400, Marc-André Lureau wrote:
> Hi
>
> On Sat, Apr 19, 2025 at 1:51 PM Weifeng Liu <weifeng.liu.z@gmail.com> wrote:
> >
> > On startup, scale_x and scale_y were set to 1 that didn't reflect the
> > real situation of the scan-out, resulting in incorrect cursor
> > coordinates to be sent when moving the mouse pointer. Simply updating
> > the scales before rendering the image fixes this issue.
> >
> > Cc: hikalium <hikalium@hikalium.com>
> > Cc: Alexander Orzechowski <orzechowski.alexander@gmail.com>
> > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com>
>
>
> Tested-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> (Hopefully someone has enough motivation to actually understand this
> change better - otherwise I'll simply queue it?)
>
> > ---
> > ui/gtk-gl-area.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
> > index 2c9a0db425..01235f876a 100644
> > --- a/ui/gtk-gl-area.c
> > +++ b/ui/gtk-gl-area.c
> > @@ -42,6 +42,7 @@ void gd_gl_area_draw(VirtualConsole *vc)
> > #ifdef CONFIG_GBM
> > QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
> > #endif
> > + int fbw, fbh;
> > int ww, wh, ws, y1, y2;
> >
> > if (!vc->gfx.gls) {
> > @@ -53,6 +54,11 @@ void gd_gl_area_draw(VirtualConsole *vc)
> > ww = gtk_widget_get_allocated_width(vc->gfx.drawing_area) * ws;
> > wh = gtk_widget_get_allocated_height(vc->gfx.drawing_area) * ws;
> >
> > + fbw = surface_width(vc->gfx.ds);
> > + fbh = surface_height(vc->gfx.ds);
> > + vc->gfx.scale_x = (double)ww / fbw / ws;
> > + vc->gfx.scale_y = (double)wh / fbh / ws;
> > +
> > if (vc->gfx.scanout_mode) {
> > if (!vc->gfx.guest_fb.framebuffer) {
> > return;
> > --
> > 2.49.0
> >
> >
>
prev parent reply other threads:[~2025-05-10 16:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-19 9:48 [PATCH] ui/gtk: Properly apply x/y scale when rendering GL area Weifeng Liu
2025-04-25 7:19 ` liuweife
2025-04-28 11:23 ` Marc-André Lureau
2025-05-10 15:58 ` Weifeng Liu
2025-05-10 16:05 ` Weifeng Liu [this message]
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=64502a9a9073d919c2524686ba8ef54929a30446.camel@gmail.com \
--to=weifeng.liu.z@gmail.com \
--cc=hikalium@hikalium.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=orzechowski.alexander@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).