touch: update per latest changes in upstream API

This commit is contained in:
Bilal Elmoussaoui 2023-06-19 21:54:07 +02:00
parent a8b605f401
commit 3aee839269
3 changed files with 23 additions and 23 deletions

View File

@ -41,7 +41,7 @@
Interactions with a console may be done with Interactions with a console may be done with
:dbus:iface:`org.qemu.Display1.Keyboard`, :dbus:iface:`org.qemu.Display1.Keyboard`,
:dbus:iface:`org.qemu.Display1.Mouse` and :dbus:iface:`org.qemu.Display1.Mouse` and
:dbus:iface:`org.qemu.Display1.Touch` interfaces when available. :dbus:iface:`org.qemu.Display1.MultiTouch` interfaces when available.
--> -->
<interface name="org.qemu.Display1.Console"> <interface name="org.qemu.Display1.Console">
<!-- <!--
@ -239,7 +239,7 @@
</interface> </interface>
<!-- <!--
org.qemu.Display1.Touch: org.qemu.Display1.MultiTouch:
This interface in implemented on ``/org/qemu/Display1/Console_$id`` (see This interface in implemented on ``/org/qemu/Display1/Console_$id`` (see
:dbus:iface:`~org.qemu.Display1.Console` documentation). :dbus:iface:`~org.qemu.Display1.Console` documentation).
@ -253,7 +253,7 @@
End = 2 End = 2
Cancel = 3 Cancel = 3
--> -->
<interface name="org.qemu.Display1.Touch"> <interface name="org.qemu.Display1.MultiTouch">
<!-- <!--
SendEvent: SendEvent:
@kind: The touch event kind @kind: The touch event kind

View File

@ -208,7 +208,7 @@ mks_screen_setup (MksDevice *device,
self->keyboard = _mks_device_new (MKS_TYPE_KEYBOARD, device->session, object); self->keyboard = _mks_device_new (MKS_TYPE_KEYBOARD, device->session, object);
else if (MKS_QEMU_IS_MOUSE (iface)) else if (MKS_QEMU_IS_MOUSE (iface))
self->mouse = _mks_device_new (MKS_TYPE_MOUSE, device->session, object); self->mouse = _mks_device_new (MKS_TYPE_MOUSE, device->session, object);
else if (MKS_QEMU_IS_TOUCH (iface)) else if (MKS_QEMU_IS_MULTI_TOUCH (iface))
self->touchable = _mks_device_new (MKS_TYPE_TOUCHABLE, device->session, object); self->touchable = _mks_device_new (MKS_TYPE_TOUCHABLE, device->session, object);
} }

View File

@ -33,8 +33,8 @@
*/ */
struct _MksTouchable struct _MksTouchable
{ {
MksDevice parent_instance; MksDevice parent_instance;
MksQemuTouch *touch; MksQemuMultiTouch *touch;
}; };
struct _MksTouchableClass struct _MksTouchableClass
@ -54,11 +54,11 @@ static GParamSpec *properties [N_PROPS];
static void static void
mks_touchable_set_touch (MksTouchable *self, mks_touchable_set_touch (MksTouchable *self,
MksQemuTouch *touch) MksQemuMultiTouch *touch)
{ {
g_assert (MKS_IS_TOUCHABLE (self)); g_assert (MKS_IS_TOUCHABLE (self));
g_assert (!touch || MKS_QEMU_IS_TOUCH (touch)); g_assert (!touch || MKS_QEMU_IS_MULTI_TOUCH (touch));
g_set_object (&self->touch, touch); g_set_object (&self->touch, touch);
} }
@ -79,8 +79,8 @@ mks_touchable_setup (MksDevice *device,
{ {
GDBusInterface *iface = iter->data; GDBusInterface *iface = iter->data;
if (MKS_QEMU_IS_TOUCH (iface)) if (MKS_QEMU_IS_MULTI_TOUCH (iface))
mks_touchable_set_touch (self, MKS_QEMU_TOUCH (iface)); mks_touchable_set_touch (self, MKS_QEMU_MULTI_TOUCH (iface));
} }
return self->touch != NULL; return self->touch != NULL;
@ -165,17 +165,17 @@ mks_touchable_send_event_cb (GObject *object,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
MksQemuTouch *touch = (MksQemuTouch *)object; MksQemuMultiTouch *touch = (MksQemuMultiTouch *)object;
g_autoptr(GTask) task = user_data; g_autoptr(GTask) task = user_data;
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
MKS_ENTRY; MKS_ENTRY;
g_assert (MKS_QEMU_IS_TOUCH (touch)); g_assert (MKS_QEMU_IS_MULTI_TOUCH (touch));
g_assert (G_IS_ASYNC_RESULT (result)); g_assert (G_IS_ASYNC_RESULT (result));
g_assert (G_IS_TASK (task)); g_assert (G_IS_TASK (task));
if (!mks_qemu_touch_call_send_event_finish (touch, result, &error)) if (!mks_qemu_multi_touch_call_send_event_finish (touch, result, &error))
g_task_return_error (task, g_steal_pointer (&error)); g_task_return_error (task, g_steal_pointer (&error));
else else
g_task_return_boolean (task, TRUE); g_task_return_boolean (task, TRUE);
@ -219,11 +219,11 @@ mks_touchable_send_event (MksTouchable *self,
if (!check_touch (self, &error)) if (!check_touch (self, &error))
g_task_return_error (task, g_steal_pointer (&error)); g_task_return_error (task, g_steal_pointer (&error));
else else
mks_qemu_touch_call_send_event (self->touch, kind, mks_qemu_multi_touch_call_send_event (self->touch, kind,
num_slot, x, y, num_slot, x, y,
cancellable, cancellable,
mks_touchable_send_event_cb, mks_touchable_send_event_cb,
g_steal_pointer (&task)); g_steal_pointer (&task));
MKS_EXIT; MKS_EXIT;
} }
@ -291,9 +291,9 @@ mks_touchable_send_event_sync (MksTouchable *self,
if (!check_touch (self, error)) if (!check_touch (self, error))
MKS_RETURN (FALSE); MKS_RETURN (FALSE);
ret = mks_qemu_touch_call_send_event_sync (self->touch, kind, ret = mks_qemu_multi_touch_call_send_event_sync (self->touch, kind,
num_slot, x, y, num_slot, x, y,
cancellable, error); cancellable, error);
MKS_RETURN (ret); MKS_RETURN (ret);
} }
@ -310,7 +310,7 @@ mks_touchable_get_max_slots (MksTouchable *self)
g_return_val_if_fail (MKS_IS_TOUCHABLE (self), 0); g_return_val_if_fail (MKS_IS_TOUCHABLE (self), 0);
if (self->touch) if (self->touch)
return mks_qemu_touch_get_max_slots (self->touch); return mks_qemu_multi_touch_get_max_slots (self->touch);
return 0; return 0;
} }