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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]