[virt-tools-list] [PATCH] Reading cursor-release hotkey set-up from settings file

Pavel Grunt pgrunt at redhat.com
Wed Nov 4 14:00:44 UTC 2015


Hi Snir,

On Mon, 2015-10-26 at 18:58 +0200, Snir Sheriber wrote:
> While opening nested remote-viewers, cursor-release doesn't effect the
> inner remote-viewer (hotkey for both is identical)
> 
> Checking for cursor release setup in the settings file,
> overriding existing command line and vv file setups
> 
Well it will override settings for all virtual machines you are accessing.
I don't think it is expected / nice.
Personally, I think the commandline setting should have "higher prio" than vv
file setting, and vv file setting should have higher priority than the global
setting.

> RHBZ #889962
If I understand the bug correctly, the inner client does not get the release key
sequence, maybe we should consider whether it is expected behavior.

> ---
>  src/virt-viewer-app.c | 27 +++++++++++++++++++++++++++
>  src/virt-viewer-app.h |  1 +
>  2 files changed, 28 insertions(+)
> 
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 0670358..9bb32ee 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -1294,6 +1294,7 @@ virt_viewer_app_activate(VirtViewerApp *self, GError
> **error)
>  
>      priv->grabbed = FALSE;
>      virt_viewer_app_update_title(self);
> +    virt_viewer_app_remote_cursor_set_from_file(self);
>  
>      return ret;
>  }
> @@ -2575,6 +2576,32 @@ gboolean
> virt_viewer_app_get_session_cancelled(VirtViewerApp *self)
>  {
>      return self->priv->cancelled;
>  }
> +void
> +virt_viewer_app_remote_cursor_set_from_file(VirtViewerApp *self)
> +{
> +	/*
> +	 * This function read cursor-release hotkey
> +	 * from the "settings" file and overrides any
> +	 * previous cursor-release hotkey setup
> +	 */
> +	GError *error = NULL;
> +	gchar *strconcat=NULL;
> +	gchar *hotkeys_str=g_key_file_get_string(self->priv->config,
> +			"virt-viewer", "release-cursor", &error);
> +	if (error) {
> +		if (error->code != G_KEY_FILE_ERROR_GROUP_NOT_FOUND
> +				&& error->code !=
> G_KEY_FILE_ERROR_KEY_NOT_FOUND)
> +			g_warning("Error reading release-cursor value: %s",
> error->message);
> +		g_clear_error(&error);
> +	} else {
> +		strconcat=g_strconcat("release-cursor=",hotkeys_str,NULL);
> +		virt_viewer_app_set_hotkeys(self, strconcat);
> +		g_free(strconcat);
> +	}
> +	g_free(hotkeys_str);
> +
> +
> +}
^^^
We are using spaces for indentation.

Pavel
>  
>  /*
>   * Local variables:
> diff --git a/src/virt-viewer-app.h b/src/virt-viewer-app.h
> index bbbc9b4..8bc46e8 100644
> --- a/src/virt-viewer-app.h
> +++ b/src/virt-viewer-app.h
> @@ -103,6 +103,7 @@ void virt_viewer_app_set_enable_accel(VirtViewerApp *app,
> gboolean enable);
>  void virt_viewer_app_show_preferences(VirtViewerApp *app, GtkWidget *parent);
>  void virt_viewer_app_set_menus_sensitive(VirtViewerApp *self, gboolean
> sensitive);
>  gboolean virt_viewer_app_get_session_cancelled(VirtViewerApp *self);
> +void virt_viewer_app_remote_cursor_set_from_file(VirtViewerApp *self);
>  
>  G_END_DECLS
>  




More information about the virt-tools-list mailing list