]> git.ipfire.org Git - thirdparty/qemu.git/commit
ui/gtk: Fix mouse/motion event scaling issue with GTK display backend
authorhikalium <hikalium@hikalium.com>
Sun, 12 May 2024 11:14:35 +0000 (20:14 +0900)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 27 May 2024 04:30:35 +0000 (07:30 +0300)
commit659835d24baf6ceeb0d96a61cd86483f719ab093
tree4f2a745ed65b24148aa681160d317cccf10c9edc
parente6000bd7c7cfdd0fc224531e2971e482bbecd1ad
ui/gtk: Fix mouse/motion event scaling issue with GTK display backend

Remove gtk_widget_get_scale_factor() usage from the calculation of
the motion events in the GTK backend to make it work correctly on
environments that have `gtk_widget_get_scale_factor() != 1`.

This scale factor usage had been introduced in the commit f14aab420c and
at that time the window size was used for calculating the things and it
was working correctly. However, in the commit 2f31663ed4 the logic
switched to use the widget size instead of window size and because of
the change the usage of scale factor becomes invalid (since widgets use
`vc->gfx.scale_{x, y}` for scaling).

Tested on Crostini on ChromeOS (15823.51.0) with an external display.

Fixes: 2f31663ed4 ("ui/gtk: use widget size for cursor motion event")
Fixes: f14aab420c ("ui: fix incorrect pointer position on highdpi with
gtk")
(f14aab420c is 95c9059e66 in stable-7.2)

Signed-off-by: hikalium <hikalium@hikalium.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20240512111435.30121-3-hikalium@hikalium.com>
(cherry picked from commit 37e91415018db3656b46cdea8f9e4d47b3ff130d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
ui/gtk.c