Blame SOURCES/0021-disable-default-grab-sequence-in-kiosk-mode.patch

19ccae
From c3a3f23968edceaf097f20450c795c762ec36fc0 Mon Sep 17 00:00:00 2001
19ccae
From: =?UTF-8?q?Jakub=20Jank=C5=AF?= <jjanku@redhat.com>
19ccae
Date: Sun, 20 Dec 2020 12:29:27 +0100
19ccae
Subject: [PATCH] disable default grab sequence in kiosk mode
19ccae
MIME-Version: 1.0
19ccae
Content-Type: text/plain; charset=UTF-8
19ccae
Content-Transfer-Encoding: 8bit
19ccae
19ccae
Hotkeys should be disabled in kiosk mode. However, if no
19ccae
"release-cursor" hotkey is specified, the default Ctrl+Alt
19ccae
grab sequence keeps functioning even in kiosk mode.
19ccae
That's because it's based on the spice/vnc functionality instead
19ccae
of on the accelerators in virt-viewer.
19ccae
19ccae
That's especially problematic with spice, because the grab
19ccae
sequence releases both the cursor and the keyboard. Thus the user
19ccae
can escape from kiosk mode by pressing Ctrl+Alt followed by
19ccae
Alt+Tab, for example.
19ccae
19ccae
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1893584
19ccae
19ccae
Signed-off-by: Jakub Janků <jjanku@redhat.com>
19ccae
---
19ccae
 src/virt-viewer-display-spice.c | 6 +++++-
19ccae
 src/virt-viewer-display-vnc.c   | 6 +++++-
19ccae
 2 files changed, 10 insertions(+), 2 deletions(-)
19ccae
19ccae
diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
19ccae
index a82422c..799403c 100644
19ccae
--- a/src/virt-viewer-display-spice.c
19ccae
+++ b/src/virt-viewer-display-spice.c
19ccae
@@ -238,10 +238,14 @@ enable_accel_changed(VirtViewerApp *app,
19ccae
                      VirtViewerDisplaySpice *self)
19ccae
 {
19ccae
     GtkAccelKey key = {0, 0, 0};
19ccae
+    gboolean kiosk;
19ccae
+
19ccae
     if (virt_viewer_app_get_enable_accel(app))
19ccae
         gtk_accel_map_lookup_entry("<virt-viewer>/view/release-cursor", &key);
19ccae
 
19ccae
-    if (key.accel_key || key.accel_mods) {
19ccae
+    g_object_get(app, "kiosk", &kiosk, NULL);
19ccae
+
19ccae
+    if (key.accel_key || key.accel_mods || kiosk) {
19ccae
         SpiceGrabSequence *seq = spice_grab_sequence_new(0, NULL);
19ccae
         /* disable default grab sequence */
19ccae
         spice_display_set_grab_keys(self->priv->display, seq);
19ccae
diff --git a/src/virt-viewer-display-vnc.c b/src/virt-viewer-display-vnc.c
19ccae
index d38dcac..537173c 100644
19ccae
--- a/src/virt-viewer-display-vnc.c
19ccae
+++ b/src/virt-viewer-display-vnc.c
19ccae
@@ -188,10 +188,14 @@ enable_accel_changed(VirtViewerApp *app,
19ccae
                      VncDisplay *vnc)
19ccae
 {
19ccae
     GtkAccelKey key = {0, 0, 0};
19ccae
+    gboolean kiosk;
19ccae
+
19ccae
     if (virt_viewer_app_get_enable_accel(app))
19ccae
         gtk_accel_map_lookup_entry("<virt-viewer>/view/release-cursor", &key);
19ccae
 
19ccae
-    if (key.accel_key || key.accel_mods) {
19ccae
+    g_object_get(app, "kiosk", &kiosk, NULL);
19ccae
+
19ccae
+    if (key.accel_key || key.accel_mods || kiosk) {
19ccae
         VncGrabSequence *seq = vnc_grab_sequence_new(0, NULL);
19ccae
         /* disable default grab sequence */
19ccae
         vnc_display_set_grab_keys(vnc, seq);
19ccae
-- 
19ccae
2.29.2
19ccae