[virt-tools-list] [PATCH virt-viewer] vnc-display: Disable default grab sequence
Fabiano Fidêncio
fidencio at redhat.com
Thu Jun 2 07:45:09 UTC 2016
On Wed, Jun 1, 2016 at 1:19 PM, Pavel Grunt <pgrunt at redhat.com> wrote:
> It should be enabled only if the "release-cursor" sequence was not
> specified (by using "--hotkeys=release-cursor=sequence"), otherwise
> both sequences would release the cursor.
>
> The solution is taken from the spice-display code.
>
> Resolves: rhbz#1339575
I'm pretty sure this bug affects the Windows client as well (if the
hotkey is set by oVirt), please, clone the bug there as well.
> ---
> src/virt-viewer-display-vnc.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/src/virt-viewer-display-vnc.c b/src/virt-viewer-display-vnc.c
> index 9e7ac63..730b5cb 100644
> --- a/src/virt-viewer-display-vnc.c
> +++ b/src/virt-viewer-display-vnc.c
> @@ -184,11 +184,32 @@ virt_viewer_display_vnc_resize_desktop(VncDisplay *vnc G_GNUC_UNUSED,
> }
>
>
> +static void
> +enable_accel_changed(VirtViewerApp *app,
> + GParamSpec *pspec G_GNUC_UNUSED,
> + VncDisplay *vnc)
> +{
> + GtkAccelKey key = { 0 };
> + if (virt_viewer_app_get_enable_accel(app))
> + gtk_accel_map_lookup_entry("<virt-viewer>/view/release-cursor", &key);
> +
> + if (key.accel_key || key.accel_mods) {
> + VncGrabSequence *seq = vnc_grab_sequence_new(0, NULL);
> + /* disable default grab sequence */
> + vnc_display_set_grab_keys(vnc, seq);
> + vnc_grab_sequence_free(seq);
> + } else {
> + vnc_display_set_grab_keys(vnc, NULL);
> + }
> +}
> +
> +
> GtkWidget *
> virt_viewer_display_vnc_new(VirtViewerSessionVnc *session,
> VncDisplay *vnc)
> {
> VirtViewerDisplayVnc *display;
> + VirtViewerApp *app;
>
> display = g_object_new(VIRT_VIEWER_TYPE_DISPLAY_VNC, "session", session, NULL);
>
> @@ -226,6 +247,11 @@ virt_viewer_display_vnc_new(VirtViewerSessionVnc *session,
> g_signal_connect(display->priv->vnc, "vnc-initialized",
> G_CALLBACK(virt_viewer_display_vnc_initialized), display);
>
> + app = virt_viewer_session_get_app(VIRT_VIEWER_SESSION(session));
> + virt_viewer_signal_connect_object(app, "notify::enable-accel",
> + G_CALLBACK(enable_accel_changed), display->priv->vnc, 0);
> + enable_accel_changed(app, NULL, display->priv->vnc);
> +
> return GTK_WIDGET(display);
> }
>
> --
> 2.8.3
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
Acked-by: Fabiano Fidêncio <fidencio at redhat.com>
More information about the virt-tools-list
mailing list