ssd: add window drop-shadows (#1648)

Add optional drop-shadows to windows using server-side decoration.
Shadows can be enabled/disabled rc.xml and their appearance configured
in themerc.  The default is no shadows to preserve current behaviour.

The shadows are drawn in fixed corner and edge buffers shared between
all windows, the edges are scaled to size depending on the size of each
window.  Two sets of buffers are used to give the different appearances
for active and inactive windows.  I use separate corner/edge buffers for
a few reasons:

- It avoids needing to store a separate large shadow buffer per window
- It avoids needing to redraw the shadows when the window is being
  resized
- Compositing the shadows onto the desktop should be faster as there are
  overall fewer pixels to blend, and scaling up the edge buffers only
  requires reading a tiny buffer which is then replicated.
This commit is contained in:
David Turner 2024-04-22 19:27:53 +01:00 committed by GitHub
parent b0ba585ff8
commit ce0d2c2966
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 606 additions and 0 deletions

View file

@ -76,6 +76,12 @@ struct ssd {
struct ssd_sub_tree inactive;
} border;
struct {
struct wlr_scene_tree *tree;
struct ssd_sub_tree active;
struct ssd_sub_tree inactive;
} shadow;
/*
* Space between the extremities of the view's wlr_surface
* and the max extents of the server-side decorations.
@ -150,4 +156,8 @@ void ssd_extents_create(struct ssd *ssd);
void ssd_extents_update(struct ssd *ssd);
void ssd_extents_destroy(struct ssd *ssd);
void ssd_shadow_create(struct ssd *ssd);
void ssd_shadow_update(struct ssd *ssd);
void ssd_shadow_destroy(struct ssd *ssd);
#endif /* LABWC_SSD_INTERNAL_H */