On Do, 2016-12-15 at 14:16 +0100, Pierre Ossman wrote: > Piggy-backing on the modifier state array made it difficult to send > out updates at the proper times. So keep track of the LED state in > a separate variable. > > This also moves the handling up a layer in to the VNC Display object > since the state is global, and also makes sure the state is readily > available directly when a client connects.
Better, thanks. > static void kbd_leds(void *opaque, int ledstate) > { > - VncState *vs = opaque; > - int caps, num, scr; > - bool has_changed = (ledstate != current_led_state(vs)); > + VncDisplay *vd = opaque; > + VncState *client; > > trace_vnc_key_guest_leds((ledstate & QEMU_CAPS_LOCK_LED), > (ledstate & QEMU_NUM_LOCK_LED), > (ledstate & QEMU_SCROLL_LOCK_LED)); > > - caps = ledstate & QEMU_CAPS_LOCK_LED ? 1 : 0; > - num = ledstate & QEMU_NUM_LOCK_LED ? 1 : 0; > - scr = ledstate & QEMU_SCROLL_LOCK_LED ? 1 : 0; > + if (ledstate != vd->ledstate) > + return; Hmm? Shouldn't that be (ledstate == vd->ledstate)? cheers, Gerd