@@ -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;
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> --- ui/gtk-gl-area.c | 6 ++++++ 1 file changed, 6 insertions(+)