Skip to content
  • Jonathon Jongsma's avatar
    Ensure keyboard modifiers are synchronized properly · 9c75c7ee
    Jonathon Jongsma authored
    In certain circumstances, the keyboard modifiers get out-of-sync between the
    guest and the client. This is easy to reproduce with the following steps:
     - launch virt-viewer with a guest that is not running
     - start the guest
     - while guest is booting, enable CAPS LOCK on the client
     - after guest finishes booting, it will set its modifiers to a default value
       (e.g. numlock on, capslock off)
     - now capslock is OFF in the guest, but ON in the client
     - toggle caps lock
     - now capslock is ON in the guest, but OFF in the client
    
    This moves the responsibility for synchronizing client and guest modifiers into
    SpiceGtkSession. It can't be handled easily within the SpiceDisplay widget since
    there can be multiple display widgets for each inputs channel.
    
    A new function (spice_gtk_session_sync_keyboard_modifiers()) was added so that
    synchronization can be triggered manually if desired. But it also registers a
    signal handler for the InputsChannel::inputs-modifiers signal to detect when the
    guest has changed its modifiers. The signal handler simply overrides the guests
    modifiers and sets them back to the value from the client.
    9c75c7ee