Skip to content
  • Vlad Zahorodnii's avatar
    [scenes/opengl] Correctly draw shadows when corner tiles are missing · 5e55664d
    Vlad Zahorodnii authored
    Summary:
    Current implementation of buildQuads assumes that corner shadow tiles
    are always present:
    
        const QRectF leftRect(
            topLeftRect.bottomLeft(),
            bottomLeftRect.topRight());
    
    but that assumption is wrong. For example, if the default panel is on
    the bottom screen edge, then the calendar popup won't have the
    bottom-left shadow tile(at least on Wayland). Which means that the left
    shadow tile won't be visible because
    topLeftRect.left() == bottomLeftRect.right().
    
    Corner rectangles only have to influence height of the left/right tile
    and width of the top/bottom tile. Width of the left/right tile and
    height of the top/bottom tile should not be controlled by corner tiles.
    
    Overall, this is how shadow quads are computed:
    
    * Compute the outer rectangle;
    * Compute target rectangle for each corner tile. If some corner tile is
      missing, move the target rectangle to the corresponding corner of the
      inner shadow rect and set its width and height to 0. We need to do
      that to prevent top/right/bottom/left tiles from spanning over
      corners:
    
    {F6190219, layout=center, size=full}
    
    We would rather prefer something like this if the top-left tile is
    missing:
    {F6190233, layout=center, size=full}
    
    * Fix overlaps between corner tiles;
    * Compute target rectangles for top, right, bottom, and left tiles;
    * Fix overlaps between left/right and top/bottom shadow tiles.
    
    Test Plan:
    * Ran tests;
    * Resized Konsole to its minimimum size(on X11 and Wayland);
    * Opened the calendar popup(on X11 and Wayland):
    
    Before:
    {F6190344, layout=center, size=full}
    
    After:
    {F6190346, layout=center, size=full}
    
    Reviewers: #kwin, davidedmundson
    
    Reviewed By: #kwin, davidedmundson
    
    Subscribers: abetts, davidedmundson, kwin
    
    Tags: #kwin
    
    Differential Revision: https://phabricator.kde.org/D14783
    5e55664d