[Spice-devel] [spice-gtk 1/2] Add SpiceSession::disable-ctrlaltdel

Christophe Fergeau cfergeau at redhat.com
Thu Jul 19 00:40:50 PDT 2012


---
 gtk/spice-session-priv.h |    5 +++++
 gtk/spice-session.c      |   30 ++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/gtk/spice-session-priv.h b/gtk/spice-session-priv.h
index c24ef8e..c904066 100644
--- a/gtk/spice-session-priv.h
+++ b/gtk/spice-session-priv.h
@@ -72,6 +72,10 @@ struct _SpiceSessionPrivate {
     GStrv             disable_effects;
     gint              color_depth;
 
+    /* Whether to block ctrl-alt-del or to pass it from the client to the
+     * guest OS */
+    gboolean          disable_ctrlaltdel;
+
     int               connection_id;
     int               protocol;
     SpiceChannel      *cmain; /* weak reference */
@@ -131,6 +135,7 @@ const gchar* spice_session_get_host(SpiceSession *session);
 const gchar* spice_session_get_cert_subject(SpiceSession *session);
 const gchar* spice_session_get_ciphers(SpiceSession *session);
 const gchar* spice_session_get_ca_file(SpiceSession *session);
+gboolean spice_session_is_ctrlaltdel_disabled(SpiceSession *session);
 
 void spice_session_set_caches_hints(SpiceSession *session,
                                     uint32_t pci_ram_size,
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 995b2ed..6fffaf4 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -103,6 +103,7 @@ enum {
     PROP_GLZ_WINDOW_SIZE,
     PROP_UUID,
     PROP_NAME,
+    PROP_DISABLE_CTRLALTDEL,
 };
 
 /* signals */
@@ -464,6 +465,9 @@ static void spice_session_get_property(GObject    *gobject,
     case PROP_UUID:
         g_value_set_pointer(value, s->uuid);
 	break;
+    case PROP_DISABLE_CTRLALTDEL:
+        g_value_set_boolean(value, s->disable_ctrlaltdel);
+        break;
     default:
 	G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
 	break;
@@ -575,6 +579,9 @@ static void spice_session_set_property(GObject      *gobject,
     case PROP_GLZ_WINDOW_SIZE:
         s->glz_window_size = g_value_get_int(value);
         break;
+    case PROP_DISABLE_CTRLALTDEL:
+        s->disable_ctrlaltdel = g_value_get_boolean(value);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
         break;
@@ -1043,6 +1050,20 @@ static void spice_session_class_init(SpiceSessionClass *klass)
                               G_PARAM_READABLE |
                               G_PARAM_STATIC_STRINGS));
 
+    /**
+     * SpiceSession:disable-ctrlaltdel:
+     *
+     * Disable transmission of Ctrl+Alt+Del to guest OS
+     * Since: 0.13
+     **/
+    g_object_class_install_property
+        (gobject_class, PROP_DISABLE_CTRLALTDEL,
+         g_param_spec_boolean("disable-ctrlaltdel", "Disable Ctrl+Alt+Del",
+                              "Whether Ctrl+Alt+Del combo should be disabled",
+                              FALSE,
+                              G_PARAM_READWRITE |
+                              G_PARAM_STATIC_STRINGS));
+
     g_type_class_add_private(klass, sizeof(SpiceSessionPrivate));
 }
 
@@ -1803,6 +1824,15 @@ const gchar* spice_session_get_ca_file(SpiceSession *session)
 }
 
 G_GNUC_INTERNAL
+gboolean spice_session_is_ctrlaltdel_disabled(SpiceSession *session)
+{
+    SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
+
+    g_return_val_if_fail(s != NULL, FALSE);
+    return s->disable_ctrlaltdel;
+}
+
+G_GNUC_INTERNAL
 void spice_session_get_caches(SpiceSession *session,
                               display_cache **images,
                               display_cache **palettes,
-- 
1.7.10.4



More information about the Spice-devel mailing list