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

Marc-André Lureau marcandre.lureau at gmail.com
Mon Oct 15 10:05:25 PDT 2012


even better without the g_print() change

On Mon, Oct 15, 2012 at 7:04 PM, Marc-André Lureau
<marcandre.lureau at gmail.com> 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);
>
> --
> 1.7.11.7
>



-- 
Marc-André Lureau


More information about the Spice-devel mailing list