ui/console: Convert mouse visibility parameter into bool

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Phil Dennis-Jordan <phil@philjordan.eu>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240715-cursor-v3-2-afa5b9492dbf@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Akihiko Odaki 2024-07-15 14:25:43 +09:00 committed by Philippe Mathieu-Daudé
parent 3f5ef05fe0
commit a418e7aeea
10 changed files with 19 additions and 18 deletions

View File

@ -742,7 +742,7 @@ static void ati_mm_write(void *opaque, hwaddr addr,
if (!s->cursor_guest_mode && if (!s->cursor_guest_mode &&
(s->regs.crtc_gen_cntl & CRTC2_CUR_EN) && !(t & BIT(31))) { (s->regs.crtc_gen_cntl & CRTC2_CUR_EN) && !(t & BIT(31))) {
dpy_mouse_set(s->vga.con, s->regs.cur_hv_pos >> 16, dpy_mouse_set(s->vga.con, s->regs.cur_hv_pos >> 16,
s->regs.cur_hv_pos & 0xffff, 1); s->regs.cur_hv_pos & 0xffff, true);
} }
break; break;
} }

View File

@ -109,8 +109,7 @@ static void update_cursor(VirtIOGPU *g, struct virtio_gpu_update_cursor *cursor)
s->cursor.pos.x = cursor->pos.x; s->cursor.pos.x = cursor->pos.x;
s->cursor.pos.y = cursor->pos.y; s->cursor.pos.y = cursor->pos.y;
} }
dpy_mouse_set(s->con, cursor->pos.x, cursor->pos.y, dpy_mouse_set(s->con, cursor->pos.x, cursor->pos.y, cursor->resource_id);
cursor->resource_id ? 1 : 0);
} }
struct virtio_gpu_simple_resource * struct virtio_gpu_simple_resource *

View File

@ -1167,7 +1167,7 @@ static void vmsvga_reset(DeviceState *dev)
s->enable = 0; s->enable = 0;
s->config = 0; s->config = 0;
s->svgaid = SVGA_ID; s->svgaid = SVGA_ID;
s->cursor.on = 0; s->cursor.on = false;
s->redraw_fifo_last = 0; s->redraw_fifo_last = 0;
s->syncing = 0; s->syncing = 0;

View File

@ -233,7 +233,7 @@ typedef struct DisplayChangeListenerOps {
/* optional */ /* optional */
void (*dpy_mouse_set)(DisplayChangeListener *dcl, void (*dpy_mouse_set)(DisplayChangeListener *dcl,
int x, int y, int on); int x, int y, bool on);
/* optional */ /* optional */
void (*dpy_cursor_define)(DisplayChangeListener *dcl, void (*dpy_cursor_define)(DisplayChangeListener *dcl,
QEMUCursor *cursor); QEMUCursor *cursor);
@ -322,7 +322,7 @@ void dpy_gfx_replace_surface(QemuConsole *con,
void dpy_text_cursor(QemuConsole *con, int x, int y); void dpy_text_cursor(QemuConsole *con, int x, int y);
void dpy_text_update(QemuConsole *con, int x, int y, int w, int h); void dpy_text_update(QemuConsole *con, int x, int y, int w, int h);
void dpy_text_resize(QemuConsole *con, int w, int h); void dpy_text_resize(QemuConsole *con, int w, int h);
void dpy_mouse_set(QemuConsole *con, int x, int y, int on); void dpy_mouse_set(QemuConsole *con, int x, int y, bool on);
void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor); void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor);
bool dpy_cursor_define_supported(QemuConsole *con); bool dpy_cursor_define_supported(QemuConsole *con);
bool dpy_gfx_check_format(QemuConsole *con, bool dpy_gfx_check_format(QemuConsole *con,

View File

@ -49,7 +49,8 @@ typedef struct QemuGraphicConsole {
uint32_t head; uint32_t head;
QEMUCursor *cursor; QEMUCursor *cursor;
int cursor_x, cursor_y, cursor_on; int cursor_x, cursor_y;
bool cursor_on;
} QemuGraphicConsole; } QemuGraphicConsole;
typedef QemuConsoleClass QemuGraphicConsoleClass; typedef QemuConsoleClass QemuGraphicConsoleClass;
@ -957,7 +958,7 @@ void dpy_text_resize(QemuConsole *con, int w, int h)
} }
} }
void dpy_mouse_set(QemuConsole *c, int x, int y, int on) void dpy_mouse_set(QemuConsole *c, int x, int y, bool on)
{ {
QemuGraphicConsole *con = QEMU_GRAPHIC_CONSOLE(c); QemuGraphicConsole *con = QEMU_GRAPHIC_CONSOLE(c);
DisplayState *s = c->ds; DisplayState *s = c->ds;

View File

@ -726,7 +726,7 @@ static void dbus_gfx_switch(DisplayChangeListener *dcl,
} }
static void dbus_mouse_set(DisplayChangeListener *dcl, static void dbus_mouse_set(DisplayChangeListener *dcl,
int x, int y, int on) int x, int y, bool on)
{ {
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl); DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);

View File

@ -446,7 +446,7 @@ static GdkDevice *gd_get_pointer(GdkDisplay *dpy)
} }
static void gd_mouse_set(DisplayChangeListener *dcl, static void gd_mouse_set(DisplayChangeListener *dcl,
int x, int y, int visible) int x, int y, bool visible)
{ {
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
GdkDisplay *dpy; GdkDisplay *dpy;

View File

@ -49,7 +49,7 @@ static int gui_grab_code = KMOD_LALT | KMOD_LCTRL;
static SDL_Cursor *sdl_cursor_normal; static SDL_Cursor *sdl_cursor_normal;
static SDL_Cursor *sdl_cursor_hidden; static SDL_Cursor *sdl_cursor_hidden;
static int absolute_enabled; static int absolute_enabled;
static int guest_cursor; static bool guest_cursor;
static int guest_x, guest_y; static int guest_x, guest_y;
static SDL_Cursor *guest_sprite; static SDL_Cursor *guest_sprite;
static Notifier mouse_mode_notifier; static Notifier mouse_mode_notifier;
@ -729,7 +729,7 @@ void sdl2_poll_events(struct sdl2_console *scon)
} }
static void sdl_mouse_warp(DisplayChangeListener *dcl, static void sdl_mouse_warp(DisplayChangeListener *dcl,
int x, int y, int on) int x, int y, bool on)
{ {
struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl); struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);

