[spice-gtk] Don't attempt to send 0 scancode when releasing keys

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

 



When releasing all keys, we send a key release for scancode in the
key_state array, including the very first element with scancode 0.
send_key() complain when the scancode is 0, so make sure we don't call it
for this first element.

This fixes a
(remote-viewer:25548): GSpice-CRITICAL **: send_key: assertion 'scancode != 0' failed
warning when starting remote-viewer windowed, and then switching to another
desktop client-side using ctrl+alt+arrow.
---
 gtk/spice-widget.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 4e76648..f5adf66 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1255,7 +1255,10 @@ static void release_keys(SpiceDisplay *display)
             continue;
         }
         for (b = 0; b < 32; b++) {
-            send_key(display, i * 32 + b, SEND_KEY_RELEASE, FALSE);
+            unsigned int scancode = i * 32 + b;
+            if (scancode != 0) {
+                send_key(display, scancode, SEND_KEY_RELEASE, FALSE);
+            }
         }
     }
 }
-- 
1.8.5.3

_______________________________________________
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]