[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-10.0.3 06/39] ui/gtk: Update scales in fixed-scale mode when ren
From: |
Michael Tokarev |
Subject: |
[Stable-10.0.3 06/39] ui/gtk: Update scales in fixed-scale mode when rendering GL area |
Date: |
Fri, 11 Jul 2025 11:16:02 +0300 |
From: Weifeng Liu <weifeng.liu.z@gmail.com>
When gl=on, scale_x and scale_y were set to 1 on startup that didn't
reflect the real situation of the scan-out in free scale mode, resulting
in incorrect cursor coordinates to be sent when moving the mouse
pointer. Simply updating the scales before rendering the image fixes
this issue.
Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com>
Message-ID: <20250511073337.876650-5-weifeng.liu.z@gmail.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit 8fb072472c38cb1778c5b0bebf535a8b13533857)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index ba9fbec432..db93cd6204 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -43,6 +43,8 @@ void gd_gl_area_draw(VirtualConsole *vc)
QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
#endif
int pw, ph, gs, y1, y2;
+ int ww, wh;
+ int fbw, fbh;
if (!vc->gfx.gls) {
return;
@@ -50,8 +52,14 @@ void gd_gl_area_draw(VirtualConsole *vc)
gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
gs =
gdk_window_get_scale_factor(gtk_widget_get_window(vc->gfx.drawing_area));
- pw = gtk_widget_get_allocated_width(vc->gfx.drawing_area) * gs;
- ph = gtk_widget_get_allocated_height(vc->gfx.drawing_area) * gs;
+ fbw = surface_width(vc->gfx.ds);
+ fbh = surface_height(vc->gfx.ds);
+ ww = gtk_widget_get_allocated_width(vc->gfx.drawing_area);
+ wh = gtk_widget_get_allocated_height(vc->gfx.drawing_area);
+ pw = ww * gs;
+ ph = wh * gs;
+
+ gd_update_scale(vc, ww, wh, fbw, fbh);
if (vc->gfx.scanout_mode) {
if (!vc->gfx.guest_fb.framebuffer) {
--
2.47.2
- [Stable-10.0.3 00/39] Patch Round-up for stable 10.0.3, freeze on 2025-07-21, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 01/39] hw/misc/aspeed_hace: Ensure HASH_IRQ is always set to prevent firmware hang, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 02/39] hw/arm/aspeed_ast27x0: Fix RAM size detection failure on BE hosts, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 05/39] gtk/ui: Introduce helper gd_update_scale, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 04/39] ui/gtk: Use consistent naming for variables in different coordinates, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 03/39] ui/gtk: Document scale and coordinate handling, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 06/39] ui/gtk: Update scales in fixed-scale mode when rendering GL area,
Michael Tokarev <=
- [Stable-10.0.3 07/39] ui/sdl: Consider scaling in mouse event handling, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 08/39] ui/vnc.c: replace big endian flag with byte order value, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 09/39] ui/vnc: take account of client byte order in pixman format, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 10/39] ui/vnc: fix tight palette pixel encoding for 8/16-bpp formats, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 11/39] hw/arm: Add missing psci_conduit to NPCM8XX SoC boot info, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 13/39] hw/i386/pc_piix: Fix RTC ISA IRQ wiring of isapc machine, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 12/39] vhost: Don't set vring call if guest notifier is unused, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 15/39] hw/i386/amd_iommu: Fix xtsup when vcpus < 255, Michael Tokarev, 2025/07/11
- [Stable-10.0.3 16/39] audio: fix SIGSEGV in AUD_get_buffer_size_out(), Michael Tokarev, 2025/07/11
- [Stable-10.0.3 14/39] hw/i386/amd_iommu: Fix device setup failure when PT is on., Michael Tokarev, 2025/07/11