Diffusion KWin 5e55664de8a3

[scenes/opengl] Correctly draw shadows when corner tiles are missing

Authored by zzag on Aug 12 2018, 6:23 PM.

Description

[scenes/opengl] Correctly draw shadows when corner tiles are missing

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:

We would rather prefer something like this if the top-left tile is
missing:

  • 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:

After:

Reviewers: KWin, davidedmundson

Reviewed By: KWin, davidedmundson

Subscribers: abetts, davidedmundson, kwin

Tags: KWin

Differential Revision: https://phabricator.kde.org/D14783

Details