ui/input: Constify QemuInputHandler structure
Access to QemuInputHandlerState::handler are read-only. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Message-Id: <20231017131251.43708-1-philmd@linaro.org>
This commit is contained in:
parent
08d4594297
commit
b1be65f643
@ -171,7 +171,7 @@ static int msmouse_chr_write(struct Chardev *s, const uint8_t *buf, int len)
|
||||
return len;
|
||||
}
|
||||
|
||||
static QemuInputHandler msmouse_handler = {
|
||||
static const QemuInputHandler msmouse_handler = {
|
||||
.name = "QEMU Microsoft Mouse",
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
|
||||
.event = msmouse_input_event,
|
||||
|
@ -178,7 +178,7 @@ static void wctablet_input_sync(DeviceState *dev)
|
||||
}
|
||||
}
|
||||
|
||||
static QemuInputHandler wctablet_handler = {
|
||||
static const QemuInputHandler wctablet_handler = {
|
||||
.name = "QEMU Wacom Pen Tablet",
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
|
||||
.event = wctablet_input_event,
|
||||
|
@ -845,7 +845,7 @@ static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
|
||||
put_queue(s, keycode);
|
||||
}
|
||||
|
||||
static QemuInputHandler sunkbd_handler = {
|
||||
static const QemuInputHandler sunkbd_handler = {
|
||||
.name = "sun keyboard",
|
||||
.mask = INPUT_EVENT_MASK_KEY,
|
||||
.event = sunkbd_handle_event,
|
||||
|
@ -321,20 +321,20 @@ static void xenfb_mouse_sync(DeviceState *dev)
|
||||
xenfb->wheel = 0;
|
||||
}
|
||||
|
||||
static QemuInputHandler xenfb_keyboard = {
|
||||
static const QemuInputHandler xenfb_keyboard = {
|
||||
.name = "Xen PV Keyboard",
|
||||
.mask = INPUT_EVENT_MASK_KEY,
|
||||
.event = xenfb_key_event,
|
||||
};
|
||||
|
||||
static QemuInputHandler xenfb_abs_mouse = {
|
||||
static const QemuInputHandler xenfb_abs_mouse = {
|
||||
.name = "Xen PV Mouse",
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
|
||||
.event = xenfb_mouse_event,
|
||||
.sync = xenfb_mouse_sync,
|
||||
};
|
||||
|
||||
static QemuInputHandler xenfb_rel_mouse = {
|
||||
static const QemuInputHandler xenfb_rel_mouse = {
|
||||
.name = "Xen PV Mouse",
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
|
||||
.event = xenfb_mouse_event,
|
||||
|
@ -355,7 +355,7 @@ static void adb_kbd_reset(DeviceState *dev)
|
||||
s->count = 0;
|
||||
}
|
||||
|
||||
static QemuInputHandler adb_keyboard_handler = {
|
||||
static const QemuInputHandler adb_keyboard_handler = {
|
||||
.name = "QEMU ADB Keyboard",
|
||||
.mask = INPUT_EVENT_MASK_KEY,
|
||||
.event = adb_keyboard_event,
|
||||
|
@ -510,20 +510,20 @@ void hid_free(HIDState *hs)
|
||||
hid_del_idle_timer(hs);
|
||||
}
|
||||
|
||||
static QemuInputHandler hid_keyboard_handler = {
|
||||
static const QemuInputHandler hid_keyboard_handler = {
|
||||
.name = "QEMU HID Keyboard",
|
||||
.mask = INPUT_EVENT_MASK_KEY,
|
||||
.event = hid_keyboard_event,
|
||||
};
|
||||
|
||||
static QemuInputHandler hid_mouse_handler = {
|
||||
static const QemuInputHandler hid_mouse_handler = {
|
||||
.name = "QEMU HID Mouse",
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
|
||||
.event = hid_pointer_event,
|
||||
.sync = hid_pointer_sync,
|
||||
};
|
||||
|
||||
static QemuInputHandler hid_tablet_handler = {
|
||||
static const QemuInputHandler hid_tablet_handler = {
|
||||
.name = "QEMU HID Tablet",
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
|
||||
.event = hid_pointer_event,
|
||||
|
@ -1231,7 +1231,7 @@ static const VMStateDescription vmstate_ps2_mouse = {
|
||||
}
|
||||
};
|
||||
|
||||
static QemuInputHandler ps2_keyboard_handler = {
|
||||
static const QemuInputHandler ps2_keyboard_handler = {
|
||||
.name = "QEMU PS/2 Keyboard",
|
||||
.mask = INPUT_EVENT_MASK_KEY,
|
||||
.event = ps2_keyboard_event,
|
||||
@ -1242,7 +1242,7 @@ static void ps2_kbd_realize(DeviceState *dev, Error **errp)
|
||||
qemu_input_handler_register(dev, &ps2_keyboard_handler);
|
||||
}
|
||||
|
||||
static QemuInputHandler ps2_mouse_handler = {
|
||||
static const QemuInputHandler ps2_mouse_handler = {
|
||||
.name = "QEMU PS/2 Mouse",
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
|
||||
.event = ps2_mouse_event,
|
||||
|
@ -265,7 +265,7 @@ static const TypeInfo virtio_input_hid_info = {
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
static QemuInputHandler virtio_keyboard_handler = {
|
||||
static const QemuInputHandler virtio_keyboard_handler = {
|
||||
.name = VIRTIO_ID_NAME_KEYBOARD,
|
||||
.mask = INPUT_EVENT_MASK_KEY,
|
||||
.event = virtio_input_handle_event,
|
||||
@ -322,7 +322,7 @@ static const TypeInfo virtio_keyboard_info = {
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
static QemuInputHandler virtio_mouse_handler = {
|
||||
static const QemuInputHandler virtio_mouse_handler = {
|
||||
.name = VIRTIO_ID_NAME_MOUSE,
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
|
||||
.event = virtio_input_handle_event,
|
||||
@ -416,7 +416,7 @@ static const TypeInfo virtio_mouse_info = {
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
static QemuInputHandler virtio_tablet_handler = {
|
||||
static const QemuInputHandler virtio_tablet_handler = {
|
||||
.name = VIRTIO_ID_NAME_TABLET,
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
|
||||
.event = virtio_input_handle_event,
|
||||
@ -541,7 +541,7 @@ static const TypeInfo virtio_tablet_info = {
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
static QemuInputHandler virtio_multitouch_handler = {
|
||||
static const QemuInputHandler virtio_multitouch_handler = {
|
||||
.name = VIRTIO_ID_NAME_MULTITOUCH,
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_MTT,
|
||||
.event = virtio_input_handle_event,
|
||||
|
@ -84,7 +84,7 @@ struct VirtIOInputHID {
|
||||
VirtIOInput parent_obj;
|
||||
char *display;
|
||||
uint32_t head;
|
||||
QemuInputHandler *handler;
|
||||
const QemuInputHandler *handler;
|
||||
QemuInputHandlerState *hs;
|
||||
int ledstate;
|
||||
bool wheel_axis;
|
||||
|
@ -30,7 +30,7 @@ struct QemuInputHandler {
|
||||
};
|
||||
|
||||
QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev,
|
||||
QemuInputHandler *handler);
|
||||
const QemuInputHandler *handler);
|
||||
void qemu_input_handler_activate(QemuInputHandlerState *s);
|
||||
void qemu_input_handler_deactivate(QemuInputHandlerState *s);
|
||||
void qemu_input_handler_unregister(QemuInputHandlerState *s);
|
||||
|
@ -127,7 +127,7 @@ static void legacy_kbd_event(DeviceState *dev, QemuConsole *src,
|
||||
}
|
||||
}
|
||||
|
||||
static QemuInputHandler legacy_kbd_handler = {
|
||||
static const QemuInputHandler legacy_kbd_handler = {
|
||||
.name = "legacy-kbd",
|
||||
.mask = INPUT_EVENT_MASK_KEY,
|
||||
.event = legacy_kbd_event,
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
struct QemuInputHandlerState {
|
||||
DeviceState *dev;
|
||||
QemuInputHandler *handler;
|
||||
const QemuInputHandler *handler;
|
||||
int id;
|
||||
int events;
|
||||
QemuConsole *con;
|
||||
@ -46,7 +46,7 @@ static uint32_t queue_count;
|
||||
static uint32_t queue_limit = 1024;
|
||||
|
||||
QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev,
|
||||
QemuInputHandler *handler)
|
||||
const QemuInputHandler *handler)
|
||||
{
|
||||
QemuInputHandlerState *s = g_new0(QemuInputHandlerState, 1);
|
||||
static int id = 1;
|
||||
|
@ -297,7 +297,7 @@ static void vdagent_pointer_sync(DeviceState *dev)
|
||||
}
|
||||
}
|
||||
|
||||
static QemuInputHandler vdagent_mouse_handler = {
|
||||
static const QemuInputHandler vdagent_mouse_handler = {
|
||||
.name = "vdagent mouse",
|
||||
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
|
||||
.event = vdagent_pointer_event,
|
||||
|
Loading…
Reference in New Issue
Block a user