Skip to contentSkip to conversation

spice: Use proper enum type for kbd led state

PATCH In review Jonathon Jongsma 3 participants 3 messages May 10, 2017 – May 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spice: Use proper enum type for kbd led state

Although the Qemu and spice flags currently have the same value, it seems more correct to pass the spice flag values to spice_server_kbd_leds(), especially considering that this function already makes an effort to convert between the QEMU_*_LED and SPICE_KEYBOARD_MODIFIER_* values.

---
 ui/spice-input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/spice-input.c +1 -1
index 8eeebdb..7fd283b 100644
@@ -87,7 +87,7 @@ static void kbd_leds(void *opaque, int ledstate)
     if (ledstate & QEMU_CAPS_LOCK_LED) {
         kbd->ledstate |= SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK;
     }
-    spice_server_kbd_leds(&kbd->sin, ledstate);
+    spice_server_kbd_leds(&kbd->sin, kbd->ledstate);
 }
 
 /* mouse bits */
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jonathon Jongsma

Although the Qemu and spice flags currently have the same value, it seems more correct to pass the spice flag values to spice_server_kbd_leds(), especially considering that this function already makes an effort to convert between the QEMU_*_LED and SPICE_KEYBOARD_MODIFIER_* values.

Quoted 21 lines
---
 ui/spice-input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/spice-input.c +1 -2
index 8eeebdb..7fd283b 100644
@@ -87,7 +87,7 @@ static void kbd_leds(void *opaque, int ledstate)
     if (ledstate & QEMU_CAPS_LOCK_LED) {
         kbd->ledstate |= SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK;
     }
-    spice_server_kbd_leds(&kbd->sin, ledstate);
+    spice_server_kbd_leds(&kbd->sin, kbd->ledstate);
 }
 
 /* mouse bits */
--

2.9.3

Quoted 1 line

--

Marc-André Lureau

#2 lore raw
Quoted 10 lines · Marc-André Lureau

On Thu, May 11, 2017 at 6:16 AM Jonathon Jongsma <[email protected]

Quoted 7 lines

wrote:
Although the Qemu and spice flags currently have the same value, it seems more correct to pass the spice flag values to spice_server_kbd_leds(), especially considering that this function already makes an effort to convert between the QEMU_*_LED and SPICE_KEYBOARD_MODIFIER_* values.

Quoted 5 lines
Quoted 1 line

Added to ui queue.

thanks,
Gerd