Skip to content
  • Martin Flöser's avatar
    Remove roundtrip to XServer from Workspace::xStackingOrder · 630514d5
    Martin Flöser authored
    Introduce a method Workspace::markXStackingOrderAsDirty
    
    Summary:
    This method replaces the calls x_stacking_dirty = true in the code base
    allowing for further refactoring of that functionality.
    
    Remove roundtrip to XServer from Workspace::xStackingOrder
    
    The method xStackingOrder is only used during a Compositor paint pass.
    If the stacking order had changed, the method updated the stacking order
    from X by performing a sync XQueryTree. With other words we had a round
    trip to the X server directly in the paint pass.
    
    This change rearchitectures this area by making better use of xcb. When
    we notice that the stacking order changed and an XQueryTree is needed,
    we directly send out the request. When xStackingOrder is finally called,
    which normally happens a few milliseconds later, the reply is retreived.
    In the worst case it still blocks, but in most cases the roundtrip is
    gone.
    
    If the stacking order changed again before accessing xStackingOrder the
    running request is cancelled and a new request is issued. So whenever we
    get into xStackingOrder it will have the current state.
    
    The updating of the xStackingOrder is moved into a dedicated method and
    xStackingOrder invokes it through a const_cast instead of operating on
    mutable variables.
    
    Test Plan: Normal system usage, no issues
    
    Reviewers: #kwin, #plasma
    
    Subscribers: plasma-devel, kwin
    
    Tags: #kwin
    
    Differential Revision: https://phabricator.kde.org/D6323
    630514d5