Skip to content
  • Marco Trevisan's avatar
    seat-x11: Translate device enabled/disabled into clutter events · cf67dfb0
    Marco Trevisan authored
    When a device is removed from the seat the events that this device may have
    emitted just before being removed might still be in the stage events queue,
    this may lead a to a crash because:
    
    Once the device is removed, we dispose it and the staling event is
    kept in queue and sent for processing at next loop.
    During event processing we ask the backend to update the last device
    with the disposed device
    The device is disposed once the events referencing it, are free'd
    The actual last device emission happens in an idle, but at this point
    the device may have been free'd, and in any case will be still disposed
    and so not providing useful informations.
    
    To avoid this, once a device has been added/removed from the seat, we queue
    ClutterDeviceEvent events to inform the stack that the device state has
    changed, preserving the order with the other actual generated device events.
    In this way it can't happen that we emit another event before that the
    device has been added or after that it has been removed.
    
    Fixes: #1345
    
    (cherry picked from commit 9db289b4)
    cf67dfb0