>From 4f14d6216d3f05f01ffe419ff0baeebe416a3e58 Mon Sep 17 00:00:00 2001 From: Qi Zhou <atm...@outlook.com> Date: Thu, 29 Dec 2022 20:25:06 +0800 Subject: [PATCH] fix gvtg cursor position if it is negative
It is valid if position of cursor is negative(not hotspot coordinates). for example: precision section, resize, move, north east arrow... Signed-off-by: Qi Zhou <atm...@outlook.com> --- include/hw/vfio/vfio-common.h | 6 ++++-- include/ui/console.h | 4 ++-- include/ui/gtk.h | 2 +- linux-headers/linux/vfio.h | 4 ++-- ui/console.c | 2 +- ui/dbus-listener.c | 2 +- ui/egl-headless.c | 2 +- ui/gtk-egl.c | 2 +- ui/spice-display.c | 2 +- 9 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index e573f5a9f1..8048816176 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -166,8 +166,10 @@ typedef struct VFIOGroup { typedef struct VFIODMABuf { QemuDmaBuf buf; - uint32_t pos_x, pos_y, pos_updates; - uint32_t hot_x, hot_y, hot_updates; + int32_t pos_x, pos_y; + uint32_t pos_updates; + uint32_t hot_x, hot_y; + uint32_t hot_updates; int dmabuf_id; QTAILQ_ENTRY(VFIODMABuf) next; } VFIODMABuf; diff --git a/include/ui/console.h b/include/ui/console.h index e400ee9fa7..589d0fd621 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -264,7 +264,7 @@ typedef struct DisplayChangeListenerOps { uint32_t hot_x, uint32_t hot_y); /* optional */ void (*dpy_gl_cursor_position)(DisplayChangeListener *dcl, - uint32_t pos_x, uint32_t pos_y); + int32_t pos_x, int32_t pos_y); /* optional */ void (*dpy_gl_release_dmabuf)(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf); @@ -362,7 +362,7 @@ void dpy_gl_scanout_dmabuf(QemuConsole *con, void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf, bool have_hot, uint32_t hot_x, uint32_t hot_y); void dpy_gl_cursor_position(QemuConsole *con, - uint32_t pos_x, uint32_t pos_y); + int32_t pos_x, int32_t pos_y); void dpy_gl_release_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf); void dpy_gl_update(QemuConsole *con, diff --git a/include/ui/gtk.h b/include/ui/gtk.h index ae0f53740d..bb28360185 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -182,7 +182,7 @@ void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf, bool have_hot, uint32_t hot_x, uint32_t hot_y); void gd_egl_cursor_position(DisplayChangeListener *dcl, - uint32_t pos_x, uint32_t pos_y); + int32_t pos_x, int32_t pos_y); void gd_egl_flush(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h); void gd_egl_scanout_flush(DisplayChangeListener *dcl, diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h index ede44b5572..646db069b8 100644 --- a/linux-headers/linux/vfio.h +++ b/linux-headers/linux/vfio.h @@ -720,8 +720,8 @@ struct vfio_device_gfx_plane_info { __u32 height; /* height of plane */ __u32 stride; /* stride of plane */ __u32 size; /* size of plane in bytes, align on page*/ - __u32 x_pos; /* horizontal position of cursor plane */ - __u32 y_pos; /* vertical position of cursor plane*/ + __s32 x_pos; /* horizontal position of cursor plane */ + __s32 y_pos; /* vertical position of cursor plane*/ __u32 x_hot; /* horizontal position of cursor hotspot */ __u32 y_hot; /* vertical position of cursor hotspot */ union { diff --git a/ui/console.c b/ui/console.c index 9ff9217f9b..8dffacf07d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2049,7 +2049,7 @@ void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf, } void dpy_gl_cursor_position(QemuConsole *con, - uint32_t pos_x, uint32_t pos_y) + int32_t pos_x, int32_t pos_y) { DisplayState *s = con->ds; DisplayChangeListener *dcl; diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index f9fc8eda51..43c00b7a75 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -188,7 +188,7 @@ static void dbus_cursor_dmabuf(DisplayChangeListener *dcl, } static void dbus_cursor_position(DisplayChangeListener *dcl, - uint32_t pos_x, uint32_t pos_y) + int32_t pos_x, int32_t pos_y) { DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl); diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 7a30fd9777..7a03b08d46 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -110,7 +110,7 @@ static void egl_cursor_dmabuf(DisplayChangeListener *dcl, } static void egl_cursor_position(DisplayChangeListener *dcl, - uint32_t pos_x, uint32_t pos_y) + int32_t pos_x, int32_t pos_y) { egl_dpy *edpy = container_of(dcl, egl_dpy, dcl); diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index e84431790c..a454402212 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -286,7 +286,7 @@ void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl, } void gd_egl_cursor_position(DisplayChangeListener *dcl, - uint32_t pos_x, uint32_t pos_y) + int32_t pos_x, int32_t pos_y) { VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); diff --git a/ui/spice-display.c b/ui/spice-display.c index 494168e7fe..347c3917bf 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -1002,7 +1002,7 @@ static void qemu_spice_gl_cursor_dmabuf(DisplayChangeListener *dcl, } static void qemu_spice_gl_cursor_position(DisplayChangeListener *dcl, - uint32_t pos_x, uint32_t pos_y) + int32_t pos_x, int32_t pos_y) { SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); -- 2.25.1