View File

@ -254,7 +254,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
static SimpleSpiceCursor* static SimpleSpiceCursor*
qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd, qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd,
QEMUCursor *c, QEMUCursor *c,
int on) bool on)
{ {
size_t size = c ? c->width * c->height * 4 : 0; size_t size = c ? c->width * c->height * 4 : 0;
SimpleSpiceCursor *update; SimpleSpiceCursor *update;
@ -448,7 +448,8 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
qemu_mutex_lock(&ssd->lock); qemu_mutex_lock(&ssd->lock);
if (ssd->cursor) { if (ssd->cursor) {
g_free(ssd->ptr_define); g_free(ssd->ptr_define);
ssd->ptr_define = qemu_spice_create_cursor_update(ssd, ssd->cursor, 0); ssd->ptr_define =
qemu_spice_create_cursor_update(ssd, ssd->cursor, false);
} }
qemu_mutex_unlock(&ssd->lock); qemu_mutex_unlock(&ssd->lock);
} }
@ -476,7 +477,7 @@ void qemu_spice_cursor_refresh_bh(void *opaque)
ssd->mouse_x = -1; ssd->mouse_x = -1;
ssd->mouse_y = -1; ssd->mouse_y = -1;
qemu_mutex_unlock(&ssd->lock); qemu_mutex_unlock(&ssd->lock);
dpy_mouse_set(ssd->dcl.con, x, y, 1); dpy_mouse_set(ssd->dcl.con, x, y, true);
} else { } else {
qemu_mutex_unlock(&ssd->lock); qemu_mutex_unlock(&ssd->lock);
} }
@ -747,7 +748,7 @@ static void display_refresh(DisplayChangeListener *dcl)
} }
static void display_mouse_set(DisplayChangeListener *dcl, static void display_mouse_set(DisplayChangeListener *dcl,
int x, int y, int on) int x, int y, bool on)
{ {
SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
@ -774,7 +775,7 @@ static void display_mouse_define(DisplayChangeListener *dcl,
g_free(ssd->ptr_move); g_free(ssd->ptr_move);
ssd->ptr_move = NULL; ssd->ptr_move = NULL;
g_free(ssd->ptr_define); g_free(ssd->ptr_define);
ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c, 0); ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c, false);
qemu_mutex_unlock(&ssd->lock); qemu_mutex_unlock(&ssd->lock);
qemu_spice_wakeup(ssd); qemu_spice_wakeup(ssd);
} }

View File

@ -981,7 +981,7 @@ int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
} }
static void vnc_mouse_set(DisplayChangeListener *dcl, static void vnc_mouse_set(DisplayChangeListener *dcl,
int x, int y, int visible) int x, int y, bool visible)
{ {
/* can we ask the client(s) to move the pointer ??? */ /* can we ask the client(s) to move the pointer ??? */
} }