ui/gtk: Update scales in fixed-scale mode when rendering GL area

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 <[email protected]>
Message-ID: <[email protected]>
Acked-by: Gerd Hoffmann <[email protected]>
Acked-by: Marc-André Lureau <[email protected]>
This commit is contained in:
Weifeng Liu authored and Marc-André Lureau committed 2025-05-24 17:03:21 +02:00
1 parent a196654481
commit 8fb072472c
1 file changed
+10 -2
+10 -2
View File
@@ -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) {