[Spice-devel] [PATCH spice-gtk] win32: ignore hardware keycode 255

Hans de Goede hdegoede at redhat.com
Mon Oct 15 10:09:59 PDT 2012


Hi,

ACK without the gprint change. Note I expect the new g_return_if_fail
to trigger under Linux, as I'm seeing lots of scancode 0 messages
in dmesg for Linux guests, which will now turn into triggering
the g_return_if_fail I expect. I had looking into this on my
todo, so if you don't see them this will be a nice job for tomorrow.

Regards,

Hans


On 10/15/2012 07:04 PM, Marc-André Lureau wrote:
> It's a reserved value, and it doesn't have a valid scancode
> translation. Currently, We hit a warning in the delayed key handling
> later.
> ---
>   gtk/spice-widget.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
> index 391cd39..f138d54 100644
> --- a/gtk/spice-widget.c
> +++ b/gtk/spice-widget.c
> @@ -1037,6 +1037,8 @@ static void send_key(SpiceDisplay *display, int scancode, SendKeyType type, gboo
>       SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
>       uint32_t i, b, m;
>
> +    g_return_if_fail(scancode != 0);
> +
>       if (!d->inputs)
>           return;
>
> @@ -1139,8 +1141,12 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
>       SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
>       int scancode;
>
> -
> -    SPICE_DEBUG("%s %s: keycode: %d  state: %d  group %d modifier %d",
> +#ifdef WIN32
> +    /* on windows, we ought to ignore the reserved key event? */
> +    if (key->hardware_keycode == 0xff)
> +        return false;
> +#endif
> +    g_print("%s %s: keycode: %d  state: %d  group %d modifier %d",
>               __FUNCTION__, key->type == GDK_KEY_PRESS ? "press" : "release",
>               key->hardware_keycode, key->state, key->group, key->is_modifier);
>
>


More information about the Spice-devel mailing list