input-linux: Register properties as class properties

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200921221045.699690-10-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2020-09-21 18:10:30 -04:00
parent 29ee2a1832
commit 7da4e3bb11

View File

@ -489,19 +489,6 @@ static void input_linux_set_grab_toggle(Object *obj, int value,
static void input_linux_instance_init(Object *obj)
{
object_property_add_str(obj, "evdev",
input_linux_get_evdev,
input_linux_set_evdev);
object_property_add_bool(obj, "grab_all",
input_linux_get_grab_all,
input_linux_set_grab_all);
object_property_add_bool(obj, "repeat",
input_linux_get_repeat,
input_linux_set_repeat);
object_property_add_enum(obj, "grab-toggle", "GrabToggleKeys",
&GrabToggleKeys_lookup,
input_linux_get_grab_toggle,
input_linux_set_grab_toggle);
}
static void input_linux_class_init(ObjectClass *oc, void *data)
@ -509,6 +496,20 @@ static void input_linux_class_init(ObjectClass *oc, void *data)
UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
ucc->complete = input_linux_complete;
object_class_property_add_str(oc, "evdev",
input_linux_get_evdev,
input_linux_set_evdev);
object_class_property_add_bool(oc, "grab_all",
input_linux_get_grab_all,
input_linux_set_grab_all);
object_class_property_add_bool(oc, "repeat",
input_linux_get_repeat,
input_linux_set_repeat);
object_class_property_add_enum(oc, "grab-toggle", "GrabToggleKeys",
&GrabToggleKeys_lookup,
input_linux_get_grab_toggle,
input_linux_set_grab_toggle);
}
static const TypeInfo input_linux_info = {