[Spice-devel] [spice-gtk 2/2] Block ctrl+alt+del if the corresponding property is set

Christophe Fergeau cfergeau at redhat.com
Thu Jul 19 07:04:33 PDT 2012


On Thu, Jul 19, 2012 at 04:22:40PM +0300, Uri Lublin wrote:
> Hi Christophe,
> 
> On 07/19/2012 10:40 AM, Christophe Fergeau wrote:
> >---
> >  gtk/spice-widget.c |   38 ++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 38 insertions(+)
> >
> >diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
> >index 02bb089..e5c48ed 100644
> >--- a/gtk/spice-widget.c
> >+++ b/gtk/spice-widget.c
> >@@ -979,6 +979,33 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose)
> >  #endif
> >
> >
> >+static gboolean check_for_ctrl_alt_del(SpiceDisplay *display, int scancode)
> >+{
> >+    /* we need to look at hardware scancodes for ctrl+alt+del detection
> >+     * since the symbolic keys sent by gtk+ might have been remapped on the
> >+     * client side, which means ctrl+alt+del on the client and ctrl+alt+del
> >+     * on the guest might not correspond to the same physical keyboard keys
> >+     */
> >+    if (is_key_pressed(display, 0x1d) || is_key_pressed(display, 0x11d)) /* ctrl */
> >+        if (is_key_pressed(display, 0x38) || is_key_pressed(display, 0x138)) /* alt */
> >+            if ((scancode == 0x53) || (scancode == 0x153)) /* DEL or keypad . */
> >+                return true;
> >+
> >+    return false;
> 
> Nitpick, Are there definitions for those scancodes ?
> I see e.g. KEY_LEFTALT and KEY_RIGHTALT in gtk/keymaps.csv, with
> values  56 and 312 (0x38 and 0x138) in their lines.
> (feel free to ignore and leave the patch as is with the nice comments)

I looked for one after your comment but couldn't find any

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120719/c5a48757/attachment.pgp>


More information about the Spice-devel mailing list