libspice-client-glib-2.0:The inputs handle ack function could not be called.
I use the libspice-client-glib-2.0 library with the following code:
gi.require_version('SpiceClientGLib', '2.0')
from gi.repository import SpiceClientGLib
...
Add g_message in each handle functions to verify that they were called correctly:
/* coroutine context */
static void inputs_handle_init(SpiceChannel *channel, SpiceMsgIn *in)
{
g_message("in inputs_handle_init!");
SpiceInputsChannelPrivate *c = SPICE_INPUTS_CHANNEL(channel)->priv;
SpiceMsgInputsInit *init = spice_msg_in_parsed(in);
c->modifiers = init->keyboard_modifiers;
}
/* coroutine context */
static void inputs_handle_modifiers(SpiceChannel *channel, SpiceMsgIn *in)
{
g_message("in inputs_handle_modifiers!");
SpiceInputsChannelPrivate *c = SPICE_INPUTS_CHANNEL(channel)->priv;
SpiceMsgInputsKeyModifiers *modifiers = spice_msg_in_parsed(in);
c->modifiers = modifiers->modifiers;
}
/* coroutine context */
static void inputs_handle_ack(SpiceChannel *channel, SpiceMsgIn *in)
{
g_message("in inputs_handle_ack!");
SpiceInputsChannelPrivate *c = SPICE_INPUTS_CHANNEL(channel)->priv;
SpiceMsgOut *msg;
c->motion_count -= SPICE_INPUT_MOTION_ACK_BUNCH;
msg = mouse_motion(SPICE_INPUTS_CHANNEL(channel));
if (msg) { /* if no motion, msg == NULL */
spice_msg_out_send_internal(msg);
}
msg = mouse_position(SPICE_INPUTS_CHANNEL(channel));
if (msg) {
spice_msg_out_send_internal(msg);
}
}
static void channel_set_handlers(SpiceChannelClass *klass)
{
static const spice_msg_handler handlers[] = {
[ SPICE_MSG_INPUTS_INIT ] = inputs_handle_init,
[ SPICE_MSG_INPUTS_KEY_MODIFIERS ] = inputs_handle_modifiers,
[ SPICE_MSG_INPUTS_MOUSE_MOTION_ACK ] = inputs_handle_ack,
};
spice_channel_set_handlers(klass, handlers, G_N_ELEMENTS(handlers));
}
When using spicy as the client, all three functions print correctly, but when using libspice-client-glib-2.0, "in inputs_handle_ack!" of the third functions won't print properly.