Re: [spice-gtk 2/4] gtk-deprecated: Use gdk_keymap_get_for_display()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> From: Victor Toso <me@xxxxxxxxxxxxxx>
> 
> As gdk_keymap_get_default() was deprecated in 3.22
> 
> Warnings fixed:
>  | vncdisplaykeymap.c: In function ‘vnc_display_keyval_set_entries’:
>  | vncdisplaykeymap.c:263:4: warning: ‘gdk_keymap_get_default’ is
>  | deprecated: Use 'gdk_keymap_get_for_display' instead
>  |
>  |     gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(),
>  |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  |
>  | spice-gtk-session.c: In function ‘spice_gtk_session_init’:
>  | spice-gtk-session.c:181:5: warning: ‘gdk_keymap_get_default’ is
>  | deprecated: Use 'gdk_keymap_get_for_display' instead
>  |
>  |     GdkKeymap *keymap = gdk_keymap_get_default();
>  |     ^~~~~~~~~
>  |
>  | spice-widget.c: In function ‘get_scancode_from_keyval’:
>  | spice-widget.c:1731:5: warning: ‘gdk_keymap_get_default’ is
>  | deprecated: Use 'gdk_keymap_get_for_display' instead
>  |
>  |      if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(),
>  |      ^~
> 
> Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

Frediano

> ---
>  src/spice-gtk-session.c | 6 ++----
>  src/spice-widget.c      | 4 ++--
>  src/vncdisplaykeymap.c  | 4 +++-
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> index 3d8973e..4b5f7a2 100644
> --- a/src/spice-gtk-session.c
> +++ b/src/spice-gtk-session.c
> @@ -120,8 +120,7 @@ static guint32 get_keyboard_lock_modifiers(void)
>  {
>      guint32 modifiers = 0;
>  /* Ignore GLib's too-new warnings */
> -G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> -    GdkKeymap *keyboard = gdk_keymap_get_default();
> +    GdkKeymap *keyboard =
> gdk_keymap_get_for_display(gdk_display_get_default());
>  
>      if (gdk_keymap_get_caps_lock_state(keyboard)) {
>          modifiers |= SPICE_INPUTS_CAPS_LOCK;
> @@ -134,7 +133,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      if (gdk_keymap_get_scroll_lock_state(keyboard)) {
>          modifiers |= SPICE_INPUTS_SCROLL_LOCK;
>      }
> -G_GNUC_END_IGNORE_DEPRECATIONS
>      return modifiers;
>  }
>  
> @@ -178,7 +176,7 @@ static void guest_modifiers_changed(SpiceInputsChannel
> *inputs, gpointer data)
>  static void spice_gtk_session_init(SpiceGtkSession *self)
>  {
>      SpiceGtkSessionPrivate *s;
> -    GdkKeymap *keymap = gdk_keymap_get_default();
> +    GdkKeymap *keymap =
> gdk_keymap_get_for_display(gdk_display_get_default());
>  
>      s = self->priv = spice_gtk_session_get_instance_private(self);
>  
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index cb35e72..6ad0865 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -1707,9 +1707,9 @@ static guint get_scancode_from_keyval(SpiceDisplay
> *display, guint keyval)
>      guint keycode = 0;
>      GdkKeymapKey *keys = NULL;
>      gint n_keys = 0;
> +    GdkKeymap *keymap =
> gdk_keymap_get_for_display(gdk_display_get_default());
>  
> -    if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(),
> -                                          keyval, &keys, &n_keys)) {
> +    if (gdk_keymap_get_entries_for_keyval(keymap, keyval, &keys, &n_keys)) {
>          /* FIXME what about levels? */
>          keycode = keys[0].keycode;
>          g_free(keys);
> diff --git a/src/vncdisplaykeymap.c b/src/vncdisplaykeymap.c
> index 86cc6bd..e1a16aa 100644
> --- a/src/vncdisplaykeymap.c
> +++ b/src/vncdisplaykeymap.c
> @@ -258,9 +258,11 @@ guint16 vnc_display_keymap_gdk2xtkbd(const guint16
> *keycode_map,
>  void vnc_display_keyval_set_entries(void)
>  {
>  	size_t i;
> +	GdkKeymap *keymap = gdk_keymap_get_for_display(gdk_display_get_default());
> +
>  	if (ref_count_for_untranslated_keys == 0)
>  		for (i = 0; i < sizeof(untranslated_keys) / sizeof(untranslated_keys[0]);
>  		i++)
> -			gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(),
> +			gdk_keymap_get_entries_for_keyval(keymap,
>  							  untranslated_keys[i].keyval,
>  							  &untranslated_keys[i].keys,
>  							  &untranslated_keys[i].n_keys);
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]