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

Uri Lublin uril at redhat.com
Thu Jul 19 06:22:40 PDT 2012


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)




More information about the Spice-devel mailing list